route-graphics 0.0.21 → 0.0.23

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.
@@ -1,9 +1,9 @@
1
- var KM=Object.create;var $d=Object.defineProperty;var ZM=Object.getOwnPropertyDescriptor;var QM=Object.getOwnPropertyNames;var JM=Object.getPrototypeOf,tB=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var K=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),fy=(r,t)=>{for(var e in t)$d(r,e,{get:t[e],enumerable:!0})},eB=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of QM(t))!tB.call(r,s)&&s!==e&&$d(r,s,{get:()=>t[s],enumerable:!(i=ZM(t,s))||i.enumerable});return r};var $i=(r,t,e)=>(e=r!=null?KM(JM(r)):{},eB(t||!r||!r.__esModule?$d(e,"default",{value:r,enumerable:!0}):e,r));var v,Xd,Tn,k,C=x(()=>{"use strict";v=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(v||{}),Xd=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Tn=(r,t)=>Xd(r).priority??t,k={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Xd).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Xd).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Tn(n.value,e)-Tn(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Tn(o,e)-Tn(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var my=K((FO,jd)=>{"use strict";var iB=Object.prototype.hasOwnProperty,Re="~";function Sn(){}Object.create&&(Sn.prototype=Object.create(null),new Sn().__proto__||(Re=!1));function sB(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function py(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new sB(e,i||r,s),n=Re?Re+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function bl(r,t){--r._eventsCount===0?r._events=new Sn:delete r._events[t]}function Se(){this._events=new Sn,this._eventsCount=0}Se.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)iB.call(e,i)&&t.push(Re?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Se.prototype.listeners=function(t){var e=Re?Re+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Se.prototype.listenerCount=function(t){var e=Re?Re+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Se.prototype.emit=function(t,e,i,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,i),!0;case 4:return h.fn.call(h.context,e,i,s),!0;case 5:return h.fn.call(h.context,e,i,s,o),!0;case 6:return h.fn.call(h.context,e,i,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,i);break;case 4:h[u].fn.call(h[u].context,e,i,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};Se.prototype.on=function(t,e,i){return py(this,t,e,i,!1)};Se.prototype.once=function(t,e,i){return py(this,t,e,i,!0)};Se.prototype.removeListener=function(t,e,i,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return bl(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&bl(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:bl(this,o)}return this};Se.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&bl(this,e)):(this._events=new Sn,this._eventsCount=0),this};Se.prototype.off=Se.prototype.removeListener;Se.prototype.addListener=Se.prototype.on;Se.prefixed=Re;Se.EventEmitter=Se;typeof jd<"u"&&(jd.exports=Se)});var gy,Ct,Ee=x(()=>{gy=$i(my(),1),Ct=gy.default});var oB,Qr,de,ir,Ey,xy,Yd,nB,vl,wy,Ay,yy,_y,by,En,aB,hB,lB,cB,Zd,vy,uB,qd,Kd,Ty,Qd,je,Sy,Tl,Jd=x(()=>{oB={grad:.9,turn:360,rad:360/(2*Math.PI)},Qr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},de=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},ir=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ey=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},xy=function(r){return{r:ir(r.r,0,255),g:ir(r.g,0,255),b:ir(r.b,0,255),a:ir(r.a)}},Yd=function(r){return{r:de(r.r),g:de(r.g),b:de(r.b),a:de(r.a,3)}},nB=/^#([0-9a-f]{3,8})$/i,vl=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},wy=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-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}},Ay=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),h=i*(1-(1-t+o)*e),l=o%6;return{r:255*[i,a,n,n,h,i][l],g:255*[h,i,i,a,n,n][l],b:255*[n,n,h,i,i,a][l],a:s}},yy=function(r){return{h:Ey(r.h),s:ir(r.s,0,100),l:ir(r.l,0,100),a:ir(r.a)}},_y=function(r){return{h:de(r.h),s:de(r.s),l:de(r.l),a:de(r.a,3)}},by=function(r){return Ay((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},En=function(r){return{h:(t=wy(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},aB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zd={string:[[function(r){var t=nB.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?de(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?de(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=lB.exec(r)||cB.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:xy({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(r){var t=aB.exec(r)||hB.exec(r);if(!t)return null;var e,i,s=yy({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(oB[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return by(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Qr(t)&&Qr(e)&&Qr(i)?xy({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=yy({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return by(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=function(a){return{h:Ey(a.h),s:ir(a.s,0,100),v:ir(a.v,0,100),a:ir(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return Ay(n)},"hsv"]]},vy=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},uB=function(r){return typeof r=="string"?vy(r.trim(),Zd.string):typeof r=="object"&&r!==null?vy(r,Zd.object):[null,void 0]},qd=function(r,t){var e=En(r);return{h:e.h,s:ir(e.s+100*t,0,100),l:e.l,a:e.a}},Kd=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ty=function(r,t){var e=En(r);return{h:e.h,s:e.s,l:ir(e.l+100*t,0,100),a:e.a}},Qd=function(){function r(t){this.parsed=uB(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return de(Kd(this.rgba),2)},r.prototype.isDark=function(){return Kd(this.rgba)<.5},r.prototype.isLight=function(){return Kd(this.rgba)>=.5},r.prototype.toHex=function(){return t=Yd(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?vl(de(255*o)):"","#"+vl(e)+vl(i)+vl(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return Yd(this.rgba)},r.prototype.toRgbString=function(){return t=Yd(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return _y(En(this.rgba))},r.prototype.toHslString=function(){return t=_y(En(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=wy(this.rgba),{h:de(t.h),s:de(t.s),v:de(t.v),a:de(t.a,3)};var t},r.prototype.invert=function(){return je({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),je(qd(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),je(qd(this.rgba,-t))},r.prototype.grayscale=function(){return je(qd(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),je(Ty(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),je(Ty(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?je({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):de(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=En(this.rgba);return typeof t=="number"?je({h:t,s:e.s,l:e.l,a:e.a}):de(e.h)},r.prototype.isEqual=function(t){return this.toHex()===je(t).toHex()},r}(),je=function(r){return r instanceof Qd?r:new Qd(r)},Sy=[],Tl=function(r){r.forEach(function(t){Sy.indexOf(t)<0&&(t(Qd,Zd),Sy.push(t))})}});function Sl(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var p in e){var m=(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));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}var tf=x(()=>{});var Gs,rt,ye=x(()=>{Jd();tf();Tl([Sl]);Gs=class wn{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 wn)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((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,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=wn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<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,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=wn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof wn||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}};Gs.shared=new Gs;Gs._temp=new Gs;Gs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;rt=Gs});var Py,Cy=x(()=>{"use strict";Py={cullArea:null,cullable:!1,cullableChildren:!0}});var Ry,My,By,ef=x(()=>{"use strict";Ry=Math.PI*2,My=180/Math.PI,By=Math.PI/180});var ht,rf,sr=x(()=>{"use strict";ht=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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 rf.x=0,rf.y=0,rf}},rf=new ht});var I,dB,fB,ft=x(()=>{ef();sr();I=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ht;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ht;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(i*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=i*l*u+-s*l*c+(-h*i+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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=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=i*l+s*u,this.b=i*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,i,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-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Ry-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*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 r;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 fB.identity()}static get shared(){return dB.identity()}},dB=new I,fB=new I});var _e,El=x(()=>{"use strict";_e=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(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 at(r="default"){return sf[r]===void 0&&(sf[r]=-1),++sf[r]}var sf,be=x(()=>{"use strict";sf={default:-1}});function W(r,t,e=3){if(Iy[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var KM=Object.create;var $d=Object.defineProperty;var ZM=Object.getOwnPropertyDescriptor;var QM=Object.getOwnPropertyNames;var JM=Object.getPrototypeOf,tB=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var K=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),fy=(r,t)=>{for(var e in t)$d(r,e,{get:t[e],enumerable:!0})},eB=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of QM(t))!tB.call(r,s)&&s!==e&&$d(r,s,{get:()=>t[s],enumerable:!(i=ZM(t,s))||i.enumerable});return r};var $i=(r,t,e)=>(e=r!=null?KM(JM(r)):{},eB(t||!r||!r.__esModule?$d(e,"default",{value:r,enumerable:!0}):e,r));var v,Xd,Tn,k,P=x(()=>{"use strict";v=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(v||{}),Xd=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Tn=(r,t)=>Xd(r).priority??t,k={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Xd).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Xd).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Tn(n.value,e)-Tn(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Tn(o,e)-Tn(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var my=K((FO,jd)=>{"use strict";var iB=Object.prototype.hasOwnProperty,Re="~";function Sn(){}Object.create&&(Sn.prototype=Object.create(null),new Sn().__proto__||(Re=!1));function sB(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function py(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new sB(e,i||r,s),n=Re?Re+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function bl(r,t){--r._eventsCount===0?r._events=new Sn:delete r._events[t]}function Se(){this._events=new Sn,this._eventsCount=0}Se.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)iB.call(e,i)&&t.push(Re?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Se.prototype.listeners=function(t){var e=Re?Re+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Se.prototype.listenerCount=function(t){var e=Re?Re+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Se.prototype.emit=function(t,e,i,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,i),!0;case 4:return h.fn.call(h.context,e,i,s),!0;case 5:return h.fn.call(h.context,e,i,s,o),!0;case 6:return h.fn.call(h.context,e,i,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,i);break;case 4:h[u].fn.call(h[u].context,e,i,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};Se.prototype.on=function(t,e,i){return py(this,t,e,i,!1)};Se.prototype.once=function(t,e,i){return py(this,t,e,i,!0)};Se.prototype.removeListener=function(t,e,i,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return bl(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&bl(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:bl(this,o)}return this};Se.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&bl(this,e)):(this._events=new Sn,this._eventsCount=0),this};Se.prototype.off=Se.prototype.removeListener;Se.prototype.addListener=Se.prototype.on;Se.prefixed=Re;Se.EventEmitter=Se;typeof jd<"u"&&(jd.exports=Se)});var gy,Ct,Ee=x(()=>{gy=$i(my(),1),Ct=gy.default});var oB,Qr,de,ir,Ey,xy,Yd,nB,vl,wy,Ay,yy,_y,by,En,aB,hB,lB,cB,Zd,vy,uB,qd,Kd,Ty,Qd,je,Sy,Tl,Jd=x(()=>{oB={grad:.9,turn:360,rad:360/(2*Math.PI)},Qr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},de=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},ir=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ey=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},xy=function(r){return{r:ir(r.r,0,255),g:ir(r.g,0,255),b:ir(r.b,0,255),a:ir(r.a)}},Yd=function(r){return{r:de(r.r),g:de(r.g),b:de(r.b),a:de(r.a,3)}},nB=/^#([0-9a-f]{3,8})$/i,vl=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},wy=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-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}},Ay=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),h=i*(1-(1-t+o)*e),l=o%6;return{r:255*[i,a,n,n,h,i][l],g:255*[h,i,i,a,n,n][l],b:255*[n,n,h,i,i,a][l],a:s}},yy=function(r){return{h:Ey(r.h),s:ir(r.s,0,100),l:ir(r.l,0,100),a:ir(r.a)}},_y=function(r){return{h:de(r.h),s:de(r.s),l:de(r.l),a:de(r.a,3)}},by=function(r){return Ay((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},En=function(r){return{h:(t=wy(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},aB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zd={string:[[function(r){var t=nB.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?de(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?de(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=lB.exec(r)||cB.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:xy({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(r){var t=aB.exec(r)||hB.exec(r);if(!t)return null;var e,i,s=yy({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(oB[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return by(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Qr(t)&&Qr(e)&&Qr(i)?xy({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=yy({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return by(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=function(a){return{h:Ey(a.h),s:ir(a.s,0,100),v:ir(a.v,0,100),a:ir(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return Ay(n)},"hsv"]]},vy=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},uB=function(r){return typeof r=="string"?vy(r.trim(),Zd.string):typeof r=="object"&&r!==null?vy(r,Zd.object):[null,void 0]},qd=function(r,t){var e=En(r);return{h:e.h,s:ir(e.s+100*t,0,100),l:e.l,a:e.a}},Kd=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ty=function(r,t){var e=En(r);return{h:e.h,s:e.s,l:ir(e.l+100*t,0,100),a:e.a}},Qd=function(){function r(t){this.parsed=uB(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return de(Kd(this.rgba),2)},r.prototype.isDark=function(){return Kd(this.rgba)<.5},r.prototype.isLight=function(){return Kd(this.rgba)>=.5},r.prototype.toHex=function(){return t=Yd(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?vl(de(255*o)):"","#"+vl(e)+vl(i)+vl(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return Yd(this.rgba)},r.prototype.toRgbString=function(){return t=Yd(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return _y(En(this.rgba))},r.prototype.toHslString=function(){return t=_y(En(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=wy(this.rgba),{h:de(t.h),s:de(t.s),v:de(t.v),a:de(t.a,3)};var t},r.prototype.invert=function(){return je({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),je(qd(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),je(qd(this.rgba,-t))},r.prototype.grayscale=function(){return je(qd(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),je(Ty(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),je(Ty(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?je({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):de(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=En(this.rgba);return typeof t=="number"?je({h:t,s:e.s,l:e.l,a:e.a}):de(e.h)},r.prototype.isEqual=function(t){return this.toHex()===je(t).toHex()},r}(),je=function(r){return r instanceof Qd?r:new Qd(r)},Sy=[],Tl=function(r){r.forEach(function(t){Sy.indexOf(t)<0&&(t(Qd,Zd),Sy.push(t))})}});function Sl(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var p in e){var m=(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));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}var tf=x(()=>{});var Gs,rt,ye=x(()=>{Jd();tf();Tl([Sl]);Gs=class wn{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 wn)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((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,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=wn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<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,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=wn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof wn||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}};Gs.shared=new Gs;Gs._temp=new Gs;Gs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;rt=Gs});var Py,Cy=x(()=>{"use strict";Py={cullArea:null,cullable:!1,cullableChildren:!0}});var Ry,My,By,ef=x(()=>{"use strict";Ry=Math.PI*2,My=180/Math.PI,By=Math.PI/180});var ht,rf,sr=x(()=>{"use strict";ht=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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 rf.x=0,rf.y=0,rf}},rf=new ht});var I,dB,fB,ft=x(()=>{ef();sr();I=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ht;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ht;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(i*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=i*l*u+-s*l*c+(-h*i+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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=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=i*l+s*u,this.b=i*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,i,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-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Ry-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*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 r;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 fB.identity()}static get shared(){return dB.identity()}},dB=new I,fB=new I});var _e,El=x(()=>{"use strict";_e=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(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 at(r="default"){return sf[r]===void 0&&(sf[r]=-1),++sf[r]}var sf,be=x(()=>{"use strict";sf={default:-1}});function z(r,t,e=3){if(Iy[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
2
  Deprecated since v${r}`):(i=i.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${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${r}`),console.warn(i))),Iy[t]=!0}var Iy,Q,Fy,Ht=x(()=>{"use strict";Iy={},Q="8.0.0",Fy="8.3.4"});var Xi,of=x(()=>{"use strict";Xi=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 nf,J,Me=x(()=>{of();nf=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 Xi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},J=new nf});var ky,Gy=x(()=>{Ht();ky={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){W("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function wl(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var af=x(()=>{"use strict"});var Uy,Oy=x(()=>{af();Ht();Uy={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}wl(this.children,r,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(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||W(Q,"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(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var Ly,Dy=x(()=>{"use strict";Ly={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var Jr,Al=x(()=>{"use strict";Jr=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 hf,Pl,Ny=x(()=>{C();Me();hf=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 i=this._tests[e];if(i.test(t))return J.get(i.maskClass,t)}return t}returnMaskEffect(t){J.return(t)}},Pl=new hf;k.handleByList(v.MaskEffect,Pl._effectClasses)});var Hy,Vy=x(()=>{Al();Ny();Hy={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),Pl.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=Pl.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new Jr);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new Jr),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var Wy,zy=x(()=>{Ht();Wy={label:null,get name(){return W(Q,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){W(Q,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var Cl,st,fe=x(()=>{sr();Cl=[new ht,new ht,new ht,new ht],st=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),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 r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=i*(1-s),c=i-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,m=a+c,g=a+o-c,b=h+c,y=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<g&&e>b&&e<y)}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 R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Cl[0].set(t.left,t.top),h=Cl[1].set(t.left,t.bottom),l=Cl[2].set(t.right,t.top),c=Cl[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)<=i||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*i+f*o,m=d*s+f*o,g=d*i+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let y=u*(a.y-l.y),_=u*(l.x-a.x),T=y*i+_*o,E=y*s+_*o,S=y*i+_*n,w=y*s+_*n;return!(Math.max(T,E,S,w)<=y*a.x+_*a.y||Math.min(T,E,S,w)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<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 $y,Et,Ne=x(()=>{ft();fe();$y=new I,Et=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=$y,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new st);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=$y,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,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,m=this.maxY,g=n*t+h*e+c,b=a*t+l*e+u;g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*i+h*e+c,b=a*i+l*e+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*t+h*s+c,b=a*t+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*i+h*s+c,b=a*i+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}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,i=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*i+c,f=a*e+l*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*i+c,f=a*s+l*i+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,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),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 r(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,i,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 m=e;m<i;m+=2){let g=t[m],b=t[m+1],y=l*g+u*b+f,_=c*g+d*b+p;o=y<o?y:o,n=_<n?_:n,a=y>a?y:a,h=_>h?_: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 te,Ye,ji=x(()=>{ft();of();Ne();te=new Xi(I),Ye=new Xi(Et)});var pB,Xy,jy=x(()=>{ft();Ne();ji();pB=new I,Xy={getFastGlobalBounds(r,t){t||(t=new Et),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ye.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.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(r,i,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,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(pB).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ye.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ye.return(i))}}});function Us(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=te.get().identity(),i=Rl(r,s)):i=I.IDENTITY,Yy(r,e,i,t),s&&te.return(s),e.isValid||e.set(0,0,0,0),e}function Yy(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=te.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)Yy(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,I.IDENTITY),Ye.return(t)}i||te.return(s)}function Rl(r,t){let e=r.parent;return e&&(Rl(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var An=x(()=>{ft();ji()});function Ml(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=i*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var lf=x(()=>{"use strict"});function Os(r,t){return r===qy?t:t===qy?r:Ml(r,t)}var qy,cf=x(()=>{lf();qy=16777215});function Pn(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var Ky,Zy=x(()=>{An();ji();cf();Ky={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Rl(this,te.get().identity());return r.appendFrom(this.localTransform,e),te.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Pn(this.renderGroup.worldColor):this.parentRenderGroup?Pn(Os(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Os(t,e.localColor),e=e.parent;return Pn(t)}}});function O(...r){uf!==Qy&&(uf++,uf===Qy?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var uf,Qy,wt=x(()=>{"use strict";uf=0,Qy=500});function Ls(r,t,e){return t.clear(),e||(e=I.IDENTITY),Jy(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function Jy(r,t,e,i,s){let o;if(s)o=te.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let h=r.localTransform;o=te.get(),o.appendFrom(h,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let h=r.children;for(let l=0;l<h.length;l++)Jy(h[l],t,o,i,!1)}if(a){for(let h=0;h<r.effects.length;h++)r.effects[h].addLocalBounds?.(t,i);n.addBounds(t,I.IDENTITY),Ye.return(t)}te.return(o)}var Bl=x(()=>{ft();ji()});function df(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],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&&df(s,t)}return t.didChange}var t_=x(()=>{"use strict"});var mB,e_,r_=x(()=>{ft();Ne();An();Bl();t_();mB=new I,e_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Et});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),df(this,r),r.didChange&&Ls(this,r.localBounds,mB),r.localBounds},getBounds(r,t){return Us(this,r,t||new Et)}}});var i_,s_=x(()=>{"use strict";i_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function gB(r,t){return r._zIndex-t._zIndex}var o_,n_=x(()=>{"use strict";o_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,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(gB))}}});var a_,h_=x(()=>{sr();ji();a_={getGlobalPosition(r=new ht,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(te.get(),e);return t=i.apply(r,t),te.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(te.get(),i);return e=s.applyInverse(r,e),te.return(s),e}}});var Ds,ff=x(()=>{be();Ds=class{constructor(){this.uid=at("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 ti(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function pf(r){return!(r&r-1)&&!!r}var Cn=x(()=>{"use strict"});function Il(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var mf=x(()=>{"use strict"});function xB(r){let t=l_[r];return t===void 0&&(l_[r]=at("resource")),t}var l_,c_,Fl,gf=x(()=>{Ee();be();Ht();l_=Object.create(null);c_=class u_ extends Ct{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...u_.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){W(Q,"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=xB(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};c_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Fl=c_});var d_,Tt,He=x(()=>{Ee();Cn();mf();be();gf();d_=class f_ extends Ct{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("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={...f_.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 Fl(Il(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=at("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,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=at("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=pf(this.pixelWidth)&&pf(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};d_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Tt=d_});function yB(){for(let r=0;r<16;r++){let t=[];xf.push(t);for(let e=0;e<16;e++){let i=kl(Yi[r]*Yi[e]+Ki[r]*qi[e]),s=kl(qi[r]*Yi[e]+Zi[r]*qi[e]),o=kl(Yi[r]*Ki[e]+Ki[r]*Zi[e]),n=kl(qi[r]*Ki[e]+Zi[r]*Zi[e]);for(let a=0;a<16;a++)if(Yi[a]===i&&qi[a]===s&&Ki[a]===o&&Zi[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new I;t.set(Yi[r],qi[r],Ki[r],Zi[r],0,0),p_.push(t)}}var Yi,qi,Ki,Zi,xf,p_,kl,Ut,m_=x(()=>{ft();Yi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],qi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ki=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xf=[],p_=[],kl=Math.sign;yB();Ut={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:r=>Yi[r],uY:r=>qi[r],vX:r=>Ki[r],vY:r=>Zi[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>xf[r][t],sub:(r,t)=>xf[r][Ut.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Ut.S:Ut.N:Math.abs(t)*2<=Math.abs(r)?r>0?Ut.E:Ut.W:t>0?r>0?Ut.SE:Ut.SW:r>0?Ut.NE:Ut.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=p_[Ut.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var yf,g_=x(()=>{"use strict";yf=()=>{}});var Qi,_f=x(()=>{C();He();Qi=class extends Tt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Qi.extension=v.TextureSource});var x_,Ns,bf=x(()=>{ft();x_=new I,Ns=class{constructor(t,e){this.mapCoord=new I,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 i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.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 i=t.orig,s=t.trim;s&&(x_.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(x_));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 A,_t=x(()=>{Ee();m_();fe();be();Ht();g_();_f();He();bf();A=class extends Ct{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new st,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Tt,this.noFrame=!i,i)this.frame.copyFrom(i);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 Ns(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=Ut.add(l,Ut.NW),t.x0=d+c*Ut.uX(l),t.y0=f+u*Ut.uY(l),l=Ut.add(l,2),t.x1=d+c*Ut.uX(l),t.y1=f+u*Ut.uY(l),l=Ut.add(l,2),t.x2=d+c*Ut.uX(l),t.y2=f+u*Ut.uY(l),l=Ut.add(l,2),t.x3=d+c*Ut.uX(l),t.y3=f+u*Ut.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 W(Q,"Texture.baseTexture is now Texture.source"),this._source}};A.EMPTY=new A({label:"EMPTY",source:new Tt({label:"EMPTY"})});A.EMPTY.destroy=yf;A.WHITE=new A({source:new Qi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});A.WHITE.destroy=yf});var _B,vf,Vt,vi=x(()=>{Cn();He();_t();_B=0,vf=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new Tt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new A({source:s,label:`texturePool_${_B++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ti(o),n=ti(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=i,h.source.width=o/i,h.source.height=n/i,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 i=t.source;return this.getOptimalTexture(t.width,t.height,i._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 i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Vt=new vf});var Gl,y_=x(()=>{ft();ff();vi();Gl=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new I,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 Ds,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 i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Vt.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 i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[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 I),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new I),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 I),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 __(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var b_=x(()=>{"use strict"});var Tf,Sf,Ef,Hs,Rn,Ji,xt,_r=x(()=>{Ee();ye();Cy();C();ft();ef();El();be();Ht();Me();Gy();Oy();Dy();Vy();zy();jy();Zy();r_();s_();n_();h_();y_();b_();Tf=new _e(null),Sf=new _e(null),Ef=new _e(null,1,1),Hs=1,Rn=2,Ji=4,xt=class r extends Ct{constructor(t={}){super(),this.uid=at("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 I,this.relativeGroupTransform=new I,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new _e(this,0,0),this._scale=Ef,this._pivot=Sf,this._skew=Tf,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){W("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),k.mixin(r,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||W(Q,"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],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=J.get(Gl,this),this.groupTransform=I.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),J.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 I),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*My}set angle(t){this.rotation=t*By}get pivot(){return this._pivot===Sf&&(this._pivot=new _e(this,0,0)),this._pivot}set pivot(t){this._pivot===Sf&&(this._pivot=new _e(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Tf&&(this._skew=new _e(this,0,0)),this._skew}set skew(t){this._skew===Tf&&(this._skew=new _e(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ef&&(this._scale=new _e(this,1,1)),this._scale}set scale(t){this._scale===Ef&&(this._scale=new _e(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 i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){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,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._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|=Hs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=rt.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Hs,this._onUpdate())}get tint(){return Pn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Rn,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|=Ji,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|=Ji,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|=Ji,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}};k.mixin(xt,Uy,Xy,a_,i_,e_,Hy,Wy,o_,Py,ky,Ky,Ly)});var Ti,Ul=x(()=>{sr();Ti=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ht,this.page=new ht,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,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 bB(r){return function(t){return t.test(r)}}function Si(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=bB(e),o={apple:{phone:s(wf)&&!s(ei),ipod:s(v_),tablet:!s(wf)&&(s(T_)||B_(t))&&!s(ei),universal:s(S_),device:(s(wf)||s(v_)||s(T_)||s(S_)||B_(t))&&!s(ei)},amazon:{phone:s(Vs),tablet:!s(Vs)&&s(Ol),device:s(Vs)||s(Ol)},android:{phone:!s(ei)&&s(Vs)||!s(ei)&&s(Af),tablet:!s(ei)&&!s(Vs)&&!s(Af)&&(s(Ol)||s(E_)),device:!s(ei)&&(s(Vs)||s(Ol)||s(Af)||s(E_))||s(/\bokhttp\b/i)},windows:{phone:s(ei),tablet:s(w_),device:s(ei)||s(w_)},other:{blackberry:s(A_),blackberry10:s(P_),opera:s(C_),firefox:s(M_),chrome:s(R_),device:s(A_)||s(P_)||s(C_)||s(M_)||s(R_)},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 wf,v_,T_,S_,Af,E_,Vs,Ol,ei,w_,A_,P_,C_,R_,M_,B_,Pf=x(()=>{wf=/iPhone/i,v_=/iPod/i,T_=/iPad/i,S_=/\biOS-universal(?:.+)Mac\b/i,Af=/\bAndroid(?:.+)Mobile\b/i,E_=/Android/i,Vs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ol=/Silk/i,ei=/Windows Phone/i,w_=/\bWindows(?:.+)ARM\b/i,A_=/BlackBerry/i,P_=/BB10/i,C_=/Opera Mini/i,R_=/\b(CriOS|Chrome)(?:.+)Mobile/i,M_=/Mobile(?:.+)Firefox\b/i,B_=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var Cf=x(()=>{Pf();Pf()});var vB,I_,F_=x(()=>{Cf();vB=Si.default??Si,I_=vB(globalThis.navigator)});var TB,Ll,SB,EB,k_,G_,wB,AB,PB,Rf,O_,L_=x(()=>{Ul();C();F_();af();TB=9,Ll=100,SB=0,EB=0,k_=2,G_=1,wB=-1e3,AB=-1e3,PB=2,Rf=class U_{constructor(t,e=I_){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=`${wB}px`,t.style.left=`${AB}px`,t.style.zIndex=PB.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=`${Ll}px`,this._div.style.height=`${Ll}px`,this._div.style.position="absolute",this._div.style.top=`${SB}px`,this._div.style.left=`${EB}px`,this._div.style.zIndex=k_.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 i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...U_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.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 i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,wl(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i<this._children.length;i++){let s=this._children[i];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:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
6
+ Deprecated since v${r}`),console.warn(i))),Iy[t]=!0}var Iy,J,Fy,Ht=x(()=>{"use strict";Iy={},J="8.0.0",Fy="8.3.4"});var Xi,of=x(()=>{"use strict";Xi=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 nf,tt,Me=x(()=>{of();nf=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 Xi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},tt=new nf});var ky,Gy=x(()=>{Ht();ky={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){z("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function wl(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var af=x(()=>{"use strict"});var Uy,Oy=x(()=>{af();Ht();Uy={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}wl(this.children,r,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(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||z(J,"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(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var Ly,Dy=x(()=>{"use strict";Ly={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var Jr,Al=x(()=>{"use strict";Jr=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 hf,Pl,Ny=x(()=>{P();Me();hf=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 i=this._tests[e];if(i.test(t))return tt.get(i.maskClass,t)}return t}returnMaskEffect(t){tt.return(t)}},Pl=new hf;k.handleByList(v.MaskEffect,Pl._effectClasses)});var Hy,Vy=x(()=>{Al();Ny();Hy={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),Pl.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=Pl.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new Jr);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new Jr),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var Wy,zy=x(()=>{Ht();Wy={label:null,get name(){return z(J,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){z(J,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var Cl,ot,fe=x(()=>{sr();Cl=[new ht,new ht,new ht,new ht],ot=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),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 r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=i*(1-s),c=i-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,m=a+c,g=a+o-c,b=h+c,y=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<g&&e>b&&e<y)}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 R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Cl[0].set(t.left,t.top),h=Cl[1].set(t.left,t.bottom),l=Cl[2].set(t.right,t.top),c=Cl[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)<=i||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*i+f*o,m=d*s+f*o,g=d*i+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let y=u*(a.y-l.y),_=u*(l.x-a.x),T=y*i+_*o,E=y*s+_*o,S=y*i+_*n,w=y*s+_*n;return!(Math.max(T,E,S,w)<=y*a.x+_*a.y||Math.min(T,E,S,w)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<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 $y,Et,Ne=x(()=>{ft();fe();$y=new I,Et=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=$y,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ot);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=$y,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,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,m=this.maxY,g=n*t+h*e+c,b=a*t+l*e+u;g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*i+h*e+c,b=a*i+l*e+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*t+h*s+c,b=a*t+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*i+h*s+c,b=a*i+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}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,i=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*i+c,f=a*e+l*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*i+c,f=a*s+l*i+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,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),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 r(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,i,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 m=e;m<i;m+=2){let g=t[m],b=t[m+1],y=l*g+u*b+f,_=c*g+d*b+p;o=y<o?y:o,n=_<n?_:n,a=y>a?y:a,h=_>h?_: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 te,Ye,ji=x(()=>{ft();of();Ne();te=new Xi(I),Ye=new Xi(Et)});var pB,Xy,jy=x(()=>{ft();Ne();ji();pB=new I,Xy={getFastGlobalBounds(r,t){t||(t=new Et),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ye.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.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(r,i,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,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(pB).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ye.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ye.return(i))}}});function Us(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=te.get().identity(),i=Rl(r,s)):i=I.IDENTITY,Yy(r,e,i,t),s&&te.return(s),e.isValid||e.set(0,0,0,0),e}function Yy(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=te.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)Yy(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,I.IDENTITY),Ye.return(t)}i||te.return(s)}function Rl(r,t){let e=r.parent;return e&&(Rl(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var An=x(()=>{ft();ji()});function Ml(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=i*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var lf=x(()=>{"use strict"});function Os(r,t){return r===qy?t:t===qy?r:Ml(r,t)}var qy,cf=x(()=>{lf();qy=16777215});function Pn(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var Ky,Zy=x(()=>{An();ji();cf();Ky={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Rl(this,te.get().identity());return r.appendFrom(this.localTransform,e),te.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Pn(this.renderGroup.worldColor):this.parentRenderGroup?Pn(Os(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Os(t,e.localColor),e=e.parent;return Pn(t)}}});function O(...r){uf!==Qy&&(uf++,uf===Qy?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var uf,Qy,wt=x(()=>{"use strict";uf=0,Qy=500});function Ls(r,t,e){return t.clear(),e||(e=I.IDENTITY),Jy(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function Jy(r,t,e,i,s){let o;if(s)o=te.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let h=r.localTransform;o=te.get(),o.appendFrom(h,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let h=r.children;for(let l=0;l<h.length;l++)Jy(h[l],t,o,i,!1)}if(a){for(let h=0;h<r.effects.length;h++)r.effects[h].addLocalBounds?.(t,i);n.addBounds(t,I.IDENTITY),Ye.return(t)}te.return(o)}var Bl=x(()=>{ft();ji()});function df(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],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&&df(s,t)}return t.didChange}var t_=x(()=>{"use strict"});var mB,e_,r_=x(()=>{ft();Ne();An();Bl();t_();mB=new I,e_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Et});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),df(this,r),r.didChange&&Ls(this,r.localBounds,mB),r.localBounds},getBounds(r,t){return Us(this,r,t||new Et)}}});var i_,s_=x(()=>{"use strict";i_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function gB(r,t){return r._zIndex-t._zIndex}var o_,n_=x(()=>{"use strict";o_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,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(gB))}}});var a_,h_=x(()=>{sr();ji();a_={getGlobalPosition(r=new ht,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(te.get(),e);return t=i.apply(r,t),te.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(te.get(),i);return e=s.applyInverse(r,e),te.return(s),e}}});var Ds,ff=x(()=>{be();Ds=class{constructor(){this.uid=at("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 ti(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function pf(r){return!(r&r-1)&&!!r}var Cn=x(()=>{"use strict"});function Il(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var mf=x(()=>{"use strict"});function xB(r){let t=l_[r];return t===void 0&&(l_[r]=at("resource")),t}var l_,c_,Fl,gf=x(()=>{Ee();be();Ht();l_=Object.create(null);c_=class u_ extends Ct{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...u_.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){z(J,"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=xB(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};c_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Fl=c_});var d_,Tt,He=x(()=>{Ee();Cn();mf();be();gf();d_=class f_ extends Ct{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("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={...f_.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 Fl(Il(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=at("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,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=at("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=pf(this.pixelWidth)&&pf(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};d_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Tt=d_});function yB(){for(let r=0;r<16;r++){let t=[];xf.push(t);for(let e=0;e<16;e++){let i=kl(Yi[r]*Yi[e]+Ki[r]*qi[e]),s=kl(qi[r]*Yi[e]+Zi[r]*qi[e]),o=kl(Yi[r]*Ki[e]+Ki[r]*Zi[e]),n=kl(qi[r]*Ki[e]+Zi[r]*Zi[e]);for(let a=0;a<16;a++)if(Yi[a]===i&&qi[a]===s&&Ki[a]===o&&Zi[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new I;t.set(Yi[r],qi[r],Ki[r],Zi[r],0,0),p_.push(t)}}var Yi,qi,Ki,Zi,xf,p_,kl,Ut,m_=x(()=>{ft();Yi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],qi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ki=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xf=[],p_=[],kl=Math.sign;yB();Ut={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:r=>Yi[r],uY:r=>qi[r],vX:r=>Ki[r],vY:r=>Zi[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>xf[r][t],sub:(r,t)=>xf[r][Ut.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Ut.S:Ut.N:Math.abs(t)*2<=Math.abs(r)?r>0?Ut.E:Ut.W:t>0?r>0?Ut.SE:Ut.SW:r>0?Ut.NE:Ut.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=p_[Ut.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var yf,g_=x(()=>{"use strict";yf=()=>{}});var Qi,_f=x(()=>{P();He();Qi=class extends Tt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Qi.extension=v.TextureSource});var x_,Ns,bf=x(()=>{ft();x_=new I,Ns=class{constructor(t,e){this.mapCoord=new I,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 i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.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 i=t.orig,s=t.trim;s&&(x_.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(x_));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 A,_t=x(()=>{Ee();m_();fe();be();Ht();g_();_f();He();bf();A=class extends Ct{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ot,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Tt,this.noFrame=!i,i)this.frame.copyFrom(i);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 Ns(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=Ut.add(l,Ut.NW),t.x0=d+c*Ut.uX(l),t.y0=f+u*Ut.uY(l),l=Ut.add(l,2),t.x1=d+c*Ut.uX(l),t.y1=f+u*Ut.uY(l),l=Ut.add(l,2),t.x2=d+c*Ut.uX(l),t.y2=f+u*Ut.uY(l),l=Ut.add(l,2),t.x3=d+c*Ut.uX(l),t.y3=f+u*Ut.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 z(J,"Texture.baseTexture is now Texture.source"),this._source}};A.EMPTY=new A({label:"EMPTY",source:new Tt({label:"EMPTY"})});A.EMPTY.destroy=yf;A.WHITE=new A({source:new Qi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});A.WHITE.destroy=yf});var _B,vf,Vt,vi=x(()=>{Cn();He();_t();_B=0,vf=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new Tt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new A({source:s,label:`texturePool_${_B++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ti(o),n=ti(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=i,h.source.width=o/i,h.source.height=n/i,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 i=t.source;return this.getOptimalTexture(t.width,t.height,i._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 i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Vt=new vf});var Gl,y_=x(()=>{ft();ff();vi();Gl=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new I,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 Ds,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 i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Vt.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 i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[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 I),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new I),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 I),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 __(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var b_=x(()=>{"use strict"});var Tf,Sf,Ef,Hs,Rn,Ji,xt,_r=x(()=>{Ee();ye();Cy();P();ft();ef();El();be();Ht();Me();Gy();Oy();Dy();Vy();zy();jy();Zy();r_();s_();n_();h_();y_();b_();Tf=new _e(null),Sf=new _e(null),Ef=new _e(null,1,1),Hs=1,Rn=2,Ji=4,xt=class r extends Ct{constructor(t={}){super(),this.uid=at("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 I,this.relativeGroupTransform=new I,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new _e(this,0,0),this._scale=Ef,this._pivot=Sf,this._skew=Tf,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){z("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),k.mixin(r,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||z(J,"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],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=tt.get(Gl,this),this.groupTransform=I.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),tt.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 I),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*My}set angle(t){this.rotation=t*By}get pivot(){return this._pivot===Sf&&(this._pivot=new _e(this,0,0)),this._pivot}set pivot(t){this._pivot===Sf&&(this._pivot=new _e(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Tf&&(this._skew=new _e(this,0,0)),this._skew}set skew(t){this._skew===Tf&&(this._skew=new _e(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ef&&(this._scale=new _e(this,1,1)),this._scale}set scale(t){this._scale===Ef&&(this._scale=new _e(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 i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){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,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._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|=Hs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=rt.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Hs,this._onUpdate())}get tint(){return Pn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Rn,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|=Ji,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|=Ji,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|=Ji,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}};k.mixin(xt,Uy,Xy,a_,i_,e_,Hy,Wy,o_,Py,ky,Ky,Ly)});var Ti,Ul=x(()=>{sr();Ti=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ht,this.page=new ht,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,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 bB(r){return function(t){return t.test(r)}}function Si(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=bB(e),o={apple:{phone:s(wf)&&!s(ei),ipod:s(v_),tablet:!s(wf)&&(s(T_)||B_(t))&&!s(ei),universal:s(S_),device:(s(wf)||s(v_)||s(T_)||s(S_)||B_(t))&&!s(ei)},amazon:{phone:s(Vs),tablet:!s(Vs)&&s(Ol),device:s(Vs)||s(Ol)},android:{phone:!s(ei)&&s(Vs)||!s(ei)&&s(Af),tablet:!s(ei)&&!s(Vs)&&!s(Af)&&(s(Ol)||s(E_)),device:!s(ei)&&(s(Vs)||s(Ol)||s(Af)||s(E_))||s(/\bokhttp\b/i)},windows:{phone:s(ei),tablet:s(w_),device:s(ei)||s(w_)},other:{blackberry:s(A_),blackberry10:s(P_),opera:s(C_),firefox:s(M_),chrome:s(R_),device:s(A_)||s(P_)||s(C_)||s(M_)||s(R_)},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 wf,v_,T_,S_,Af,E_,Vs,Ol,ei,w_,A_,P_,C_,R_,M_,B_,Pf=x(()=>{wf=/iPhone/i,v_=/iPod/i,T_=/iPad/i,S_=/\biOS-universal(?:.+)Mac\b/i,Af=/\bAndroid(?:.+)Mobile\b/i,E_=/Android/i,Vs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ol=/Silk/i,ei=/Windows Phone/i,w_=/\bWindows(?:.+)ARM\b/i,A_=/BlackBerry/i,P_=/BB10/i,C_=/Opera Mini/i,R_=/\b(CriOS|Chrome)(?:.+)Mobile/i,M_=/Mobile(?:.+)Firefox\b/i,B_=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var Cf=x(()=>{Pf();Pf()});var vB,I_,F_=x(()=>{Cf();vB=Si.default??Si,I_=vB(globalThis.navigator)});var TB,Ll,SB,EB,k_,G_,wB,AB,PB,Rf,O_,L_=x(()=>{Ul();P();F_();af();TB=9,Ll=100,SB=0,EB=0,k_=2,G_=1,wB=-1e3,AB=-1e3,PB=2,Rf=class U_{constructor(t,e=I_){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=`${wB}px`,t.style.left=`${AB}px`,t.style.zIndex=PB.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=`${Ll}px`,this._div.style.height=`${Ll}px`,this._div.style.position="absolute",this._div.style.top=`${SB}px`,this._div.style.left=`${EB}px`,this._div.style.zIndex=k_.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 i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...U_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.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 i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,wl(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i<this._children.length;i++){let s=this._children[i];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:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(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${r}`),console.warn(i))),Iy[t]=!0}var Iy,Q,Fy,Ht=x(()=>{"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=`${Ll}px`,e.style.height=`${Ll}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=k_.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:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Ti(s),{target:i});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!==TB||!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()}};Rf.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"accessibility"};Rf.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};O_=Rf});var D_,N_=x(()=>{"use strict";D_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var H_=x(()=>{C();_r();L_();N_();k.add(O_);k.mixin(xt,D_)});var Mn,V_=x(()=>{C();Mn=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,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Mn.extension=v.Application});var Br,Bn=x(()=>{"use strict";Br=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Br||{})});var Ws,W_=x(()=>{"use strict";Ws=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){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 z_,ne,zs=x(()=>{Bn();W_();z_=class qe{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 Ws(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Br.NORMAL){return this._addListener(new Ws(t,e,i))}addOnce(t,e,i=Br.NORMAL){return this._addListener(new Ws(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/i}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(!qe._shared){let t=qe._shared=new qe;t.autoStart=!0,t._protected=!0}return qe._shared}static get system(){if(!qe._system){let t=qe._system=new qe;t.autoStart=!0,t._protected=!0}return qe._system}};z_.targetFPMS=.06;ne=z_});var In,$_=x(()=>{C();Bn();zs();In=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,Br.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ne.shared:new ne,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};In.extension=v.Application});var Mf=x(()=>{C();V_();$_();k.add(Mn);k.add(In)});var Bf,Ir,If=x(()=>{Bn();zs();Bf=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||(ne.system.add(this._tickerUpdate,this,Br.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ne.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())}},Ir=new Bf});var ri,Dl=x(()=>{sr();Ul();ri=class extends Ti{constructor(){super(...arguments),this.client=new ht,this.movement=new ht,this.offset=new ht,this.global=new ht,this.screen=new ht}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}});var Be,Ff=x(()=>{Dl();Be=class extends ri{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 Fr,kf=x(()=>{Dl();Fr=class extends ri{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Fr.DOM_DELTA_PIXEL=0;Fr.DOM_DELTA_LINE=1;Fr.DOM_DELTA_PAGE=2});var CB,RB,Fn,Nl,X_=x(()=>{Ee();sr();wt();If();Dl();Ff();kf();CB=2048,RB=new ht,Fn=new ht,Nl=class{constructor(t){this.dispatch=new Ct,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((i,s)=>i.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 i=0,s=e.length;i<s;i++)e[i].fn(t);else O(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ir.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,RB.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(t.currentTarget=i[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=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i<CB&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.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,i,s,o,n||o(t,i));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,i)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=i;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,i)?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,Fn),!t.hitArea.contains(Fn.x,Fn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let s=t.effects[i];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,Fn),t.containsPoint(Fn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let i=`on${e}`;t.currentTarget[i]?.(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 Be)){O("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 i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Be)){O("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 i=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"),i&&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),i&&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"),i&&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),i&&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")),i&&(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 Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"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=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&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),i&&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 Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"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(i)}mapPointerUpOutside(t){if(!(t instanceof Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;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 Fr)){O("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 i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let s=this.allocateEvent(Be);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Fr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(Be);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Be&&e instanceof Be&&(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 ri&&e instanceof ri&&(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 i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,o=i.length;s<o&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}});var MB,BB,Uf,Hl,Of=x(()=>{C();X_();If();Ff();kf();MB=1,BB={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Uf=class Gf{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Nl(null),Ir.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Be(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Gf.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Gf._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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);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 i=0,s=e.length;i<s;i++){let o=e[i],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,Ir.pointerMoved();let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);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 i=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+=i,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 i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);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,Ir.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Ir.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;Ir.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,i){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=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches[i];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 i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=MB),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}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=BB[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}};Uf.extension={name:"events",type:[v.WebGLSystem,v.CanvasSystem,v.WebGPUSystem],priority:-1};Uf.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Hl=Uf});var j_,Y_=x(()=>{Of();Ul();j_={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(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Hl.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=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;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(r,a,n)}),o?h.once(r,a,n):h.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Ti))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var q_=x(()=>{C();_r();Of();Y_();k.add(Hl);k.mixin(xt,j_)});var kn,K_=x(()=>{C();kn=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 i=0;i<t.length;i++){let s=t[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(i,1),i--;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}};kn.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"dom"}});var Ei,Vl=x(()=>{Ne();_r();Ei=class extends xt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new Et(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:i,y:s}=t;return i>=e.minX&&i<=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,i){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,i)}}});var Z_=x(()=>{C();K_();k.add(kn)});var pe,ii=x(()=>{"use strict";pe=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(pe||{})});var Q_,J_=x(()=>{"use strict";Q_={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var tb,z,Rt=x(()=>{J_();tb=Q_,z={get(){return tb},set(r){tb=r}}});function br(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Gn(r){return r.split("?")[0].split("#")[0]}function IB(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FB(r,t,e){return r.replace(new RegExp(IB(t),"g"),e)}function kB(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a<r.length)n=r.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||i!==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="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ae,ts=x(()=>{Rt();ae={toPosix(r){return FB(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){br(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(br(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Gn(this.toPosix(t??z.get().getBaseUrl())),s=Gn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ae.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(br(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=kB(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return br(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){let i=r[e];if(br(i),i.length>0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(br(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){br(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){br(r),t&&br(t),r=Gn(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let h=r.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&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){br(r),r=Gn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){br(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Gn(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.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&&i?t.base=t.name=r.slice(1,h):t.base=t.name=r.slice(a,h)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,h)):(t.name=r.slice(a,n),t.base=r.slice(a,h)),t.ext=r.slice(n,h)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ie,Un=x(()=>{"use strict";Ie=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function eb(r,t,e,i,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?eb(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function rb(r){let t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),eb(r,s,0,e,i)}else i.push(r);return i}var ib=x(()=>{"use strict"});var es,Wl=x(()=>{"use strict";es=r=>!Array.isArray(r)});function GB(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Ke,$s=x(()=>{wt();ts();Un();ib();Wl();Ke=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(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Ie(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&O("[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 i=[],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);i.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));i.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&O(`[Resolver] already has key: ${o} overwriting`)},Ie(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Ie(n).map(f=>typeof f=="string"?rb(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g<this._parsers.length;g++){let b=this._parsers[g];if(b.test(p)){m=b.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,m={...m,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:h,loadParser:l}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=es(t);t=Ie(t);let i={};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}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=es(t);t=Ie(t);let i={};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},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(i.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:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ae.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??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??GB(t.src),t}};Ke.RETINA_PREFIX=/@([0-9\.]+)x/});var On,Lf=x(()=>{"use strict";On=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var sb,wi,Df=x(()=>{fe();_t();sb=class Ln{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof A?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,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<=Ln.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=Ln.BATCH_SIZE;for(;e-t<i&&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 st(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new st(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 st(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 st(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 A({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 i=0;i<t[e].length;i++){let s=t[e][i];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*Ln.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ln.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=[]}};sb.BATCH_SIZE=1e3;wi=sb});function ob(r,t,e){let i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=ae.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=ob([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var UB,nb,ab=x(()=>{ii();$s();Lf();C();_t();ts();Df();UB=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];nb={extension:v.Asset,cache:{test:r=>r instanceof wi,getCacheableAssets:(r,t)=>ob(r,t,!1)},resolver:{extension:{type:v.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&UB.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:v.LoadParser,priority:pe.Normal,name:"spritesheetLoader"},async testParse(r,t){return ae.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=ae.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof A)a=i;else{let c=On(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new wi(a.source,r);await h.parse();let l=r?.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=On(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(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var zl=x(()=>{C();ab();k.add(nb)});function $l(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var Nf=x(()=>{"use strict"});var kt,Dn=x(()=>{El();_t();Nf();Ht();Vl();kt=class r extends Ei{constructor(t=A.EMPTY){t instanceof A&&(t={texture:t});let{texture:e=A.EMPTY,anchor:i,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 _e({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i: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 A?new r(t):new r(A.from(t,e))}set texture(t){t||(t=A.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 $l(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return W("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Xl(r,t,e){let i=OB;r.measurable=!0,Us(r,e,i),t.addBoundsMask(i),r.measurable=!1}var OB,Hf=x(()=>{Ne();An();OB=new Et});function jl(r,t,e){let i=Ye.get();r.measurable=!0;let s=te.get().identity(),o=hb(r,e,s);Ls(r,i,o),r.measurable=!1,t.addBoundsMask(i),te.return(s),Ye.return(i)}function hb(r,t,e){return r?(r!==t&&(hb(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Vf=x(()=>{Bl();ji();wt()});var Nn,lb=x(()=>{C();Dn();Hf();Vf();Nn=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 kt),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){jl(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof kt}};Nn.extension=v.MaskEffect});var Hn,cb=x(()=>{C();Hn=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"}};Hn.extension=v.MaskEffect});var Vn,ub=x(()=>{C();_r();Hf();Vf();Vn=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){jl(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof xt}};Vn.extension=v.MaskEffect});var we,Xs=x(()=>{Rt();C();He();we=class extends Tt{constructor(t){t.resource||(t.resource=z.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);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"))}};we.extension=v.TextureSource});var Ve,js=x(()=>{Rt();C();wt();He();Ve=class extends Tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=z.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,O("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}};Ve.extension=v.TextureSource});async function Yl(){return Wf??(Wf=(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 i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Wf}var Wf,zf=x(()=>{"use strict"});var ql,Ys,$f=x(()=>{C();zs();zf();He();ql=class db extends Tt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...db.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=ne.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((i,s)=>{this.isValid?i(this):(this._resolve=i,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&&(ne.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||(ne.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ne.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ql.extension=v.TextureSource;ql.defaultOptions={...Tt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};ql.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Ys=ql});var Xf,bt,Ai=x(()=>{wt();Un();Xf=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||O(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Ie(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(i,e);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.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&&O("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){O(`[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}},bt=new Xf});function fb(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<jf.length;s++){let o=jf[s];if(o.test(e))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function pb(r={},t=!1){let e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&bt.has(i))return bt.get(i);let o=new A({source:fb(s)});return o.on("destroy",()=>{bt.has(i)&&bt.remove(i)}),t||bt.set(i,o),o}function mb(r,t=!1){return typeof r=="string"?bt.get(r):r instanceof Tt?new A({source:r}):pb(r,t)}var jf,Yf=x(()=>{Ai();C();He();_t();jf=[];k.handleByList(v.TextureSource,jf);A.from=mb;Tt.from=fb});var Kl=x(()=>{C();lb();cb();ub();_f();Xs();js();$f();Yf();k.add(Nn,Hn,Vn,Ys,Ve,we,Qi)});var me,Pi=x(()=>{"use strict";me=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&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 i in e)e[i]._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 i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function Ql(){return(!Zl||Zl?.isContextLost())&&(Zl=z.get().createCanvas().getContext("webgl",{})),Zl}var Zl,qf=x(()=>{Rt()});function DB(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Ll}px`,e.style.height=`${Ll}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=k_.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:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Ti(s),{target:i});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!==TB||!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()}};Rf.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"accessibility"};Rf.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};O_=Rf});var D_,N_=x(()=>{"use strict";D_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var H_=x(()=>{P();_r();L_();N_();k.add(O_);k.mixin(xt,D_)});var Mn,V_=x(()=>{P();Mn=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,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Mn.extension=v.Application});var Br,Bn=x(()=>{"use strict";Br=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Br||{})});var Ws,W_=x(()=>{"use strict";Ws=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){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 z_,ne,zs=x(()=>{Bn();W_();z_=class qe{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 Ws(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Br.NORMAL){return this._addListener(new Ws(t,e,i))}addOnce(t,e,i=Br.NORMAL){return this._addListener(new Ws(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/i}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(!qe._shared){let t=qe._shared=new qe;t.autoStart=!0,t._protected=!0}return qe._shared}static get system(){if(!qe._system){let t=qe._system=new qe;t.autoStart=!0,t._protected=!0}return qe._system}};z_.targetFPMS=.06;ne=z_});var In,$_=x(()=>{P();Bn();zs();In=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,Br.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ne.shared:new ne,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};In.extension=v.Application});var Mf=x(()=>{P();V_();$_();k.add(Mn);k.add(In)});var Bf,Ir,If=x(()=>{Bn();zs();Bf=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||(ne.system.add(this._tickerUpdate,this,Br.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ne.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())}},Ir=new Bf});var ri,Dl=x(()=>{sr();Ul();ri=class extends Ti{constructor(){super(...arguments),this.client=new ht,this.movement=new ht,this.offset=new ht,this.global=new ht,this.screen=new ht}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}});var Be,Ff=x(()=>{Dl();Be=class extends ri{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 Fr,kf=x(()=>{Dl();Fr=class extends ri{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Fr.DOM_DELTA_PIXEL=0;Fr.DOM_DELTA_LINE=1;Fr.DOM_DELTA_PAGE=2});var CB,RB,Fn,Nl,X_=x(()=>{Ee();sr();wt();If();Dl();Ff();kf();CB=2048,RB=new ht,Fn=new ht,Nl=class{constructor(t){this.dispatch=new Ct,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((i,s)=>i.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 i=0,s=e.length;i<s;i++)e[i].fn(t);else O(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ir.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,RB.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(t.currentTarget=i[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=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i<CB&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.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,i,s,o,n||o(t,i));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,i)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=i;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,i)?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,Fn),!t.hitArea.contains(Fn.x,Fn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let s=t.effects[i];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,Fn),t.containsPoint(Fn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let i=`on${e}`;t.currentTarget[i]?.(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 Be)){O("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 i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Be)){O("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 i=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"),i&&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),i&&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"),i&&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),i&&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")),i&&(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 Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"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=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&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),i&&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 Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"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(i)}mapPointerUpOutside(t){if(!(t instanceof Be)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;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 Fr)){O("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 i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let s=this.allocateEvent(Be);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Fr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(Be);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Be&&e instanceof Be&&(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 ri&&e instanceof ri&&(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 i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,o=i.length;s<o&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}});var MB,BB,Uf,Hl,Of=x(()=>{P();X_();If();Ff();kf();MB=1,BB={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Uf=class Gf{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Nl(null),Ir.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Be(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Gf.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Gf._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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);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 i=0,s=e.length;i<s;i++){let o=e[i],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,Ir.pointerMoved();let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);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 i=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+=i,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 i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);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,Ir.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Ir.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;Ir.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,i){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=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches[i];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 i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=MB),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}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=BB[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}};Uf.extension={name:"events",type:[v.WebGLSystem,v.CanvasSystem,v.WebGPUSystem],priority:-1};Uf.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Hl=Uf});var j_,Y_=x(()=>{Of();Ul();j_={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(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Hl.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=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;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(r,a,n)}),o?h.once(r,a,n):h.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Ti))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var q_=x(()=>{P();_r();Of();Y_();k.add(Hl);k.mixin(xt,j_)});var kn,K_=x(()=>{P();kn=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 i=0;i<t.length;i++){let s=t[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(i,1),i--;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}};kn.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"dom"}});var Ei,Vl=x(()=>{Ne();_r();Ei=class extends xt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new Et(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:i,y:s}=t;return i>=e.minX&&i<=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,i){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,i)}}});var Z_=x(()=>{P();K_();k.add(kn)});var pe,ii=x(()=>{"use strict";pe=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(pe||{})});var Q_,J_=x(()=>{"use strict";Q_={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var tb,$,Rt=x(()=>{J_();tb=Q_,$={get(){return tb},set(r){tb=r}}});function br(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Gn(r){return r.split("?")[0].split("#")[0]}function IB(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FB(r,t,e){return r.replace(new RegExp(IB(t),"g"),e)}function kB(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a<r.length)n=r.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||i!==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="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ae,ts=x(()=>{Rt();ae={toPosix(r){return FB(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){br(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(br(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Gn(this.toPosix(t??$.get().getBaseUrl())),s=Gn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ae.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(br(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=kB(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return br(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){let i=r[e];if(br(i),i.length>0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(br(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){br(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){br(r),t&&br(t),r=Gn(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let h=r.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&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){br(r),r=Gn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){br(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Gn(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.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&&i?t.base=t.name=r.slice(1,h):t.base=t.name=r.slice(a,h)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,h)):(t.name=r.slice(a,n),t.base=r.slice(a,h)),t.ext=r.slice(n,h)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ie,Un=x(()=>{"use strict";Ie=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function eb(r,t,e,i,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?eb(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function rb(r){let t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),eb(r,s,0,e,i)}else i.push(r);return i}var ib=x(()=>{"use strict"});var es,Wl=x(()=>{"use strict";es=r=>!Array.isArray(r)});function GB(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Ke,$s=x(()=>{wt();ts();Un();ib();Wl();Ke=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(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Ie(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&O("[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 i=[],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);i.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));i.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&O(`[Resolver] already has key: ${o} overwriting`)},Ie(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Ie(n).map(f=>typeof f=="string"?rb(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g<this._parsers.length;g++){let b=this._parsers[g];if(b.test(p)){m=b.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,m={...m,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:h,loadParser:l}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=es(t);t=Ie(t);let i={};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}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=es(t);t=Ie(t);let i={};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},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(i.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:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ae.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??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??GB(t.src),t}};Ke.RETINA_PREFIX=/@([0-9\.]+)x/});var On,Lf=x(()=>{"use strict";On=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var sb,wi,Df=x(()=>{fe();_t();sb=class Ln{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof A?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,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<=Ln.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=Ln.BATCH_SIZE;for(;e-t<i&&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 ot(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new ot(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 ot(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 ot(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 A({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 i=0;i<t[e].length;i++){let s=t[e][i];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*Ln.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ln.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=[]}};sb.BATCH_SIZE=1e3;wi=sb});function ob(r,t,e){let i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=ae.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=ob([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var UB,nb,ab=x(()=>{ii();$s();Lf();P();_t();ts();Df();UB=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];nb={extension:v.Asset,cache:{test:r=>r instanceof wi,getCacheableAssets:(r,t)=>ob(r,t,!1)},resolver:{extension:{type:v.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&UB.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:v.LoadParser,priority:pe.Normal,name:"spritesheetLoader"},async testParse(r,t){return ae.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=ae.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof A)a=i;else{let c=On(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new wi(a.source,r);await h.parse();let l=r?.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=On(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(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var zl=x(()=>{P();ab();k.add(nb)});function $l(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var Nf=x(()=>{"use strict"});var kt,Dn=x(()=>{El();_t();Nf();Ht();Vl();kt=class r extends Ei{constructor(t=A.EMPTY){t instanceof A&&(t={texture:t});let{texture:e=A.EMPTY,anchor:i,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 _e({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i: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 A?new r(t):new r(A.from(t,e))}set texture(t){t||(t=A.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 $l(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return z("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Xl(r,t,e){let i=OB;r.measurable=!0,Us(r,e,i),t.addBoundsMask(i),r.measurable=!1}var OB,Hf=x(()=>{Ne();An();OB=new Et});function jl(r,t,e){let i=Ye.get();r.measurable=!0;let s=te.get().identity(),o=hb(r,e,s);Ls(r,i,o),r.measurable=!1,t.addBoundsMask(i),te.return(s),Ye.return(i)}function hb(r,t,e){return r?(r!==t&&(hb(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Vf=x(()=>{Bl();ji();wt()});var Nn,lb=x(()=>{P();Dn();Hf();Vf();Nn=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 kt),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){jl(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof kt}};Nn.extension=v.MaskEffect});var Hn,cb=x(()=>{P();Hn=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"}};Hn.extension=v.MaskEffect});var Vn,ub=x(()=>{P();_r();Hf();Vf();Vn=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){jl(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof xt}};Vn.extension=v.MaskEffect});var we,Xs=x(()=>{Rt();P();He();we=class extends Tt{constructor(t){t.resource||(t.resource=$.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);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"))}};we.extension=v.TextureSource});var Ve,js=x(()=>{Rt();P();wt();He();Ve=class extends Tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=$.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,O("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}};Ve.extension=v.TextureSource});async function Yl(){return Wf??(Wf=(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 i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Wf}var Wf,zf=x(()=>{"use strict"});var ql,Ys,$f=x(()=>{P();zs();zf();He();ql=class db extends Tt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...db.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=ne.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((i,s)=>{this.isValid?i(this):(this._resolve=i,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&&(ne.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||(ne.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ne.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ql.extension=v.TextureSource;ql.defaultOptions={...Tt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};ql.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Ys=ql});var Xf,bt,Ai=x(()=>{wt();Un();Xf=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||O(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Ie(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(i,e);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.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&&O("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){O(`[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}},bt=new Xf});function fb(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<jf.length;s++){let o=jf[s];if(o.test(e))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function pb(r={},t=!1){let e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&bt.has(i))return bt.get(i);let o=new A({source:fb(s)});return o.on("destroy",()=>{bt.has(i)&&bt.remove(i)}),t||bt.set(i,o),o}function mb(r,t=!1){return typeof r=="string"?bt.get(r):r instanceof Tt?new A({source:r}):pb(r,t)}var jf,Yf=x(()=>{Ai();P();He();_t();jf=[];k.handleByList(v.TextureSource,jf);A.from=mb;Tt.from=fb});var Kl=x(()=>{P();lb();cb();ub();_f();Xs();js();$f();Yf();k.add(Nn,Hn,Vn,Ys,Ve,we,Qi)});var me,Pi=x(()=>{"use strict";me=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&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 i in e)e[i]._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 i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function Ql(){return(!Zl||Zl?.isContextLost())&&(Zl=$.get().createCanvas().getContext("webgl",{})),Zl}var Zl,qf=x(()=>{Rt()});function DB(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
20
20
  else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function gb(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let i=LB.replace(/%forloop%/gi,DB(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}var LB,xb=x(()=>{"use strict";LB=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `)});function or(){if(qs)return qs;let r=Ql();return qs=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),qs=gb(qs,r),r.getExtension("WEBGL_lose_context")?.loseContext(),qs}var qs,rs=x(()=>{qf();xb();qs=null});function Ks(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return yb[e]||NB(r,t,e)}function NB(r,t,e){let i={},s=0;Kf||(Kf=or());for(let n=0;n<Kf;n++){let a=n<t?r[n]:A.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new me(i);return yb[e]=o,o}var yb,Kf,Jl=x(()=>{Pi();_t();rs();yb={};Kf=0});var kr,Zf=x(()=>{"use strict";kr=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(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var Qf=x(()=>{"use strict"});var _b,It,is=x(()=>{"use strict";_b={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},It=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(It||{})});function si(r,t){return t.alphaMode==="no-premultiply-alpha"&&_b[r]||r}var zn=x(()=>{is()});var tc,bb=x(()=>{"use strict";tc=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 vb(){return tp>0?Sb[--tp]:new Jf}function Tb(r){Sb[tp++]=r}var Jf,Sb,tp,$n,Eb,wb,Ab=x(()=>{be();Zf();Qf();zn();rs();bb();Jf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new tc,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Sb=[],tp=0;$n=0,Eb=class ec{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],ec.defaultOptions.maxTextures=ec.defaultOptions.maxTextures??or(),t={...ec.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new kr(i*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++)Tb(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 i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;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 i=vb(),s=i.textures;s.clear();let o=e[this.elementStart],n=si(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 m=this.elementStart;m<this.elementSize;++m){let g=e[m];e[m]=null;let y=g.texture._source,_=si(g.blendMode,y),T=n!==_||a!==g.topology;if(y._batchTick===$n&&!T){g._textureId=y._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=i;continue}y._batchTick=$n,(s.count>=p||T)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=_,a=g.topology,i=vb(),s=i.textures,s.clear(),++$n),g._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,g._batch=i,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++$n),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,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=i,++$n,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),i=new kr(e);Wn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);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,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[i++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)Tb(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}};Eb.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};wb=Eb});var ot,oi=x(()=>{"use strict";ot=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(ot||{})});var $t,Ci=x(()=>{Ee();be();oi();$t=class extends Ct{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,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,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&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?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=at("resource"),this.emit("change",this));return}i&&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 ep(r,t){if(!(r instanceof $t)){let e=t?ot.INDEX:ot.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=ot.INDEX|ot.COPY_DST):(r=new Float32Array(r),e=ot.VERTEX|ot.COPY_DST)),r=new $t({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}var Pb=x(()=>{Ci();oi()});function Cb(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(i.offset||0)/l,u=(i.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 Rb=x(()=>{"use strict"});function HB(r){return(r instanceof $t||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=ep(r.buffer,!1),r}var nr,Zs=x(()=>{Ee();Ne();be();Ci();Pb();Rb();nr=class extends Ct{constructor(t={}){super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Et,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),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 i=HB(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=ep(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Cb(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 VB,WB,rc,Mb=x(()=>{Ci();oi();Zs();VB=new Float32Array(1),WB=new Uint32Array(1),rc=class extends nr{constructor(){let e=new $t({data:VB,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),i=new $t({data:WB,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:i})}}});function ni(r,t){let e=Bb[r];return e===void 0&&(rp[t]===void 0&&(rp[t]=1),Bb[r]=e=rp[t]++),e}var rp,Bb,Xn=x(()=>{"use strict";rp=Object.create(null),Bb=Object.create(null)});function Ib(){if(!ic){ic="mediump";let r=Ql();r&&r.getShaderPrecisionFormat&&(ic=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return ic}var ic,Fb=x(()=>{qf()});function kb(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
21
+ `)});function or(){if(qs)return qs;let r=Ql();return qs=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),qs=gb(qs,r),r.getExtension("WEBGL_lose_context")?.loseContext(),qs}var qs,rs=x(()=>{qf();xb();qs=null});function Ks(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return yb[e]||NB(r,t,e)}function NB(r,t,e){let i={},s=0;Kf||(Kf=or());for(let n=0;n<Kf;n++){let a=n<t?r[n]:A.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new me(i);return yb[e]=o,o}var yb,Kf,Jl=x(()=>{Pi();_t();rs();yb={};Kf=0});var kr,Zf=x(()=>{"use strict";kr=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(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var Qf=x(()=>{"use strict"});var _b,It,is=x(()=>{"use strict";_b={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},It=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(It||{})});function si(r,t){return t.alphaMode==="no-premultiply-alpha"&&_b[r]||r}var zn=x(()=>{is()});var tc,bb=x(()=>{"use strict";tc=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 vb(){return tp>0?Sb[--tp]:new Jf}function Tb(r){Sb[tp++]=r}var Jf,Sb,tp,$n,Eb,wb,Ab=x(()=>{be();Zf();Qf();zn();rs();bb();Jf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new tc,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Sb=[],tp=0;$n=0,Eb=class ec{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],ec.defaultOptions.maxTextures=ec.defaultOptions.maxTextures??or(),t={...ec.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new kr(i*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++)Tb(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 i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;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 i=vb(),s=i.textures;s.clear();let o=e[this.elementStart],n=si(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 m=this.elementStart;m<this.elementSize;++m){let g=e[m];e[m]=null;let y=g.texture._source,_=si(g.blendMode,y),T=n!==_||a!==g.topology;if(y._batchTick===$n&&!T){g._textureId=y._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=i;continue}y._batchTick=$n,(s.count>=p||T)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=_,a=g.topology,i=vb(),s=i.textures,s.clear(),++$n),g._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,g._batch=i,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++$n),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,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=i,++$n,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),i=new kr(e);Wn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);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,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[i++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)Tb(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}};Eb.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};wb=Eb});var nt,oi=x(()=>{"use strict";nt=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(nt||{})});var $t,Ci=x(()=>{Ee();be();oi();$t=class extends Ct{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,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&nt.STATIC)}set static(t){t?this.descriptor.usage|=nt.STATIC:this.descriptor.usage&=~nt.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&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?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=at("resource"),this.emit("change",this));return}i&&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 ep(r,t){if(!(r instanceof $t)){let e=t?nt.INDEX:nt.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=nt.INDEX|nt.COPY_DST):(r=new Float32Array(r),e=nt.VERTEX|nt.COPY_DST)),r=new $t({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}var Pb=x(()=>{Ci();oi()});function Cb(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(i.offset||0)/l,u=(i.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 Rb=x(()=>{"use strict"});function HB(r){return(r instanceof $t||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=ep(r.buffer,!1),r}var nr,Zs=x(()=>{Ee();Ne();be();Ci();Pb();Rb();nr=class extends Ct{constructor(t={}){super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Et,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),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 i=HB(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=ep(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Cb(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 VB,WB,rc,Mb=x(()=>{Ci();oi();Zs();VB=new Float32Array(1),WB=new Uint32Array(1),rc=class extends nr{constructor(){let e=new $t({data:VB,label:"attribute-batch-buffer",usage:nt.VERTEX|nt.COPY_DST,shrinkToFit:!1}),i=new $t({data:WB,label:"index-batch-buffer",usage:nt.INDEX|nt.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:i})}}});function ni(r,t){let e=Bb[r];return e===void 0&&(rp[t]===void 0&&(rp[t]=1),Bb[r]=e=rp[t]++),e}var rp,Bb,Xn=x(()=>{"use strict";rp=Object.create(null),Bb=Object.create(null)});function Ib(){if(!ic){ic="mediump";let r=Ql();r&&r.getShaderPrecisionFormat&&(ic=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return ic}var ic,Fb=x(()=>{qf()});function kb(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -250,7 +250,7 @@ ${s.join(`
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}}});var pp,Sv,Ev=x(()=>{"use strict";pp=["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>"],Sv=pp.reduce((r,t)=>(r[t]=!0,r),{})});function wv(r,t){switch(r){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 Av=x(()=>{"use strict"});var Pv,At,Fe=x(()=>{be();Xn();Ev();Av();Pv=class Cv{constructor(t,e){this._touched=0,this.uid=at("uniform"),this._resourceType="uniformGroup",this._resourceId=at("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Cv.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Sv[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${pp.join(", ")}`);o.value??(o.value=wv(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ni(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Pv.defaultOptions={ubo:!1,isStatic:!1};At=Pv});function so(r){let t=Rv[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=Rv[r]=new At({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var Rv,oc=x(()=>{Fe();Rv={}});var ee,Dr=x(()=>{"use strict";ee=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(ee||{})});var Xt,vr=x(()=>{Ee();be();ss();Pi();Js();Dr();Fe();Xt=class r extends Ct{constructor(t){super(),this.uid=at("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=ee.WEBGPU),i&&(n|=ee.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 me,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 At(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new me,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,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new me,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}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:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=ar.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var nc,Mv=x(()=>{Mi();jn();Yn();Bi();oc();vr();nc=class extends Xt{constructor(t){let e=Ur({name:"batch",bits:[eo,io(t),Lr]}),i=Gr({name:"batch",bits:[to,ro(t),Or]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:so(t)}})}}});var Bv,Iv,qn,mp=x(()=>{C();Ab();Mb();Mv();Bv=null,Iv=class Fv extends wb{constructor(){super(...arguments),this.geometry=new rc,this.shader=Bv||(Bv=new nc(this.maxTextures)),this.name=Fv.extension.name,this.vertexSize=6}packAttributes(t,e,i,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:m}=t,g=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let _=b;_<y;_++){let T=_*2,E=p[T],S=p[T+1];e[s++]=h*E+c*S+d,e[s++]=u*S+l*E+f,e[s++]=m[T],e[s++]=m[T+1],i[s++]=g,i[s++]=n}}packQuadAttributes(t,e,i,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,m=p.maxX,g=p.minX,b=p.maxY,y=p.minY,_=n.uvs,T=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=h*g+c*y+d,e[s+1]=u*y+l*g+f,e[s+2]=_.x0,e[s+3]=_.y0,i[s+4]=T,i[s+5]=E,e[s+6]=h*m+c*y+d,e[s+7]=u*y+l*m+f,e[s+8]=_.x1,e[s+9]=_.y1,i[s+10]=T,i[s+11]=E,e[s+12]=h*m+c*b+d,e[s+13]=u*b+l*m+f,e[s+14]=_.x2,e[s+15]=_.y2,i[s+16]=T,i[s+17]=E,e[s+18]=h*g+c*b+d,e[s+19]=u*b+l*g+f,e[s+20]=_.x3,e[s+21]=_.y3,i[s+22]=T,i[s+23]=E}};Iv.extension={type:[v.Batcher],name:"default"};qn=Iv});function kv(r,t,e,i,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 m=r[e],g=r[e+1];i[s]=l*m+u*g+f,i[s+1]=c*m+d*g+p,s+=o,e+=t,h++}}function Gv(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var Uv=x(()=>{"use strict"});function gp(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],p=r[u+1];r[u]=o*f+a*p+l,r[u+1]=n*f+h*p+c,u+=i}}var Ov=x(()=>{"use strict"});var eI,ns,xp=x(()=>{ft();lf();eI=new I,ns=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,i=this.renderable;return i?Ml(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||eI}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 oo,Lv,Dv,Nv=x(()=>{C();oo={extension:{type:v.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let T=r;e=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;e=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,E=T.width/2,S=T.height/2;e=T.x+E,i=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(E,S))),s=E-n,o=S-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]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,m=o,g=e+p,b=e-p,y=i+m;if(t[c++]=g,t[c++]=y,t[--u]=y,t[--u]=b,o){let T=i-m;t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<h;T++){let E=Math.PI/2*(T/h),S=s+Math.cos(E)*n,w=o+Math.sin(E)*a,M=e+S,P=e-S,R=i+w,B=i-w;t[c++]=M,t[c++]=R,t[--u]=R,t[--u]=P,t[d++]=P,t[d++]=B,t[--f]=B,t[--f]=M}p=s,m=o+a,g=e+p,b=e-p,y=i+m;let _=i-m;return t[c++]=g,t[c++]=y,t[--f]=_,t[--f]=g,s&&(t[c++]=b,t[c++]=y,t[--f]=_,t[--f]=b),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let c=0;c<r.length;c+=2)n+=r[c],a+=r[c+1];n/=r.length/2,a/=r.length/2;let h=i;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<r.length;c+=2)t[h*e]=r[c],t[h*e+1]=r[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}},Lv={...oo,extension:{...oo.extension,name:"ellipse"}},Dv={...oo,extension:{...oo.extension,name:"roundedRectangle"}}});function Hv(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Vv=x(()=>{"use strict"});function Wv(r,t,e,i,s,o,n,a){let h=r-e*s,l=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let p=h+d,m=l+f,g=c+d,b=u+f;return a.push(p,m),a.push(g,b),2}function as(r,t,e,i,s,o,n,a){let h=e-r,l=i-t,c=Math.atan2(h,l),u=Math.atan2(s-r,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),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,b=f/g;if(d+=b,a){n.push(r,t),n.push(e,i);for(let y=1,_=d;y<g;y++,_+=b)n.push(r,t),n.push(r+Math.sin(_)*m,t+Math.cos(_)*m);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let y=1,_=d;y<g;y++,_+=b)n.push(r+Math.sin(_)*m,t+Math.cos(_)*m),n.push(r,t);n.push(s,o),n.push(r,t)}return g*2}function zv(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let U=Hv(r);e&&(U*=-1),h=(h-.5)*U+.5}let l=new ht(r[0],r[1]),c=new ht(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));let U=(l.x+c.x)*.5,tt=(c.y+l.y)*.5;r.unshift(U,tt),r.push(U,tt)}let f=s,p=r.length/2,m=r.length,g=f.length/2,b=a.width/2,y=b*b,_=a.miterLimit*a.miterLimit,T=r[0],E=r[1],S=r[2],w=r[3],M=0,P=0,R=-(E-w),B=T-S,F=0,X=0,L=Math.sqrt(R*R+B*B);R/=L,B/=L,R*=b,B*=b;let nt=h,D=(1-nt)*2,$=nt*2;u||(a.cap==="round"?m+=as(T-R*(D-$)*.5,E-B*(D-$)*.5,T-R*D,E-B*D,T+R*$,E+B*$,f,!0)+2:a.cap==="square"&&(m+=Wv(T,E,R,B,D,$,!0,f))),f.push(T-R*D,E-B*D),f.push(T+R*$,E+B*$);for(let U=1;U<p-1;++U){T=r[(U-1)*2],E=r[(U-1)*2+1],S=r[U*2],w=r[U*2+1],M=r[(U+1)*2],P=r[(U+1)*2+1],R=-(E-w),B=T-S,L=Math.sqrt(R*R+B*B),R/=L,B/=L,R*=b,B*=b,F=-(w-P),X=S-M,L=Math.sqrt(F*F+X*X),F/=L,X/=L,F*=b,X*=b;let tt=S-T,vt=E-w,gt=S-M,Dt=P-w,Nt=tt*gt+vt*Dt,Zt=vt*gt-Dt*tt,oe=Zt<0;if(Math.abs(Zt)<.001*Math.abs(Nt)){f.push(S-R*D,w-B*D),f.push(S+R*$,w+B*$),Nt>=0&&(a.join==="round"?m+=as(S,w,S-R*D,w-B*D,S-F*D,w-X*D,f,!1)+4:m+=2,f.push(S-F*$,w-X*$),f.push(S+F*D,w+X*D));continue}let Te=(-R+T)*(-B+w)-(-R+S)*(-B+E),St=(-F+M)*(-X+w)-(-F+S)*(-X+P),ut=(tt*St-gt*Te)/Zt,yt=(Dt*Te-vt*St)/Zt,Ft=(ut-S)*(ut-S)+(yt-w)*(yt-w),Qt=S+(ut-S)*D,Jt=w+(yt-w)*D,De=S-(ut-S)*$,zi=w-(yt-w)*$,YM=Math.min(tt*tt+vt*vt,gt*gt+Dt*Dt),dy=oe?D:$,qM=YM+dy*dy*y;Ft<=qM?a.join==="bevel"||Ft/y>_?(oe?(f.push(Qt,Jt),f.push(S+R*$,w+B*$),f.push(Qt,Jt),f.push(S+F*$,w+X*$)):(f.push(S-R*D,w-B*D),f.push(De,zi),f.push(S-F*D,w-X*D),f.push(De,zi)),m+=2):a.join==="round"?oe?(f.push(Qt,Jt),f.push(S+R*$,w+B*$),m+=as(S,w,S+R*$,w+B*$,S+F*$,w+X*$,f,!0)+4,f.push(Qt,Jt),f.push(S+F*$,w+X*$)):(f.push(S-R*D,w-B*D),f.push(De,zi),m+=as(S,w,S-R*D,w-B*D,S-F*D,w-X*D,f,!1)+4,f.push(S-F*D,w-X*D),f.push(De,zi)):(f.push(Qt,Jt),f.push(De,zi)):(f.push(S-R*D,w-B*D),f.push(S+R*$,w+B*$),a.join==="round"?oe?m+=as(S,w,S+R*$,w+B*$,S+F*$,w+X*$,f,!0)+2:m+=as(S,w,S-R*D,w-B*D,S-F*D,w-X*D,f,!1)+2:a.join==="miter"&&Ft/y<=_&&(oe?(f.push(De,zi),f.push(De,zi)):(f.push(Qt,Jt),f.push(Qt,Jt)),m+=2),f.push(S-F*D,w-X*D),f.push(S+F*$,w+X*$),m+=2)}T=r[(p-2)*2],E=r[(p-2)*2+1],S=r[(p-1)*2],w=r[(p-1)*2+1],R=-(E-w),B=T-S,L=Math.sqrt(R*R+B*B),R/=L,B/=L,R*=b,B*=b,f.push(S-R*D,w-B*D),f.push(S+R*$,w+B*$),u||(a.cap==="round"?m+=as(S-R*(D-$)*.5,w-B*(D-$)*.5,S-R*D,w-B*D,S+R*$,w+B*$,f,!1)+2:a.cap==="square"&&(m+=Wv(S,w,R,B,D,$,!1,f)));let H=1e-4*1e-4;for(let U=g;U<m+g-2;++U)T=f[U*2],E=f[U*2+1],S=f[(U+1)*2],w=f[(U+1)*2+1],M=f[(U+2)*2],P=f[(U+2)*2+1],!(Math.abs(T*(w-P)+S*(P-E)+M*(E-w))<H)&&o.push(U,U+1,U+2)}var $v=x(()=>{sr();Vv()});function Xv(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],h=r[r.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=r.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);l&&i.push(d+u-1,d)}var jv=x(()=>{});var uc=K((DW,vp)=>{"use strict";vp.exports=lc;vp.exports.default=lc;function lc(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=qv(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(i&&(o=hI(r,t,o,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[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 Kn(o,n,e,a,h,f,0),n}function qv(r,t,e,i,s){var o,n;if(s===bp(r,t,e,i)>0)for(o=t;o<e;o+=i)n=Yv(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=Yv(o,r[o],r[o+1],n);return n&&cc(n,n.next)&&(Qn(n),n=n.next),n}function hs(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(cc(e,e.next)||Wt(e.prev,e,e.next)===0)){if(Qn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Kn(r,t,e,i,s,o,n){if(r){!n&&o&&fI(r,i,s,o);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,o?oI(r,i,s,o):sI(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Qn(r),r=l.next,a=l.next;continue}if(r=l,r===a){n?n===1?(r=nI(hs(r),t,e),Kn(r,t,e,i,s,o,2)):n===2&&aI(r,t,e,i,s,o):Kn(hs(r),t,e,i,s,o,1);break}}}}function sI(r){var t=r.prev,e=r,i=r.next;if(Wt(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,h=e.y,l=i.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=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&no(s,a,o,h,n,l,p.x,p.y)&&Wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function oI(r,t,e,i){var s=r.prev,o=r,n=r.next;if(Wt(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,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,b=yp(f,p,t,e,i),y=yp(m,g,t,e,i),_=r.prevZ,T=r.nextZ;_&&_.z>=b&&T&&T.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==n&&no(a,c,h,u,l,d,_.x,_.y)&&Wt(_.prev,_,_.next)>=0||(_=_.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&no(a,c,h,u,l,d,T.x,T.y)&&Wt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;_&&_.z>=b;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==n&&no(a,c,h,u,l,d,_.x,_.y)&&Wt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;T&&T.z<=y;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&no(a,c,h,u,l,d,T.x,T.y)&&Wt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function nI(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!cc(s,o)&&Kv(s,i,i.next,o)&&Zn(s,o)&&Zn(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),Qn(i),Qn(i.next),i=r=o),i=i.next}while(i!==r);return hs(i)}function aI(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&gI(n,a)){var h=Zv(n,a);n=hs(n,n.next),h=hs(h,h.next),Kn(n,t,e,i,s,o,0),Kn(h,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function hI(r,t,e,i){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*i,h=o<n-1?t[o+1]*i:r.length,l=qv(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(mI(l));for(s.sort(lI),o=0;o<s.length;o++)e=cI(s[o],e);return e}function lI(r,t){return r.x-t.x}function cI(r,t){var e=uI(r,t);if(!e)return t;var i=Zv(e,r);return hs(i,i.next),hs(e,e.next)}function uI(r,t){var e=t,i=r.x,s=r.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<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))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 i>=e.x&&e.x>=l&&i!==e.x&&no(s<c?i:o,s,l,c,s<c?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Zn(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&dI(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function dI(r,t){return Wt(r.prev,r,t.prev)<0&&Wt(t.next,r,r.next)<0}function fI(r,t,e,i){var s=r;do s.z===0&&(s.z=yp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,pI(s)}function pI(r){var t,e,i,s,o,n,a,h,l=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,h--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,l*=2}while(n>1);return r}function yp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function mI(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function no(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function gI(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!xI(r,t)&&(Zn(r,t)&&Zn(t,r)&&yI(r,t)&&(Wt(r.prev,r,t.prev)||Wt(r,t.prev,t))||cc(r,t)&&Wt(r.prev,r,r.next)>0&&Wt(t.prev,t,t.next)>0)}function Wt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function cc(r,t){return r.x===t.x&&r.y===t.y}function Kv(r,t,e,i){var s=hc(Wt(r,t,e)),o=hc(Wt(r,t,i)),n=hc(Wt(e,i,r)),a=hc(Wt(e,i,t));return!!(s!==o&&n!==a||s===0&&ac(r,e,t)||o===0&&ac(r,i,t)||n===0&&ac(e,r,i)||a===0&&ac(e,t,i))}function ac(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function hc(r){return r>0?1:r<0?-1:0}function xI(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Kv(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Zn(r,t){return Wt(r.prev,r,r.next)<0?Wt(r,t,r.next)>=0&&Wt(r,r.prev,t)>=0:Wt(r,t,r.prev)<0||Wt(r,r.next,t)<0}function yI(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.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&&(i=!i),e=e.next;while(e!==r);return i}function Zv(r,t){var e=new _p(r.i,r.x,r.y),i=new _p(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Yv(r,t,e,i){var s=new _p(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Qn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _p(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}lc.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(bp(r,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:r.length;n-=Math.abs(bp(r,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function bp(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}lc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function dc(r,t,e,i,s,o,n){let a=(0,Qv.default)(r,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*i;for(let l=0;l<r.length;l+=2)e[h]=r[l],e[h+1]=r[l+1],h+=i}var Qv,Tp=x(()=>{Qv=$i(uc(),1)});var _I,Jv,t0=x(()=>{C();Tp();_I=[],Jv={extension:{type:v.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){dc(r,_I,t,e,i,s,o)}}});var e0,r0=x(()=>{C();e0={extension:{type:v.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/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 i0,s0=x(()=>{C();i0={extension:{type:v.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function n0(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function a0(r,t){let e=z.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function bI(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&(W("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??ze.defaultLinearOptions.textureSize}),t}var o0,Ep,ze,ao=x(()=>{ye();Rt();ft();js();_t();be();Ht();mf();o0=[{offset:0,color:"white"},{offset:1,color:"black"}],Ep=class Sp{constructor(...t){this.uid=at("fillGradient"),this.type="linear",this.colorStops=[];let e=bI(t);e={...e.type==="radial"?Sp.defaultRadialOptions:Sp.defaultLinearOptions,...Il(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:rt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=i,i=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let h=this.colorStops.length?this.colorStops:o0,l=this._textureSize,{canvas:c,context:u}=a0(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);n0(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new A({source:new Ve({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new I;m.scale(f/l,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(l,l),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:o0,e=this._textureSize,{canvas:i,context:s}=a0(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,m=(n-d)*f,g=s.createRadialGradient(p,m,l*f,(a-u)*f,(h-d)*f,c*f);n0(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new A({source:new Ve({resource:i,addressMode:this._wrapMode})});let b=new I;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}};Ep.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Ep.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ze=Ep});function h0(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(TI);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,m=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*g+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 ze)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(vI.copyFrom(i).invert()),s}var vI,TI,l0=x(()=>{ft();fe();ao();vI=new I,TI=new st});function u0(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")wI(o.data,i,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&&c0(l.shapePath,h,!0,i,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),c0(a,h,n,i,e)}}}function wI(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,h=[],l=fc.rectangle,c=SI,u=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;let d=r.transform;l.build(c,h),d&&gp(h,d),l.triangulate(h,i,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=J.get(ns);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=u,p.geometryData=e,t.push(p)}function c0(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=fc[h.type],m="triangle-list";if(p.build(h,f),l&&gp(f,l),e){let _=h.closePath??!0,T=t;T.pixelLine?(Xv(f,_,o,a),m="line-list"):zv(f,T,!1,_,o,a)}else if(c){let _=[],T=f.slice();AI(c).forEach(S=>{_.push(T.length/2),T.push(...S)}),dc(T,_,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let g=n.length/2,b=t.texture;if(b!==A.WHITE){let _=h0(EI,t,h,l);kv(o,2,d,n,g,2,o.length/2-d,_)}else Gv(n,g,2,o.length/2-d);let y=J.get(ns);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=m,i.push(y)})}function AI(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];fc[i.type].build(i,s),t.push(s)}return t}var fc,SI,EI,d0=x(()=>{C();ft();fe();Uv();Ov();_t();Me();xp();Nv();$v();jv();t0();r0();s0();l0();Tp();fc={};k.handleByMap(v.ShapeBuilder,fc);k.add(e0,Jv,i0,oo,Lv,Dv);SI=new st,EI=new I});var wp,Ap,Cp,ho,pc=x(()=>{C();Jl();mp();ff();Ht();Me();d0();wp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ap=class{constructor(){this.batcher=new qn,this.instructions=new Ds}init(){this.instructions.reset()}get geometry(){return W(Fy,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Cp=class Pp{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Pp.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Pp.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),u0(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="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=J.get(Ap),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<i.length;c++){let u=i[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=Ks(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wp;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]&&(J.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{J.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Cp.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"graphicsContext"};Cp.defaultOptions={bezierSmoothness:.5};ho=Cp});var PI,Rp,Mp,Bp,Ip,Fp,kp,Gp,Yt,Tr=x(()=>{"use strict";PI={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},Rp=0,Mp=1,Bp=2,Ip=3,Fp=4,kp=5,Gp=class f0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Rp)}set blend(t){!!(this.data&1<<Rp)!==t&&(this.data^=1<<Rp)}get offsets(){return!!(this.data&1<<Mp)}set offsets(t){!!(this.data&1<<Mp)!==t&&(this.data^=1<<Mp)}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<<Bp)}set culling(t){!!(this.data&1<<Bp)!==t&&(this.data^=1<<Bp)}get depthTest(){return!!(this.data&1<<Ip)}set depthTest(t){!!(this.data&1<<Ip)!==t&&(this.data^=1<<Ip)}get depthMask(){return!!(this.data&1<<kp)}set depthMask(t){!!(this.data&1<<kp)!==t&&(this.data^=1<<kp)}get clockwiseFrontFace(){return!!(this.data&1<<Fp)}set clockwiseFrontFace(t){!!(this.data&1<<Fp)!==t&&(this.data^=1<<Fp)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=PI[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 f0;return t.depthTest=!1,t.blend=!0,t}};Gp.default2d=Gp.for2d();Yt=Gp});function Nr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var lo=x(()=>{"use strict"});var Jn,p0=x(()=>{C();Tr();Me();lo();xp();Jn=class{constructor(t,e){this.state=Yt.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,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let s=e[i];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,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.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,Nr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=J.get(ns);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=>{J.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}};Jn.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"graphics"}});var Up=x(()=>{C();pc();p0();k.add(Jn);k.add(ho)});var Ii,mc=x(()=>{"use strict";Ii=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"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,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 ta,m0=x(()=>{C();ft();Pi();Fe();zn();Me();lo();mc();ta=class{constructor(t,e){this.localUniforms=new At({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new me({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),i=e.batched,s=t.batched;if(e.batched=s,i!==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 i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.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&&(J.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=si(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Nr(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=J.get(Ii);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]&&J.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}};ta.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"mesh"}});var Op=x(()=>{C();m0();k.add(ta)});var gc,g0=x(()=>{"use strict";gc=class{execute(t,e){let i=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(i),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 Lp(r,t=null){let e=r*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 i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var x0=x(()=>{"use strict"});function _0(r){return{dynamicUpdate:y0(r,!0),staticUpdate:y0(r,!1)}}function y0(r,t){let e=[];e.push(`
253
+ `}}});var pp,Sv,Ev=x(()=>{"use strict";pp=["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>"],Sv=pp.reduce((r,t)=>(r[t]=!0,r),{})});function wv(r,t){switch(r){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 Av=x(()=>{"use strict"});var Pv,At,Fe=x(()=>{be();Xn();Ev();Av();Pv=class Cv{constructor(t,e){this._touched=0,this.uid=at("uniform"),this._resourceType="uniformGroup",this._resourceId=at("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Cv.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Sv[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${pp.join(", ")}`);o.value??(o.value=wv(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ni(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Pv.defaultOptions={ubo:!1,isStatic:!1};At=Pv});function so(r){let t=Rv[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=Rv[r]=new At({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var Rv,oc=x(()=>{Fe();Rv={}});var ee,Dr=x(()=>{"use strict";ee=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(ee||{})});var Xt,vr=x(()=>{Ee();be();ss();Pi();Js();Dr();Fe();Xt=class r extends Ct{constructor(t){super(),this.uid=at("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=ee.WEBGPU),i&&(n|=ee.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 me,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 At(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new me,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,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new me,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}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:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=ar.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var nc,Mv=x(()=>{Mi();jn();Yn();Bi();oc();vr();nc=class extends Xt{constructor(t){let e=Ur({name:"batch",bits:[eo,io(t),Lr]}),i=Gr({name:"batch",bits:[to,ro(t),Or]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:so(t)}})}}});var Bv,Iv,qn,mp=x(()=>{P();Ab();Mb();Mv();Bv=null,Iv=class Fv extends wb{constructor(){super(...arguments),this.geometry=new rc,this.shader=Bv||(Bv=new nc(this.maxTextures)),this.name=Fv.extension.name,this.vertexSize=6}packAttributes(t,e,i,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:m}=t,g=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let _=b;_<y;_++){let T=_*2,E=p[T],S=p[T+1];e[s++]=h*E+c*S+d,e[s++]=u*S+l*E+f,e[s++]=m[T],e[s++]=m[T+1],i[s++]=g,i[s++]=n}}packQuadAttributes(t,e,i,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,m=p.maxX,g=p.minX,b=p.maxY,y=p.minY,_=n.uvs,T=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=h*g+c*y+d,e[s+1]=u*y+l*g+f,e[s+2]=_.x0,e[s+3]=_.y0,i[s+4]=T,i[s+5]=E,e[s+6]=h*m+c*y+d,e[s+7]=u*y+l*m+f,e[s+8]=_.x1,e[s+9]=_.y1,i[s+10]=T,i[s+11]=E,e[s+12]=h*m+c*b+d,e[s+13]=u*b+l*m+f,e[s+14]=_.x2,e[s+15]=_.y2,i[s+16]=T,i[s+17]=E,e[s+18]=h*g+c*b+d,e[s+19]=u*b+l*g+f,e[s+20]=_.x3,e[s+21]=_.y3,i[s+22]=T,i[s+23]=E}};Iv.extension={type:[v.Batcher],name:"default"};qn=Iv});function kv(r,t,e,i,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 m=r[e],g=r[e+1];i[s]=l*m+u*g+f,i[s+1]=c*m+d*g+p,s+=o,e+=t,h++}}function Gv(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var Uv=x(()=>{"use strict"});function gp(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],p=r[u+1];r[u]=o*f+a*p+l,r[u+1]=n*f+h*p+c,u+=i}}var Ov=x(()=>{"use strict"});var eI,ns,xp=x(()=>{ft();lf();eI=new I,ns=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,i=this.renderable;return i?Ml(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||eI}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 oo,Lv,Dv,Nv=x(()=>{P();oo={extension:{type:v.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let T=r;e=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;e=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,E=T.width/2,S=T.height/2;e=T.x+E,i=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(E,S))),s=E-n,o=S-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]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,m=o,g=e+p,b=e-p,y=i+m;if(t[c++]=g,t[c++]=y,t[--u]=y,t[--u]=b,o){let T=i-m;t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<h;T++){let E=Math.PI/2*(T/h),S=s+Math.cos(E)*n,w=o+Math.sin(E)*a,M=e+S,C=e-S,R=i+w,B=i-w;t[c++]=M,t[c++]=R,t[--u]=R,t[--u]=C,t[d++]=C,t[d++]=B,t[--f]=B,t[--f]=M}p=s,m=o+a,g=e+p,b=e-p,y=i+m;let _=i-m;return t[c++]=g,t[c++]=y,t[--f]=_,t[--f]=g,s&&(t[c++]=b,t[c++]=y,t[--f]=_,t[--f]=b),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let c=0;c<r.length;c+=2)n+=r[c],a+=r[c+1];n/=r.length/2,a/=r.length/2;let h=i;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<r.length;c+=2)t[h*e]=r[c],t[h*e+1]=r[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}},Lv={...oo,extension:{...oo.extension,name:"ellipse"}},Dv={...oo,extension:{...oo.extension,name:"roundedRectangle"}}});function Hv(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Vv=x(()=>{"use strict"});function Wv(r,t,e,i,s,o,n,a){let h=r-e*s,l=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let p=h+d,m=l+f,g=c+d,b=u+f;return a.push(p,m),a.push(g,b),2}function as(r,t,e,i,s,o,n,a){let h=e-r,l=i-t,c=Math.atan2(h,l),u=Math.atan2(s-r,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),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,b=f/g;if(d+=b,a){n.push(r,t),n.push(e,i);for(let y=1,_=d;y<g;y++,_+=b)n.push(r,t),n.push(r+Math.sin(_)*m,t+Math.cos(_)*m);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let y=1,_=d;y<g;y++,_+=b)n.push(r+Math.sin(_)*m,t+Math.cos(_)*m),n.push(r,t);n.push(s,o),n.push(r,t)}return g*2}function zv(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let U=Hv(r);e&&(U*=-1),h=(h-.5)*U+.5}let l=new ht(r[0],r[1]),c=new ht(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));let U=(l.x+c.x)*.5,Q=(c.y+l.y)*.5;r.unshift(U,Q),r.push(U,Q)}let f=s,p=r.length/2,m=r.length,g=f.length/2,b=a.width/2,y=b*b,_=a.miterLimit*a.miterLimit,T=r[0],E=r[1],S=r[2],w=r[3],M=0,C=0,R=-(E-w),B=T-S,F=0,j=0,W=Math.sqrt(R*R+B*B);R/=W,B/=W,R*=b,B*=b;let st=h,L=(1-st)*2,H=st*2;u||(a.cap==="round"?m+=as(T-R*(L-H)*.5,E-B*(L-H)*.5,T-R*L,E-B*L,T+R*H,E+B*H,f,!0)+2:a.cap==="square"&&(m+=Wv(T,E,R,B,L,H,!0,f))),f.push(T-R*L,E-B*L),f.push(T+R*H,E+B*H);for(let U=1;U<p-1;++U){T=r[(U-1)*2],E=r[(U-1)*2+1],S=r[U*2],w=r[U*2+1],M=r[(U+1)*2],C=r[(U+1)*2+1],R=-(E-w),B=T-S,W=Math.sqrt(R*R+B*B),R/=W,B/=W,R*=b,B*=b,F=-(w-C),j=S-M,W=Math.sqrt(F*F+j*j),F/=W,j/=W,F*=b,j*=b;let Q=S-T,vt=E-w,gt=S-M,Dt=C-w,Nt=Q*gt+vt*Dt,Zt=vt*gt-Dt*Q,oe=Zt<0;if(Math.abs(Zt)<.001*Math.abs(Nt)){f.push(S-R*L,w-B*L),f.push(S+R*H,w+B*H),Nt>=0&&(a.join==="round"?m+=as(S,w,S-R*L,w-B*L,S-F*L,w-j*L,f,!1)+4:m+=2,f.push(S-F*H,w-j*H),f.push(S+F*L,w+j*L));continue}let Te=(-R+T)*(-B+w)-(-R+S)*(-B+E),St=(-F+M)*(-j+w)-(-F+S)*(-j+C),ut=(Q*St-gt*Te)/Zt,yt=(Dt*Te-vt*St)/Zt,Ft=(ut-S)*(ut-S)+(yt-w)*(yt-w),Qt=S+(ut-S)*L,Jt=w+(yt-w)*L,De=S-(ut-S)*H,zi=w-(yt-w)*H,YM=Math.min(Q*Q+vt*vt,gt*gt+Dt*Dt),dy=oe?L:H,qM=YM+dy*dy*y;Ft<=qM?a.join==="bevel"||Ft/y>_?(oe?(f.push(Qt,Jt),f.push(S+R*H,w+B*H),f.push(Qt,Jt),f.push(S+F*H,w+j*H)):(f.push(S-R*L,w-B*L),f.push(De,zi),f.push(S-F*L,w-j*L),f.push(De,zi)),m+=2):a.join==="round"?oe?(f.push(Qt,Jt),f.push(S+R*H,w+B*H),m+=as(S,w,S+R*H,w+B*H,S+F*H,w+j*H,f,!0)+4,f.push(Qt,Jt),f.push(S+F*H,w+j*H)):(f.push(S-R*L,w-B*L),f.push(De,zi),m+=as(S,w,S-R*L,w-B*L,S-F*L,w-j*L,f,!1)+4,f.push(S-F*L,w-j*L),f.push(De,zi)):(f.push(Qt,Jt),f.push(De,zi)):(f.push(S-R*L,w-B*L),f.push(S+R*H,w+B*H),a.join==="round"?oe?m+=as(S,w,S+R*H,w+B*H,S+F*H,w+j*H,f,!0)+2:m+=as(S,w,S-R*L,w-B*L,S-F*L,w-j*L,f,!1)+2:a.join==="miter"&&Ft/y<=_&&(oe?(f.push(De,zi),f.push(De,zi)):(f.push(Qt,Jt),f.push(Qt,Jt)),m+=2),f.push(S-F*L,w-j*L),f.push(S+F*H,w+j*H),m+=2)}T=r[(p-2)*2],E=r[(p-2)*2+1],S=r[(p-1)*2],w=r[(p-1)*2+1],R=-(E-w),B=T-S,W=Math.sqrt(R*R+B*B),R/=W,B/=W,R*=b,B*=b,f.push(S-R*L,w-B*L),f.push(S+R*H,w+B*H),u||(a.cap==="round"?m+=as(S-R*(L-H)*.5,w-B*(L-H)*.5,S-R*L,w-B*L,S+R*H,w+B*H,f,!1)+2:a.cap==="square"&&(m+=Wv(S,w,R,B,L,H,!1,f)));let N=1e-4*1e-4;for(let U=g;U<m+g-2;++U)T=f[U*2],E=f[U*2+1],S=f[(U+1)*2],w=f[(U+1)*2+1],M=f[(U+2)*2],C=f[(U+2)*2+1],!(Math.abs(T*(w-C)+S*(C-E)+M*(E-w))<N)&&o.push(U,U+1,U+2)}var $v=x(()=>{sr();Vv()});function Xv(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],h=r[r.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=r.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);l&&i.push(d+u-1,d)}var jv=x(()=>{});var uc=K((DW,vp)=>{"use strict";vp.exports=lc;vp.exports.default=lc;function lc(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=qv(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(i&&(o=hI(r,t,o,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[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 Kn(o,n,e,a,h,f,0),n}function qv(r,t,e,i,s){var o,n;if(s===bp(r,t,e,i)>0)for(o=t;o<e;o+=i)n=Yv(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=Yv(o,r[o],r[o+1],n);return n&&cc(n,n.next)&&(Qn(n),n=n.next),n}function hs(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(cc(e,e.next)||Wt(e.prev,e,e.next)===0)){if(Qn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Kn(r,t,e,i,s,o,n){if(r){!n&&o&&fI(r,i,s,o);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,o?oI(r,i,s,o):sI(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Qn(r),r=l.next,a=l.next;continue}if(r=l,r===a){n?n===1?(r=nI(hs(r),t,e),Kn(r,t,e,i,s,o,2)):n===2&&aI(r,t,e,i,s,o):Kn(hs(r),t,e,i,s,o,1);break}}}}function sI(r){var t=r.prev,e=r,i=r.next;if(Wt(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,h=e.y,l=i.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=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&no(s,a,o,h,n,l,p.x,p.y)&&Wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function oI(r,t,e,i){var s=r.prev,o=r,n=r.next;if(Wt(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,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,b=yp(f,p,t,e,i),y=yp(m,g,t,e,i),_=r.prevZ,T=r.nextZ;_&&_.z>=b&&T&&T.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==n&&no(a,c,h,u,l,d,_.x,_.y)&&Wt(_.prev,_,_.next)>=0||(_=_.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&no(a,c,h,u,l,d,T.x,T.y)&&Wt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;_&&_.z>=b;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==n&&no(a,c,h,u,l,d,_.x,_.y)&&Wt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;T&&T.z<=y;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&no(a,c,h,u,l,d,T.x,T.y)&&Wt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function nI(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!cc(s,o)&&Kv(s,i,i.next,o)&&Zn(s,o)&&Zn(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),Qn(i),Qn(i.next),i=r=o),i=i.next}while(i!==r);return hs(i)}function aI(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&gI(n,a)){var h=Zv(n,a);n=hs(n,n.next),h=hs(h,h.next),Kn(n,t,e,i,s,o,0),Kn(h,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function hI(r,t,e,i){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*i,h=o<n-1?t[o+1]*i:r.length,l=qv(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(mI(l));for(s.sort(lI),o=0;o<s.length;o++)e=cI(s[o],e);return e}function lI(r,t){return r.x-t.x}function cI(r,t){var e=uI(r,t);if(!e)return t;var i=Zv(e,r);return hs(i,i.next),hs(e,e.next)}function uI(r,t){var e=t,i=r.x,s=r.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<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))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 i>=e.x&&e.x>=l&&i!==e.x&&no(s<c?i:o,s,l,c,s<c?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Zn(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&dI(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function dI(r,t){return Wt(r.prev,r,t.prev)<0&&Wt(t.next,r,r.next)<0}function fI(r,t,e,i){var s=r;do s.z===0&&(s.z=yp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,pI(s)}function pI(r){var t,e,i,s,o,n,a,h,l=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,h--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,l*=2}while(n>1);return r}function yp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function mI(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function no(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function gI(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!xI(r,t)&&(Zn(r,t)&&Zn(t,r)&&yI(r,t)&&(Wt(r.prev,r,t.prev)||Wt(r,t.prev,t))||cc(r,t)&&Wt(r.prev,r,r.next)>0&&Wt(t.prev,t,t.next)>0)}function Wt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function cc(r,t){return r.x===t.x&&r.y===t.y}function Kv(r,t,e,i){var s=hc(Wt(r,t,e)),o=hc(Wt(r,t,i)),n=hc(Wt(e,i,r)),a=hc(Wt(e,i,t));return!!(s!==o&&n!==a||s===0&&ac(r,e,t)||o===0&&ac(r,i,t)||n===0&&ac(e,r,i)||a===0&&ac(e,t,i))}function ac(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function hc(r){return r>0?1:r<0?-1:0}function xI(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Kv(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Zn(r,t){return Wt(r.prev,r,r.next)<0?Wt(r,t,r.next)>=0&&Wt(r,r.prev,t)>=0:Wt(r,t,r.prev)<0||Wt(r,r.next,t)<0}function yI(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.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&&(i=!i),e=e.next;while(e!==r);return i}function Zv(r,t){var e=new _p(r.i,r.x,r.y),i=new _p(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Yv(r,t,e,i){var s=new _p(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Qn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _p(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}lc.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(bp(r,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:r.length;n-=Math.abs(bp(r,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function bp(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}lc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function dc(r,t,e,i,s,o,n){let a=(0,Qv.default)(r,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*i;for(let l=0;l<r.length;l+=2)e[h]=r[l],e[h+1]=r[l+1],h+=i}var Qv,Tp=x(()=>{Qv=$i(uc(),1)});var _I,Jv,t0=x(()=>{P();Tp();_I=[],Jv={extension:{type:v.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){dc(r,_I,t,e,i,s,o)}}});var e0,r0=x(()=>{P();e0={extension:{type:v.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/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 i0,s0=x(()=>{P();i0={extension:{type:v.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function n0(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function a0(r,t){let e=$.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function bI(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&(z("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??ze.defaultLinearOptions.textureSize}),t}var o0,Ep,ze,ao=x(()=>{ye();Rt();ft();js();_t();be();Ht();mf();o0=[{offset:0,color:"white"},{offset:1,color:"black"}],Ep=class Sp{constructor(...t){this.uid=at("fillGradient"),this.type="linear",this.colorStops=[];let e=bI(t);e={...e.type==="radial"?Sp.defaultRadialOptions:Sp.defaultLinearOptions,...Il(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:rt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=i,i=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let h=this.colorStops.length?this.colorStops:o0,l=this._textureSize,{canvas:c,context:u}=a0(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);n0(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new A({source:new Ve({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new I;m.scale(f/l,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(l,l),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:o0,e=this._textureSize,{canvas:i,context:s}=a0(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,m=(n-d)*f,g=s.createRadialGradient(p,m,l*f,(a-u)*f,(h-d)*f,c*f);n0(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new A({source:new Ve({resource:i,addressMode:this._wrapMode})});let b=new I;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}};Ep.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Ep.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ze=Ep});function h0(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(TI);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,m=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*g+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 ze)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(vI.copyFrom(i).invert()),s}var vI,TI,l0=x(()=>{ft();fe();ao();vI=new I,TI=new ot});function u0(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")wI(o.data,i,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&&c0(l.shapePath,h,!0,i,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),c0(a,h,n,i,e)}}}function wI(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,h=[],l=fc.rectangle,c=SI,u=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;let d=r.transform;l.build(c,h),d&&gp(h,d),l.triangulate(h,i,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=tt.get(ns);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=u,p.geometryData=e,t.push(p)}function c0(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=fc[h.type],m="triangle-list";if(p.build(h,f),l&&gp(f,l),e){let _=h.closePath??!0,T=t;T.pixelLine?(Xv(f,_,o,a),m="line-list"):zv(f,T,!1,_,o,a)}else if(c){let _=[],T=f.slice();AI(c).forEach(S=>{_.push(T.length/2),T.push(...S)}),dc(T,_,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let g=n.length/2,b=t.texture;if(b!==A.WHITE){let _=h0(EI,t,h,l);kv(o,2,d,n,g,2,o.length/2-d,_)}else Gv(n,g,2,o.length/2-d);let y=tt.get(ns);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=m,i.push(y)})}function AI(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];fc[i.type].build(i,s),t.push(s)}return t}var fc,SI,EI,d0=x(()=>{P();ft();fe();Uv();Ov();_t();Me();xp();Nv();$v();jv();t0();r0();s0();l0();Tp();fc={};k.handleByMap(v.ShapeBuilder,fc);k.add(e0,Jv,i0,oo,Lv,Dv);SI=new ot,EI=new I});var wp,Ap,Cp,ho,pc=x(()=>{P();Jl();mp();ff();Ht();Me();d0();wp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ap=class{constructor(){this.batcher=new qn,this.instructions=new Ds}init(){this.instructions.reset()}get geometry(){return z(Fy,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Cp=class Pp{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Pp.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Pp.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),u0(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="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=tt.get(Ap),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<i.length;c++){let u=i[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=Ks(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wp;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]&&(tt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{tt.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Cp.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"graphicsContext"};Cp.defaultOptions={bezierSmoothness:.5};ho=Cp});var PI,Rp,Mp,Bp,Ip,Fp,kp,Gp,Yt,Tr=x(()=>{"use strict";PI={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},Rp=0,Mp=1,Bp=2,Ip=3,Fp=4,kp=5,Gp=class f0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Rp)}set blend(t){!!(this.data&1<<Rp)!==t&&(this.data^=1<<Rp)}get offsets(){return!!(this.data&1<<Mp)}set offsets(t){!!(this.data&1<<Mp)!==t&&(this.data^=1<<Mp)}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<<Bp)}set culling(t){!!(this.data&1<<Bp)!==t&&(this.data^=1<<Bp)}get depthTest(){return!!(this.data&1<<Ip)}set depthTest(t){!!(this.data&1<<Ip)!==t&&(this.data^=1<<Ip)}get depthMask(){return!!(this.data&1<<kp)}set depthMask(t){!!(this.data&1<<kp)!==t&&(this.data^=1<<kp)}get clockwiseFrontFace(){return!!(this.data&1<<Fp)}set clockwiseFrontFace(t){!!(this.data&1<<Fp)!==t&&(this.data^=1<<Fp)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=PI[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 f0;return t.depthTest=!1,t.blend=!0,t}};Gp.default2d=Gp.for2d();Yt=Gp});function Nr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var lo=x(()=>{"use strict"});var Jn,p0=x(()=>{P();Tr();Me();lo();xp();Jn=class{constructor(t,e){this.state=Yt.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,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let s=e[i];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,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.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,Nr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=tt.get(ns);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=>{tt.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}};Jn.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"graphics"}});var Up=x(()=>{P();pc();p0();k.add(Jn);k.add(ho)});var Ii,mc=x(()=>{"use strict";Ii=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"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,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 ta,m0=x(()=>{P();ft();Pi();Fe();zn();Me();lo();mc();ta=class{constructor(t,e){this.localUniforms=new At({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new me({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),i=e.batched,s=t.batched;if(e.batched=s,i!==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 i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.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&&(tt.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=si(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Nr(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=tt.get(Ii);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]&&tt.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}};ta.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"mesh"}});var Op=x(()=>{P();m0();k.add(ta)});var gc,g0=x(()=>{"use strict";gc=class{execute(t,e){let i=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(i),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 Lp(r,t=null){let e=r*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 i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var x0=x(()=>{"use strict"});function _0(r){return{dynamicUpdate:y0(r,!0),staticUpdate:y0(r,!1)}}function y0(r,t){let e=[];e.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -264,7 +264,7 @@ ${s.join(`
264
264
  `),e.unshift(`
265
265
  var stride = ${i};
266
266
  `);let s=e.join(`
267
- `);return new Function("ps","f32v","u32v",s)}var b0=x(()=>{os()});function CI(r){let t=[];for(let e in r){let i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var xc,v0=x(()=>{Ci();oi();Zs();os();Zf();x0();b0();xc=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,i=t.properties,s=0,o=0;for(let c in i){let u=i[c],d=We(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new kr(e*4*s),this.dynamicAttributeBuffer=new kr(e*4*o),this.indexBuffer=Lp(e);let n=new nr,a=0,h=0;this._staticBuffer=new $t({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ot.VERTEX|ot.COPY_DST}),this._dynamicBuffer=new $t({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ot.VERTEX|ot.COPY_DST});for(let c in i){let u=i[c],d=We(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(i);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=CI(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return _0(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new kr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new kr(this._size*this._dynamicStride*4*4),this.indexBuffer=Lp(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.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 T0,S0=x(()=>{T0=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var b0=x(()=>{os()});function CI(r){let t=[];for(let e in r){let i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var xc,v0=x(()=>{Ci();oi();Zs();os();Zf();x0();b0();xc=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,i=t.properties,s=0,o=0;for(let c in i){let u=i[c],d=We(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new kr(e*4*s),this.dynamicAttributeBuffer=new kr(e*4*o),this.indexBuffer=Lp(e);let n=new nr,a=0,h=0;this._staticBuffer=new $t({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:nt.VERTEX|nt.COPY_DST}),this._dynamicBuffer=new $t({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:nt.VERTEX|nt.COPY_DST});for(let c in i){let u=i[c],d=We(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(i);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=CI(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return _0(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new kr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new kr(this._size*this._dynamicStride*4*4),this.indexBuffer=Lp(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.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 T0,S0=x(()=>{T0=`varying vec2 vUV;
268
268
  varying vec4 vColor;
269
269
 
270
270
  uniform sampler2D uTexture;
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`});var yc,P0=x(()=>{ye();ft();ss();Js();vr();_t();gf();S0();w0();A0();yc=class extends Xt{constructor(){let t=ar.from({vertex:E0,fragment:T0}),e=hr.from({fragment:{source:Dp,entryPoint:"mainFragment"},vertex:{source:Dp,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:A.WHITE.source,uSampler:new Fl({}),uniforms:{uTranslationMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new rt(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var co,Np=x(()=>{ft();Fe();zn();Tr();lo();v0();P0();co=class{constructor(t,e){this.state=Yt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new At({uTranslationMatrix:{value:new I,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 yc,this.state=Yt.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 xc({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 i=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=si(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var ea,C0=x(()=>{C();g0();Np();ea=class extends co{constructor(t){super(t,new gc)}};ea.extension={type:[v.WebGLPipes],name:"particle"}});var _c,R0=x(()=>{"use strict";_c=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var ra,M0=x(()=>{C();R0();Np();ra=class extends co{constructor(t){super(t,new _c)}};ra.extension={type:[v.WebGPUPipes],name:"particle"}});var Hp=x(()=>{C();C0();M0();k.add(ea);k.add(ra)});var Hr,ia=x(()=>{"use strict";Hr=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 sa(r,t){let{texture:e,bounds:i}=r;$l(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Vp=x(()=>{Nf()});var oa,B0=x(()=>{C();Me();ia();Vp();oa=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,sa(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:J.get(Hr)};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}};oa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"text"}});var Wp,$e,uo=x(()=>{Rt();Cn();Wp=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=z.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ti(t),e=ti(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:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},$e=new Wp});function I0(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function F0(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function k0(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,h=0,l=e-1,c=i-1;for(;h<i&&I0(n,e,h);)++h;if(h===i)return st.EMPTY;for(;I0(n,e,c);)--c;for(;F0(n,e,a,h,c);)++a;for(;F0(n,e,l,h,c);)--l;return++l,++c,new st(a/t,h/t,(l-a)/t,(c-h)/t)}var G0=x(()=>{fe()});var U0,ai,bc=x(()=>{ft();be();U0={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"}},ai=class{constructor(t,e){this.uid=at("fillPattern"),this.transform=new I,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=U0[e].addressModeU,t.source.style.addressModeV=U0[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 L0=K((l$,O0)=>{O0.exports=MI;var zp={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},RI=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function MI(r){var t=[];return r.replace(RI,function(e,i,s){var o=i.toLowerCase();for(s=II(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==zp[o])return s.unshift(i),t.push(s);if(s.length<zp[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,zp[o])))}}),t}var BI=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function II(r){var t=r.match(BI);return t?t.map(Number):[]}});function N0(r,t){let e=(0,D0.default)(r),i=[],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(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:O(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var D0,H0=x(()=>{D0=$i(L0(),1);wt()});var vc,V0=x(()=>{fe();vc=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*i,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(i-h)}getBounds(t){return t||(t=new st),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 Tc,W0=x(()=>{fe();Tc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),h=i-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(l*l)+p*p/(c*c),g=f*f/(u*u)+p*p/(d*d);return m>1&&g<=1}getBounds(t){return t||(t=new st),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 z0(r,t,e,i,s,o){let n=r-e,a=t-i,h=s-e,l=o-i,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=i):d>1?(f=s,p=o):(f=e+d*h,p=i+d*l);let m=r-f,g=t-p;return m*m+g*g}var $0=x(()=>{"use strict"});var FI,kI,fo,X0=x(()=>{$0();fe();fo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],h=e[(s+3)%i];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(FI),i=t.getBounds(kI);if(!e.containsRect(i))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 r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!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&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,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],m=z0(t,e,u,d,f,p),g=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new st);let e=this.points,i=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];i=l<i?l:i,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=i,t.width=s-i,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 Sc,Ec,j0=x(()=>{fe();Sc=(r,t,e,i,s,o,n)=>{let a=r-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},Ec=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new st),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=i*(1-s),u=i-c,d=o+l,f=n+l,p=a-l*2,m=h-l*2,g=o+a,b=n+h;return(t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=b-u&&e<=b+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&Sc(t,e,d,f,l,u,c)||t>g-l&&e<f&&Sc(t,e,g-l,f,l,u,c)||t>g-l&&e>b-l&&Sc(t,e,g-l,b-l,l,u,c)||t<d&&e>b-l&&Sc(t,e,d,b-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 Ac(r,t,e,i,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??ho.defaultOptions.bezierSmoothness)),d=(UI-u)/1;return d*=d,OI(t,e,i,s,o,n,a,h,r,d),r}function OI(r,t,e,i,s,o,n,a,h,l){Xp(r,t,e,i,s,o,n,a,h,l,0),h.push(n,a)}function Xp(r,t,e,i,s,o,n,a,h,l,c){if(c>GI)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,p=(e+s)/2,m=(i+o)/2,g=(s+n)/2,b=(o+a)/2,y=(d+p)/2,_=(f+m)/2,T=(p+g)/2,E=(m+b)/2,S=(y+T)/2,w=(_+E)/2;if(c>0){let M=n-r,P=a-t,R=Math.abs((e-n)*P-(i-a)*M),B=Math.abs((s-n)*P-(o-a)*M),F,X;if(R>wc&&B>wc){if((R+B)*(R+B)<=l*(M*M+P*P)){if(po<$p){h.push(S,w);return}let L=Math.atan2(o-i,s-e);if(F=Math.abs(L-Math.atan2(i-t,e-r)),X=Math.abs(Math.atan2(a-o,n-s)-L),F>=u&&(F=2*u-F),X>=u&&(X=2*u-X),F+X<po){h.push(S,w);return}if(ls!==0){if(F>ls){h.push(e,i);return}if(X>ls){h.push(s,o);return}}}}else if(R>wc){if(R*R<=l*(M*M+P*P)){if(po<$p){h.push(S,w);return}if(F=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),F>=u&&(F=2*u-F),F<po){h.push(e,i),h.push(s,o);return}if(ls!==0&&F>ls){h.push(e,i);return}}}else if(B>wc){if(B*B<=l*(M*M+P*P)){if(po<$p){h.push(S,w);return}if(F=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),F>=u&&(F=2*u-F),F<po){h.push(e,i),h.push(s,o);return}if(ls!==0&&F>ls){h.push(s,o);return}}}else if(M=S-(r+n)/2,P=w-(t+a)/2,M*M+P*P<=l){h.push(S,w);return}}Xp(r,t,d,f,y,_,S,w,h,l,c+1),Xp(S,w,T,E,g,b,n,a,h,l,c+1)}var GI,wc,UI,$p,po,ls,jp=x(()=>{pc();GI=8,wc=11920929e-14,UI=1,$p=.01,po=0,ls=0});function q0(r,t,e,i,s,o,n,a){let l=Math.min(.99,Math.max(0,a??ho.defaultOptions.bezierSmoothness)),c=(NI-l)/1;return c*=c,VI(t,e,i,s,o,n,r,c),r}function VI(r,t,e,i,s,o,n,a){Yp(n,r,t,e,i,s,o,a,0),n.push(s,o)}function Yp(r,t,e,i,s,o,n,a,h){if(h>LI)return;let l=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,p=(c+d)/2,m=(u+f)/2,g=o-t,b=n-e,y=Math.abs((i-o)*b-(s-n)*g);if(y>DI){if(y*y<=a*(g*g+b*b)){if(Y0<HI){r.push(p,m);return}let _=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(_>=l&&(_=2*l-_),_<Y0){r.push(p,m);return}}}else if(g=p-(t+o)/2,b=m-(e+n)/2,g*g+b*b<=a){r.push(p,m);return}Yp(r,t,e,c,u,p,m,a,h+1),Yp(r,p,m,d,f,o,n,a,h+1)}var LI,DI,NI,HI,Y0,K0=x(()=>{pc();LI=8,DI=11920929e-14,NI=1,HI=.01,Y0=0});function Pc(r,t,e,i,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(i,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*i,m=e+f*i;r.push(p,m),c+=l}}var qp=x(()=>{"use strict"});function Z0(r,t,e,i,s,o){let n=r[r.length-2],h=r[r.length-1]-e,l=n-t,c=s-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,g=o*Math.sqrt(f)/d,b=o*Math.sqrt(p)/d,y=g*m/f,_=b*m/p,T=g*u+b*l,E=g*c+b*h,S=l*(b+y),w=h*(b+y),M=u*(g+_),P=c*(g+_),R=Math.atan2(w-E,S-T),B=Math.atan2(P-E,M-T);Pc(r,T+t,E+e,o,R,B,l*c>u*h)}var Q0=x(()=>{qp()});function WI(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function tT(r,t,e,i,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*na/360),u=Math.cos(a*na/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/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)),zI(t,e,i,s,o,n,h,l,c,u,d,f,Kp);let{ang1:m,ang2:g}=Kp,{centerX:b,centerY:y}=Kp,_=Math.abs(g)/(na/4);Math.abs(1-_)<1e-7&&(_=1);let T=Math.max(Math.ceil(_),1);g/=T;let E=r[r.length-2],S=r[r.length-1],w={x:0,y:0};for(let M=0;M<T;M++){let P=WI(m,g),{x:R,y:B}=Zp(P[0],o,n,u,c,b,y,w),{x:F,y:X}=Zp(P[1],o,n,u,c,b,y,w),{x:L,y:nt}=Zp(P[2],o,n,u,c,b,y,w);Ac(r,E,S,R,B,F,X,L,nt),E=L,S=nt,m+=g}}var na,Kp,Zp,J0,zI,eT=x(()=>{jp();na=Math.PI*2,Kp={centerX:0,centerY:0,ang1:0,ang2:0},Zp=({x:r,y:t},e,i,s,o,n,a,h)=>{r*=e,t*=i;let l=s*r-o*t,c=o*r+s*t;return h.x=l+n,h.y=c+a,h};J0=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},zI=(r,t,e,i,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(c,2),g=Math.pow(u,2),b=f*p-f*g-p*m;b<0&&(b=0),b/=f*g+p*m,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,_=b*-o/s*c,T=l*y-h*_+(r+e)/2,E=h*y+l*_+(t+i)/2,S=(c-y)/s,w=(u-_)/o,M=(-c-y)/s,P=(-u-_)/o,R=J0(1,0,S,w),B=J0(S,w,M,P);a===0&&B>0&&(B-=na),a===1&&B<0&&(B+=na),d.centerX=T,d.centerY=E,d.ang1=R,d.ang2=B}});function rT(r,t,e){let i=(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?r.moveTo(a.x,a.y):r.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=i(a,o),u=i(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 m=d/2,g,b=Math.abs(Math.cos(m)*h/Math.sin(m));b>Math.min(c.len/2,u.len/2)?(b=Math.min(c.len/2,u.len/2),g=Math.abs(b*Math.sin(m)/Math.cos(m))):g=h;let y=a.x+u.nx*b+-u.ny*g*f,_=a.y+u.ny*b+u.nx*g*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&&r.moveTo(y+Math.cos(T)*g,_+Math.sin(T)*g),r.arc(y,_,g,T,E,p),o=a}}function iT(r,t,e,i){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?r.moveTo(h.x,h.y):r.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 g=Math.min(d/2,l);f=o(h,c,g/d)}let p=s(u,h),m;if(p<1e-4)m=h;else{let g=Math.min(p/2,l);m=o(h,u,g/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(h.x,h.y,m.x,m.y,i)}}var sT=x(()=>{"use strict"});var $I,Cc,oT=x(()=>{V0();W0();X0();fe();j0();Ne();jp();K0();qp();Q0();eT();sT();$I=new st,Cc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Et,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Pc(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return Z0(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let h=this._currentPoly.points;return tT(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return Ac(this._currentPoly.points,h.lastX,h.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return q0(this._currentPoly.points,n.lastX,n.lastY,t,e,i,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 i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[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),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new st(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new vc(t,e,i),s),this}poly(t,e,i){let s=new fo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,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+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let h=i*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+i*Math.cos(f),m=e+i*Math.sin(f),g=f+Math.PI+u,b=f-Math.PI-u,y=p+o*Math.cos(g),_=m+o*Math.sin(g),T=p+o*Math.cos(b),E=m+o*Math.sin(b);d===0?this.moveTo(y,_):this.lineTo(y,_),this.quadraticCurveTo(p,m,T,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?iT(this,t,e,s):rT(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+i,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+i-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),h=t+i,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,i,s,o){return this.drawShape(new Tc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Ec(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new fo,i.points.push(t,e),this._currentPoly=i,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 fo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,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 i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds($I);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function aa(r,t){return r?r.prepend(t):t.clone()}var Fi,Qp=x(()=>{sr();be();wt();H0();oT();Fi=class r{constructor(t,e=!1){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?N0(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Cc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ht.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,i,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,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ht.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,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,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,i,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=i*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 r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];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,i=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,m=0;for(let g=0;g<this.instructions.length;g++){let b=this.instructions[g],y=b.data;switch(b.action){case"moveTo":case"lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=i*h+o*l+a;break;case"bezierCurveTo":c=y[0],u=y[1],d=y[2],f=y[3],h=y[4],l=y[5],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*d+s*f+n,y[3]=i*d+o*f+a,y[4]=e*h+s*l+n,y[5]=i*h+o*l+a;break;case"quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*h+s*l+n,y[3]=i*h+o*l+a;break;case"arcToSvg":h=y[5],l=y[6],p=y[0],m=y[1],y[0]=e*p+s*m,y[1]=i*p+o*m,y[5]=e*h+s*l+n,y[6]=i*h+o*l+a;break;case"circle":y[4]=aa(y[3],t);break;case"rect":y[4]=aa(y[4],t);break;case"ellipse":y[8]=aa(y[8],t);break;case"roundRect":y[5]=aa(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=aa(y[2],t);break;default:O("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,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Ot(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var Jp=x(()=>{"use strict"});function nT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=XI(n);break;case"radialgradient":t.defs[n.id]=jI(n);break;default:break}}}}function XI(r){let t=Ot(r,"x1",0),e=Ot(r,"y1",0),i=Ot(r,"x2",1),s=Ot(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new ze(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let h=r.children[a],l=Ot(h,"offset",0),c=rt.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function jI(r){return O("[SVG Parser] Radial gradients are not yet supported"),new ze(0,0,1,0)}var aT=x(()=>{ye();wt();ao();Jp()});function tm(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var hT=x(()=>{"use strict"});function em(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in lT){let a=r.getAttribute(n);a&&cT(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(":");lT[l]&&cT(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function cT(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=tm(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=rt.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=tm(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=rt.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var lT,uT=x(()=>{ye();hT();lT={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 dT(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Fi};nT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=em(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&fT(a,e,s,o)}return t}function fT(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=em(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let h,l,c,u,d,f,p,m,g,b,y,_,T,E,S,w,M;switch(r.nodeName.toLowerCase()){case"path":E=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&O("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Fi(E,!0),t.context.path(S),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":p=Ot(r,"cx",0),m=Ot(r,"cy",0),g=Ot(r,"r",0),t.context.ellipse(p,m,g,g),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":h=Ot(r,"x",0),l=Ot(r,"y",0),w=Ot(r,"width",0),M=Ot(r,"height",0),b=Ot(r,"rx",0),y=Ot(r,"ry",0),b||y?t.context.roundRect(h,l,w,M,b||y):t.context.rect(h,l,w,M),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Ot(r,"cx",0),m=Ot(r,"cy",0),b=Ot(r,"rx",0),y=Ot(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,b,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Ot(r,"x1",0),u=Ot(r,"y1",0),d=Ot(r,"x2",0),f=Ot(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":T=r.getAttribute("points"),_=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(_,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),_=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(_,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{O(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)fT(s[P],t,e,i)}var pT=x(()=>{wt();Qp();aT();Jp();uT()});function YI(r){return rt.isColorLike(r)}function mT(r){return r instanceof ai}function gT(r){return r instanceof ze}function qI(r){return r instanceof A}function KI(r,t,e){let i=rt.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=A.WHITE,{...e,...r}}function ZI(r,t,e){return r.texture=t,{...e,...r}}function xT(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function yT(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function QI(r,t){let e={...t,...r},i=rt.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function hi(r,t){if(r==null)return null;let e={},i=r;return YI(r)?KI(e,r,t):qI(r)?ZI(e,r,t):mT(r)?xT(e,r,t):gT(r)?yT(e,r,t):i.fill&&mT(i.fill)?xT(i,i.fill,t):i.fill&&gT(i.fill)?yT(i,i.fill,t):QI(i,t)}function mo(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=hi(r,h);return l?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var rm=x(()=>{ye();_t();ao();bc()});var JI,_T,im,ke,Rc=x(()=>{Ee();ye();ft();sr();_t();be();Ht();Ne();Qp();pT();rm();JI=new ht,_T=new I,im=class Vr extends Ct{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Fi,this._transform=new I,this._fillStyle={...Vr.defaultFillStyle},this._strokeStyle={...Vr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Et,this._boundsDirty=!0}clone(){let t=new Vr;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=hi(t,Vr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=mo(t,Vr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=hi(t,Vr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=hi(t,Vr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?rt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Fi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(W(Q,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=hi(t,Vr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ht.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=mo(t,Vr.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],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,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,i,s,o,n),this}arcTo(t,e,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,i,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*i+h.c*s+h.tx,h.b*i+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,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.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,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,dT(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,i,s,o,n){return t instanceof I?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof I?(this._transform.append(t),this):(_T.set(t,e,i,s,o,n),this._transform.append(_T),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 i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.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,i=!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,JI):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let m=h;i=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let g=0;g<m.length;g++)m[g].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};im.defaultFillStyle={color:16777215,alpha:1,texture:A.WHITE,matrix:null,fill:null,textureSpace:"local"};im.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:A.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};ke=im});function Mc(r){let t=[],e=0;for(let i=0;i<bT.length;i++){let s=`_${bT[i]}`;t[e++]=r[s]}return e=vT(r._fill,t,e),e=tF(r._stroke,t,e),e=eF(r.dropShadow,t,e),t.join("-")}function vT(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function tF(r,t,e){return r&&(e=vT(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function eF(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=rt.shared.setValue(r.color).toNumber()),e}var bT,sm=x(()=>{ye();bT=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function rF(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Mt.defaultDropShadow;r.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){W(Q,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(rt.isColorLike(e))i.color=e;else if(e instanceof ze||e instanceof ai)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){W(Q,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Mt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new ze({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>rt.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var om,Mt,cs=x(()=>{Ee();ye();Ht();ao();bc();Rc();rm();sm();om=class go extends Ct{constructor(t={}){super(),rF(t);let e={...go.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...go.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...go.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({...ke.defaultFillStyle,...t},()=>{this._fill=hi({...this._originalFill},ke.defaultFillStyle)})),this._fill=hi(t===0?"black":t,ke.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...ke.defaultStrokeStyle,...t},()=>{this._stroke=mo({...this._originalStroke},ke.defaultStrokeStyle)})),this._stroke=mo(t,ke.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Mc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=go.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new go({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 i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(rt.isColorLike(t)||t instanceof ze||t instanceof ai)}};om.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};om.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};Mt=om});function Bc(r,t,e,i){let s=iF;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Vt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var iF,nm=x(()=>{vi();Ne();iF=new Et});function us(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!sF.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var sF,Ic=x(()=>{"use strict";sF=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var am,Sr,qt,ha=x(()=>{Rt();Ic();am={willReadFrequently:!0},Sr=class j{static get experimentalLetterSpacingSupported(){let t=j._experimentalLetterSpacingSupported;if(t!==void 0){let e=z.get().getCanvasRenderingContext2D().prototype;t=j._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,i=j._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(j._measurementCache[o])return j._measurementCache[o];let n=us(e),a=j.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=j.__context;h.font=n;let c=(s?j._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let y=0;y<c.length;y++){let _=j._measureText(c[y],e.letterSpacing,h);u[y]=_,d=Math.max(d,_)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new j(t,e,p,g,c,u,m+e.leading,d,a)}static _measureText(t,e,i){let s=!1;j.experimentalLetterSpacingSupported&&(j.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(j.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,i=j._canvas){let s=i.getContext("2d",am),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=j._collapseSpaces(c),d=j._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,m=j._tokenize(t);for(let g=0;g<m.length;g++){let b=m[g];if(j._isNewline(b)){if(!d){a+=j._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let _=j.isBreakingSpace(b),T=j.isBreakingSpace(n[n.length-1]);if(_&&T)continue}let y=j._getFromCache(b,l,h,s);if(y>p)if(n!==""&&(a+=j._addLine(n),n="",o=0),j.canBreakWords(b,e.breakWords)){let _=j.wordWrapSplit(b);for(let T=0;T<_.length;T++){let E=_[T],S=E,w=1;for(;_[T+w];){let P=_[T+w];if(!j.canBreakChars(S,P,b,T,e.breakWords))E+=P;else break;S=P,w++}T+=w-1;let M=j._getFromCache(E,l,h,s);M+o>p&&(a+=j._addLine(n),f=!1,n="",o=0),n+=E,o+=M}}else{n.length>0&&(a+=j._addLine(n),n="",o=0);let _=g===m.length-1;a+=j._addLine(b,!_),f=!1,n="",o=0}else y+o>p&&(f=!1,a+=j._addLine(n),n="",o=0),(n.length>0||!j.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=j._addLine(n,!1),a}static _addLine(t,e=!0){return t=j._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=j._measureText(t,e,s)+e,i[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 i=t[e];if(!j.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:j._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:j._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(j.isBreakingSpace(o,n)||j._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return j.graphemeSegmenter(t)}static measureFont(t){if(j._fonts[t])return j._fonts[t];let e=j._context;e.font=t;let i=e.measureText(j.METRICS_STRING+j.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return j._fonts[t]=s,s}static clearMetrics(t=""){t?delete j._fonts[t]:j._fonts={}}static get _canvas(){if(!j.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",am)?.measureText)return j.__canvas=e,e;t=z.get().createCanvas()}catch{t=z.get().createCanvas()}t.width=t.height=10,j.__canvas=t}return j.__canvas}static get _context(){return j.__context||(j.__context=j._canvas.getContext("2d",am)),j.__context}};Sr.METRICS_STRING="|\xC9q\xC5";Sr.BASELINE_SYMBOL="M";Sr.BASELINE_MULTIPLIER=1.4;Sr.HEIGHT_MULTIPLIER=2;Sr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Sr.experimentalLetterSpacing=!1;Sr._fonts={};Sr._newlines=[10,13];Sr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Sr._measurementCache={};qt=Sr});function xo(r,t,e,i=0){if(r.texture===A.WHITE&&!r.fill)return rt.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ai){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(I.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ze){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+i,h=e.height+i);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+i/2)/h;s.colorStops.forEach(p=>{let m=f+p.offset*u;l.addColorStop(Math.floor(m*TT)/TT,rt.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,rt.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(I.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",r),"red"}var TT,hm=x(()=>{ye();ft();_t();wt();ao();bc();TT=1e5});var la,ST=x(()=>{ye();C();Cn();uo();vi();G0();Ht();cs();nm();ha();Ic();hm();la=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=qt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ti(o),n=ti(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(W("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Mt||(t.style=new Mt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),$e.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=qt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),h=$e.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,i,s,h);let c=Bc(l,n,a,s);if(i.trim){let u=k0(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:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Vt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&($e.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=us(e),h=qt.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(i,i),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 m,g,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let _=e.dropShadow&&y===0,T=_?Math.ceil(Math.max(1,p)+e.padding*2):0,E=T*i;if(_){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,P=M.color,R=M.alpha;n.shadowColor=rt.shared.setValue(P).setAlpha(R).toRgbaString();let B=M.blur*i,F=M.distance*i;n.shadowBlur=B,n.shadowOffsetX=Math.cos(M.angle)*F,n.shadowOffsetY=Math.sin(M.angle)*F+E}else{if(n.fillStyle=e._fill?xo(e._fill,n,h):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=xo(e._stroke,n,h,M)}n.shadowColor="black"}let S=(c-f.fontSize)/2;c-f.fontSize<0&&(S=0);let w=e._stroke?.width??0;for(let M=0;M<l.length;M++)m=w/2,g=w/2+M*c+f.ascent+S,e.align==="right"?m+=d-u[M]:e.align==="center"&&(m+=(d-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,h=e.letterSpacing,l=!1;if(qt.experimentalLetterSpacingSupported&&(qt.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=qt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,c,o):a.fillText(m,c,o);let g="";for(let b=p+1;b<u.length;++b)g+=u[b];f=a.measureText(g).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};la.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"canvasText"}});var lm=x(()=>{C();B0();ST();k.add(la);k.add(oa)});var he,cm=x(()=>{Ht();Vl();Rc();he=class r extends Ei{constructor(t){t instanceof ke&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new ke,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!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 r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){W(Q,"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),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){W(Q,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){W(Q,"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!==ke.defaultStrokeStyle.width||t.color!==ke.defaultStrokeStyle.color||t.alpha!==ke.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return W(Q,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return W(Q,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return W(Q,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return W(Q,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return W(Q,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return W(Q,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var ET,wT,AT=x(()=>{"use strict";ET={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var yc,P0=x(()=>{ye();ft();ss();Js();vr();_t();gf();S0();w0();A0();yc=class extends Xt{constructor(){let t=ar.from({vertex:E0,fragment:T0}),e=hr.from({fragment:{source:Dp,entryPoint:"mainFragment"},vertex:{source:Dp,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:A.WHITE.source,uSampler:new Fl({}),uniforms:{uTranslationMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new rt(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var co,Np=x(()=>{ft();Fe();zn();Tr();lo();v0();P0();co=class{constructor(t,e){this.state=Yt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new At({uTranslationMatrix:{value:new I,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 yc,this.state=Yt.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 xc({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 i=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=si(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var ea,C0=x(()=>{P();g0();Np();ea=class extends co{constructor(t){super(t,new gc)}};ea.extension={type:[v.WebGLPipes],name:"particle"}});var _c,R0=x(()=>{"use strict";_c=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var ra,M0=x(()=>{P();R0();Np();ra=class extends co{constructor(t){super(t,new _c)}};ra.extension={type:[v.WebGPUPipes],name:"particle"}});var Hp=x(()=>{P();C0();M0();k.add(ea);k.add(ra)});var Hr,ia=x(()=>{"use strict";Hr=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 sa(r,t){let{texture:e,bounds:i}=r;$l(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Vp=x(()=>{Nf()});var oa,B0=x(()=>{P();Me();ia();Vp();oa=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),tt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,sa(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:tt.get(Hr)};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}};oa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"text"}});var Wp,$e,uo=x(()=>{Rt();Cn();Wp=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=$.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ti(t),e=ti(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:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},$e=new Wp});function I0(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function F0(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function k0(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,h=0,l=e-1,c=i-1;for(;h<i&&I0(n,e,h);)++h;if(h===i)return ot.EMPTY;for(;I0(n,e,c);)--c;for(;F0(n,e,a,h,c);)++a;for(;F0(n,e,l,h,c);)--l;return++l,++c,new ot(a/t,h/t,(l-a)/t,(c-h)/t)}var G0=x(()=>{fe()});var U0,ai,bc=x(()=>{ft();be();U0={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"}},ai=class{constructor(t,e){this.uid=at("fillPattern"),this.transform=new I,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=U0[e].addressModeU,t.source.style.addressModeV=U0[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 L0=K((l$,O0)=>{O0.exports=MI;var zp={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},RI=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function MI(r){var t=[];return r.replace(RI,function(e,i,s){var o=i.toLowerCase();for(s=II(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==zp[o])return s.unshift(i),t.push(s);if(s.length<zp[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,zp[o])))}}),t}var BI=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function II(r){var t=r.match(BI);return t?t.map(Number):[]}});function N0(r,t){let e=(0,D0.default)(r),i=[],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(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:O(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var D0,H0=x(()=>{D0=$i(L0(),1);wt()});var vc,V0=x(()=>{fe();vc=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*i,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(i-h)}getBounds(t){return t||(t=new ot),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 Tc,W0=x(()=>{fe();Tc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),h=i-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(l*l)+p*p/(c*c),g=f*f/(u*u)+p*p/(d*d);return m>1&&g<=1}getBounds(t){return t||(t=new ot),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 z0(r,t,e,i,s,o){let n=r-e,a=t-i,h=s-e,l=o-i,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=i):d>1?(f=s,p=o):(f=e+d*h,p=i+d*l);let m=r-f,g=t-p;return m*m+g*g}var $0=x(()=>{"use strict"});var FI,kI,fo,X0=x(()=>{$0();fe();fo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],h=e[(s+3)%i];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(FI),i=t.getBounds(kI);if(!e.containsRect(i))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 r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!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&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,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],m=z0(t,e,u,d,f,p),g=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new ot);let e=this.points,i=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];i=l<i?l:i,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=i,t.width=s-i,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 Sc,Ec,j0=x(()=>{fe();Sc=(r,t,e,i,s,o,n)=>{let a=r-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},Ec=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new ot),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=i*(1-s),u=i-c,d=o+l,f=n+l,p=a-l*2,m=h-l*2,g=o+a,b=n+h;return(t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=b-u&&e<=b+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&Sc(t,e,d,f,l,u,c)||t>g-l&&e<f&&Sc(t,e,g-l,f,l,u,c)||t>g-l&&e>b-l&&Sc(t,e,g-l,b-l,l,u,c)||t<d&&e>b-l&&Sc(t,e,d,b-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 Ac(r,t,e,i,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??ho.defaultOptions.bezierSmoothness)),d=(UI-u)/1;return d*=d,OI(t,e,i,s,o,n,a,h,r,d),r}function OI(r,t,e,i,s,o,n,a,h,l){Xp(r,t,e,i,s,o,n,a,h,l,0),h.push(n,a)}function Xp(r,t,e,i,s,o,n,a,h,l,c){if(c>GI)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,p=(e+s)/2,m=(i+o)/2,g=(s+n)/2,b=(o+a)/2,y=(d+p)/2,_=(f+m)/2,T=(p+g)/2,E=(m+b)/2,S=(y+T)/2,w=(_+E)/2;if(c>0){let M=n-r,C=a-t,R=Math.abs((e-n)*C-(i-a)*M),B=Math.abs((s-n)*C-(o-a)*M),F,j;if(R>wc&&B>wc){if((R+B)*(R+B)<=l*(M*M+C*C)){if(po<$p){h.push(S,w);return}let W=Math.atan2(o-i,s-e);if(F=Math.abs(W-Math.atan2(i-t,e-r)),j=Math.abs(Math.atan2(a-o,n-s)-W),F>=u&&(F=2*u-F),j>=u&&(j=2*u-j),F+j<po){h.push(S,w);return}if(ls!==0){if(F>ls){h.push(e,i);return}if(j>ls){h.push(s,o);return}}}}else if(R>wc){if(R*R<=l*(M*M+C*C)){if(po<$p){h.push(S,w);return}if(F=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),F>=u&&(F=2*u-F),F<po){h.push(e,i),h.push(s,o);return}if(ls!==0&&F>ls){h.push(e,i);return}}}else if(B>wc){if(B*B<=l*(M*M+C*C)){if(po<$p){h.push(S,w);return}if(F=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),F>=u&&(F=2*u-F),F<po){h.push(e,i),h.push(s,o);return}if(ls!==0&&F>ls){h.push(s,o);return}}}else if(M=S-(r+n)/2,C=w-(t+a)/2,M*M+C*C<=l){h.push(S,w);return}}Xp(r,t,d,f,y,_,S,w,h,l,c+1),Xp(S,w,T,E,g,b,n,a,h,l,c+1)}var GI,wc,UI,$p,po,ls,jp=x(()=>{pc();GI=8,wc=11920929e-14,UI=1,$p=.01,po=0,ls=0});function q0(r,t,e,i,s,o,n,a){let l=Math.min(.99,Math.max(0,a??ho.defaultOptions.bezierSmoothness)),c=(NI-l)/1;return c*=c,VI(t,e,i,s,o,n,r,c),r}function VI(r,t,e,i,s,o,n,a){Yp(n,r,t,e,i,s,o,a,0),n.push(s,o)}function Yp(r,t,e,i,s,o,n,a,h){if(h>LI)return;let l=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,p=(c+d)/2,m=(u+f)/2,g=o-t,b=n-e,y=Math.abs((i-o)*b-(s-n)*g);if(y>DI){if(y*y<=a*(g*g+b*b)){if(Y0<HI){r.push(p,m);return}let _=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(_>=l&&(_=2*l-_),_<Y0){r.push(p,m);return}}}else if(g=p-(t+o)/2,b=m-(e+n)/2,g*g+b*b<=a){r.push(p,m);return}Yp(r,t,e,c,u,p,m,a,h+1),Yp(r,p,m,d,f,o,n,a,h+1)}var LI,DI,NI,HI,Y0,K0=x(()=>{pc();LI=8,DI=11920929e-14,NI=1,HI=.01,Y0=0});function Pc(r,t,e,i,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(i,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*i,m=e+f*i;r.push(p,m),c+=l}}var qp=x(()=>{"use strict"});function Z0(r,t,e,i,s,o){let n=r[r.length-2],h=r[r.length-1]-e,l=n-t,c=s-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,g=o*Math.sqrt(f)/d,b=o*Math.sqrt(p)/d,y=g*m/f,_=b*m/p,T=g*u+b*l,E=g*c+b*h,S=l*(b+y),w=h*(b+y),M=u*(g+_),C=c*(g+_),R=Math.atan2(w-E,S-T),B=Math.atan2(C-E,M-T);Pc(r,T+t,E+e,o,R,B,l*c>u*h)}var Q0=x(()=>{qp()});function WI(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function tT(r,t,e,i,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*na/360),u=Math.cos(a*na/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/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)),zI(t,e,i,s,o,n,h,l,c,u,d,f,Kp);let{ang1:m,ang2:g}=Kp,{centerX:b,centerY:y}=Kp,_=Math.abs(g)/(na/4);Math.abs(1-_)<1e-7&&(_=1);let T=Math.max(Math.ceil(_),1);g/=T;let E=r[r.length-2],S=r[r.length-1],w={x:0,y:0};for(let M=0;M<T;M++){let C=WI(m,g),{x:R,y:B}=Zp(C[0],o,n,u,c,b,y,w),{x:F,y:j}=Zp(C[1],o,n,u,c,b,y,w),{x:W,y:st}=Zp(C[2],o,n,u,c,b,y,w);Ac(r,E,S,R,B,F,j,W,st),E=W,S=st,m+=g}}var na,Kp,Zp,J0,zI,eT=x(()=>{jp();na=Math.PI*2,Kp={centerX:0,centerY:0,ang1:0,ang2:0},Zp=({x:r,y:t},e,i,s,o,n,a,h)=>{r*=e,t*=i;let l=s*r-o*t,c=o*r+s*t;return h.x=l+n,h.y=c+a,h};J0=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},zI=(r,t,e,i,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(c,2),g=Math.pow(u,2),b=f*p-f*g-p*m;b<0&&(b=0),b/=f*g+p*m,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,_=b*-o/s*c,T=l*y-h*_+(r+e)/2,E=h*y+l*_+(t+i)/2,S=(c-y)/s,w=(u-_)/o,M=(-c-y)/s,C=(-u-_)/o,R=J0(1,0,S,w),B=J0(S,w,M,C);a===0&&B>0&&(B-=na),a===1&&B<0&&(B+=na),d.centerX=T,d.centerY=E,d.ang1=R,d.ang2=B}});function rT(r,t,e){let i=(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?r.moveTo(a.x,a.y):r.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=i(a,o),u=i(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 m=d/2,g,b=Math.abs(Math.cos(m)*h/Math.sin(m));b>Math.min(c.len/2,u.len/2)?(b=Math.min(c.len/2,u.len/2),g=Math.abs(b*Math.sin(m)/Math.cos(m))):g=h;let y=a.x+u.nx*b+-u.ny*g*f,_=a.y+u.ny*b+u.nx*g*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&&r.moveTo(y+Math.cos(T)*g,_+Math.sin(T)*g),r.arc(y,_,g,T,E,p),o=a}}function iT(r,t,e,i){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?r.moveTo(h.x,h.y):r.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 g=Math.min(d/2,l);f=o(h,c,g/d)}let p=s(u,h),m;if(p<1e-4)m=h;else{let g=Math.min(p/2,l);m=o(h,u,g/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(h.x,h.y,m.x,m.y,i)}}var sT=x(()=>{"use strict"});var $I,Cc,oT=x(()=>{V0();W0();X0();fe();j0();Ne();jp();K0();qp();Q0();eT();sT();$I=new ot,Cc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Et,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Pc(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return Z0(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let h=this._currentPoly.points;return tT(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return Ac(this._currentPoly.points,h.lastX,h.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return q0(this._currentPoly.points,n.lastX,n.lastY,t,e,i,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 i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[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),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new ot(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new vc(t,e,i),s),this}poly(t,e,i){let s=new fo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,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+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let h=i*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+i*Math.cos(f),m=e+i*Math.sin(f),g=f+Math.PI+u,b=f-Math.PI-u,y=p+o*Math.cos(g),_=m+o*Math.sin(g),T=p+o*Math.cos(b),E=m+o*Math.sin(b);d===0?this.moveTo(y,_):this.lineTo(y,_),this.quadraticCurveTo(p,m,T,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?iT(this,t,e,s):rT(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+i,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+i-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),h=t+i,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,i,s,o){return this.drawShape(new Tc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Ec(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new fo,i.points.push(t,e),this._currentPoly=i,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 fo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,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 i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds($I);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function aa(r,t){return r?r.prepend(t):t.clone()}var Fi,Qp=x(()=>{sr();be();wt();H0();oT();Fi=class r{constructor(t,e=!1){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?N0(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Cc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ht.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,i,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,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ht.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,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,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,i,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=i*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 r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];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,i=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,m=0;for(let g=0;g<this.instructions.length;g++){let b=this.instructions[g],y=b.data;switch(b.action){case"moveTo":case"lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=i*h+o*l+a;break;case"bezierCurveTo":c=y[0],u=y[1],d=y[2],f=y[3],h=y[4],l=y[5],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*d+s*f+n,y[3]=i*d+o*f+a,y[4]=e*h+s*l+n,y[5]=i*h+o*l+a;break;case"quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*h+s*l+n,y[3]=i*h+o*l+a;break;case"arcToSvg":h=y[5],l=y[6],p=y[0],m=y[1],y[0]=e*p+s*m,y[1]=i*p+o*m,y[5]=e*h+s*l+n,y[6]=i*h+o*l+a;break;case"circle":y[4]=aa(y[3],t);break;case"rect":y[4]=aa(y[4],t);break;case"ellipse":y[8]=aa(y[8],t);break;case"roundRect":y[5]=aa(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=aa(y[2],t);break;default:O("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,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Ot(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var Jp=x(()=>{"use strict"});function nT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=XI(n);break;case"radialgradient":t.defs[n.id]=jI(n);break;default:break}}}}function XI(r){let t=Ot(r,"x1",0),e=Ot(r,"y1",0),i=Ot(r,"x2",1),s=Ot(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new ze(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let h=r.children[a],l=Ot(h,"offset",0),c=rt.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function jI(r){return O("[SVG Parser] Radial gradients are not yet supported"),new ze(0,0,1,0)}var aT=x(()=>{ye();wt();ao();Jp()});function tm(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var hT=x(()=>{"use strict"});function em(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in lT){let a=r.getAttribute(n);a&&cT(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(":");lT[l]&&cT(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function cT(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=tm(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=rt.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=tm(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=rt.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var lT,uT=x(()=>{ye();hT();lT={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 dT(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Fi};nT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=em(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&fT(a,e,s,o)}return t}function fT(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=em(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let h,l,c,u,d,f,p,m,g,b,y,_,T,E,S,w,M;switch(r.nodeName.toLowerCase()){case"path":E=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&O("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Fi(E,!0),t.context.path(S),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":p=Ot(r,"cx",0),m=Ot(r,"cy",0),g=Ot(r,"r",0),t.context.ellipse(p,m,g,g),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":h=Ot(r,"x",0),l=Ot(r,"y",0),w=Ot(r,"width",0),M=Ot(r,"height",0),b=Ot(r,"rx",0),y=Ot(r,"ry",0),b||y?t.context.roundRect(h,l,w,M,b||y):t.context.rect(h,l,w,M),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Ot(r,"cx",0),m=Ot(r,"cy",0),b=Ot(r,"rx",0),y=Ot(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,b,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Ot(r,"x1",0),u=Ot(r,"y1",0),d=Ot(r,"x2",0),f=Ot(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":T=r.getAttribute("points"),_=T.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(_,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),_=T.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(_,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{O(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let C=0;C<s.length;C++)fT(s[C],t,e,i)}var pT=x(()=>{wt();Qp();aT();Jp();uT()});function YI(r){return rt.isColorLike(r)}function mT(r){return r instanceof ai}function gT(r){return r instanceof ze}function qI(r){return r instanceof A}function KI(r,t,e){let i=rt.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=A.WHITE,{...e,...r}}function ZI(r,t,e){return r.texture=t,{...e,...r}}function xT(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function yT(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function QI(r,t){let e={...t,...r},i=rt.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function hi(r,t){if(r==null)return null;let e={},i=r;return YI(r)?KI(e,r,t):qI(r)?ZI(e,r,t):mT(r)?xT(e,r,t):gT(r)?yT(e,r,t):i.fill&&mT(i.fill)?xT(i,i.fill,t):i.fill&&gT(i.fill)?yT(i,i.fill,t):QI(i,t)}function mo(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=hi(r,h);return l?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var rm=x(()=>{ye();_t();ao();bc()});var JI,_T,im,ke,Rc=x(()=>{Ee();ye();ft();sr();_t();be();Ht();Ne();Qp();pT();rm();JI=new ht,_T=new I,im=class Vr extends Ct{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Fi,this._transform=new I,this._fillStyle={...Vr.defaultFillStyle},this._strokeStyle={...Vr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Et,this._boundsDirty=!0}clone(){let t=new Vr;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=hi(t,Vr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=mo(t,Vr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=hi(t,Vr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=hi(t,Vr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?rt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Fi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(z(J,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=hi(t,Vr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ht.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=mo(t,Vr.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],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,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,i,s,o,n),this}arcTo(t,e,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,i,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*i+h.c*s+h.tx,h.b*i+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,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.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,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,dT(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,i,s,o,n){return t instanceof I?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof I?(this._transform.append(t),this):(_T.set(t,e,i,s,o,n),this._transform.append(_T),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 i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.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,i=!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,JI):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let m=h;i=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let g=0;g<m.length;g++)m[g].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};im.defaultFillStyle={color:16777215,alpha:1,texture:A.WHITE,matrix:null,fill:null,textureSpace:"local"};im.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:A.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};ke=im});function Mc(r){let t=[],e=0;for(let i=0;i<bT.length;i++){let s=`_${bT[i]}`;t[e++]=r[s]}return e=vT(r._fill,t,e),e=tF(r._stroke,t,e),e=eF(r.dropShadow,t,e),t.join("-")}function vT(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function tF(r,t,e){return r&&(e=vT(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function eF(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=rt.shared.setValue(r.color).toNumber()),e}var bT,sm=x(()=>{ye();bT=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function rF(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Mt.defaultDropShadow;r.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){z(J,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(rt.isColorLike(e))i.color=e;else if(e instanceof ze||e instanceof ai)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){z(J,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Mt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new ze({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>rt.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var om,Mt,cs=x(()=>{Ee();ye();Ht();ao();bc();Rc();rm();sm();om=class go extends Ct{constructor(t={}){super(),rF(t);let e={...go.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...go.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...go.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({...ke.defaultFillStyle,...t},()=>{this._fill=hi({...this._originalFill},ke.defaultFillStyle)})),this._fill=hi(t===0?"black":t,ke.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...ke.defaultStrokeStyle,...t},()=>{this._stroke=mo({...this._originalStroke},ke.defaultStrokeStyle)})),this._stroke=mo(t,ke.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Mc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=go.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new go({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 i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(rt.isColorLike(t)||t instanceof ze||t instanceof ai)}};om.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};om.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};Mt=om});function Bc(r,t,e,i){let s=iF;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Vt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var iF,nm=x(()=>{vi();Ne();iF=new Et});function us(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!sF.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var sF,Ic=x(()=>{"use strict";sF=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var am,Sr,qt,ha=x(()=>{Rt();Ic();am={willReadFrequently:!0},Sr=class X{static get experimentalLetterSpacingSupported(){let t=X._experimentalLetterSpacingSupported;if(t!==void 0){let e=$.get().getCanvasRenderingContext2D().prototype;t=X._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,i=X._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(X._measurementCache[o])return X._measurementCache[o];let n=us(e),a=X.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=X.__context;h.font=n;let c=(s?X._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let y=0;y<c.length;y++){let _=X._measureText(c[y],e.letterSpacing,h);u[y]=_,d=Math.max(d,_)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new X(t,e,p,g,c,u,m+e.leading,d,a)}static _measureText(t,e,i){let s=!1;X.experimentalLetterSpacingSupported&&(X.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(X.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,i=X._canvas){let s=i.getContext("2d",am),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=X._collapseSpaces(c),d=X._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,m=X._tokenize(t);for(let g=0;g<m.length;g++){let b=m[g];if(X._isNewline(b)){if(!d){a+=X._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let _=X.isBreakingSpace(b),T=X.isBreakingSpace(n[n.length-1]);if(_&&T)continue}let y=X._getFromCache(b,l,h,s);if(y>p)if(n!==""&&(a+=X._addLine(n),n="",o=0),X.canBreakWords(b,e.breakWords)){let _=X.wordWrapSplit(b);for(let T=0;T<_.length;T++){let E=_[T],S=E,w=1;for(;_[T+w];){let C=_[T+w];if(!X.canBreakChars(S,C,b,T,e.breakWords))E+=C;else break;S=C,w++}T+=w-1;let M=X._getFromCache(E,l,h,s);M+o>p&&(a+=X._addLine(n),f=!1,n="",o=0),n+=E,o+=M}}else{n.length>0&&(a+=X._addLine(n),n="",o=0);let _=g===m.length-1;a+=X._addLine(b,!_),f=!1,n="",o=0}else y+o>p&&(f=!1,a+=X._addLine(n),n="",o=0),(n.length>0||!X.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=X._addLine(n,!1),a}static _addLine(t,e=!0){return t=X._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=X._measureText(t,e,s)+e,i[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 i=t[e];if(!X.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:X._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:X._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(X.isBreakingSpace(o,n)||X._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return X.graphemeSegmenter(t)}static measureFont(t){if(X._fonts[t])return X._fonts[t];let e=X._context;e.font=t;let i=e.measureText(X.METRICS_STRING+X.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return X._fonts[t]=s,s}static clearMetrics(t=""){t?delete X._fonts[t]:X._fonts={}}static get _canvas(){if(!X.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",am)?.measureText)return X.__canvas=e,e;t=$.get().createCanvas()}catch{t=$.get().createCanvas()}t.width=t.height=10,X.__canvas=t}return X.__canvas}static get _context(){return X.__context||(X.__context=X._canvas.getContext("2d",am)),X.__context}};Sr.METRICS_STRING="|\xC9q\xC5";Sr.BASELINE_SYMBOL="M";Sr.BASELINE_MULTIPLIER=1.4;Sr.HEIGHT_MULTIPLIER=2;Sr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Sr.experimentalLetterSpacing=!1;Sr._fonts={};Sr._newlines=[10,13];Sr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Sr._measurementCache={};qt=Sr});function xo(r,t,e,i=0){if(r.texture===A.WHITE&&!r.fill)return rt.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ai){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(I.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ze){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+i,h=e.height+i);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+i/2)/h;s.colorStops.forEach(p=>{let m=f+p.offset*u;l.addColorStop(Math.floor(m*TT)/TT,rt.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,rt.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(I.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",r),"red"}var TT,hm=x(()=>{ye();ft();_t();wt();ao();bc();TT=1e5});var la,ST=x(()=>{ye();P();Cn();uo();vi();G0();Ht();cs();nm();ha();Ic();hm();la=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=qt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ti(o),n=ti(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(z("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Mt||(t.style=new Mt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),$e.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=qt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),h=$e.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,i,s,h);let c=Bc(l,n,a,s);if(i.trim){let u=k0(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:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Vt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&($e.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=us(e),h=qt.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(i,i),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 m,g,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let _=e.dropShadow&&y===0,T=_?Math.ceil(Math.max(1,p)+e.padding*2):0,E=T*i;if(_){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,C=M.color,R=M.alpha;n.shadowColor=rt.shared.setValue(C).setAlpha(R).toRgbaString();let B=M.blur*i,F=M.distance*i;n.shadowBlur=B,n.shadowOffsetX=Math.cos(M.angle)*F,n.shadowOffsetY=Math.sin(M.angle)*F+E}else{if(n.fillStyle=e._fill?xo(e._fill,n,h):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=xo(e._stroke,n,h,M)}n.shadowColor="black"}let S=(c-f.fontSize)/2;c-f.fontSize<0&&(S=0);let w=e._stroke?.width??0;for(let M=0;M<l.length;M++)m=w/2,g=w/2+M*c+f.ascent+S,e.align==="right"?m+=d-u[M]:e.align==="center"&&(m+=(d-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,h=e.letterSpacing,l=!1;if(qt.experimentalLetterSpacingSupported&&(qt.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=qt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,c,o):a.fillText(m,c,o);let g="";for(let b=p+1;b<u.length;++b)g+=u[b];f=a.measureText(g).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};la.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"canvasText"}});var lm=x(()=>{P();B0();ST();k.add(la);k.add(oa)});var he,cm=x(()=>{Ht();Vl();Rc();he=class r extends Ei{constructor(t){t instanceof ke&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new ke,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!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 r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){z(J,"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),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){z(J,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){z(J,"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!==ke.defaultStrokeStyle.width||t.color!==ke.defaultStrokeStyle.color||t.alpha!==ke.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return z(J,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return z(J,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return z(J,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return z(J,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return z(J,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return z(J,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var ET,wT,AT=x(()=>{"use strict";ET={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -462,16 +462,16 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}}});var um,dm,Fc,MT=x(()=>{ft();rs();Mi();jn();Yn();Bi();oc();vr();Fe();AT();RT();Fc=class extends Xt{constructor(){let t=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=or();um??(um=Gr({name:"sdf-shader",bits:[to,ro(e),ET,PT,Or]})),dm??(dm=Ur({name:"sdf-shader",bits:[eo,io(e),wT,CT,Lr]})),super({glProgram:dm,gpuProgram:um,resources:{localUniforms:t,batchSamplers:so(e)}})}}});var yo,fm=x(()=>{Ee();Ht();yo=class extends Ct{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 W(Q,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return W(Q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return W(Q,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return W(Q,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return W(Q,"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 kc(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[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 pm=x(()=>{"use strict"});var BT,mm,FT=x(()=>{ye();fe();uo();js();_t();Ht();ha();Ic();hm();cs();fm();pm();BT=class IT extends yo{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={...IT.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=A.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=us(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=qt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=kc(t).filter(g=>!this._currentChars.includes(g)).filter((g,b,y)=>y.indexOf(g)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.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,m=s.height/this.resolution;for(let g=0;g<e.length;g++){let b=e[g],y=qt.measureText(b,a,s,!1);y.lineHeight=y.height;let _=y.width*c,T=Math.ceil((a.fontStyle==="italic"?2:1)*_),E=y.height*c,S=T+u*2,w=E+u*2;if(f=!1,b!==`
466
- `&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(w,d))),h+S>p&&(l+=d,d=w,h=0,l+d>m)){n.update();let P=this._nextPage();s=P.canvasAndContext.canvas,o=P.canvasAndContext.context,n=P.texture.source,l=0}let M=_/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:M,kerning:{}},f){this._drawGlyph(o,y,h+u,l+u,c,a);let P=n.width*c,R=n.height*c,B=new st(h/P*n.width,l/R*n.height,S/P*n.width,w/R*n.height);this.chars[b].texture=new A({source:n,frame:B}),h+=Math.ceil(S)}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return W(Q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=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=i[o];h||(h=i[o]=e.measureText(o).width);let l=i[a];l||(l=i[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=$e.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new A({source:new Ve({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=us(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=xo(s,t)),e._fill&&(t.fillStyle=xo(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=rt.shared.setValue(n.color).toArray(),h=n.blur*i,l=n.distance*i;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,i,s,o,n){let a=e.text,h=e.fontProperties,c=(n._stroke?.width??0)*o,u=i+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:i}=this.pages[t];$e.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};BT.defaultOptions={textureSize:512,style:new Mt,mipmap:!0};mm=BT});function Gc(r,t,e,i){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 m=o.width;for(let g=0;g<h.index;g++){let b=p.positions[g];o.chars.push(p.chars[g]),o.charPositions.push(b+m)}o.width+=p.width,a=!1,h.width=0,h.index=0,h.chars.length=0},c=()=>{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=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<r.length+1;p++){let m,g=p===r.length;g||(m=r[p]);let b=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
465
+ `}}});var um,dm,Fc,MT=x(()=>{ft();rs();Mi();jn();Yn();Bi();oc();vr();Fe();AT();RT();Fc=class extends Xt{constructor(){let t=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=or();um??(um=Gr({name:"sdf-shader",bits:[to,ro(e),ET,PT,Or]})),dm??(dm=Ur({name:"sdf-shader",bits:[eo,io(e),wT,CT,Lr]})),super({glProgram:dm,gpuProgram:um,resources:{localUniforms:t,batchSamplers:so(e)}})}}});var yo,fm=x(()=>{Ee();Ht();yo=class extends Ct{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 z(J,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return z(J,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return z(J,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return z(J,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return z(J,"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 kc(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[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 pm=x(()=>{"use strict"});var BT,mm,FT=x(()=>{ye();fe();uo();js();_t();Ht();ha();Ic();hm();cs();fm();pm();BT=class IT extends yo{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={...IT.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=A.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=us(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=qt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=kc(t).filter(g=>!this._currentChars.includes(g)).filter((g,b,y)=>y.indexOf(g)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.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,m=s.height/this.resolution;for(let g=0;g<e.length;g++){let b=e[g],y=qt.measureText(b,a,s,!1);y.lineHeight=y.height;let _=y.width*c,T=Math.ceil((a.fontStyle==="italic"?2:1)*_),E=y.height*c,S=T+u*2,w=E+u*2;if(f=!1,b!==`
466
+ `&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(w,d))),h+S>p&&(l+=d,d=w,h=0,l+d>m)){n.update();let C=this._nextPage();s=C.canvasAndContext.canvas,o=C.canvasAndContext.context,n=C.texture.source,l=0}let M=_/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:M,kerning:{}},f){this._drawGlyph(o,y,h+u,l+u,c,a);let C=n.width*c,R=n.height*c,B=new ot(h/C*n.width,l/R*n.height,S/C*n.width,w/R*n.height);this.chars[b].texture=new A({source:n,frame:B}),h+=Math.ceil(S)}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return z(J,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=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=i[o];h||(h=i[o]=e.measureText(o).width);let l=i[a];l||(l=i[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=$e.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new A({source:new Ve({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=us(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=xo(s,t)),e._fill&&(t.fillStyle=xo(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=rt.shared.setValue(n.color).toArray(),h=n.blur*i,l=n.distance*i;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,i,s,o,n){let a=e.text,h=e.fontProperties,c=(n._stroke?.width??0)*o,u=i+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:i}=this.pages[t];$e.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};BT.defaultOptions={textureSize:512,style:new Mt,mipmap:!0};mm=BT});function Gc(r,t,e,i){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 m=o.width;for(let g=0;g<h.index;g++){let b=p.positions[g];o.chars.push(p.chars[g]),o.charPositions.push(b+m)}o.width+=p.width,a=!1,h.width=0,h.index=0,h.chars.length=0},c=()=>{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=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<r.length+1;p++){let m,g=p===r.length;g||(m=r[p]);let b=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
467
467
  `||g){if(!a&&t.wordWrap&&o.width+h.width-d>f?(c(),l(h),g||o.charPositions.push(0)):(h.start=o.width,l(h),g||o.charPositions.push(0)),m==="\r"||m===`
468
- `)o.width!==0&&c();else if(!g){let E=b.xAdvance+(b.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=b.kerning[n]||0,E=b.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(m),h.width+=E}n=m}return c(),t.align==="center"?oF(s):t.align==="right"?nF(s):t.align==="justify"&&aF(s),s}function oF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function nF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function aF(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,l=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===o&&(o=i.spacesIndex[s++],n+=l),i.charPositions[c]+=n}}var gm=x(()=>{"use strict"});var Uc,xm,ca,ym=x(()=>{Ai();Ht();wt();cs();FT();gm();pm();Uc=0,xm=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 i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!bt.has(i)){let n=new mm({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Uc++,Uc>50&&O("BitmapText",`You have dynamically created ${Uc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Uc--,bt.remove(i)}),bt.set(i,n)}let o=bt.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return Gc([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}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},W(Q,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Mt?s:new Mt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new mm({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=kc(e.chars);return a.ensureCharacters(h.join("")),bt.set(`${i}-bitmap`,a),a.once("destroy",()=>bt.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=bt.get(e);i&&i.destroy()}},ca=new xm});function kT(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var ua,GT=x(()=>{Ai();C();Me();cm();MT();ym();gm();ua=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 i=this._getGpuBitmapText(t);kT(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(J.return(e.customShader),e.customShader=null),J.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);kT(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ca.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=J.get(Fc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=Gc(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),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<h.lines.length;m++){let g=h.lines[m];for(let b=0;b<g.charPositions.length;b++){let y=o[l++],_=s.chars[y];_?.texture&&i.texture(_.texture,p||"black",Math.round(g.charPositions[b]+_.xOffset),Math.round(a+_.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=J.get(he);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,i=t._style.fontFamily,s=bt.get(`${i}-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}};ua.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"bitmapText"}});var _m=x(()=>{C();GT();k.add(ua)});var da,UT=x(()=>{C();_t();Me();ia();Vp();da=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,sa(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;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(),sa(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:A.EMPTY,currentKey:"--",batchableSprite:J.get(Hr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=A.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.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}};da.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"htmlText"}});function OT(){let{userAgent:r}=z.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var LT=x(()=>{Rt()});var DT,NT,_o,bm=x(()=>{"use strict";DT="http://www.w3.org/2000/svg",NT="http://www.w3.org/1999/xhtml",_o=class{constructor(){this.svgRoot=document.createElementNS(DT,"svg"),this.foreignObject=document.createElementNS(DT,"foreignObject"),this.domElement=document.createElementNS(NT,"div"),this.styleElement=document.createElementNS(NT,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function WT(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${rt.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[$T(t)]:[],...r.dropShadow?[zT(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return hF(r.tagStyles,s),s.join(" ")}function zT(r){let t=rt.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function $T(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${rt.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${rt.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function hF(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)VT[o]?s.push(VT[o](i[o])):HT[o]&&s.push(HT[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var HT,VT,XT=x(()=>{ye();HT={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"},VT={fill:r=>`color: ${rt.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:$T,dropShadow:zT}});var Oc,jT=x(()=>{wt();cs();sm();XT();Oc=class r extends Mt{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=Mc(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({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=WT(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function YT(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(h){s[h]||(i.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 i}var qT=x(()=>{"use strict"});async function KT(r){let e=await(await z.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var ZT=x(()=>{Rt()});async function vm(r,t){let e=await KT(t);return`@font-face {
468
+ `)o.width!==0&&c();else if(!g){let E=b.xAdvance+(b.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=b.kerning[n]||0,E=b.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(m),h.width+=E}n=m}return c(),t.align==="center"?oF(s):t.align==="right"?nF(s):t.align==="justify"&&aF(s),s}function oF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function nF(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function aF(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,l=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===o&&(o=i.spacesIndex[s++],n+=l),i.charPositions[c]+=n}}var gm=x(()=>{"use strict"});var Uc,xm,ca,ym=x(()=>{Ai();Ht();wt();cs();FT();gm();pm();Uc=0,xm=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 i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!bt.has(i)){let n=new mm({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Uc++,Uc>50&&O("BitmapText",`You have dynamically created ${Uc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Uc--,bt.remove(i)}),bt.set(i,n)}let o=bt.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return Gc([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}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},z(J,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Mt?s:new Mt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new mm({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=kc(e.chars);return a.ensureCharacters(h.join("")),bt.set(`${i}-bitmap`,a),a.once("destroy",()=>bt.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=bt.get(e);i&&i.destroy()}},ca=new xm});function kT(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var ua,GT=x(()=>{Ai();P();Me();cm();MT();ym();gm();ua=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 i=this._getGpuBitmapText(t);kT(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(tt.return(e.customShader),e.customShader=null),tt.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);kT(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ca.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=tt.get(Fc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=Gc(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),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<h.lines.length;m++){let g=h.lines[m];for(let b=0;b<g.charPositions.length;b++){let y=o[l++],_=s.chars[y];_?.texture&&i.texture(_.texture,p||"black",Math.round(g.charPositions[b]+_.xOffset),Math.round(a+_.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=tt.get(he);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,i=t._style.fontFamily,s=bt.get(`${i}-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}};ua.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"bitmapText"}});var _m=x(()=>{P();GT();k.add(ua)});var da,UT=x(()=>{P();_t();Me();ia();Vp();da=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),tt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,sa(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;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(),sa(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:A.EMPTY,currentKey:"--",batchableSprite:tt.get(Hr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=A.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.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}};da.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"htmlText"}});function OT(){let{userAgent:r}=$.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var LT=x(()=>{Rt()});var DT,NT,_o,bm=x(()=>{"use strict";DT="http://www.w3.org/2000/svg",NT="http://www.w3.org/1999/xhtml",_o=class{constructor(){this.svgRoot=document.createElementNS(DT,"svg"),this.foreignObject=document.createElementNS(DT,"foreignObject"),this.domElement=document.createElementNS(NT,"div"),this.styleElement=document.createElementNS(NT,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function WT(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${rt.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[$T(t)]:[],...r.dropShadow?[zT(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return hF(r.tagStyles,s),s.join(" ")}function zT(r){let t=rt.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function $T(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${rt.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${rt.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function hF(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)VT[o]?s.push(VT[o](i[o])):HT[o]&&s.push(HT[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var HT,VT,XT=x(()=>{ye();HT={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"},VT={fill:r=>`color: ${rt.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:$T,dropShadow:zT}});var Oc,jT=x(()=>{wt();cs();sm();XT();Oc=class r extends Mt{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=Mc(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({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=WT(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function YT(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(h){s[h]||(i.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 i}var qT=x(()=>{"use strict"});async function KT(r){let e=await(await $.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var ZT=x(()=>{Rt()});async function vm(r,t){let e=await KT(t);return`@font-face {
469
469
  font-family: "${r.fontFamily}";
470
470
  src: url('${e}');
471
471
  font-weight: ${r.fontWeight};
472
472
  font-style: ${r.fontStyle};
473
473
  }`}var QT=x(()=>{ZT()});async function JT(r,t,e){let i=r.filter(s=>bt.has(`${s}-and-url`)).map((s,o)=>{if(!Lc.has(s)){let{url:n}=bt.get(`${s}-and-url`);o===0?Lc.set(s,vm({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):Lc.set(s,vm({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return Lc.get(s)});return(await Promise.all(i)).join(`
474
- `)}var Lc,tS=x(()=>{Ai();QT();Lc=new Map});function eS(r,t,e,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var rS=x(()=>{"use strict"});function iS(r,t){let e=$e.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}var sS=x(()=>{uo()});function oS(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}var nS=x(()=>{"use strict"});function hS(r,t,e,i){i||(i=aS||(aS=new _o));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</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 aS,lS=x(()=>{bm()});var bo,cS=x(()=>{C();uo();vi();Dr();LT();wt();Me();nm();bm();jT();qT();tS();rS();sS();nS();lS();bo=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===ee.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,i){let s=J.get(_o),o=YT(t,i),n=await JT(o,i,Oc.defaultTextStyle),a=hS(t,i,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let d=eS(t,i,e,n,s);await oS(c,d,OT()&&o.length>0);let f=c,p;this._createCanvas&&(p=iS(c,e));let m=Bc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(m.source),$e.returnCanvasAndContext(p)),J.return(s),m}_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(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{O("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){Vt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};bo.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"htmlText"};bo.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Tm=x(()=>{C();UT();cS();k.add(bo);k.add(da)});var uS,vo,Dc=x(()=>{Ci();oi();Zs();Ht();uS=class dS extends nr{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(W(Q,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...dS.defaultOptions,...e};let i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(i.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 $t({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),h=new $t({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),l=new $t({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}};uS.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};vo=uS});var ds,fS,To,So=x(()=>{"use strict";ds={name:"local-uniform-bit",vertex:{header:`
474
+ `)}var Lc,tS=x(()=>{Ai();QT();Lc=new Map});function eS(r,t,e,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var rS=x(()=>{"use strict"});function iS(r,t){let e=$e.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}var sS=x(()=>{uo()});function oS(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}var nS=x(()=>{"use strict"});function hS(r,t,e,i){i||(i=aS||(aS=new _o));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</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 aS,lS=x(()=>{bm()});var bo,cS=x(()=>{P();uo();vi();Dr();LT();wt();Me();nm();bm();jT();qT();tS();rS();sS();nS();lS();bo=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===ee.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,i){let s=tt.get(_o),o=YT(t,i),n=await JT(o,i,Oc.defaultTextStyle),a=hS(t,i,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let d=eS(t,i,e,n,s);await oS(c,d,OT()&&o.length>0);let f=c,p;this._createCanvas&&(p=iS(c,e));let m=Bc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(m.source),$e.returnCanvasAndContext(p)),tt.return(s),m}_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(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{O("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){Vt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};bo.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"htmlText"};bo.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Tm=x(()=>{P();UT();cS();k.add(bo);k.add(da)});var uS,vo,Dc=x(()=>{Ci();oi();Zs();Ht();uS=class dS extends nr{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(z(J,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...dS.defaultOptions,...e};let i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(i.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 $t({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:nt.VERTEX|nt.COPY_DST}),h=new $t({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:nt.VERTEX|nt.COPY_DST}),l=new $t({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:nt.INDEX|nt.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}};uS.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};vo=uS});var ds,fS,To,So=x(()=>{"use strict";ds={name:"local-uniform-bit",vertex:{header:`
475
475
 
476
476
  struct LocalUniforms {
477
477
  uTransformMatrix:mat3x3<f32>,
@@ -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 Sm,Em,Nc,xS=x(()=>{ft();Mi();So();Bi();vr();Fe();_t();gS();Nc=class extends Xt{constructor(){Sm??(Sm=Gr({name:"tiling-sprite-shader",bits:[ds,pS,Or]})),Em??(Em=Ur({name:"tiling-sprite-shader",bits:[To,mS,Lr]}));let t=new At({uMapCoord:{value:new I,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 I,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Em,gpuProgram:Sm,resources:{localUniforms:new At({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:A.EMPTY.source,uSampler:A.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*h/t,i.b*h/e,i.c*l/t,i.d*l/e,i.tx/t,i.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 Hc,yS=x(()=>{Dc();Hc=class extends vo{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 _S(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var bS=x(()=>{"use strict"});function vS(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,h=i.c,l=i.d,c=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+h*f+c,r[e+1]=a*d+l*f+u,e+=t,s++}}var TS=x(()=>{"use strict"});function SS(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=I.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),vS(t,2,0,a)}var ES=x(()=>{ft();TS()});var Vc,fa,wS=x(()=>{C();zn();Tr();Dr();lo();mc();Dc();xS();yS();bS();ES();Vc=new Hc,fa=class{constructor(t){this._state=Yt.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),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ii);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,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Nc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=si(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Vc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){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 vo({indices:Vc.indices,positions:Vc.positions.slice(),uvs:Vc.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:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),SS(t,i.uvs),_S(t,i.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),i=t.texture,s=!0;return this._renderer.type===ee.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};fa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"tilingSprite"}});var wm=x(()=>{C();wS();k.add(fa)});var AS,CS,RS=x(()=>{Ht();Dc();AS=class PS extends vo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(W(Q,"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={...PS.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,i=[],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;i.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,m=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,b,g)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};AS.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};CS=AS});var MS,IS,FS=x(()=>{RS();MS=class BS extends CS{constructor(t={}){t={...BS.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:i,_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=i>d?1:i/d,p=Math.min(u,f),m=h*e,g=l*i;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*p-g,t[17]=t[19]=t[21]=t[23]=i-a*p-g,t[25]=t[27]=t[29]=t[31]=i-g,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,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};MS.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};IS=MS});var pa,kS=x(()=>{C();Me();mc();FS();pa=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];J.return(e.geometry),J.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=J.get(Ii);return e.geometry=J.get(IS),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}};pa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"nineSliceSprite"}});var Am=x(()=>{C();kS();k.add(pa)});var ma,GS=x(()=>{C();ma=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.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}};ma.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"filter"}});function US(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var OS=x(()=>{"use strict"});var lF,ga,LS=x(()=>{C();ft();sr();Pi();Zs();Fe();_t();vi();Dr();Ne();OS();wt();lF=new nr({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])}),ga=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new At({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 me({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?US(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<i.length;f++){let p=i[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)){O("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=Vt.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 i=e.inputTexture,s=e.bounds,o=A.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(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),Vt.returnTexture(i);else{let a=e.inputTexture,h=Vt.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),Vt.returnTexture(a),Vt.returnTexture(h)}e.blendRequired&&Vt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=Vt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.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,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=ht.shared,c=n.previousRenderSurface===i,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,m=p.uOutputFrame,g=p.uInputSize,b=p.uInputPixel,y=p.uInputClamp,_=p.uGlobalFrame,T=p.uOutputTexture;if(c){let w=this._filterStackIndex;for(;w>0;){w--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){h.x=M.bounds.minX,h.y=M.bounds.minY;break}}m[0]=a.minX-h.x,m[1]=a.minY-h.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[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*g[2]-.5*b[2],y[3]=e.frame.height*g[3]-.5*b[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;_[0]=h.x*u,_[1]=h.y*u,_[2]=E.source.width*u,_[3]=E.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof A?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.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:lF,shader:t,state:t._state,topology:"triangle-list"}),o.type===ee.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Et,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(I.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}};ga.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"filter"}});var Pm=x(()=>{C();GS();LS();k.add(ga);k.add(ma)});var cF={};var DS=x(()=>{H_();Mf();q_();Z_();zl();Kl();Up();Op();Hp();lm();_m();Tm();wm();Am();Pm()});var uF={};var HS=x(()=>{Mf();zl();Kl();Up();Op();Hp();lm();_m();Tm();wm();Am();Pm()});var WS,zS,$S=x(()=>{ss();Js();vr();Tr();WS=class Cm extends Xt{constructor(t){t={...Cm.defaultOptions,...t},super(t),this.enabled=!0,this._state=Yt.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,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=ar.from(i)),new Cm({gpuProgram:o,glProgram:n,...s})}};WS.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};zS=WS});async function XS(r){if(!r)for(let t=0;t<Rm.length;t++){let e=Rm[t];if(e.value.test()){await e.value.load();return}}}var Rm,jS=x(()=>{C();Rm=[];k.handleByNamedList(v.Environment,Rm)});function Wc(){if(typeof xa=="boolean")return xa;try{xa=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{xa=!1}return xa}var xa,Mm=x(()=>{"use strict"});var ge,Eo=x(()=>{"use strict";ge=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(ge||{})});var wo,Bm=x(()=>{"use strict";wo=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,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,i,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 dF,YS,ki,ya=x(()=>{ye();jS();_r();Mm();Ht();Eo();Bm();Ee();dF=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],YS=class qS extends Ct{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=[...dF,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await XS(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...qS.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof xt&&(i={container:i},e&&(W(Q,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:rt.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ge.ALL);let{clear:i,clearColor:s,target:o}=t;rt.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,rt.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 wo(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[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(!Wc())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()}};YS.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};ki=YS});var _a,QS=x(()=>{C();ft();rs();Jl();Mi();jn();Yn();So();Bi();vr();Fe();_a=class{init(){let t=new At({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Gr({name:"graphics",bits:[to,ro(or()),fS,Or]});this.shader=new Xt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(i),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 m=d[p];if(m.topology!==f&&(f=m.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let g=m.textures;m.bindGroup=Ks(g.textures,g.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,m.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};_a.extension={type:[v.WebGPUPipesAdaptor],name:"graphics"}});var JS,tE,Im=x(()=>{"use strict";JS={name:"texture-bit",vertex:{header:`
569
+ `}}});var Sm,Em,Nc,xS=x(()=>{ft();Mi();So();Bi();vr();Fe();_t();gS();Nc=class extends Xt{constructor(){Sm??(Sm=Gr({name:"tiling-sprite-shader",bits:[ds,pS,Or]})),Em??(Em=Ur({name:"tiling-sprite-shader",bits:[To,mS,Lr]}));let t=new At({uMapCoord:{value:new I,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 I,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Em,gpuProgram:Sm,resources:{localUniforms:new At({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:A.EMPTY.source,uSampler:A.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*h/t,i.b*h/e,i.c*l/t,i.d*l/e,i.tx/t,i.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 Hc,yS=x(()=>{Dc();Hc=class extends vo{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 _S(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var bS=x(()=>{"use strict"});function vS(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,h=i.c,l=i.d,c=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+h*f+c,r[e+1]=a*d+l*f+u,e+=t,s++}}var TS=x(()=>{"use strict"});function SS(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=I.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),vS(t,2,0,a)}var ES=x(()=>{ft();TS()});var Vc,fa,wS=x(()=>{P();zn();Tr();Dr();lo();mc();Dc();xS();yS();bS();ES();Vc=new Hc,fa=class{constructor(t){this._state=Yt.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),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ii);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,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Nc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=si(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Vc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){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 vo({indices:Vc.indices,positions:Vc.positions.slice(),uvs:Vc.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:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),SS(t,i.uvs),_S(t,i.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),i=t.texture,s=!0;return this._renderer.type===ee.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};fa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"tilingSprite"}});var wm=x(()=>{P();wS();k.add(fa)});var AS,CS,RS=x(()=>{Ht();Dc();AS=class PS extends vo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(z(J,"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={...PS.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,i=[],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;i.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,m=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,b,g)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};AS.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};CS=AS});var MS,IS,FS=x(()=>{RS();MS=class BS extends CS{constructor(t={}){t={...BS.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:i,_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=i>d?1:i/d,p=Math.min(u,f),m=h*e,g=l*i;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*p-g,t[17]=t[19]=t[21]=t[23]=i-a*p-g,t[25]=t[27]=t[29]=t[31]=i-g,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,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};MS.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};IS=MS});var pa,kS=x(()=>{P();Me();mc();FS();pa=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];tt.return(e.geometry),tt.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=tt.get(Ii);return e.geometry=tt.get(IS),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}};pa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"nineSliceSprite"}});var Am=x(()=>{P();kS();k.add(pa)});var ma,GS=x(()=>{P();ma=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.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}};ma.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"filter"}});function US(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var OS=x(()=>{"use strict"});var lF,ga,LS=x(()=>{P();ft();sr();Pi();Zs();Fe();_t();vi();Dr();Ne();OS();wt();lF=new nr({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])}),ga=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new At({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 me({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?US(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<i.length;f++){let p=i[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)){O("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=Vt.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 i=e.inputTexture,s=e.bounds,o=A.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(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),Vt.returnTexture(i);else{let a=e.inputTexture,h=Vt.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),Vt.returnTexture(a),Vt.returnTexture(h)}e.blendRequired&&Vt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=Vt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.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,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=ht.shared,c=n.previousRenderSurface===i,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,m=p.uOutputFrame,g=p.uInputSize,b=p.uInputPixel,y=p.uInputClamp,_=p.uGlobalFrame,T=p.uOutputTexture;if(c){let w=this._filterStackIndex;for(;w>0;){w--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){h.x=M.bounds.minX,h.y=M.bounds.minY;break}}m[0]=a.minX-h.x,m[1]=a.minY-h.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[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*g[2]-.5*b[2],y[3]=e.frame.height*g[3]-.5*b[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;_[0]=h.x*u,_[1]=h.y*u,_[2]=E.source.width*u,_[3]=E.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof A?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.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:lF,shader:t,state:t._state,topology:"triangle-list"}),o.type===ee.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Et,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(I.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}};ga.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"filter"}});var Pm=x(()=>{P();GS();LS();k.add(ga);k.add(ma)});var cF={};var DS=x(()=>{H_();Mf();q_();Z_();zl();Kl();Up();Op();Hp();lm();_m();Tm();wm();Am();Pm()});var uF={};var HS=x(()=>{Mf();zl();Kl();Up();Op();Hp();lm();_m();Tm();wm();Am();Pm()});var WS,zS,$S=x(()=>{ss();Js();vr();Tr();WS=class Cm extends Xt{constructor(t){t={...Cm.defaultOptions,...t},super(t),this.enabled=!0,this._state=Yt.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,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=ar.from(i)),new Cm({gpuProgram:o,glProgram:n,...s})}};WS.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};zS=WS});async function XS(r){if(!r)for(let t=0;t<Rm.length;t++){let e=Rm[t];if(e.value.test()){await e.value.load();return}}}var Rm,jS=x(()=>{P();Rm=[];k.handleByNamedList(v.Environment,Rm)});function Wc(){if(typeof xa=="boolean")return xa;try{xa=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{xa=!1}return xa}var xa,Mm=x(()=>{"use strict"});var ge,Eo=x(()=>{"use strict";ge=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(ge||{})});var wo,Bm=x(()=>{"use strict";wo=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,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,i,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 dF,YS,ki,ya=x(()=>{ye();jS();_r();Mm();Ht();Eo();Bm();Ee();dF=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],YS=class qS extends Ct{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=[...dF,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await XS(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...qS.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof xt&&(i={container:i},e&&(z(J,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:rt.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ge.ALL);let{clear:i,clearColor:s,target:o}=t;rt.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,rt.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 wo(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[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(!Wc())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()}};YS.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};ki=YS});var _a,QS=x(()=>{P();ft();rs();Jl();Mi();jn();Yn();So();Bi();vr();Fe();_a=class{init(){let t=new At({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Gr({name:"graphics",bits:[to,ro(or()),fS,Or]});this.shader=new Xt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(i),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 m=d[p];if(m.topology!==f&&(f=m.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let g=m.textures;m.bindGroup=Ks(g.textures,g.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,m.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};_a.extension={type:[v.WebGPUPipesAdaptor],name:"graphics"}});var JS,tE,Im=x(()=>{"use strict";JS={name:"texture-bit",vertex:{header:`
570
570
 
571
571
  struct TextureUniforms {
572
572
  uTextureMatrix:mat3x3<f32>,
@@ -592,7 +592,7 @@ fn mainFragment(
592
592
 
593
593
  `,main:`
594
594
  outColor = texture(uTexture, vUV);
595
- `}}});var ba,eE=x(()=>{C();ft();Mi();So();Bi();Im();vr();_t();wt();ba=class{init(){let t=Gr({name:"mesh",bits:[ds,JS,Or]});this._shader=new Xt({gpuProgram:t,resources:{uTexture:A.EMPTY._source,uSampler:A.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new I}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){O("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ba.extension={type:[v.WebGPUPipesAdaptor],name:"mesh"}});var Xc,va,rE=x(()=>{C();Tr();Jl();Xc=Yt.for2d(),va=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,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 i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Ks(h.textures,h.count)}Xc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,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)}};va.extension={type:[v.WebGPUPipesAdaptor],name:"batch"}});var Ta,iE=x(()=>{C();Ta=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}};Ta.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"}});function Sa(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=i[s];t[o.renderPipeId].execute(o)}}var Fm=x(()=>{"use strict"});var fF,Ea,sE=x(()=>{C();ft();Me();ia();Fm();fF=new I,Ea=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&&(J.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=J.get(Hr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=fF.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}),Sa(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}),Sa(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ea.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"}});function wa(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}var km=x(()=>{"use strict"});function Gm(r,t=!1){mF(r);let e=r.childrenToUpdate,i=r.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===r&&c.relativeRenderGroupDepth===o&&aE(c,i,0)}wa(a,h),n.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Gm(r.renderGroupChildren[s],t)}function mF(r){let t=r.root,e;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Os(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function aE(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&oE&&nE(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&oE&&nE(r,pF,e)),!r.renderGroup){let o=r.children,n=o.length;for(let l=0;l<n;l++)aE(o[l],t,e);let a=r.parentRenderGroup,h=r;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function nE(r,t,e){if(e&Hs){r.groupColor=Os(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&Rn&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Ji&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var pF,oE,hE=x(()=>{_r();km();cf();pF=new xt,oE=Ji|Hs|Rn});function lE(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var cE=x(()=>{"use strict"});var gF,Aa,uE=x(()=>{C();ft();vi();Ne();km();Fm();hE();cE();gF=new I,Aa=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=gF;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}),Sa(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,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 i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&Vt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Vt.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new Et),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Vt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?wa(t.childrenRenderablesToUpdate.list,0):lE(t,i),Gm(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:i}=t.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}wa(e,i)}_buildInstructions(t,e){let i=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(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Aa.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"}});var Pa,dE=x(()=>{C();Me();ia();Pa=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];J.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=J.get(Hr);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)J.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Pa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"}});var Ao,Um=x(()=>{Ee();Ao="8.9.2"});var Ca,Ra,Om=x(()=>{C();Um();Ca=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Ao)}static destroy(){}};Ca.extension=v.Application;Ra=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Ao)}destroy(){this._renderer=null}};Ra.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"initHook",priority:-10}});var Lm,Dm,pE=x(()=>{C();Tr();mp();Lm=class fE{constructor(t,e){this.state=Yt.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 qn)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=fE.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],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 i in e){let s=e[i],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,i=e.geometry,s=e.shader;this._adaptor.start(this,i,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}};Lm.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"batch"};Lm._availableBatchers=Object.create(null);Dm=Lm;k.handleByMap(v.Batcher,Dm._availableBatchers);k.add(qn)});var mE,gE=x(()=>{mE=`in vec2 vMaskCoord;
595
+ `}}});var ba,eE=x(()=>{P();ft();Mi();So();Bi();Im();vr();_t();wt();ba=class{init(){let t=Gr({name:"mesh",bits:[ds,JS,Or]});this._shader=new Xt({gpuProgram:t,resources:{uTexture:A.EMPTY._source,uSampler:A.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new I}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){O("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ba.extension={type:[v.WebGPUPipesAdaptor],name:"mesh"}});var Xc,va,rE=x(()=>{P();Tr();Jl();Xc=Yt.for2d(),va=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,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 i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Ks(h.textures,h.count)}Xc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,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)}};va.extension={type:[v.WebGPUPipesAdaptor],name:"batch"}});var Ta,iE=x(()=>{P();Ta=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}};Ta.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"}});function Sa(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=i[s];t[o.renderPipeId].execute(o)}}var Fm=x(()=>{"use strict"});var fF,Ea,sE=x(()=>{P();ft();Me();ia();Fm();fF=new I,Ea=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&&(tt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=tt.get(Hr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=fF.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}),Sa(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}),Sa(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ea.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"}});function wa(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}var km=x(()=>{"use strict"});function Gm(r,t=!1){mF(r);let e=r.childrenToUpdate,i=r.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===r&&c.relativeRenderGroupDepth===o&&aE(c,i,0)}wa(a,h),n.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Gm(r.renderGroupChildren[s],t)}function mF(r){let t=r.root,e;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Os(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function aE(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&oE&&nE(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&oE&&nE(r,pF,e)),!r.renderGroup){let o=r.children,n=o.length;for(let l=0;l<n;l++)aE(o[l],t,e);let a=r.parentRenderGroup,h=r;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function nE(r,t,e){if(e&Hs){r.groupColor=Os(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&Rn&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Ji&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var pF,oE,hE=x(()=>{_r();km();cf();pF=new xt,oE=Ji|Hs|Rn});function lE(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var cE=x(()=>{"use strict"});var gF,Aa,uE=x(()=>{P();ft();vi();Ne();km();Fm();hE();cE();gF=new I,Aa=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=gF;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}),Sa(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,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 i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&Vt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Vt.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new Et),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Vt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?wa(t.childrenRenderablesToUpdate.list,0):lE(t,i),Gm(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:i}=t.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}wa(e,i)}_buildInstructions(t,e){let i=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(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Aa.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"}});var Pa,dE=x(()=>{P();Me();ia();Pa=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];tt.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=tt.get(Hr);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)tt.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Pa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"}});var Ao,Um=x(()=>{Ee();Ao="8.9.2"});var Ca,Ra,Om=x(()=>{P();Um();Ca=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Ao)}static destroy(){}};Ca.extension=v.Application;Ra=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Ao)}destroy(){this._renderer=null}};Ra.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"initHook",priority:-10}});var Lm,Dm,pE=x(()=>{P();Tr();mp();Lm=class fE{constructor(t,e){this.state=Yt.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 qn)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=fE.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],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 i in e){let s=e[i],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,i=e.geometry,s=e.shader;this._adaptor.start(this,i,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}};Lm.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"batch"};Lm._availableBatchers=Object.create(null);Dm=Lm;k.handleByMap(v.Batcher,Dm._availableBatchers);k.add(qn)});var mE,gE=x(()=>{mE=`in vec2 vMaskCoord;
596
596
  in vec2 vTextureCoord;
597
597
 
598
598
  uniform sampler2D uTexture;
@@ -761,9 +761,9 @@ fn mainFragment(
761
761
 
762
762
  return source * a;
763
763
  }
764
- `});var jc,bE=x(()=>{ft();ss();Js();Fe();bf();$S();gE();yE();_E();jc=class extends zS{constructor(t){let{sprite:e,...i}=t,s=new Ns(e.texture),o=new At({uFilterMatrix:{value:new I,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=hr.from({vertex:{source:Nm,entryPoint:"mainVertex"},fragment:{source:Nm,entryPoint:"mainFragment"}}),a=ar.from({vertex:xE,fragment:mE,name:"mask-filter"});super({...i,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,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var xF,Hm,Ma,vE=x(()=>{C();Al();bE();Ne();An();Dn();Me();_t();vi();Dr();xF=new Et,Hm=class extends Jr{constructor(){super(),this.filters=[new jc({sprite:new kt(A.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}},Ma=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=J.get(Hm);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=Us(t.mask.mask,!0,xF);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Vt.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];i&&(e.type===ee.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();i&&Vt.returnTexture(s.filterTexture),J.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Ma.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"alphaMask"}});var Ba,TE=x(()=>{C();Ba=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,i){this._renderer.renderPipes.batch.break(i);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,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Ba.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"colorMask"}});var Ia,SE=x(()=>{C();Eo();is();Ia=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.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=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=i.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.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++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(It.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(It.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(It.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,ge.STENCIL),i.stencil.setStencilMode(It.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(It.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Ia.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"stencilMask"}});var Vm,wE,AE=x(()=>{ye();C();Vm=class EE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new rt(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...EE.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(){}};Vm.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0};Vm.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};wE=Vm});var Fa,ka,PE=x(()=>{C();Al();wt();Fa={};k.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Fa[r.name]=r.ref},r=>{delete Fa[r.name]});ka=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,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Fa[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!Fa[e]){O(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new Jr,i.filters=[new Fa[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,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}};ka.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"}});var Wm,zm,RE,ME=x(()=>{C();_r();_t();Wm={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},zm=class CE{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof xt||t instanceof A?{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,CE.defaultImageOptions);let{format:e,quality:i}=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)},Wm[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Wm[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Wm[e],quality:i});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,i=this._renderer;if(e instanceof A)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof A?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof xt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof A?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.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}};zm.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"};zm.defaultImageOptions={format:"png",quality:1};RE=zm});var Yc,BE=x(()=>{He();_t();Yc=class r extends A{static create(t){return new r({source:new Tt(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var yF,_F,bF,Ga,IE=x(()=>{ye();C();ft();fe();Ne();Bl();_r();BE();yF=new st,_F=new Et,bF=[0,0,0,0],Ga=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof xt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:rt.shared.setValue(o).toArray():o=bF;let n=t.frame?.copyTo(yF)||Ls(s,_F).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:i}),h=I.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}};Ga.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"}});var Ua,FE=x(()=>{C();ft();sr();lo();Pi();Dr();Fe();Ua=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:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new I,worldColor:4294967295,offset:new ht},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:i||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,Nr(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 me,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===ee.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 At({uProjectionMatrix:{value:new I,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new I,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Ua.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"}});var vF,Oa,kE=x(()=>{C();zs();vF=1,Oa=class{constructor(){this._tasks=[],this._offset=0}init(){ne.system.add(this._update,this)}repeat(t,e,i=!0){let s=vF++,o=0;return i&&(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 i=this._tasks[e];if(t-i.offset-i.last>=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){ne.system.remove(this._update,this),this._tasks.length=0}};Oa.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0}});function UE(r){if(!GE){if(z.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Ao} (${r}) http://www.pixijs.com/
764
+ `});var jc,bE=x(()=>{ft();ss();Js();Fe();bf();$S();gE();yE();_E();jc=class extends zS{constructor(t){let{sprite:e,...i}=t,s=new Ns(e.texture),o=new At({uFilterMatrix:{value:new I,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=hr.from({vertex:{source:Nm,entryPoint:"mainVertex"},fragment:{source:Nm,entryPoint:"mainFragment"}}),a=ar.from({vertex:xE,fragment:mE,name:"mask-filter"});super({...i,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,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var xF,Hm,Ma,vE=x(()=>{P();Al();bE();Ne();An();Dn();Me();_t();vi();Dr();xF=new Et,Hm=class extends Jr{constructor(){super(),this.filters=[new jc({sprite:new kt(A.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}},Ma=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=tt.get(Hm);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=Us(t.mask.mask,!0,xF);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Vt.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];i&&(e.type===ee.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();i&&Vt.returnTexture(s.filterTexture),tt.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Ma.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"alphaMask"}});var Ba,TE=x(()=>{P();Ba=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,i){this._renderer.renderPipes.batch.break(i);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,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Ba.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"colorMask"}});var Ia,SE=x(()=>{P();Eo();is();Ia=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.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=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=i.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.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++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(It.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(It.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(It.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,ge.STENCIL),i.stencil.setStencilMode(It.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(It.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Ia.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"stencilMask"}});var Vm,wE,AE=x(()=>{ye();P();Vm=class EE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new rt(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...EE.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(){}};Vm.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0};Vm.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};wE=Vm});var Fa,ka,PE=x(()=>{P();Al();wt();Fa={};k.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Fa[r.name]=r.ref},r=>{delete Fa[r.name]});ka=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,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Fa[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!Fa[e]){O(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new Jr,i.filters=[new Fa[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,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}};ka.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"}});var Wm,zm,RE,ME=x(()=>{P();_r();_t();Wm={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},zm=class CE{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof xt||t instanceof A?{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,CE.defaultImageOptions);let{format:e,quality:i}=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)},Wm[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Wm[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Wm[e],quality:i});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,i=this._renderer;if(e instanceof A)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof A?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof xt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof A?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.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}};zm.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"};zm.defaultImageOptions={format:"png",quality:1};RE=zm});var Yc,BE=x(()=>{He();_t();Yc=class r extends A{static create(t){return new r({source:new Tt(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var yF,_F,bF,Ga,IE=x(()=>{ye();P();ft();fe();Ne();Bl();_r();BE();yF=new ot,_F=new Et,bF=[0,0,0,0],Ga=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof xt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:rt.shared.setValue(o).toArray():o=bF;let n=t.frame?.copyTo(yF)||Ls(s,_F).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:i}),h=I.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}};Ga.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"}});var Ua,FE=x(()=>{P();ft();sr();lo();Pi();Dr();Fe();Ua=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:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new I,worldColor:4294967295,offset:new ht},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:i||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,Nr(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 me,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===ee.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 At({uProjectionMatrix:{value:new I,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new I,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Ua.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"}});var vF,Oa,kE=x(()=>{P();zs();vF=1,Oa=class{constructor(){this._tasks=[],this._offset=0}init(){ne.system.add(this._update,this)}repeat(t,e,i=!0){let s=vF++,o=0;return i&&(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 i=this._tasks[e];if(t-i.offset-i.last>=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){ne.system.remove(this._update,this),this._tasks.length=0}};Oa.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0}});function UE(r){if(!GE){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Ao} (${r}) 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 ${Ao} - ${r} - http://www.pixijs.com/`);GE=!0}}var GE,OE=x(()=>{Rt();Um();GE=!1});var Po,LE=x(()=>{C();OE();Dr();Po=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===ee.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),UE(e)}}};Po.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"hello",priority:-2};Po.defaultOptions={hello:!1}});function DE(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function NE(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var HE=x(()=>{"use strict"});var TF,$m,WE,zE=x(()=>{C();HE();TF=0,$m=class VE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...VE.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]=DE(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)NE(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=TF++,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,i=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=i;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 i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};$m.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"renderableGC",priority:0};$m.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};WE=$m});var Xm,XE,jE=x(()=>{C();Xm=class $E{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...$E.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 i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Xm.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGC"};Xm.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};XE=Xm});var YE,La,jm=x(()=>{be();He();_t();YE=class qE{constructor(t={}){if(this.uid=at("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...qE.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 Tt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.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 A||t.depthStencilTexture instanceof Tt?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 Tt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};YE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};La=YE});function qc(r,t){if(!Da.has(r)){let e=new A({source:new we({resource:r,...t})}),i=()=>{Da.get(r)===e&&Da.delete(r)};e.once("destroy",i),e.source.once("destroy",i),Da.set(r,e)}return Da.get(r)}var Da,Ym=x(()=>{Xs();_t();Da=new Map});var qm,ZE,QE=x(()=>{Rt();C();fe();Ht();jm();Ym();qm=class KE{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={...KE.defaultOptions,...t},t.view&&(W(Q,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new st(0,0,t.width,t.height),this.canvas=t.canvas||z.get().createCanvas(),this.antialias=!!t.antialias,this.texture=qc(this.canvas,t),this.renderTarget=new La({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};qm.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"view",priority:0};qm.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};ZE=qm});var Kc,Zc,Km=x(()=>{iE();sE();uE();dE();Om();pE();vE();TE();SE();AE();PE();ME();IE();FE();kE();LE();zE();jE();QE();Kc=[wE,Ua,Po,ZE,Aa,XE,Ga,RE,Ra,WE,Oa],Zc=[ka,Dm,Pa,Ea,Ma,Ia,Ba,Ta]});var Na,JE=x(()=>{C();Na=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,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],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[i],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}};Na.extension={type:[v.WebGPUSystem],name:"bindGroup"}});var Ha,tw=x(()=>{C();Qf();Ha=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),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(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}};Ha.extension={type:[v.WebGPUSystem],name:"buffer"}});var Va,ew=x(()=>{C();Va=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}};Va.extension={type:[v.WebGPUSystem],name:"colorMask"}});var Co,rw=x(()=>{Rt();C();Co=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 z.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Co.extension={type:[v.WebGPUSystem],name:"device"};Co.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Wa,iw=x(()=>{C();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,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,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,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,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,i={...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 i)this._setVertexBuffer(a,i[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:[v.WebGPUSystem],name:"encoder",priority:1}});var za,sw=x(()=>{C();is();za=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:It.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.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}};za.extension={type:[v.WebGPUSystem],name:"stencil"}});var Ro,Zm=x(()=>{Mm();Ci();oi();Ro=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Wc())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 $t({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,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new $t({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),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!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 ow(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i<t.length;i++){let s=t[i],o=$a[s.data.type].size,n=$a[s.data.type].align;if(!$a[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 $a,Qm=x(()=>{"use strict";$a={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 li,Jm=x(()=>{"use strict";li=[{type:"mat3x3<f32>",test:r=>r.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 ${Ao} - ${r} - http://www.pixijs.com/`);GE=!0}}var GE,OE=x(()=>{Rt();Um();GE=!1});var Po,LE=x(()=>{P();OE();Dr();Po=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===ee.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),UE(e)}}};Po.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"hello",priority:-2};Po.defaultOptions={hello:!1}});function DE(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function NE(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var HE=x(()=>{"use strict"});var TF,$m,WE,zE=x(()=>{P();HE();TF=0,$m=class VE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...VE.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]=DE(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)NE(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=TF++,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,i=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=i;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 i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};$m.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"renderableGC",priority:0};$m.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};WE=$m});var Xm,XE,jE=x(()=>{P();Xm=class $E{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...$E.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 i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Xm.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGC"};Xm.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};XE=Xm});var YE,La,jm=x(()=>{be();He();_t();YE=class qE{constructor(t={}){if(this.uid=at("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...qE.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 Tt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.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 A||t.depthStencilTexture instanceof Tt?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 Tt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};YE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};La=YE});function qc(r,t){if(!Da.has(r)){let e=new A({source:new we({resource:r,...t})}),i=()=>{Da.get(r)===e&&Da.delete(r)};e.once("destroy",i),e.source.once("destroy",i),Da.set(r,e)}return Da.get(r)}var Da,Ym=x(()=>{Xs();_t();Da=new Map});var qm,ZE,QE=x(()=>{Rt();P();fe();Ht();jm();Ym();qm=class KE{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={...KE.defaultOptions,...t},t.view&&(z(J,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new ot(0,0,t.width,t.height),this.canvas=t.canvas||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=qc(this.canvas,t),this.renderTarget=new La({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};qm.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"view",priority:0};qm.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};ZE=qm});var Kc,Zc,Km=x(()=>{iE();sE();uE();dE();Om();pE();vE();TE();SE();AE();PE();ME();IE();FE();kE();LE();zE();jE();QE();Kc=[wE,Ua,Po,ZE,Aa,XE,Ga,RE,Ra,WE,Oa],Zc=[ka,Dm,Pa,Ea,Ma,Ia,Ba,Ta]});var Na,JE=x(()=>{P();Na=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,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],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[i],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}};Na.extension={type:[v.WebGPUSystem],name:"bindGroup"}});var Ha,tw=x(()=>{P();Qf();Ha=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),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(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}};Ha.extension={type:[v.WebGPUSystem],name:"buffer"}});var Va,ew=x(()=>{P();Va=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}};Va.extension={type:[v.WebGPUSystem],name:"colorMask"}});var Co,rw=x(()=>{Rt();P();Co=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 $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Co.extension={type:[v.WebGPUSystem],name:"device"};Co.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Wa,iw=x(()=>{P();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,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,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,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,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,i={...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 i)this._setVertexBuffer(a,i[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:[v.WebGPUSystem],name:"encoder",priority:1}});var za,sw=x(()=>{P();is();za=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:It.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.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}};za.extension={type:[v.WebGPUSystem],name:"stencil"}});var Ro,Zm=x(()=>{Mm();Ci();oi();Ro=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Wc())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 $t({data:new Float32Array(e.layout.size/4),usage:nt.UNIFORM|nt.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new $t({data:new Float32Array(s.layout.size/4),usage:nt.UNIFORM|nt.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!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 ow(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i<t.length;i++){let s=t[i],o=$a[s.data.type].size,n=$a[s.data.type].align;if(!$a[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 $a,Qm=x(()=>{"use strict";$a={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 li,Jm=x(()=>{"use strict";li=[{type:"mat3x3<f32>",test:r=>r.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];
@@ -907,7 +907,7 @@ fn mainFragment(
907
907
  }
908
908
  ${s!==0?`arrayOffset += ${s};`:""}
909
909
  }
910
- `}var hw=x(()=>{Qm()});function lw(r){return Qc(r,"uboWgsl",aw,nw)}var cw=x(()=>{tg();rg();hw()});var Xa,uw=x(()=>{C();Zm();Qm();cw();Xa=class extends Ro{constructor(){super({createUboElements:ow,generateUboSync:lw})}};Xa.extension={type:[v.WebGPUSystem],name:"ubo"}});var Gi,Jc=x(()=>{Ee();be();Gi=class extends Ct{constructor({buffer:t,offset:e,size:i}){super(),this.uid=at("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=at("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=at("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var tu,dw=x(()=>{"use strict";tu=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,i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}});var Ui,ja,fw=x(()=>{C();Ci();Jc();oi();dw();Pi();Ui=128,ja=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 tu({minUniformOffsetAlignment:Ui});let e=256/Ui;for(let i=0;i<e;i++){let s=ot.UNIFORM|ot.COPY_DST;i===0&&(s|=ot.COPY_SRC),this._buffers.push(new $t({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 i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Ui),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Ui)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ui)}getArrayBufferResource(t){let i=this._batchBuffer.addGroup(t)/Ui;return this._getBufferResource(i)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Gi({buffer:e,offset:(t/2|0)*256,size:Ui})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new me({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 i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Ui,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.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}};ja.extension={type:[v.WebGPUPipes],name:"uniformBatch"}});function eu(r,t){for(let e in r.attributes){let i=r.attributes[e],s=t[e];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):O(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}SF(r)}function SF(r){let{buffers:t,attributes:e}=r,i={},s={};for(let o in t){let n=t[o];i[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];i[n.buffer.uid]+=We(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=We(n.format).stride}}var ig=x(()=>{wt();os()});var Wr,sg=x(()=>{is();Wr=[];Wr[It.NONE]=void 0;Wr[It.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Wr[It.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Wr[It.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Wr[It.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Wr[It.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function wF(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function AF(r,t,e,i){return e<<6|r<<3|i<<1|t}var EF,Ya,pw=x(()=>{C();wt();ig();is();Xn();sg();EF={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ya=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(It.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=Wr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(eu(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=wF(t._layoutKey,e._layoutKey,i.data,i._blendModeId,EF[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===It.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:i.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.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=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let o=e.join("|");return t._layoutKey=ni(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[i++]=a.location}let o=e.join("|");return t._attributeLocationsKey=ni(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];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[i]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];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&&O(`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[i]=s,s}_updatePipeHash(){let t=AF(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}};Ya.extension={type:[v.WebGPUSystem],name:"pipeline"}});function mw(r,t,e,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-t*r.a,r.ty=-n-e*r.d,r}var gw=x(()=>{"use strict"});function xw(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var yw=x(()=>{"use strict"});var Bo,og=x(()=>{ft();fe();Eo();gw();Bm();Xs();He();_t();Ym();yw();jm();Bo=class{constructor(t){this.rootViewPort=new st,this.viewport=new st,this.onRenderTargetChange=new wo("onRenderTargetChange"),this.projectionMatrix=new I,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:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=xw(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,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 A&&(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 mw(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ge.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ge.ALL,i,s){let o=this.bind(t,e,i,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,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,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 we.test(t)&&(t=qc(t).source),t instanceof La?e=t:t instanceof Tt&&(e=new La({colorTextures:[t]}),we.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var ru,_w=x(()=>{"use strict";ru=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var iu,bw=x(()=>{Eo();Xs();He();_w();iu=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,i);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,i){typeof e=="boolean"&&(e=e?ge.ALL:ge.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&ge.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,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&ge.STENCIL?"clear":"load",c=e&ge.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,i,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,i),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,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new ru;return t.colorTextures.forEach((i,s)=>{if(we.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.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=i.source.antialias,i.source.antialias){let o=new Tt({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((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var qa,vw=x(()=>{C();og();bw();qa=class extends Bo{constructor(t){super(t),this.adaptor=new iu,this.adaptor.init(t,this)}};qa.extension={type:[v.WebGPUSystem],name:"renderTarget"}});var Ka,Tw=x(()=>{C();Ka=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,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Ka.extension={type:[v.WebGPUSystem],name:"shader"}});var Ge,Sw=x(()=>{"use strict";Ge={};Ge.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ge.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ge.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ge.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ge["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ge["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ge.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ge.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ge.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Za,Ew=x(()=>{C();Tr();Sw();Za=class{constructor(){this.defaultState=new Yt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ge[t.blendMode]||Ge.normal}]}destroy(){this.gpu=null}};Za.extension={type:[v.WebGPUSystem],name:"state"}});var ww,Aw=x(()=>{"use strict";ww={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var ng,PF,Pw,Cw=x(()=>{"use strict";ng={"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}},PF={blockBytes:4,blockWidth:1,blockHeight:1},Pw={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=ng[r.format]||PF;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],h=Math.ceil(i/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var su,ag=x(()=>{"use strict";su={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var Rw,Mw=x(()=>{ag();Rw={type:"video",upload(r,t,e){su.upload(r,t,e)}}});var ou,Bw=x(()=>{"use strict";ou=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 hw=x(()=>{Qm()});function lw(r){return Qc(r,"uboWgsl",aw,nw)}var cw=x(()=>{tg();rg();hw()});var Xa,uw=x(()=>{P();Zm();Qm();cw();Xa=class extends Ro{constructor(){super({createUboElements:ow,generateUboSync:lw})}};Xa.extension={type:[v.WebGPUSystem],name:"ubo"}});var Gi,Jc=x(()=>{Ee();be();Gi=class extends Ct{constructor({buffer:t,offset:e,size:i}){super(),this.uid=at("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=at("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=at("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var tu,dw=x(()=>{"use strict";tu=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,i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}});var Ui,ja,fw=x(()=>{P();Ci();Jc();oi();dw();Pi();Ui=128,ja=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 tu({minUniformOffsetAlignment:Ui});let e=256/Ui;for(let i=0;i<e;i++){let s=nt.UNIFORM|nt.COPY_DST;i===0&&(s|=nt.COPY_SRC),this._buffers.push(new $t({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 i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Ui),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Ui)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ui)}getArrayBufferResource(t){let i=this._batchBuffer.addGroup(t)/Ui;return this._getBufferResource(i)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Gi({buffer:e,offset:(t/2|0)*256,size:Ui})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new me({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 i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Ui,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.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}};ja.extension={type:[v.WebGPUPipes],name:"uniformBatch"}});function eu(r,t){for(let e in r.attributes){let i=r.attributes[e],s=t[e];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):O(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}SF(r)}function SF(r){let{buffers:t,attributes:e}=r,i={},s={};for(let o in t){let n=t[o];i[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];i[n.buffer.uid]+=We(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=We(n.format).stride}}var ig=x(()=>{wt();os()});var Wr,sg=x(()=>{is();Wr=[];Wr[It.NONE]=void 0;Wr[It.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Wr[It.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Wr[It.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Wr[It.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Wr[It.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function wF(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function AF(r,t,e,i){return e<<6|r<<3|i<<1|t}var EF,Ya,pw=x(()=>{P();wt();ig();is();Xn();sg();EF={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ya=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(It.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=Wr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(eu(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=wF(t._layoutKey,e._layoutKey,i.data,i._blendModeId,EF[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===It.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:i.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.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=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let o=e.join("|");return t._layoutKey=ni(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[i++]=a.location}let o=e.join("|");return t._attributeLocationsKey=ni(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];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[i]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];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&&O(`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[i]=s,s}_updatePipeHash(){let t=AF(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}};Ya.extension={type:[v.WebGPUSystem],name:"pipeline"}});function mw(r,t,e,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-t*r.a,r.ty=-n-e*r.d,r}var gw=x(()=>{"use strict"});function xw(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var yw=x(()=>{"use strict"});var Bo,og=x(()=>{ft();fe();Eo();gw();Bm();Xs();He();_t();Ym();yw();jm();Bo=class{constructor(t){this.rootViewPort=new ot,this.viewport=new ot,this.onRenderTargetChange=new wo("onRenderTargetChange"),this.projectionMatrix=new I,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:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=xw(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,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 A&&(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 mw(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ge.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ge.ALL,i,s){let o=this.bind(t,e,i,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,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,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 we.test(t)&&(t=qc(t).source),t instanceof La?e=t:t instanceof Tt&&(e=new La({colorTextures:[t]}),we.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var ru,_w=x(()=>{"use strict";ru=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var iu,bw=x(()=>{Eo();Xs();He();_w();iu=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,i);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,i){typeof e=="boolean"&&(e=e?ge.ALL:ge.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&ge.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,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&ge.STENCIL?"clear":"load",c=e&ge.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,i,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,i),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,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new ru;return t.colorTextures.forEach((i,s)=>{if(we.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.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=i.source.antialias,i.source.antialias){let o=new Tt({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((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var qa,vw=x(()=>{P();og();bw();qa=class extends Bo{constructor(t){super(t),this.adaptor=new iu,this.adaptor.init(t,this)}};qa.extension={type:[v.WebGPUSystem],name:"renderTarget"}});var Ka,Tw=x(()=>{P();Ka=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,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Ka.extension={type:[v.WebGPUSystem],name:"shader"}});var Ge,Sw=x(()=>{"use strict";Ge={};Ge.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ge.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ge.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ge.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ge["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ge["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ge["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ge.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ge.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ge.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Za,Ew=x(()=>{P();Tr();Sw();Za=class{constructor(){this.defaultState=new Yt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ge[t.blendMode]||Ge.normal}]}destroy(){this.gpu=null}};Za.extension={type:[v.WebGPUSystem],name:"state"}});var ww,Aw=x(()=>{"use strict";ww={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var ng,PF,Pw,Cw=x(()=>{"use strict";ng={"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}},PF={blockBytes:4,blockWidth:1,blockHeight:1},Pw={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=ng[r.format]||PF;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],h=Math.ceil(i/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var su,ag=x(()=>{"use strict";su={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var Rw,Mw=x(()=>{ag();Rw={type:"video",upload(r,t,e){su.upload(r,t,e)}}});var ou,Bw=x(()=>{"use strict";ou=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 i=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};i=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=i.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:i,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||i.destroy(),t}}});var Qa,Iw=x(()=>{Rt();C();Fe();uo();Pi();Aw();Cw();ag();Mw();Bw();Qa=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:su,buffer:ww,video:Rw,compressed:Pw},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 i=ng[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.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 ou(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 me({0:e,1:e.style,2:new At({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,i=e.gpu.device.createCommandEncoder(),s=z.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:z.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.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([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=$e.getOptimalCanvasAndContext(e.width,e.height),s=i.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 $e.returnCanvasAndContext(i),{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}};Qa.extension={type:[v.WebGPUSystem],name:"texture"}});var Uw={};fy(Uw,{WebGPURenderer:()=>hg});var CF,RF,MF,Fw,kw,Gw,hg,Ow=x(()=>{C();QS();eE();rE();ya();Km();Dr();JE();tw();ew();rw();iw();sw();uw();fw();pw();vw();Tw();Ew();Iw();CF=[...Kc,Xa,Wa,Co,Ha,Qa,qa,Ka,Za,Ya,Va,za,Na],RF=[...Zc,ja],MF=[va,ba,_a],Fw=[],kw=[],Gw=[];k.handleByNamedList(v.WebGPUSystem,Fw);k.handleByNamedList(v.WebGPUPipes,kw);k.handleByNamedList(v.WebGPUPipesAdaptor,Gw);k.add(...CF,...RF,...MF);hg=class extends ki{constructor(){let t={name:"webgpu",type:ee.WEBGPU,systems:Fw,renderPipes:kw,renderPipeAdaptors:Gw};super(t)}}});var Ja,Lw=x(()=>{C();ft();rs();Mi();jn();Yn();So();Bi();oc();vr();Fe();Ja=class{init(){let t=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=or(),i=Ur({name:"graphics",bits:[eo,io(e),To,Lr]});this.shader=new Xt({glProgram:i,resources:{localUniforms:t,batchSamplers:so(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(i);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}};Ja.extension={type:[v.WebGLPipesAdaptor],name:"graphics"}});var th,Dw=x(()=>{C();ft();Mi();So();Bi();Im();vr();_t();wt();th=class{init(){let t=Ur({name:"mesh",bits:[To,tE,Lr]});this._shader=new Xt({glProgram:t,resources:{uTexture:A.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new I}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){O("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]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};th.extension={type:[v.WebGLPipesAdaptor],name:"mesh"}});var eh,Nw=x(()=>{C();Tr();eh=class{constructor(){this._tempState=Yt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(e.topology,e.size,e.start)}};eh.extension={type:[v.WebGLPipesAdaptor],name:"batch"}});var rh,Hw=x(()=>{"use strict";rh=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(rh||{})});var nu,Vw=x(()=>{"use strict";nu=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var ih,Ww=x(()=>{C();oi();Hw();Vw();ih=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,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,i>=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,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&ot.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}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 i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=rh.ARRAY_BUFFER;t.descriptor.usage&ot.INDEX?i=rh.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ot.UNIFORM&&(i=rh.UNIFORM_BUFFER);let s=new nu(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};ih.extension={type:[v.WebGLSystem],name:"buffer"}});var lg,$w,Xw=x(()=>{Rt();C();wt();lg=class zw{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={...zw.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(O("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=z.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&O("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 z.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 i,s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,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 i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.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&&O("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||O("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};lg.extension={type:[v.WebGLSystem],name:"context"};lg.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};$w=lg});var au,cg,pt,ug=x(()=>{"use strict";au=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(au||{}),cg=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(cg||{}),pt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(pt||{})});function Yw(r){return jw[r]??jw.float32}var jw,qw=x(()=>{ug();jw={uint8x2:pt.UNSIGNED_BYTE,uint8x4:pt.UNSIGNED_BYTE,sint8x2:pt.BYTE,sint8x4:pt.BYTE,unorm8x2:pt.UNSIGNED_BYTE,unorm8x4:pt.UNSIGNED_BYTE,snorm8x2:pt.BYTE,snorm8x4:pt.BYTE,uint16x2:pt.UNSIGNED_SHORT,uint16x4:pt.UNSIGNED_SHORT,sint16x2:pt.SHORT,sint16x4:pt.SHORT,unorm16x2:pt.UNSIGNED_SHORT,unorm16x4:pt.UNSIGNED_SHORT,snorm16x2:pt.SHORT,snorm16x4:pt.SHORT,float16x2:pt.HALF_FLOAT,float16x4:pt.HALF_FLOAT,float32:pt.FLOAT,float32x2:pt.FLOAT,float32x3:pt.FLOAT,float32x4:pt.FLOAT,uint32:pt.UNSIGNED_INT,uint32x2:pt.UNSIGNED_INT,uint32x3:pt.UNSIGNED_INT,uint32x4:pt.UNSIGNED_INT,sint32:pt.INT,sint32x2:pt.INT,sint32x3:pt.INT,sint32x4:pt.INT}});var BF,sh,Kw=x(()=>{C();os();ig();qw();BF={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},sh=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 i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{i.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){let i=t.attributes,s=e._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in i)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,i=!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;eu(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 i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=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;i.enableVertexAttribArray(d);let f=We(h.format),p=Yw(h.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):i.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let m=h.divisor??1;i.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=BF[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,(i||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(i||0)*h)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||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}};sh.extension={type:[v.WebGLSystem],name:"geometry"}});var IF,dg,Qw,Jw=x(()=>{C();wt();Zs();vr();Tr();He();_t();ss();IF=new nr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),dg=class Zw{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...Zw.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(O("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Yt.for2d();let s=new ar({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 i=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};i=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=i.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:i,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||i.destroy(),t}}});var Qa,Iw=x(()=>{Rt();P();Fe();uo();Pi();Aw();Cw();ag();Mw();Bw();Qa=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:su,buffer:ww,video:Rw,compressed:Pw},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 i=ng[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.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 ou(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 me({0:e,1:e.style,2:new At({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,i=e.gpu.device.createCommandEncoder(),s=$.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:$.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.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([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=$e.getOptimalCanvasAndContext(e.width,e.height),s=i.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 $e.returnCanvasAndContext(i),{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}};Qa.extension={type:[v.WebGPUSystem],name:"texture"}});var Uw={};fy(Uw,{WebGPURenderer:()=>hg});var CF,RF,MF,Fw,kw,Gw,hg,Ow=x(()=>{P();QS();eE();rE();ya();Km();Dr();JE();tw();ew();rw();iw();sw();uw();fw();pw();vw();Tw();Ew();Iw();CF=[...Kc,Xa,Wa,Co,Ha,Qa,qa,Ka,Za,Ya,Va,za,Na],RF=[...Zc,ja],MF=[va,ba,_a],Fw=[],kw=[],Gw=[];k.handleByNamedList(v.WebGPUSystem,Fw);k.handleByNamedList(v.WebGPUPipes,kw);k.handleByNamedList(v.WebGPUPipesAdaptor,Gw);k.add(...CF,...RF,...MF);hg=class extends ki{constructor(){let t={name:"webgpu",type:ee.WEBGPU,systems:Fw,renderPipes:kw,renderPipeAdaptors:Gw};super(t)}}});var Ja,Lw=x(()=>{P();ft();rs();Mi();jn();Yn();So();Bi();oc();vr();Fe();Ja=class{init(){let t=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=or(),i=Ur({name:"graphics",bits:[eo,io(e),To,Lr]});this.shader=new Xt({glProgram:i,resources:{localUniforms:t,batchSamplers:so(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(i);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}};Ja.extension={type:[v.WebGLPipesAdaptor],name:"graphics"}});var th,Dw=x(()=>{P();ft();Mi();So();Bi();Im();vr();_t();wt();th=class{init(){let t=Ur({name:"mesh",bits:[To,tE,Lr]});this._shader=new Xt({glProgram:t,resources:{uTexture:A.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new I}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){O("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]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};th.extension={type:[v.WebGLPipesAdaptor],name:"mesh"}});var eh,Nw=x(()=>{P();Tr();eh=class{constructor(){this._tempState=Yt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(e.topology,e.size,e.start)}};eh.extension={type:[v.WebGLPipesAdaptor],name:"batch"}});var rh,Hw=x(()=>{"use strict";rh=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(rh||{})});var nu,Vw=x(()=>{"use strict";nu=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var ih,Ww=x(()=>{P();oi();Hw();Vw();ih=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,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,i>=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,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&nt.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}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 i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=rh.ARRAY_BUFFER;t.descriptor.usage&nt.INDEX?i=rh.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&nt.UNIFORM&&(i=rh.UNIFORM_BUFFER);let s=new nu(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};ih.extension={type:[v.WebGLSystem],name:"buffer"}});var lg,$w,Xw=x(()=>{Rt();P();wt();lg=class zw{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={...zw.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(O("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=$.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&O("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 $.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 i,s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,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 i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.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&&O("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||O("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};lg.extension={type:[v.WebGLSystem],name:"context"};lg.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};$w=lg});var au,cg,pt,ug=x(()=>{"use strict";au=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(au||{}),cg=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(cg||{}),pt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(pt||{})});function Yw(r){return jw[r]??jw.float32}var jw,qw=x(()=>{ug();jw={uint8x2:pt.UNSIGNED_BYTE,uint8x4:pt.UNSIGNED_BYTE,sint8x2:pt.BYTE,sint8x4:pt.BYTE,unorm8x2:pt.UNSIGNED_BYTE,unorm8x4:pt.UNSIGNED_BYTE,snorm8x2:pt.BYTE,snorm8x4:pt.BYTE,uint16x2:pt.UNSIGNED_SHORT,uint16x4:pt.UNSIGNED_SHORT,sint16x2:pt.SHORT,sint16x4:pt.SHORT,unorm16x2:pt.UNSIGNED_SHORT,unorm16x4:pt.UNSIGNED_SHORT,snorm16x2:pt.SHORT,snorm16x4:pt.SHORT,float16x2:pt.HALF_FLOAT,float16x4:pt.HALF_FLOAT,float32:pt.FLOAT,float32x2:pt.FLOAT,float32x3:pt.FLOAT,float32x4:pt.FLOAT,uint32:pt.UNSIGNED_INT,uint32x2:pt.UNSIGNED_INT,uint32x3:pt.UNSIGNED_INT,uint32x4:pt.UNSIGNED_INT,sint32:pt.INT,sint32x2:pt.INT,sint32x3:pt.INT,sint32x4:pt.INT}});var BF,sh,Kw=x(()=>{P();os();ig();qw();BF={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},sh=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 i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{i.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){let i=t.attributes,s=e._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in i)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,i=!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;eu(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 i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=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;i.enableVertexAttribArray(d);let f=We(h.format),p=Yw(h.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):i.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let m=h.divisor??1;i.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=BF[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,(i||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(i||0)*h)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||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}};sh.extension={type:[v.WebGLSystem],name:"geometry"}});var IF,dg,Qw,Jw=x(()=>{P();wt();Zs();vr();Tr();He();_t();ss();IF=new nr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),dg=class Zw{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...Zw.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(O("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Yt.for2d();let s=new ar({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:A.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.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:IF,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new A({source:new Tt({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)}};dg.extension={type:[v.WebGLSystem],name:"backBuffer",priority:1};dg.defaultOptions={useBackBuffer:!1};Qw=dg});var oh,tA=x(()=>{C();oh=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)))}};oh.extension={type:[v.WebGLSystem],name:"colorMask"}});var nh,eA=x(()=>{C();nh=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:i,shader:s,state:o,skipSync:n,topology:a,size:h,start:l,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(i,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,h,l,c??i.instanceCount)}destroy(){this._renderer=null}};nh.extension={type:[v.WebGLSystem],name:"encoder"}});var ah,rA=x(()=>{C();sg();is();ah=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:It.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:It.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=It.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Wr[t],n=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===It.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]))}};ah.extension={type:[v.WebGLSystem],name:"stencil"}});function iA(r){let t=r.map(o=>({data:o,offset:0,size:0})),e=16,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(i=fg[n.data.type],!i)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(i=Math.max(i,e)*n.data.size);let a=i===12?16:i;n.size=i;let h=s%e;h>0&&e-h<a?s+=(e-h)%16:s+=(i-h%i)%i,n.offset=s,s+=i}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var fg,pg=x(()=>{"use strict";fg={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 sA(r,t){let e=Math.max(fg[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
953
+ }`,name:"big-triangle"});this._bigTriangleShader=new Xt({glProgram:s,resources:{uTexture:A.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.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:IF,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new A({source:new Tt({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)}};dg.extension={type:[v.WebGLSystem],name:"backBuffer",priority:1};dg.defaultOptions={useBackBuffer:!1};Qw=dg});var oh,tA=x(()=>{P();oh=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)))}};oh.extension={type:[v.WebGLSystem],name:"colorMask"}});var nh,eA=x(()=>{P();nh=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:i,shader:s,state:o,skipSync:n,topology:a,size:h,start:l,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(i,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,h,l,c??i.instanceCount)}destroy(){this._renderer=null}};nh.extension={type:[v.WebGLSystem],name:"encoder"}});var ah,rA=x(()=>{P();sg();is();ah=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:It.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:It.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=It.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Wr[t],n=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===It.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]))}};ah.extension={type:[v.WebGLSystem],name:"stencil"}});function iA(r){let t=r.map(o=>({data:o,offset:0,size:0})),e=16,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(i=fg[n.data.type],!i)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(i=Math.max(i,e)*n.data.size);let a=i===12?16:i;n.size=i;let h=s%e;h>0&&e-h<a?s+=(e-h)%16:s+=(i-h%i)%i,n.offset=s,s+=i}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var fg,pg=x(()=>{"use strict";fg={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 sA(r,t){let e=Math.max(fg[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
954
954
  v = uv.${r.data.name};
955
955
  offset += ${t};
956
956
 
@@ -966,7 +966,7 @@ fn mainFragment(
966
966
  }
967
967
  ${s!==0?`arrayOffset += ${s};`:""}
968
968
  }
969
- `}var oA=x(()=>{pg()});function nA(r){return Qc(r,"uboStd40",sA,eg)}var aA=x(()=>{tg();rg();oA()});var hh,hA=x(()=>{C();Zm();pg();aA();hh=class extends Ro{constructor(){super({createUboElements:iA,generateUboSync:nA})}};hh.extension={type:[v.WebGLSystem],name:"ubo"}});var hu,lA=x(()=>{"use strict";hu=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var lu,cA=x(()=>{fe();wt();Xs();Eo();lA();lu=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new st}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new st}copyToTexture(t,e,i,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,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,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,i)}finishRenderPass(t){let i=this._renderTargetSystem.getGpuRenderTarget(t);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(t){let i=this._renderer.gl,s=new hu,o=t.colorTexture;return we.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.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(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ge.ALL:ge.NONE);let o=this._renderer.gl;if(e&ge.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(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 i=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,i),(t.stencil||t.depth)&&this._resizeStencil(i)}_initColor(t,e){let i=this._renderer,s=i.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&&(i.context.supports.msaa?e.msaa=!0:O("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(h,0);let c=i.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 i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._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,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){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&&we.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&we.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}});var lh,uA=x(()=>{C();og();cA();lh=class extends Bo{constructor(t){super(t),this.adaptor=new lu,this.adaptor.init(t,this)}};lh.extension={type:[v.WebGLSystem],name:"renderTarget"}});function dA(r,t){let e=[],i=[`
969
+ `}var oA=x(()=>{pg()});function nA(r){return Qc(r,"uboStd40",sA,eg)}var aA=x(()=>{tg();rg();oA()});var hh,hA=x(()=>{P();Zm();pg();aA();hh=class extends Ro{constructor(){super({createUboElements:iA,generateUboSync:nA})}};hh.extension={type:[v.WebGLSystem],name:"ubo"}});var hu,lA=x(()=>{"use strict";hu=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var lu,cA=x(()=>{fe();wt();Xs();Eo();lA();lu=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}copyToTexture(t,e,i,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,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,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,i)}finishRenderPass(t){let i=this._renderTargetSystem.getGpuRenderTarget(t);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(t){let i=this._renderer.gl,s=new hu,o=t.colorTexture;return we.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.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(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ge.ALL:ge.NONE);let o=this._renderer.gl;if(e&ge.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(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 i=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,i),(t.stencil||t.depth)&&this._resizeStencil(i)}_initColor(t,e){let i=this._renderer,s=i.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&&(i.context.supports.msaa?e.msaa=!0:O("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(h,0);let c=i.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 i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._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,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){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&&we.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&we.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}});var lh,uA=x(()=>{P();og();cA();lh=class extends Bo{constructor(t){super(t),this.adaptor=new lu,this.adaptor.init(t,this)}};lh.extension={type:[v.WebGLSystem],name:"renderTarget"}});function dA(r,t){let e=[],i=[`
970
970
  var g = s.groups;
971
971
  var sS = r.shader;
972
972
  var p = s.glProgram;
@@ -996,7 +996,7 @@ fn mainFragment(
996
996
  `);return new Function("r","s","sD",a)}var fA=x(()=>{Jc();Fe();He()});var cu,pA=x(()=>{"use strict";cu=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 mg(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}var mA=x(()=>{"use strict"});function gg(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function uu(r,t){switch(r){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 gg(2*t);case"bvec3":return gg(3*t);case"bvec4":return gg(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 xg=x(()=>{"use strict"});function yg(r,t){if(!du){let e=Object.keys(gA);du={};for(let i=0;i<e.length;++i){let s=e[i];du[r[s]]=gA[s]}}return du[t]}function xA(r,t){let e=yg(r,t);return FF[e]||"float32"}var du,gA,FF,_g=x(()=>{"use strict";du=null,gA={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"},FF={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 yA(r,t,e=!1){let i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(r,n);if(a.name.startsWith("gl_"))continue;let h=xA(t,a.type);i[a.name]={location:0,format:h,stride:We(h).stride,offset:0,instance:!1,start:0}}let o=Object.keys(i);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)i[o[n]].location=n,t.bindAttribLocation(r,n,o[n]);t.linkProgram(r)}else for(let n=0;n<o.length;n++)i[o[n]].location=t.getAttribLocation(r,o[n]);return i}var _A=x(()=>{os();_g()});function bA(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){let o=t.getActiveUniformBlockName(r,s),n=t.getUniformBlockIndex(r,o),a=t.getActiveUniformBlockParameter(r,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var vA=x(()=>{"use strict"});function TA(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=yg(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:uu(h,o.size)}}return e}var SA=x(()=>{xg();_g()});function EA(r,t){let e=r.getShaderSource(t).split(`
997
997
  `).map((l,c)=>`${c}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
998
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(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function wA(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||EA(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||EA(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var AA=x(()=>{"use strict"});function PA(r,t){let e=mg(r,r.VERTEX_SHADER,t.vertex),i=mg(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?O("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||wA(r,s,e,i),t._attributeData=yA(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=TA(s,r),t._uniformBlockData=bA(s,r),r.deleteShader(e),r.deleteShader(i);let n={};for(let h in t._uniformData){let l=t._uniformData[h];n[h]={location:r.getUniformLocation(s,h),value:uu(l.type,l.size)}}return new cu(s,n)}var CA=x(()=>{wt();pA();mA();xg();_A();vA();SA();AA()});var fu,ch,RA=x(()=>{C();rs();fA();CA();fu={textureCount:0,blockIndex:0},ch=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=or()}bind(t,e){if(this._setProgram(t.glProgram),e)return;fu.textureCount=0,fu.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,fu)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,fu)}bindUniformBlock(t,e,i=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[i]!==l&&(o.uniformBlockBindings[i]=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]=PA(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 dA(t,e)}resetState(){this._activeProgram=null}};ch.extension={type:[v.WebGLSystem],name:"shader"}});var MA,BA,IA=x(()=>{"use strict";MA={f32:`if (cv !== v) {
999
+ `);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function wA(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||EA(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||EA(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var AA=x(()=>{"use strict"});function PA(r,t){let e=mg(r,r.VERTEX_SHADER,t.vertex),i=mg(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?O("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||wA(r,s,e,i),t._attributeData=yA(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=TA(s,r),t._uniformBlockData=bA(s,r),r.deleteShader(e),r.deleteShader(i);let n={};for(let h in t._uniformData){let l=t._uniformData[h];n[h]={location:r.getUniformLocation(s,h),value:uu(l.type,l.size)}}return new cu(s,n)}var CA=x(()=>{wt();pA();mA();xg();_A();vA();SA();AA()});var fu,ch,RA=x(()=>{P();rs();fA();CA();fu={textureCount:0,blockIndex:0},ch=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=or()}bind(t,e){if(this._setProgram(t.glProgram),e)return;fu.textureCount=0,fu.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,fu)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,fu)}bindUniformBlock(t,e,i=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[i]!==l&&(o.uniformBlockBindings[i]=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]=PA(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 dA(t,e)}resetState(){this._activeProgram=null}};ch.extension={type:[v.WebGLSystem],name:"shader"}});var MA,BA,IA=x(()=>{"use strict";MA={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]) {
@@ -1086,12 +1086,12 @@ fn mainFragment(
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${i}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var kA=x(()=>{Jc();Fe();Jm();IA()});var uh,GA=x(()=>{C();kA();uh=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){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,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=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)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return FA(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];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}};uh.extension={type:[v.WebGLSystem],name:"uniformGroup"}});function UA(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof z.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var OA=x(()=>{Rt()});var kF,GF,UF,OF,LF,DF,LA,DA,NA=x(()=>{C();Tr();OA();kF=0,GF=1,UF=2,OF=3,LF=4,DF=5,LA=class bg{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[kF]=this.setBlend,this.map[GF]=this.setOffset,this.map[UF]=this.setCullFace,this.map[OF]=this.setDepthTest,this.map[LF]=this.setFrontFace,this.map[DF]=this.setDepthMask,this.checks=[],this.defaultState=Yt.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=UA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;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(bg._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(bg._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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,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}};LA.extension={type:[v.WebGLSystem],name:"state"};DA=LA});var pu,HA=x(()=>{ug();pu=class{constructor(t){this.target=cg.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=pt.UNSIGNED_BYTE,this.internalFormat=au.RGBA,this.format=au.RGBA,this.samplerType=0}}});var VA,WA=x(()=>{"use strict";VA={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var NF,zA,$A=x(()=>{"use strict";NF={"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},zA={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!NF[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var mu,vg=x(()=>{"use strict";mu={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,h=r.resourceWidth,l=r.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var XA,jA=x(()=>{vg();XA={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}mu.upload(r,t,e,i)}}});var Tg,YA,gu,qA,KA=x(()=>{"use strict";Tg={linear:9729,nearest:9728},YA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},gu={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},qA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Sg(r,t,e,i,s,o,n,a){let h=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let l=gu[n?"clamp-to-edge":r.addressModeU],c=gu[n?"clamp-to-edge":r.addressModeV],u=gu[n?"clamp-to-edge":r.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||r.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Tg[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let l=YA[r.minFilter][r.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Tg[r.minFilter]);if(i&&r.maxAnisotropy>1){let l=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,i.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,qA[r.compare])}var ZA=x(()=>{KA()});function QA(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var JA=x(()=>{"use strict"});function t1(r,t){let e={},i=r.RGBA;return r instanceof z.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var e1=x(()=>{Rt()});function r1(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var i1=x(()=>{"use strict"});var HF,dh,s1=x(()=>{Rt();C();_t();HA();WA();$A();vg();jA();ZA();JA();e1();i1();HF=4,dh=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:mu,buffer:VA,video:XA,compressed:zA},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=t1(t,this._renderer.context.extensions),this._mapFormatToType=r1(t),this._mapFormatToFormat=QA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(A.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=A.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new pu(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.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]=i,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),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Sg(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.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,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.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,i,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 i=this.getGlSource(t);this._gl.generateMipmap(i.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,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Sg(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!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:i,height:s}=this.getPixels(t),o=z.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(HF*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(i.x*e),Math.round(i.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(A.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};dh.extension={type:[v.WebGLSystem],name:"texture"}});var h1={};fy(h1,{WebGLRenderer:()=>Eg});var VF,WF,zF,o1,n1,a1,Eg,l1=x(()=>{C();Lw();Dw();Nw();ya();Km();Dr();Ww();Xw();Kw();Jw();tA();eA();rA();hA();uA();RA();GA();NA();s1();VF=[...Kc,hh,Qw,$w,ih,dh,lh,sh,uh,ch,nh,DA,ah,oh],WF=[...Zc],zF=[eh,th,Ja],o1=[],n1=[],a1=[];k.handleByNamedList(v.WebGLSystem,o1);k.handleByNamedList(v.WebGLPipes,n1);k.handleByNamedList(v.WebGLPipesAdaptor,a1);k.add(...VF,...WF,...zF);Eg=class extends ki{constructor(){let t={name:"webgl",type:ee.WEBGL,systems:o1,renderPipes:n1,renderPipeAdaptors:a1};super(t)}}});var FP=K((Bct,$g)=>{"use strict";var jk=Object.prototype.hasOwnProperty,Le="~";function Eh(){}Object.create&&(Eh.prototype=Object.create(null),new Eh().__proto__||(Le=!1));function Yk(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function IP(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new Yk(e,i||r,s),n=Le?Le+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Zu(r,t){--r._eventsCount===0?r._events=new Eh:delete r._events[t]}function Ce(){this._events=new Eh,this._eventsCount=0}Ce.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)jk.call(e,i)&&t.push(Le?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ce.prototype.listeners=function(t){var e=Le?Le+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Ce.prototype.listenerCount=function(t){var e=Le?Le+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Ce.prototype.emit=function(t,e,i,s,o,n){var a=Le?Le+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,i),!0;case 4:return h.fn.call(h.context,e,i,s),!0;case 5:return h.fn.call(h.context,e,i,s,o),!0;case 6:return h.fn.call(h.context,e,i,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,i);break;case 4:h[u].fn.call(h[u].context,e,i,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};Ce.prototype.on=function(t,e,i){return IP(this,t,e,i,!1)};Ce.prototype.once=function(t,e,i){return IP(this,t,e,i,!0)};Ce.prototype.removeListener=function(t,e,i,s){var o=Le?Le+t:t;if(!this._events[o])return this;if(!e)return Zu(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Zu(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Zu(this,o)}return this};Ce.prototype.removeAllListeners=function(t){var e;return t?(e=Le?Le+t:t,this._events[e]&&Zu(this,e)):(this._events=new Eh,this._eventsCount=0),this};Ce.prototype.off=Ce.prototype.removeListener;Ce.prototype.addListener=Ce.prototype.on;Ce.prefixed=Le;Ce.EventEmitter=Ce;typeof $g<"u"&&($g.exports=Ce)});var kP=K((Vo,Wo)=>{(function(r){var t=typeof Vo=="object"&&Vo&&!Vo.nodeType&&Vo,e=typeof Wo=="object"&&Wo&&!Wo.nodeType&&Wo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,_=Math.floor,T=String.fromCharCode,E;function S(H){throw new RangeError(b[H])}function w(H,U){for(var tt=H.length,vt=[];tt--;)vt[tt]=U(H[tt]);return vt}function M(H,U){var tt=H.split("@"),vt="";tt.length>1&&(vt=tt[0]+"@",H=tt[1]),H=H.replace(g,".");var gt=H.split("."),Dt=w(gt,U).join(".");return vt+Dt}function P(H){for(var U=[],tt=0,vt=H.length,gt,Dt;tt<vt;)gt=H.charCodeAt(tt++),gt>=55296&&gt<=56319&&tt<vt?(Dt=H.charCodeAt(tt++),(Dt&64512)==56320?U.push(((gt&1023)<<10)+(Dt&1023)+65536):(U.push(gt),tt--)):U.push(gt);return U}function R(H){return w(H,function(U){var tt="";return U>65535&&(U-=65536,tt+=T(U>>>10&1023|55296),U=56320|U&1023),tt+=T(U),tt}).join("")}function B(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:n}function F(H,U){return H+22+75*(H<26)-((U!=0)<<5)}function X(H,U,tt){var vt=0;for(H=tt?_(H/c):H>>1,H+=_(H/U);H>y*h>>1;vt+=n)H=_(H/y);return _(vt+(y+1)*H/(H+l))}function L(H){var U=[],tt=H.length,vt,gt=0,Dt=d,Nt=u,Zt,oe,Te,St,ut,yt,Ft,Qt,Jt;for(Zt=H.lastIndexOf(f),Zt<0&&(Zt=0),oe=0;oe<Zt;++oe)H.charCodeAt(oe)>=128&&S("not-basic"),U.push(H.charCodeAt(oe));for(Te=Zt>0?Zt+1:0;Te<tt;){for(St=gt,ut=1,yt=n;Te>=tt&&S("invalid-input"),Ft=B(H.charCodeAt(Te++)),(Ft>=n||Ft>_((o-gt)/ut))&&S("overflow"),gt+=Ft*ut,Qt=yt<=Nt?a:yt>=Nt+h?h:yt-Nt,!(Ft<Qt);yt+=n)Jt=n-Qt,ut>_(o/Jt)&&S("overflow"),ut*=Jt;vt=U.length+1,Nt=X(gt-St,vt,St==0),_(gt/vt)>o-Dt&&S("overflow"),Dt+=_(gt/vt),gt%=vt,U.splice(gt++,0,Dt)}return R(U)}function nt(H){var U,tt,vt,gt,Dt,Nt,Zt,oe,Te,St,ut,yt=[],Ft,Qt,Jt,De;for(H=P(H),Ft=H.length,U=d,tt=0,Dt=u,Nt=0;Nt<Ft;++Nt)ut=H[Nt],ut<128&&yt.push(T(ut));for(vt=gt=yt.length,gt&&yt.push(f);vt<Ft;){for(Zt=o,Nt=0;Nt<Ft;++Nt)ut=H[Nt],ut>=U&&ut<Zt&&(Zt=ut);for(Qt=vt+1,Zt-U>_((o-tt)/Qt)&&S("overflow"),tt+=(Zt-U)*Qt,U=Zt,Nt=0;Nt<Ft;++Nt)if(ut=H[Nt],ut<U&&++tt>o&&S("overflow"),ut==U){for(oe=tt,Te=n;St=Te<=Dt?a:Te>=Dt+h?h:Te-Dt,!(oe<St);Te+=n)De=oe-St,Jt=n-St,yt.push(T(F(St+De%Jt,0))),oe=_(De/Jt);yt.push(T(F(oe,0))),Dt=X(tt,Qt,vt==gt),tt=0,++vt}++tt,++U}return yt.join("")}function D(H){return M(H,function(U){return p.test(U)?L(U.slice(4).toLowerCase()):U})}function $(H){return M(H,function(U){return m.test(U)?"xn--"+nt(U):U})}if(s={version:"1.4.1",ucs2:{decode:P,encode:R},decode:L,encode:nt,toASCII:$,toUnicode:D},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Wo.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else r.punycode=s})(Vo)});var ps=K((Ict,GP)=>{"use strict";GP.exports=TypeError});var UP=K(()=>{});var Rh=K((Gct,rC)=>{var ex=typeof Map=="function"&&Map.prototype,Xg=Object.getOwnPropertyDescriptor&&ex?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ju=ex&&Xg&&typeof Xg.get=="function"?Xg.get:null,OP=ex&&Map.prototype.forEach,rx=typeof Set=="function"&&Set.prototype,jg=Object.getOwnPropertyDescriptor&&rx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,td=rx&&jg&&typeof jg.get=="function"?jg.get:null,LP=rx&&Set.prototype.forEach,qk=typeof WeakMap=="function"&&WeakMap.prototype,Ah=qk?WeakMap.prototype.has:null,Kk=typeof WeakSet=="function"&&WeakSet.prototype,Ph=Kk?WeakSet.prototype.has:null,Zk=typeof WeakRef=="function"&&WeakRef.prototype,DP=Zk?WeakRef.prototype.deref:null,Qk=Boolean.prototype.valueOf,Jk=Object.prototype.toString,t2=Function.prototype.toString,e2=String.prototype.match,ix=String.prototype.slice,Di=String.prototype.replace,r2=String.prototype.toUpperCase,NP=String.prototype.toLowerCase,qP=RegExp.prototype.test,HP=Array.prototype.concat,zr=Array.prototype.join,i2=Array.prototype.slice,VP=Math.floor,Kg=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Yg=Object.getOwnPropertySymbols,Zg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,zo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ch=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===zo||!0)?Symbol.toStringTag:null,KP=Object.prototype.propertyIsEnumerable,WP=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function zP(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||qP.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-VP(-r):VP(r);if(i!==r){var s=String(i),o=ix.call(t,s.length+1);return Di.call(s,e,"$&_")+"."+Di.call(Di.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Di.call(t,e,"$&_")}var Qg=UP(),$P=Qg.custom,XP=JP($P)?$P:null,ZP={__proto__:null,double:'"',single:"'"},s2={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};rC.exports=function r(t,e,i,s){var o=e||{};if(ui(o,"quoteStyle")&&!ui(ZP,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ui(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=ui(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(ui(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(ui(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 eC(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?zP(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?zP(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return Jg(t)?"[Array]":"[Object]";var u=T2(o,i);if(typeof s>"u")s=[];else if(tC(s,t)>=0)return"[Circular]";function d(X,L,nt){if(L&&(s=i2.call(s),s.push(L)),nt){var D={depth:o.depth};return ui(o,"quoteStyle")&&(D.quoteStyle=o.quoteStyle),r(X,D,i+1,s)}return r(X,o,i+1,s)}if(typeof t=="function"&&!jP(t)){var f=f2(t),p=Qu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+zr.call(p,", ")+" }":"")}if(JP(t)){var m=zo?Di.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zg.call(t);return typeof t=="object"&&!zo?wh(m):m}if(_2(t)){for(var g="<"+NP.call(String(t.nodeName)),b=t.attributes||[],y=0;y<b.length;y++)g+=" "+b[y].name+"="+QP(o2(b[y].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+NP.call(String(t.nodeName))+">",g}if(Jg(t)){if(t.length===0)return"[]";var _=Qu(t,d);return u&&!v2(_)?"["+tx(_,u)+"]":"[ "+zr.call(_,", ")+" ]"}if(a2(t)){var T=Qu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!KP.call(t,"cause")?"{ ["+String(t)+"] "+zr.call(HP.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+zr.call(T,", ")+" }"}if(typeof t=="object"&&n){if(XP&&typeof t[XP]=="function"&&Qg)return Qg(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(p2(t)){var E=[];return OP&&OP.call(t,function(X,L){E.push(d(L,t,!0)+" => "+d(X,t))}),YP("Map",Ju.call(t),E,u)}if(x2(t)){var S=[];return LP&&LP.call(t,function(X){S.push(d(X,t))}),YP("Set",td.call(t),S,u)}if(m2(t))return qg("WeakMap");if(y2(t))return qg("WeakSet");if(g2(t))return qg("WeakRef");if(l2(t))return wh(d(Number(t)));if(u2(t))return wh(d(Kg.call(t)));if(c2(t))return wh(Qk.call(t));if(h2(t))return wh(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(!n2(t)&&!jP(t)){var w=Qu(t,d),M=WP?WP(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",R=!M&&Ch&&Object(t)===t&&Ch in t?ix.call(Ni(t),8,-1):P?"Object":"",B=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",F=B+(R||P?"["+zr.call(HP.call([],R||[],P||[]),": ")+"] ":"");return w.length===0?F+"{}":u?F+"{"+tx(w,u)+"}":F+"{ "+zr.call(w,", ")+" }"}return String(t)};function QP(r,t,e){var i=e.quoteStyle||t,s=ZP[i];return s+r+s}function o2(r){return Di.call(String(r),/"/g,"&quot;")}function ms(r){return!Ch||!(typeof r=="object"&&(Ch in r||typeof r[Ch]<"u"))}function Jg(r){return Ni(r)==="[object Array]"&&ms(r)}function n2(r){return Ni(r)==="[object Date]"&&ms(r)}function jP(r){return Ni(r)==="[object RegExp]"&&ms(r)}function a2(r){return Ni(r)==="[object Error]"&&ms(r)}function h2(r){return Ni(r)==="[object String]"&&ms(r)}function l2(r){return Ni(r)==="[object Number]"&&ms(r)}function c2(r){return Ni(r)==="[object Boolean]"&&ms(r)}function JP(r){if(zo)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Zg)return!1;try{return Zg.call(r),!0}catch{}return!1}function u2(r){if(!r||typeof r!="object"||!Kg)return!1;try{return Kg.call(r),!0}catch{}return!1}var d2=Object.prototype.hasOwnProperty||function(r){return r in this};function ui(r,t){return d2.call(r,t)}function Ni(r){return Jk.call(r)}function f2(r){if(r.name)return r.name;var t=e2.call(t2.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function tC(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function p2(r){if(!Ju||!r||typeof r!="object")return!1;try{Ju.call(r);try{td.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function m2(r){if(!Ah||!r||typeof r!="object")return!1;try{Ah.call(r,Ah);try{Ph.call(r,Ph)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function g2(r){if(!DP||!r||typeof r!="object")return!1;try{return DP.call(r),!0}catch{}return!1}function x2(r){if(!td||!r||typeof r!="object")return!1;try{td.call(r);try{Ju.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function y2(r){if(!Ph||!r||typeof r!="object")return!1;try{Ph.call(r,Ph);try{Ah.call(r,Ah)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function _2(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function eC(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return eC(ix.call(r,0,t.maxStringLength),t)+i}var s=s2[t.quoteStyle||"single"];s.lastIndex=0;var o=Di.call(Di.call(r,s,"\\$1"),/[\x00-\x1f]/g,b2);return QP(o,"single",t)}function b2(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+r2.call(t.toString(16))}function wh(r){return"Object("+r+")"}function qg(r){return r+" { ? }"}function YP(r,t,e,i){var s=i?tx(e,i):zr.call(e,", ");return r+" ("+t+") {"+s+"}"}function v2(r){for(var t=0;t<r.length;t++)if(tC(r[t],`
1089
+ `))}var kA=x(()=>{Jc();Fe();Jm();IA()});var uh,GA=x(()=>{P();kA();uh=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){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,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=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)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return FA(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];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}};uh.extension={type:[v.WebGLSystem],name:"uniformGroup"}});function UA(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof $.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var OA=x(()=>{Rt()});var kF,GF,UF,OF,LF,DF,LA,DA,NA=x(()=>{P();Tr();OA();kF=0,GF=1,UF=2,OF=3,LF=4,DF=5,LA=class bg{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[kF]=this.setBlend,this.map[GF]=this.setOffset,this.map[UF]=this.setCullFace,this.map[OF]=this.setDepthTest,this.map[LF]=this.setFrontFace,this.map[DF]=this.setDepthMask,this.checks=[],this.defaultState=Yt.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=UA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;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(bg._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(bg._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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,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}};LA.extension={type:[v.WebGLSystem],name:"state"};DA=LA});var pu,HA=x(()=>{ug();pu=class{constructor(t){this.target=cg.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=pt.UNSIGNED_BYTE,this.internalFormat=au.RGBA,this.format=au.RGBA,this.samplerType=0}}});var VA,WA=x(()=>{"use strict";VA={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var NF,zA,$A=x(()=>{"use strict";NF={"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},zA={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!NF[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var mu,vg=x(()=>{"use strict";mu={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,h=r.resourceWidth,l=r.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var XA,jA=x(()=>{vg();XA={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}mu.upload(r,t,e,i)}}});var Tg,YA,gu,qA,KA=x(()=>{"use strict";Tg={linear:9729,nearest:9728},YA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},gu={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},qA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Sg(r,t,e,i,s,o,n,a){let h=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let l=gu[n?"clamp-to-edge":r.addressModeU],c=gu[n?"clamp-to-edge":r.addressModeV],u=gu[n?"clamp-to-edge":r.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||r.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Tg[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let l=YA[r.minFilter][r.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Tg[r.minFilter]);if(i&&r.maxAnisotropy>1){let l=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,i.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,qA[r.compare])}var ZA=x(()=>{KA()});function QA(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var JA=x(()=>{"use strict"});function t1(r,t){let e={},i=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var e1=x(()=>{Rt()});function r1(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var i1=x(()=>{"use strict"});var HF,dh,s1=x(()=>{Rt();P();_t();HA();WA();$A();vg();jA();ZA();JA();e1();i1();HF=4,dh=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:mu,buffer:VA,video:XA,compressed:zA},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=t1(t,this._renderer.context.extensions),this._mapFormatToType=r1(t),this._mapFormatToFormat=QA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(A.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=A.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new pu(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.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]=i,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),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Sg(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.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,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.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,i,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 i=this.getGlSource(t);this._gl.generateMipmap(i.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,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Sg(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!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:i,height:s}=this.getPixels(t),o=$.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(HF*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(i.x*e),Math.round(i.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(A.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};dh.extension={type:[v.WebGLSystem],name:"texture"}});var h1={};fy(h1,{WebGLRenderer:()=>Eg});var VF,WF,zF,o1,n1,a1,Eg,l1=x(()=>{P();Lw();Dw();Nw();ya();Km();Dr();Ww();Xw();Kw();Jw();tA();eA();rA();hA();uA();RA();GA();NA();s1();VF=[...Kc,hh,Qw,$w,ih,dh,lh,sh,uh,ch,nh,DA,ah,oh],WF=[...Zc],zF=[eh,th,Ja],o1=[],n1=[],a1=[];k.handleByNamedList(v.WebGLSystem,o1);k.handleByNamedList(v.WebGLPipes,n1);k.handleByNamedList(v.WebGLPipesAdaptor,a1);k.add(...VF,...WF,...zF);Eg=class extends ki{constructor(){let t={name:"webgl",type:ee.WEBGL,systems:o1,renderPipes:n1,renderPipeAdaptors:a1};super(t)}}});var FP=K((Bct,$g)=>{"use strict";var jk=Object.prototype.hasOwnProperty,Le="~";function Eh(){}Object.create&&(Eh.prototype=Object.create(null),new Eh().__proto__||(Le=!1));function Yk(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function IP(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new Yk(e,i||r,s),n=Le?Le+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Zu(r,t){--r._eventsCount===0?r._events=new Eh:delete r._events[t]}function Ce(){this._events=new Eh,this._eventsCount=0}Ce.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)jk.call(e,i)&&t.push(Le?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ce.prototype.listeners=function(t){var e=Le?Le+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Ce.prototype.listenerCount=function(t){var e=Le?Le+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Ce.prototype.emit=function(t,e,i,s,o,n){var a=Le?Le+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,i),!0;case 4:return h.fn.call(h.context,e,i,s),!0;case 5:return h.fn.call(h.context,e,i,s,o),!0;case 6:return h.fn.call(h.context,e,i,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,i);break;case 4:h[u].fn.call(h[u].context,e,i,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};Ce.prototype.on=function(t,e,i){return IP(this,t,e,i,!1)};Ce.prototype.once=function(t,e,i){return IP(this,t,e,i,!0)};Ce.prototype.removeListener=function(t,e,i,s){var o=Le?Le+t:t;if(!this._events[o])return this;if(!e)return Zu(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Zu(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Zu(this,o)}return this};Ce.prototype.removeAllListeners=function(t){var e;return t?(e=Le?Le+t:t,this._events[e]&&Zu(this,e)):(this._events=new Eh,this._eventsCount=0),this};Ce.prototype.off=Ce.prototype.removeListener;Ce.prototype.addListener=Ce.prototype.on;Ce.prefixed=Le;Ce.EventEmitter=Ce;typeof $g<"u"&&($g.exports=Ce)});var kP=K((Vo,Wo)=>{(function(r){var t=typeof Vo=="object"&&Vo&&!Vo.nodeType&&Vo,e=typeof Wo=="object"&&Wo&&!Wo.nodeType&&Wo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,_=Math.floor,T=String.fromCharCode,E;function S(N){throw new RangeError(b[N])}function w(N,U){for(var Q=N.length,vt=[];Q--;)vt[Q]=U(N[Q]);return vt}function M(N,U){var Q=N.split("@"),vt="";Q.length>1&&(vt=Q[0]+"@",N=Q[1]),N=N.replace(g,".");var gt=N.split("."),Dt=w(gt,U).join(".");return vt+Dt}function C(N){for(var U=[],Q=0,vt=N.length,gt,Dt;Q<vt;)gt=N.charCodeAt(Q++),gt>=55296&&gt<=56319&&Q<vt?(Dt=N.charCodeAt(Q++),(Dt&64512)==56320?U.push(((gt&1023)<<10)+(Dt&1023)+65536):(U.push(gt),Q--)):U.push(gt);return U}function R(N){return w(N,function(U){var Q="";return U>65535&&(U-=65536,Q+=T(U>>>10&1023|55296),U=56320|U&1023),Q+=T(U),Q}).join("")}function B(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function F(N,U){return N+22+75*(N<26)-((U!=0)<<5)}function j(N,U,Q){var vt=0;for(N=Q?_(N/c):N>>1,N+=_(N/U);N>y*h>>1;vt+=n)N=_(N/y);return _(vt+(y+1)*N/(N+l))}function W(N){var U=[],Q=N.length,vt,gt=0,Dt=d,Nt=u,Zt,oe,Te,St,ut,yt,Ft,Qt,Jt;for(Zt=N.lastIndexOf(f),Zt<0&&(Zt=0),oe=0;oe<Zt;++oe)N.charCodeAt(oe)>=128&&S("not-basic"),U.push(N.charCodeAt(oe));for(Te=Zt>0?Zt+1:0;Te<Q;){for(St=gt,ut=1,yt=n;Te>=Q&&S("invalid-input"),Ft=B(N.charCodeAt(Te++)),(Ft>=n||Ft>_((o-gt)/ut))&&S("overflow"),gt+=Ft*ut,Qt=yt<=Nt?a:yt>=Nt+h?h:yt-Nt,!(Ft<Qt);yt+=n)Jt=n-Qt,ut>_(o/Jt)&&S("overflow"),ut*=Jt;vt=U.length+1,Nt=j(gt-St,vt,St==0),_(gt/vt)>o-Dt&&S("overflow"),Dt+=_(gt/vt),gt%=vt,U.splice(gt++,0,Dt)}return R(U)}function st(N){var U,Q,vt,gt,Dt,Nt,Zt,oe,Te,St,ut,yt=[],Ft,Qt,Jt,De;for(N=C(N),Ft=N.length,U=d,Q=0,Dt=u,Nt=0;Nt<Ft;++Nt)ut=N[Nt],ut<128&&yt.push(T(ut));for(vt=gt=yt.length,gt&&yt.push(f);vt<Ft;){for(Zt=o,Nt=0;Nt<Ft;++Nt)ut=N[Nt],ut>=U&&ut<Zt&&(Zt=ut);for(Qt=vt+1,Zt-U>_((o-Q)/Qt)&&S("overflow"),Q+=(Zt-U)*Qt,U=Zt,Nt=0;Nt<Ft;++Nt)if(ut=N[Nt],ut<U&&++Q>o&&S("overflow"),ut==U){for(oe=Q,Te=n;St=Te<=Dt?a:Te>=Dt+h?h:Te-Dt,!(oe<St);Te+=n)De=oe-St,Jt=n-St,yt.push(T(F(St+De%Jt,0))),oe=_(De/Jt);yt.push(T(F(oe,0))),Dt=j(Q,Qt,vt==gt),Q=0,++vt}++Q,++U}return yt.join("")}function L(N){return M(N,function(U){return p.test(U)?W(U.slice(4).toLowerCase()):U})}function H(N){return M(N,function(U){return m.test(U)?"xn--"+st(U):U})}if(s={version:"1.4.1",ucs2:{decode:C,encode:R},decode:W,encode:st,toASCII:H,toUnicode:L},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Wo.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else r.punycode=s})(Vo)});var ps=K((Ict,GP)=>{"use strict";GP.exports=TypeError});var UP=K(()=>{});var Rh=K((Gct,rC)=>{var ex=typeof Map=="function"&&Map.prototype,Xg=Object.getOwnPropertyDescriptor&&ex?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ju=ex&&Xg&&typeof Xg.get=="function"?Xg.get:null,OP=ex&&Map.prototype.forEach,rx=typeof Set=="function"&&Set.prototype,jg=Object.getOwnPropertyDescriptor&&rx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,td=rx&&jg&&typeof jg.get=="function"?jg.get:null,LP=rx&&Set.prototype.forEach,qk=typeof WeakMap=="function"&&WeakMap.prototype,Ah=qk?WeakMap.prototype.has:null,Kk=typeof WeakSet=="function"&&WeakSet.prototype,Ph=Kk?WeakSet.prototype.has:null,Zk=typeof WeakRef=="function"&&WeakRef.prototype,DP=Zk?WeakRef.prototype.deref:null,Qk=Boolean.prototype.valueOf,Jk=Object.prototype.toString,t2=Function.prototype.toString,e2=String.prototype.match,ix=String.prototype.slice,Di=String.prototype.replace,r2=String.prototype.toUpperCase,NP=String.prototype.toLowerCase,qP=RegExp.prototype.test,HP=Array.prototype.concat,zr=Array.prototype.join,i2=Array.prototype.slice,VP=Math.floor,Kg=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Yg=Object.getOwnPropertySymbols,Zg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,zo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ch=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===zo||!0)?Symbol.toStringTag:null,KP=Object.prototype.propertyIsEnumerable,WP=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function zP(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||qP.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-VP(-r):VP(r);if(i!==r){var s=String(i),o=ix.call(t,s.length+1);return Di.call(s,e,"$&_")+"."+Di.call(Di.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Di.call(t,e,"$&_")}var Qg=UP(),$P=Qg.custom,XP=JP($P)?$P:null,ZP={__proto__:null,double:'"',single:"'"},s2={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};rC.exports=function r(t,e,i,s){var o=e||{};if(ui(o,"quoteStyle")&&!ui(ZP,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ui(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=ui(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(ui(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(ui(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 eC(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?zP(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?zP(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return Jg(t)?"[Array]":"[Object]";var u=T2(o,i);if(typeof s>"u")s=[];else if(tC(s,t)>=0)return"[Circular]";function d(j,W,st){if(W&&(s=i2.call(s),s.push(W)),st){var L={depth:o.depth};return ui(o,"quoteStyle")&&(L.quoteStyle=o.quoteStyle),r(j,L,i+1,s)}return r(j,o,i+1,s)}if(typeof t=="function"&&!jP(t)){var f=f2(t),p=Qu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+zr.call(p,", ")+" }":"")}if(JP(t)){var m=zo?Di.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zg.call(t);return typeof t=="object"&&!zo?wh(m):m}if(_2(t)){for(var g="<"+NP.call(String(t.nodeName)),b=t.attributes||[],y=0;y<b.length;y++)g+=" "+b[y].name+"="+QP(o2(b[y].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+NP.call(String(t.nodeName))+">",g}if(Jg(t)){if(t.length===0)return"[]";var _=Qu(t,d);return u&&!v2(_)?"["+tx(_,u)+"]":"[ "+zr.call(_,", ")+" ]"}if(a2(t)){var T=Qu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!KP.call(t,"cause")?"{ ["+String(t)+"] "+zr.call(HP.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+zr.call(T,", ")+" }"}if(typeof t=="object"&&n){if(XP&&typeof t[XP]=="function"&&Qg)return Qg(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(p2(t)){var E=[];return OP&&OP.call(t,function(j,W){E.push(d(W,t,!0)+" => "+d(j,t))}),YP("Map",Ju.call(t),E,u)}if(x2(t)){var S=[];return LP&&LP.call(t,function(j){S.push(d(j,t))}),YP("Set",td.call(t),S,u)}if(m2(t))return qg("WeakMap");if(y2(t))return qg("WeakSet");if(g2(t))return qg("WeakRef");if(l2(t))return wh(d(Number(t)));if(u2(t))return wh(d(Kg.call(t)));if(c2(t))return wh(Qk.call(t));if(h2(t))return wh(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(!n2(t)&&!jP(t)){var w=Qu(t,d),M=WP?WP(t)===Object.prototype:t instanceof Object||t.constructor===Object,C=t instanceof Object?"":"null prototype",R=!M&&Ch&&Object(t)===t&&Ch in t?ix.call(Ni(t),8,-1):C?"Object":"",B=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",F=B+(R||C?"["+zr.call(HP.call([],R||[],C||[]),": ")+"] ":"");return w.length===0?F+"{}":u?F+"{"+tx(w,u)+"}":F+"{ "+zr.call(w,", ")+" }"}return String(t)};function QP(r,t,e){var i=e.quoteStyle||t,s=ZP[i];return s+r+s}function o2(r){return Di.call(String(r),/"/g,"&quot;")}function ms(r){return!Ch||!(typeof r=="object"&&(Ch in r||typeof r[Ch]<"u"))}function Jg(r){return Ni(r)==="[object Array]"&&ms(r)}function n2(r){return Ni(r)==="[object Date]"&&ms(r)}function jP(r){return Ni(r)==="[object RegExp]"&&ms(r)}function a2(r){return Ni(r)==="[object Error]"&&ms(r)}function h2(r){return Ni(r)==="[object String]"&&ms(r)}function l2(r){return Ni(r)==="[object Number]"&&ms(r)}function c2(r){return Ni(r)==="[object Boolean]"&&ms(r)}function JP(r){if(zo)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Zg)return!1;try{return Zg.call(r),!0}catch{}return!1}function u2(r){if(!r||typeof r!="object"||!Kg)return!1;try{return Kg.call(r),!0}catch{}return!1}var d2=Object.prototype.hasOwnProperty||function(r){return r in this};function ui(r,t){return d2.call(r,t)}function Ni(r){return Jk.call(r)}function f2(r){if(r.name)return r.name;var t=e2.call(t2.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function tC(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function p2(r){if(!Ju||!r||typeof r!="object")return!1;try{Ju.call(r);try{td.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function m2(r){if(!Ah||!r||typeof r!="object")return!1;try{Ah.call(r,Ah);try{Ph.call(r,Ph)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function g2(r){if(!DP||!r||typeof r!="object")return!1;try{return DP.call(r),!0}catch{}return!1}function x2(r){if(!td||!r||typeof r!="object")return!1;try{td.call(r);try{Ju.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function y2(r){if(!Ph||!r||typeof r!="object")return!1;try{Ph.call(r,Ph);try{Ah.call(r,Ah)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function _2(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function eC(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return eC(ix.call(r,0,t.maxStringLength),t)+i}var s=s2[t.quoteStyle||"single"];s.lastIndex=0;var o=Di.call(Di.call(r,s,"\\$1"),/[\x00-\x1f]/g,b2);return QP(o,"single",t)}function b2(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+r2.call(t.toString(16))}function wh(r){return"Object("+r+")"}function qg(r){return r+" { ? }"}function YP(r,t,e,i){var s=i?tx(e,i):zr.call(e,", ");return r+" ("+t+") {"+s+"}"}function v2(r){for(var t=0;t<r.length;t++)if(tC(r[t],`
1090
1090
  `)>=0)return!1;return!0}function T2(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=zr.call(Array(r.indent+1)," ");else return null;return{base:e,prev:zr.call(Array(t+1),e)}}function tx(r,t){if(r.length===0)return"";var e=`
1091
1091
  `+t.prev+t.base;return e+zr.call(r,","+e)+`
1092
- `+t.prev}function Qu(r,t){var e=Jg(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=ui(r,s)?t(r[s],r):""}var o=typeof Yg=="function"?Yg(r):[],n;if(zo){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in r)ui(r,h)&&(e&&String(Number(h))===h&&h<r.length||zo&&n["$"+h]instanceof Symbol||(qP.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Yg=="function")for(var l=0;l<o.length;l++)KP.call(r,o[l])&&i.push("["+t(o[l])+"]: "+t(r[o[l]],r));return i}});var sC=K((Uct,iC)=>{"use strict";var S2=Rh(),E2=ps(),ed=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},w2=function(r,t){if(r){var e=ed(r,t);return e&&e.value}},A2=function(r,t,e){var i=ed(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},P2=function(r,t){return r?!!ed(r,t):!1},C2=function(r,t){if(r)return ed(r,t,!0)};iC.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new E2("Side channel does not contain "+S2(i))},delete:function(i){var s=t&&t.next,o=C2(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return w2(t,i)},has:function(i){return P2(t,i)},set:function(i,s){t||(t={next:void 0}),A2(t,i,s)}};return e}});var sx=K((Oct,oC)=>{"use strict";oC.exports=Object});var aC=K((Lct,nC)=>{"use strict";nC.exports=Error});var lC=K((Dct,hC)=>{"use strict";hC.exports=EvalError});var uC=K((Nct,cC)=>{"use strict";cC.exports=RangeError});var fC=K((Hct,dC)=>{"use strict";dC.exports=ReferenceError});var mC=K((Vct,pC)=>{"use strict";pC.exports=SyntaxError});var xC=K((Wct,gC)=>{"use strict";gC.exports=URIError});var _C=K((zct,yC)=>{"use strict";yC.exports=Math.abs});var vC=K(($ct,bC)=>{"use strict";bC.exports=Math.floor});var SC=K((Xct,TC)=>{"use strict";TC.exports=Math.max});var wC=K((jct,EC)=>{"use strict";EC.exports=Math.min});var PC=K((Yct,AC)=>{"use strict";AC.exports=Math.pow});var RC=K((qct,CC)=>{"use strict";CC.exports=Math.round});var BC=K((Kct,MC)=>{"use strict";MC.exports=Number.isNaN||function(t){return t!==t}});var FC=K((Zct,IC)=>{"use strict";var R2=BC();IC.exports=function(t){return R2(t)||t===0?t:t<0?-1:1}});var GC=K((Qct,kC)=>{"use strict";kC.exports=Object.getOwnPropertyDescriptor});var ox=K((Jct,UC)=>{"use strict";var rd=GC();if(rd)try{rd([],"length")}catch{rd=null}UC.exports=rd});var LC=K((tut,OC)=>{"use strict";var sd=Object.defineProperty||!1;if(sd)try{sd({},"a",{value:1})}catch{sd=!1}OC.exports=sd});var NC=K((eut,DC)=>{"use strict";DC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[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 WC=K((rut,VC)=>{"use strict";var HC=typeof Symbol<"u"&&Symbol,M2=NC();VC.exports=function(){return typeof HC!="function"||typeof Symbol!="function"||typeof HC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:M2()}});var nx=K((iut,zC)=>{"use strict";zC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ax=K((sut,$C)=>{"use strict";var B2=sx();$C.exports=B2.getPrototypeOf||null});var YC=K((out,jC)=>{"use strict";var I2="Function.prototype.bind called on incompatible ",F2=Object.prototype.toString,k2=Math.max,G2="[object Function]",XC=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},U2=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},O2=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};jC.exports=function(t){var e=this;if(typeof e!="function"||F2.apply(e)!==G2)throw new TypeError(I2+e);for(var i=U2(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,XC(i,arguments));return Object(c)===c?c:this}return e.apply(t,XC(i,arguments))},n=k2(0,e.length-i.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+O2(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 Mh=K((nut,qC)=>{"use strict";var L2=YC();qC.exports=Function.prototype.bind||L2});var od=K((aut,KC)=>{"use strict";KC.exports=Function.prototype.call});var hx=K((hut,ZC)=>{"use strict";ZC.exports=Function.prototype.apply});var JC=K((lut,QC)=>{"use strict";QC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var eR=K((cut,tR)=>{"use strict";var D2=Mh(),N2=hx(),H2=od(),V2=JC();tR.exports=V2||D2.call(H2,N2)});var lx=K((uut,rR)=>{"use strict";var W2=Mh(),z2=ps(),$2=od(),X2=eR();rR.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new z2("a function is required");return X2(W2,$2,t)}});var hR=K((dut,aR)=>{"use strict";var j2=lx(),iR=ox(),oR;try{oR=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var cx=!!oR&&iR&&iR(Object.prototype,"__proto__"),nR=Object,sR=nR.getPrototypeOf;aR.exports=cx&&typeof cx.get=="function"?j2([cx.get]):typeof sR=="function"?function(t){return sR(t==null?t:nR(t))}:!1});var fR=K((fut,dR)=>{"use strict";var lR=nx(),cR=ax(),uR=hR();dR.exports=lR?function(t){return lR(t)}:cR?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return cR(t)}:uR?function(t){return uR(t)}:null});var mR=K((put,pR)=>{"use strict";var Y2=Function.prototype.call,q2=Object.prototype.hasOwnProperty,K2=Mh();pR.exports=K2.call(Y2,q2)});var hd=K((mut,vR)=>{"use strict";var ct,Z2=sx(),Q2=aC(),J2=lC(),tG=uC(),eG=fC(),Yo=mC(),jo=ps(),rG=xC(),iG=_C(),sG=vC(),oG=SC(),nG=wC(),aG=PC(),hG=RC(),lG=FC(),_R=Function,ux=function(r){try{return _R('"use strict"; return ('+r+").constructor;")()}catch{}},Bh=ox(),cG=LC(),dx=function(){throw new jo},uG=Bh?function(){try{return arguments.callee,dx}catch{try{return Bh(arguments,"callee").get}catch{return dx}}}():dx,$o=WC()(),xe=fR(),dG=ax(),fG=nx(),bR=hx(),Ih=od(),Xo={},pG=typeof Uint8Array>"u"||!xe?ct:xe(Uint8Array),gs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":$o&&xe?xe([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Xo,"%AsyncGenerator%":Xo,"%AsyncGeneratorFunction%":Xo,"%AsyncIteratorPrototype%":Xo,"%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%":Q2,"%eval%":eval,"%EvalError%":J2,"%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%":_R,"%GeneratorFunction%":Xo,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":$o&&xe?xe(xe([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!$o||!xe?ct:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Z2,"%Object.getOwnPropertyDescriptor%":Bh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":tG,"%ReferenceError%":eG,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!$o||!xe?ct:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":$o&&xe?xe(""[Symbol.iterator]()):ct,"%Symbol%":$o?Symbol:ct,"%SyntaxError%":Yo,"%ThrowTypeError%":uG,"%TypedArray%":pG,"%TypeError%":jo,"%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%":rG,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":Ih,"%Function.prototype.apply%":bR,"%Object.defineProperty%":cG,"%Object.getPrototypeOf%":dG,"%Math.abs%":iG,"%Math.floor%":sG,"%Math.max%":oG,"%Math.min%":nG,"%Math.pow%":aG,"%Math.round%":hG,"%Math.sign%":lG,"%Reflect.getPrototypeOf%":fG};if(xe)try{null.error}catch(r){gR=xe(xe(r)),gs["%Error.prototype%"]=gR}var gR,mG=function r(t){var e;if(t==="%AsyncFunction%")e=ux("async function () {}");else if(t==="%GeneratorFunction%")e=ux("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ux("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&xe&&(e=xe(s.prototype))}return gs[t]=e,e},xR={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Fh=Mh(),nd=mR(),gG=Fh.call(Ih,Array.prototype.concat),xG=Fh.call(bR,Array.prototype.splice),yR=Fh.call(Ih,String.prototype.replace),ad=Fh.call(Ih,String.prototype.slice),yG=Fh.call(Ih,RegExp.prototype.exec),_G=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,bG=/\\(\\)?/g,vG=function(t){var e=ad(t,0,1),i=ad(t,-1);if(e==="%"&&i!=="%")throw new Yo("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Yo("invalid intrinsic syntax, expected opening `%`");var s=[];return yR(t,_G,function(o,n,a,h){s[s.length]=a?yR(h,bG,"$1"):n||o}),s},TG=function(t,e){var i=t,s;if(nd(xR,i)&&(s=xR[i],i="%"+s[0]+"%"),nd(gs,i)){var o=gs[i];if(o===Xo&&(o=mG(i)),typeof o>"u"&&!e)throw new jo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Yo("intrinsic "+t+" does not exist!")};vR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new jo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new jo('"allowMissing" argument must be a boolean');if(yG(/^%?[^%]*%?$/,t)===null)throw new Yo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=vG(t),s=i.length>0?i[0]:"",o=TG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],xG(i,gG([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=ad(d,0,1),p=ad(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Yo("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",nd(gs,n))a=gs[n];else if(a!=null){if(!(d in a)){if(!e)throw new jo("base intrinsic for "+t+" exists, but the property is not available.");return}if(Bh&&c+1>=i.length){var m=Bh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=nd(a,d),a=a[d];u&&!h&&(gs[n]=a)}}return a}});var fx=K((gut,ER)=>{"use strict";var TR=hd(),SR=lx(),SG=SR([TR("%String.prototype.indexOf%")]);ER.exports=function(t,e){var i=TR(t,!!e);return typeof i=="function"&&SG(t,".prototype.")>-1?SR([i]):i}});var px=K((xut,AR)=>{"use strict";var EG=hd(),kh=fx(),wG=Rh(),AG=ps(),wR=EG("%Map%",!0),PG=kh("Map.prototype.get",!0),CG=kh("Map.prototype.set",!0),RG=kh("Map.prototype.has",!0),MG=kh("Map.prototype.delete",!0),BG=kh("Map.prototype.size",!0);AR.exports=!!wR&&function(){var t,e={assert:function(i){if(!e.has(i))throw new AG("Side channel does not contain "+wG(i))},delete:function(i){if(t){var s=MG(t,i);return BG(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return PG(t,i)},has:function(i){return t?RG(t,i):!1},set:function(i,s){t||(t=new wR),CG(t,i,s)}};return e}});var CR=K((yut,PR)=>{"use strict";var IG=hd(),cd=fx(),FG=Rh(),ld=px(),kG=ps(),qo=IG("%WeakMap%",!0),GG=cd("WeakMap.prototype.get",!0),UG=cd("WeakMap.prototype.set",!0),OG=cd("WeakMap.prototype.has",!0),LG=cd("WeakMap.prototype.delete",!0);PR.exports=qo?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new kG("Side channel does not contain "+FG(s))},delete:function(s){if(qo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return LG(t,s)}else if(ld&&e)return e.delete(s);return!1},get:function(s){return qo&&s&&(typeof s=="object"||typeof s=="function")&&t?GG(t,s):e&&e.get(s)},has:function(s){return qo&&s&&(typeof s=="object"||typeof s=="function")&&t?OG(t,s):!!e&&e.has(s)},set:function(s,o){qo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new qo),UG(t,s,o)):ld&&(e||(e=ld()),e.set(s,o))}};return i}:ld});var MR=K((_ut,RR)=>{"use strict";var DG=ps(),NG=Rh(),HG=sC(),VG=px(),WG=CR(),zG=WG||VG||HG;RR.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new DG("Side channel does not contain "+NG(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=zG()),t.set(i,s)}};return e}});var ud=K((but,BR)=>{"use strict";var $G=String.prototype.replace,XG=/%20/g,mx={RFC1738:"RFC1738",RFC3986:"RFC3986"};BR.exports={default:mx.RFC3986,formatters:{RFC1738:function(r){return $G.call(r,XG,"+")},RFC3986:function(r){return String(r)}},RFC1738:mx.RFC1738,RFC3986:mx.RFC3986}});var yx=K((vut,FR)=>{"use strict";var jG=ud(),gx=Object.prototype.hasOwnProperty,xs=Array.isArray,$r=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),YG=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(xs(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},IR=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},qG=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(xs(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!gx.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 xs(t)&&!xs(e)&&(s=IR(t,i)),xs(t)&&xs(e)?(e.forEach(function(o,n){if(gx.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return gx.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},KG=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},ZG=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},xx=1024,QG=function(t,e,i,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)),i==="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+=xx){for(var l=n.length>=xx?n.slice(h,h+xx):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===jG.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=$r[d];continue}if(d<2048){c[c.length]=$r[192|d>>6]+$r[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=$r[224|d>>12]+$r[128|d>>6&63]+$r[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=$r[240|d>>18]+$r[128|d>>12&63]+$r[128|d>>6&63]+$r[128|d&63]}a+=c.join("")}return a},JG=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],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&&i.indexOf(c)===-1&&(e.push({obj:n,prop:l}),i.push(c))}return YG(e),t},tU=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},eU=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},rU=function(t,e){return[].concat(t,e)},iU=function(t,e){if(xs(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};FR.exports={arrayToObject:IR,assign:KG,combine:rU,compact:JG,decode:ZG,encode:QG,isBuffer:eU,isRegExp:tU,maybeMap:iU,merge:qG}});var DR=K((Tut,LR)=>{"use strict";var GR=MR(),dd=yx(),Gh=ud(),sU=Object.prototype.hasOwnProperty,UR={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Xr=Array.isArray,oU=Array.prototype.push,OR=function(r,t){oU.apply(r,Xr(t)?t:[t])},nU=Date.prototype.toISOString,kR=Gh.default,ce={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:dd.encode,encodeValuesOnly:!1,filter:void 0,format:kR,formatter:Gh.formatters[kR],indices:!1,serializeDate:function(t){return nU.call(t)},skipNulls:!1,strictNullHandling:!1},aU=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},_x={},hU=function r(t,e,i,s,o,n,a,h,l,c,u,d,f,p,m,g,b,y){for(var _=t,T=y,E=0,S=!1;(T=T.get(_x))!==void 0&&!S;){var w=T.get(t);if(E+=1,typeof w<"u"){if(w===E)throw new RangeError("Cyclic object value");S=!0}typeof T.get(_x)>"u"&&(E=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=f(_):i==="comma"&&Xr(_)&&(_=dd.maybeMap(_,function(tt){return tt instanceof Date?f(tt):tt})),_===null){if(n)return l&&!g?l(e,ce.encoder,b,"key",p):e;_=""}if(aU(_)||dd.isBuffer(_)){if(l){var M=g?e:l(e,ce.encoder,b,"key",p);return[m(M)+"="+m(l(_,ce.encoder,b,"value",p))]}return[m(e)+"="+m(String(_))]}var P=[];if(typeof _>"u")return P;var R;if(i==="comma"&&Xr(_))g&&l&&(_=dd.maybeMap(_,l)),R=[{value:_.length>0?_.join(",")||null:void 0}];else if(Xr(c))R=c;else{var B=Object.keys(_);R=u?B.sort(u):B}var F=h?String(e).replace(/\./g,"%2E"):String(e),X=s&&Xr(_)&&_.length===1?F+"[]":F;if(o&&Xr(_)&&_.length===0)return X+"[]";for(var L=0;L<R.length;++L){var nt=R[L],D=typeof nt=="object"&&nt&&typeof nt.value<"u"?nt.value:_[nt];if(!(a&&D===null)){var $=d&&h?String(nt).replace(/\./g,"%2E"):String(nt),H=Xr(_)?typeof i=="function"?i(X,$):X:X+(d?"."+$:"["+$+"]");y.set(t,E);var U=GR();U.set(_x,y),OR(P,r(D,H,i,s,o,n,a,h,i==="comma"&&g&&Xr(_)?null:l,c,u,d,f,p,m,g,b,U))}}return P},lU=function(t){if(!t)return ce;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||ce.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 i=Gh.default;if(typeof t.format<"u"){if(!sU.call(Gh.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Gh.formatters[i],o=ce.filter;(typeof t.filter=="function"||Xr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in UR?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=ce.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:ce.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ce.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ce.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ce.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ce.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ce.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ce.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ce.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ce.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ce.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ce.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ce.strictNullHandling}};LR.exports=function(r,t){var e=r,i=lU(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):Xr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=UR[i.arrayFormat],h=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var l=GR(),c=0;c<s.length;++c){var u=s[c],d=e[u];i.skipNulls&&d===null||OR(n,hU(d,u,a,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,l))}var f=n.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var WR=K((Sut,VR)=>{"use strict";var ys=yx(),bx=Object.prototype.hasOwnProperty,NR=Array.isArray,jt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ys.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},cU=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},HR=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.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 r},uU="utf8=%26%2310003%3B",dU="utf8=%E2%9C%93",fU=function(t,e){var i={__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]===dU?l="utf-8":n[h]===uU&&(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,jt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),jt.decoder,l,"key"),p=ys.maybeMap(HR(c.slice(d+1),e,NR(i[f])?i[f].length:0),function(g){return e.decoder(g,jt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=cU(String(p))),c.indexOf("[]=")>-1&&(p=NR(p)?[p]:p);var m=bx.call(i,f);m&&e.duplicates==="combine"?i[f]=ys.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},pU=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:HR(t,e,s),a=r.length-1;a>=0;--a){var h,l=r[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ys.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},mU=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!i.plainObjects&&bx.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&bx.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}if(h){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return pU(c,e,i,s)}},gU=function(t){if(!t)return jt;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"?jt.charset:t.charset,i=typeof t.duplicates>"u"?jt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:jt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:jt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:jt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:jt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:jt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:jt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:jt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:jt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:jt.decoder,delimiter:typeof t.delimiter=="string"||ys.isRegExp(t.delimiter)?t.delimiter:jt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:jt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:jt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:jt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:jt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:jt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:jt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};VR.exports=function(r,t){var e=gU(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?fU(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],h=mU(a,i[a],e,typeof r=="string");s=ys.merge(s,h,e)}return e.allowSparse===!0?s:ys.compact(s)}});var $R=K((Eut,zR)=>{"use strict";var xU=DR(),yU=WR(),_U=ud();zR.exports={formats:_U,parse:yU,stringify:xU}});var qR=K(Zo=>{"use strict";var bU=kP();function pr(){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 vU=/^([a-z0-9.+-]+:)/i,TU=/:[0-9]*$/,SU=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,EU=["<",">",'"',"`"," ","\r",`
1093
- `," "],wU=["{","}","|","\\","^","`"].concat(EU),vx=["'"].concat(wU),XR=["%","/","?",";","#"].concat(vx),jR=["/","?","#"],AU=255,YR=/^[+a-z0-9A-Z_-]{0,63}$/,PU=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,CU={javascript:!0,"javascript:":!0},Tx={javascript:!0,"javascript:":!0},Ko={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sx=$R();function Uh(r,t,e){if(r&&typeof r=="object"&&r instanceof pr)return r;var i=new pr;return i.parse(r,t,e),i}pr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var h=SU.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sx.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=vU.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&&Tx[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tx[l]&&(u||l&&!Ko[l])){for(var d=-1,f=0;f<jR.length;f++){var p=a.indexOf(jR[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<XR.length;f++){var p=a.indexOf(XR[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!b)for(var y=this.hostname.split(/\./),f=0,_=y.length;f<_;f++){var T=y[f];if(T&&!T.match(YR)){for(var E="",S=0,w=T.length;S<w;S++)T.charCodeAt(S)>127?E+="x":E+=T[S];if(!E.match(YR)){var M=y.slice(0,f),P=y.slice(f+1),R=T.match(PU);R&&(M.push(R[1]),P.unshift(R[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>AU?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=bU.toASCII(this.hostname));var B=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+B,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!CU[c])for(var f=0,_=vx.length;f<_;f++){var X=vx[f];if(a.indexOf(X)!==-1){var L=encodeURIComponent(X);L===X&&(L=escape(X)),a=a.split(X).join(L)}}var nt=a.indexOf("#");nt!==-1&&(this.hash=a.substr(nt),a=a.slice(0,nt));var D=a.indexOf("?");if(D!==-1?(this.search=a.substr(D),this.query=a.substr(D+1),t&&(this.query=Sx.parse(this.query)),a=a.slice(0,D)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Ko[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var B=this.pathname||"",$=this.search||"";this.path=B+$}return this.href=this.format(),this};function RU(r){return typeof r=="string"&&(r=Uh(r)),r instanceof pr?r.format():pr.prototype.format.call(r)}pr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(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=Sx.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Ko[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function MU(r,t){return Uh(r,!1,!0).resolve(t)}pr.prototype.resolve=function(r){return this.resolveObject(Uh(r,!1,!0)).format()};function BU(r,t){return r?Uh(r,!1,!0).resolveObject(t):t}pr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new pr;t.parse(r,!1,!0),r=t}for(var e=new pr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=r[h])}return Ko[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Ko[r.protocol]){for(var l=Object.keys(r),c=0;c<l.length;c++){var u=l[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Tx[r.protocol]){for(var _=(r.pathname||"").split("/");_.length&&!(r.host=_.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),_[0]!==""&&_.unshift(""),_.length<2&&_.unshift(""),e.pathname=_.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,b=g,y=e.pathname&&e.pathname.split("/")||[],_=r.pathname&&r.pathname.split("/")||[],T=e.protocol&&!Ko[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(_[0]===""?_[0]=r.host:_.unshift(r.host)),r.host=null),g=g&&(_[0]===""||y[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,y=_;else if(_.length)y||(y=[]),y.pop(),y=y.concat(_),e.search=r.search,e.query=r.query;else if(r.search!=null){if(T){e.host=y.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=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!y.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=y.slice(-1)[0],w=(e.host||r.host||y.length>1)&&(S==="."||S==="..")||S==="",M=0,P=y.length;P>=0;P--)S=y[P],S==="."?y.splice(P,1):S===".."?(y.splice(P,1),M++):M&&(y.splice(P,1),M--);if(!g&&!b)for(;M--;M)y.unshift("..");g&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),w&&y.join("/").substr(-1)!=="/"&&y.push("");var R=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(T){e.hostname=R?"":y.length?y.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 g=g||e.host&&y.length,g&&!R&&y.unshift(""),y.length>0?e.pathname=y.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=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};pr.prototype.parseHost=function(){var r=this.host,t=TU.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};Zo.parse=Uh;Zo.resolve=MU;Zo.resolveObject=BU;Zo.format=RU;Zo.Url=pr});var rB=()=>{let r=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))r.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};r.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of r.entries())n[a]=h;return n},clear:()=>r.clear(),size:()=>r.size,has:n=>r.has(n)}};C();var NS={extension:{type:v.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(DS(),cF))}};C();var VS={extension:{type:v.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(HS(),uF))}};C();C();Kl();zl();C();Rt();ya();var zc;function KS(r){return zc!==void 0||(zc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??ki.defaultOptions.failIfMajorPerformanceCaveat};try{if(!z.get().getWebGLRenderingContext())return!1;let i=z.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),zc}Rt();var $c;async function ZS(r={}){return $c!==void 0||($c=await(async()=>{let t=z.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),$c}ya();var c1=["webgl","webgpu","canvas"];async function u1(r){let t=[];r.preference?(t.push(r.preference),c1.forEach(o=>{o!==r.preference&&t.push(o)})):t=c1.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await ZS()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(Ow(),Uw));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&KS(r.failIfMajorPerformanceCaveat??ki.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(l1(),h1));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}_r();Om();Ht();var d1=class wg{constructor(...t){this.stage=new xt,t[0]!==void 0&&W(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await u1(t),wg._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return W(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=wg._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};d1._plugins=[];var fh=d1;k.handleByList(v.Application,fh._plugins);k.add(Ca);C();ii();Lf();Rt();C();ts();fe();_t();fm();ym();var ph=class extends yo{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=i[n.page],l=new st(n.x+a.x,n.y+a.y,n.width,n.height),c=new A({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){ca.install(t)}static uninstall(t){ca.uninstall(t)}};var xu={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),b=g[0],y=g[1].replace(/"/gm,""),_=parseFloat(y),T=isNaN(_)?y:_;p[b]=T}e[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};i.baseLineOffset=i.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,i.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);i.chars[h[f]].kerning[h[d]]=p}return i}};Rt();var Ag={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let l=0;l<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(i.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 Pg={test(r){return typeof r=="string"&&r.includes("<font>")?Ag.test(z.get().parseXML(r)):!1},parse(r){return Ag.parse(z.get().parseXML(r))}};var $F=[".xml",".fnt"],f1={extension:{type:v.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof ph,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},p1={extension:{type:v.LoadParser,priority:pe.Normal},name:"loadBitmapFont",test(r){return $F.includes(ae.extname(r).toLowerCase())},async testParse(r){return xu.test(r)||Pg.test(r)},async parse(r,t,e){let i=xu.test(r)?xu.parse(r):Pg.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.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=ae.join(ae.dirname(s),d);f=On(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new ph({data:i,textures:l},s)},async load(r,t){return await(await z.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};wt();var yu=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 i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};Ai();C();_t();var m1={extension:{type:v.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof A),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};C();async function _u(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var g1={extension:{type:v.DetectionParser,priority:1},test:async()=>_u("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};C();var x1=["png","jpg","jpeg"],y1={extension:{type:v.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...x1],remove:async r=>r.filter(t=>!x1.includes(t))};C();var XF="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Io(r){return XF?!1:document.createElement("video").canPlayType(r)!==""}var _1={extension:{type:v.DetectionParser,priority:0},test:async()=>Io("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};C();var b1={extension:{type:v.DetectionParser,priority:0},test:async()=>Io("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};C();var v1={extension:{type:v.DetectionParser,priority:0},test:async()=>Io("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};C();var T1={extension:{type:v.DetectionParser,priority:0},test:async()=>_u("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};wt();ts();Un();Wl();var bu=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),i.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,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=es(t),n=Ie(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ae.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(++i/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 i=Ie(t,s=>({alias:[s],src:s})).map(async s=>{let o=ae.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(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Rt();C();function lr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}ts();function cr(r,t){let e=r.split("?")[0],i=ae.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}ii();var jF=".json",YF="application/json",S1={extension:{type:v.LoadParser,priority:pe.Low},name:"loadJson",test(r){return lr(r,YF)||cr(r,jF)},async load(r){return await(await z.get().fetch(r)).json()}};Rt();C();ii();var qF=".txt",KF="text/plain",E1={name:"loadTxt",extension:{type:v.LoadParser,priority:pe.Low,name:"loadTxt"},test(r){return lr(r,KF)||cr(r,qF)},async load(r){return await(await z.get().fetch(r)).text()}};Rt();C();wt();ts();Ai();ii();var ZF=["normal","bold","100","200","300","400","500","600","700","800","900"],QF=[".ttf",".otf",".woff",".woff2"],JF=["font/ttf","font/otf","font/woff","font/woff2"],tk=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ek(r){let t=ae.extname(r),s=ae.basename(r,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(tk)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var rk=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function ik(r){return rk.test(r)?r:encodeURI(r)}var w1={extension:{type:v.LoadParser,priority:pe.Low},name:"loadWebFont",test(r){return lr(r,JF)||cr(r,QF)},async load(r,t){let e=z.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??ek(r),o=t.data?.weights?.filter(a=>ZF.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${ik(r)})`,{...n,weight:h});await l.load(),e.add(l),i.push(l)}return bt.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return O("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{bt.remove(`${t.family}-and-url`),z.get().getFontFaceSet().delete(t)})}};Rt();C();js();Rc();$s();function Fo(r,t=1){let e=Ke.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}ii();_t();wt();Ai();function ko(r,t,e){r.label=e,r._sourceOrigin=e;let i=new A({source:r,label:e}),s=()=>{delete t.promiseCache[e],bt.has(e)&&bt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(O("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(O("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var sk=".svg",ok="image/svg+xml",A1={extension:{type:v.LoadParser,priority:pe.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return lr(r,ok)||cr(r,sk)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?ak(r):nk(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function nk(r,t,e,i){let o=await(await z.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||Fo(r),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new Ve({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return ko(m,e,r)}async function ak(r){let e=await(await z.get().fetch(r)).text(),i=new ke;return i.svg(e),i}Rt();C();js();var hk=`(function () {
1092
+ `+t.prev}function Qu(r,t){var e=Jg(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=ui(r,s)?t(r[s],r):""}var o=typeof Yg=="function"?Yg(r):[],n;if(zo){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in r)ui(r,h)&&(e&&String(Number(h))===h&&h<r.length||zo&&n["$"+h]instanceof Symbol||(qP.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Yg=="function")for(var l=0;l<o.length;l++)KP.call(r,o[l])&&i.push("["+t(o[l])+"]: "+t(r[o[l]],r));return i}});var sC=K((Uct,iC)=>{"use strict";var S2=Rh(),E2=ps(),ed=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},w2=function(r,t){if(r){var e=ed(r,t);return e&&e.value}},A2=function(r,t,e){var i=ed(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},P2=function(r,t){return r?!!ed(r,t):!1},C2=function(r,t){if(r)return ed(r,t,!0)};iC.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new E2("Side channel does not contain "+S2(i))},delete:function(i){var s=t&&t.next,o=C2(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return w2(t,i)},has:function(i){return P2(t,i)},set:function(i,s){t||(t={next:void 0}),A2(t,i,s)}};return e}});var sx=K((Oct,oC)=>{"use strict";oC.exports=Object});var aC=K((Lct,nC)=>{"use strict";nC.exports=Error});var lC=K((Dct,hC)=>{"use strict";hC.exports=EvalError});var uC=K((Nct,cC)=>{"use strict";cC.exports=RangeError});var fC=K((Hct,dC)=>{"use strict";dC.exports=ReferenceError});var mC=K((Vct,pC)=>{"use strict";pC.exports=SyntaxError});var xC=K((Wct,gC)=>{"use strict";gC.exports=URIError});var _C=K((zct,yC)=>{"use strict";yC.exports=Math.abs});var vC=K(($ct,bC)=>{"use strict";bC.exports=Math.floor});var SC=K((Xct,TC)=>{"use strict";TC.exports=Math.max});var wC=K((jct,EC)=>{"use strict";EC.exports=Math.min});var PC=K((Yct,AC)=>{"use strict";AC.exports=Math.pow});var RC=K((qct,CC)=>{"use strict";CC.exports=Math.round});var BC=K((Kct,MC)=>{"use strict";MC.exports=Number.isNaN||function(t){return t!==t}});var FC=K((Zct,IC)=>{"use strict";var R2=BC();IC.exports=function(t){return R2(t)||t===0?t:t<0?-1:1}});var GC=K((Qct,kC)=>{"use strict";kC.exports=Object.getOwnPropertyDescriptor});var ox=K((Jct,UC)=>{"use strict";var rd=GC();if(rd)try{rd([],"length")}catch{rd=null}UC.exports=rd});var LC=K((tut,OC)=>{"use strict";var sd=Object.defineProperty||!1;if(sd)try{sd({},"a",{value:1})}catch{sd=!1}OC.exports=sd});var NC=K((eut,DC)=>{"use strict";DC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[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 WC=K((rut,VC)=>{"use strict";var HC=typeof Symbol<"u"&&Symbol,M2=NC();VC.exports=function(){return typeof HC!="function"||typeof Symbol!="function"||typeof HC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:M2()}});var nx=K((iut,zC)=>{"use strict";zC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ax=K((sut,$C)=>{"use strict";var B2=sx();$C.exports=B2.getPrototypeOf||null});var YC=K((out,jC)=>{"use strict";var I2="Function.prototype.bind called on incompatible ",F2=Object.prototype.toString,k2=Math.max,G2="[object Function]",XC=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},U2=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},O2=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};jC.exports=function(t){var e=this;if(typeof e!="function"||F2.apply(e)!==G2)throw new TypeError(I2+e);for(var i=U2(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,XC(i,arguments));return Object(c)===c?c:this}return e.apply(t,XC(i,arguments))},n=k2(0,e.length-i.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+O2(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 Mh=K((nut,qC)=>{"use strict";var L2=YC();qC.exports=Function.prototype.bind||L2});var od=K((aut,KC)=>{"use strict";KC.exports=Function.prototype.call});var hx=K((hut,ZC)=>{"use strict";ZC.exports=Function.prototype.apply});var JC=K((lut,QC)=>{"use strict";QC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var eR=K((cut,tR)=>{"use strict";var D2=Mh(),N2=hx(),H2=od(),V2=JC();tR.exports=V2||D2.call(H2,N2)});var lx=K((uut,rR)=>{"use strict";var W2=Mh(),z2=ps(),$2=od(),X2=eR();rR.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new z2("a function is required");return X2(W2,$2,t)}});var hR=K((dut,aR)=>{"use strict";var j2=lx(),iR=ox(),oR;try{oR=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var cx=!!oR&&iR&&iR(Object.prototype,"__proto__"),nR=Object,sR=nR.getPrototypeOf;aR.exports=cx&&typeof cx.get=="function"?j2([cx.get]):typeof sR=="function"?function(t){return sR(t==null?t:nR(t))}:!1});var fR=K((fut,dR)=>{"use strict";var lR=nx(),cR=ax(),uR=hR();dR.exports=lR?function(t){return lR(t)}:cR?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return cR(t)}:uR?function(t){return uR(t)}:null});var mR=K((put,pR)=>{"use strict";var Y2=Function.prototype.call,q2=Object.prototype.hasOwnProperty,K2=Mh();pR.exports=K2.call(Y2,q2)});var hd=K((mut,vR)=>{"use strict";var ct,Z2=sx(),Q2=aC(),J2=lC(),tG=uC(),eG=fC(),Yo=mC(),jo=ps(),rG=xC(),iG=_C(),sG=vC(),oG=SC(),nG=wC(),aG=PC(),hG=RC(),lG=FC(),_R=Function,ux=function(r){try{return _R('"use strict"; return ('+r+").constructor;")()}catch{}},Bh=ox(),cG=LC(),dx=function(){throw new jo},uG=Bh?function(){try{return arguments.callee,dx}catch{try{return Bh(arguments,"callee").get}catch{return dx}}}():dx,$o=WC()(),xe=fR(),dG=ax(),fG=nx(),bR=hx(),Ih=od(),Xo={},pG=typeof Uint8Array>"u"||!xe?ct:xe(Uint8Array),gs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":$o&&xe?xe([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Xo,"%AsyncGenerator%":Xo,"%AsyncGeneratorFunction%":Xo,"%AsyncIteratorPrototype%":Xo,"%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%":Q2,"%eval%":eval,"%EvalError%":J2,"%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%":_R,"%GeneratorFunction%":Xo,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":$o&&xe?xe(xe([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!$o||!xe?ct:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Z2,"%Object.getOwnPropertyDescriptor%":Bh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":tG,"%ReferenceError%":eG,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!$o||!xe?ct:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":$o&&xe?xe(""[Symbol.iterator]()):ct,"%Symbol%":$o?Symbol:ct,"%SyntaxError%":Yo,"%ThrowTypeError%":uG,"%TypedArray%":pG,"%TypeError%":jo,"%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%":rG,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":Ih,"%Function.prototype.apply%":bR,"%Object.defineProperty%":cG,"%Object.getPrototypeOf%":dG,"%Math.abs%":iG,"%Math.floor%":sG,"%Math.max%":oG,"%Math.min%":nG,"%Math.pow%":aG,"%Math.round%":hG,"%Math.sign%":lG,"%Reflect.getPrototypeOf%":fG};if(xe)try{null.error}catch(r){gR=xe(xe(r)),gs["%Error.prototype%"]=gR}var gR,mG=function r(t){var e;if(t==="%AsyncFunction%")e=ux("async function () {}");else if(t==="%GeneratorFunction%")e=ux("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ux("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&xe&&(e=xe(s.prototype))}return gs[t]=e,e},xR={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Fh=Mh(),nd=mR(),gG=Fh.call(Ih,Array.prototype.concat),xG=Fh.call(bR,Array.prototype.splice),yR=Fh.call(Ih,String.prototype.replace),ad=Fh.call(Ih,String.prototype.slice),yG=Fh.call(Ih,RegExp.prototype.exec),_G=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,bG=/\\(\\)?/g,vG=function(t){var e=ad(t,0,1),i=ad(t,-1);if(e==="%"&&i!=="%")throw new Yo("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Yo("invalid intrinsic syntax, expected opening `%`");var s=[];return yR(t,_G,function(o,n,a,h){s[s.length]=a?yR(h,bG,"$1"):n||o}),s},TG=function(t,e){var i=t,s;if(nd(xR,i)&&(s=xR[i],i="%"+s[0]+"%"),nd(gs,i)){var o=gs[i];if(o===Xo&&(o=mG(i)),typeof o>"u"&&!e)throw new jo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Yo("intrinsic "+t+" does not exist!")};vR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new jo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new jo('"allowMissing" argument must be a boolean');if(yG(/^%?[^%]*%?$/,t)===null)throw new Yo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=vG(t),s=i.length>0?i[0]:"",o=TG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],xG(i,gG([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=ad(d,0,1),p=ad(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Yo("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",nd(gs,n))a=gs[n];else if(a!=null){if(!(d in a)){if(!e)throw new jo("base intrinsic for "+t+" exists, but the property is not available.");return}if(Bh&&c+1>=i.length){var m=Bh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=nd(a,d),a=a[d];u&&!h&&(gs[n]=a)}}return a}});var fx=K((gut,ER)=>{"use strict";var TR=hd(),SR=lx(),SG=SR([TR("%String.prototype.indexOf%")]);ER.exports=function(t,e){var i=TR(t,!!e);return typeof i=="function"&&SG(t,".prototype.")>-1?SR([i]):i}});var px=K((xut,AR)=>{"use strict";var EG=hd(),kh=fx(),wG=Rh(),AG=ps(),wR=EG("%Map%",!0),PG=kh("Map.prototype.get",!0),CG=kh("Map.prototype.set",!0),RG=kh("Map.prototype.has",!0),MG=kh("Map.prototype.delete",!0),BG=kh("Map.prototype.size",!0);AR.exports=!!wR&&function(){var t,e={assert:function(i){if(!e.has(i))throw new AG("Side channel does not contain "+wG(i))},delete:function(i){if(t){var s=MG(t,i);return BG(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return PG(t,i)},has:function(i){return t?RG(t,i):!1},set:function(i,s){t||(t=new wR),CG(t,i,s)}};return e}});var CR=K((yut,PR)=>{"use strict";var IG=hd(),cd=fx(),FG=Rh(),ld=px(),kG=ps(),qo=IG("%WeakMap%",!0),GG=cd("WeakMap.prototype.get",!0),UG=cd("WeakMap.prototype.set",!0),OG=cd("WeakMap.prototype.has",!0),LG=cd("WeakMap.prototype.delete",!0);PR.exports=qo?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new kG("Side channel does not contain "+FG(s))},delete:function(s){if(qo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return LG(t,s)}else if(ld&&e)return e.delete(s);return!1},get:function(s){return qo&&s&&(typeof s=="object"||typeof s=="function")&&t?GG(t,s):e&&e.get(s)},has:function(s){return qo&&s&&(typeof s=="object"||typeof s=="function")&&t?OG(t,s):!!e&&e.has(s)},set:function(s,o){qo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new qo),UG(t,s,o)):ld&&(e||(e=ld()),e.set(s,o))}};return i}:ld});var MR=K((_ut,RR)=>{"use strict";var DG=ps(),NG=Rh(),HG=sC(),VG=px(),WG=CR(),zG=WG||VG||HG;RR.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new DG("Side channel does not contain "+NG(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=zG()),t.set(i,s)}};return e}});var ud=K((but,BR)=>{"use strict";var $G=String.prototype.replace,XG=/%20/g,mx={RFC1738:"RFC1738",RFC3986:"RFC3986"};BR.exports={default:mx.RFC3986,formatters:{RFC1738:function(r){return $G.call(r,XG,"+")},RFC3986:function(r){return String(r)}},RFC1738:mx.RFC1738,RFC3986:mx.RFC3986}});var yx=K((vut,FR)=>{"use strict";var jG=ud(),gx=Object.prototype.hasOwnProperty,xs=Array.isArray,$r=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),YG=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(xs(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},IR=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},qG=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(xs(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!gx.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 xs(t)&&!xs(e)&&(s=IR(t,i)),xs(t)&&xs(e)?(e.forEach(function(o,n){if(gx.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return gx.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},KG=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},ZG=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},xx=1024,QG=function(t,e,i,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)),i==="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+=xx){for(var l=n.length>=xx?n.slice(h,h+xx):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===jG.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=$r[d];continue}if(d<2048){c[c.length]=$r[192|d>>6]+$r[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=$r[224|d>>12]+$r[128|d>>6&63]+$r[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=$r[240|d>>18]+$r[128|d>>12&63]+$r[128|d>>6&63]+$r[128|d&63]}a+=c.join("")}return a},JG=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],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&&i.indexOf(c)===-1&&(e.push({obj:n,prop:l}),i.push(c))}return YG(e),t},tU=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},eU=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},rU=function(t,e){return[].concat(t,e)},iU=function(t,e){if(xs(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};FR.exports={arrayToObject:IR,assign:KG,combine:rU,compact:JG,decode:ZG,encode:QG,isBuffer:eU,isRegExp:tU,maybeMap:iU,merge:qG}});var DR=K((Tut,LR)=>{"use strict";var GR=MR(),dd=yx(),Gh=ud(),sU=Object.prototype.hasOwnProperty,UR={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Xr=Array.isArray,oU=Array.prototype.push,OR=function(r,t){oU.apply(r,Xr(t)?t:[t])},nU=Date.prototype.toISOString,kR=Gh.default,ce={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:dd.encode,encodeValuesOnly:!1,filter:void 0,format:kR,formatter:Gh.formatters[kR],indices:!1,serializeDate:function(t){return nU.call(t)},skipNulls:!1,strictNullHandling:!1},aU=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},_x={},hU=function r(t,e,i,s,o,n,a,h,l,c,u,d,f,p,m,g,b,y){for(var _=t,T=y,E=0,S=!1;(T=T.get(_x))!==void 0&&!S;){var w=T.get(t);if(E+=1,typeof w<"u"){if(w===E)throw new RangeError("Cyclic object value");S=!0}typeof T.get(_x)>"u"&&(E=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=f(_):i==="comma"&&Xr(_)&&(_=dd.maybeMap(_,function(Q){return Q instanceof Date?f(Q):Q})),_===null){if(n)return l&&!g?l(e,ce.encoder,b,"key",p):e;_=""}if(aU(_)||dd.isBuffer(_)){if(l){var M=g?e:l(e,ce.encoder,b,"key",p);return[m(M)+"="+m(l(_,ce.encoder,b,"value",p))]}return[m(e)+"="+m(String(_))]}var C=[];if(typeof _>"u")return C;var R;if(i==="comma"&&Xr(_))g&&l&&(_=dd.maybeMap(_,l)),R=[{value:_.length>0?_.join(",")||null:void 0}];else if(Xr(c))R=c;else{var B=Object.keys(_);R=u?B.sort(u):B}var F=h?String(e).replace(/\./g,"%2E"):String(e),j=s&&Xr(_)&&_.length===1?F+"[]":F;if(o&&Xr(_)&&_.length===0)return j+"[]";for(var W=0;W<R.length;++W){var st=R[W],L=typeof st=="object"&&st&&typeof st.value<"u"?st.value:_[st];if(!(a&&L===null)){var H=d&&h?String(st).replace(/\./g,"%2E"):String(st),N=Xr(_)?typeof i=="function"?i(j,H):j:j+(d?"."+H:"["+H+"]");y.set(t,E);var U=GR();U.set(_x,y),OR(C,r(L,N,i,s,o,n,a,h,i==="comma"&&g&&Xr(_)?null:l,c,u,d,f,p,m,g,b,U))}}return C},lU=function(t){if(!t)return ce;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||ce.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 i=Gh.default;if(typeof t.format<"u"){if(!sU.call(Gh.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Gh.formatters[i],o=ce.filter;(typeof t.filter=="function"||Xr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in UR?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=ce.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:ce.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ce.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ce.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ce.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ce.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ce.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ce.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ce.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ce.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ce.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ce.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ce.strictNullHandling}};LR.exports=function(r,t){var e=r,i=lU(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):Xr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=UR[i.arrayFormat],h=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var l=GR(),c=0;c<s.length;++c){var u=s[c],d=e[u];i.skipNulls&&d===null||OR(n,hU(d,u,a,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,l))}var f=n.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var WR=K((Sut,VR)=>{"use strict";var ys=yx(),bx=Object.prototype.hasOwnProperty,NR=Array.isArray,jt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ys.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},cU=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},HR=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.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 r},uU="utf8=%26%2310003%3B",dU="utf8=%E2%9C%93",fU=function(t,e){var i={__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]===dU?l="utf-8":n[h]===uU&&(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,jt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),jt.decoder,l,"key"),p=ys.maybeMap(HR(c.slice(d+1),e,NR(i[f])?i[f].length:0),function(g){return e.decoder(g,jt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=cU(String(p))),c.indexOf("[]=")>-1&&(p=NR(p)?[p]:p);var m=bx.call(i,f);m&&e.duplicates==="combine"?i[f]=ys.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},pU=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:HR(t,e,s),a=r.length-1;a>=0;--a){var h,l=r[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ys.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},mU=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!i.plainObjects&&bx.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&bx.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}if(h){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return pU(c,e,i,s)}},gU=function(t){if(!t)return jt;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"?jt.charset:t.charset,i=typeof t.duplicates>"u"?jt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:jt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:jt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:jt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:jt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:jt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:jt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:jt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:jt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:jt.decoder,delimiter:typeof t.delimiter=="string"||ys.isRegExp(t.delimiter)?t.delimiter:jt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:jt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:jt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:jt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:jt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:jt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:jt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};VR.exports=function(r,t){var e=gU(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?fU(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],h=mU(a,i[a],e,typeof r=="string");s=ys.merge(s,h,e)}return e.allowSparse===!0?s:ys.compact(s)}});var $R=K((Eut,zR)=>{"use strict";var xU=DR(),yU=WR(),_U=ud();zR.exports={formats:_U,parse:yU,stringify:xU}});var qR=K(Zo=>{"use strict";var bU=kP();function pr(){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 vU=/^([a-z0-9.+-]+:)/i,TU=/:[0-9]*$/,SU=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,EU=["<",">",'"',"`"," ","\r",`
1093
+ `," "],wU=["{","}","|","\\","^","`"].concat(EU),vx=["'"].concat(wU),XR=["%","/","?",";","#"].concat(vx),jR=["/","?","#"],AU=255,YR=/^[+a-z0-9A-Z_-]{0,63}$/,PU=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,CU={javascript:!0,"javascript:":!0},Tx={javascript:!0,"javascript:":!0},Ko={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sx=$R();function Uh(r,t,e){if(r&&typeof r=="object"&&r instanceof pr)return r;var i=new pr;return i.parse(r,t,e),i}pr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var h=SU.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sx.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=vU.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&&Tx[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tx[l]&&(u||l&&!Ko[l])){for(var d=-1,f=0;f<jR.length;f++){var p=a.indexOf(jR[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<XR.length;f++){var p=a.indexOf(XR[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!b)for(var y=this.hostname.split(/\./),f=0,_=y.length;f<_;f++){var T=y[f];if(T&&!T.match(YR)){for(var E="",S=0,w=T.length;S<w;S++)T.charCodeAt(S)>127?E+="x":E+=T[S];if(!E.match(YR)){var M=y.slice(0,f),C=y.slice(f+1),R=T.match(PU);R&&(M.push(R[1]),C.unshift(R[2])),C.length&&(a="/"+C.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>AU?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=bU.toASCII(this.hostname));var B=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+B,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!CU[c])for(var f=0,_=vx.length;f<_;f++){var j=vx[f];if(a.indexOf(j)!==-1){var W=encodeURIComponent(j);W===j&&(W=escape(j)),a=a.split(j).join(W)}}var st=a.indexOf("#");st!==-1&&(this.hash=a.substr(st),a=a.slice(0,st));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=Sx.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Ko[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var B=this.pathname||"",H=this.search||"";this.path=B+H}return this.href=this.format(),this};function RU(r){return typeof r=="string"&&(r=Uh(r)),r instanceof pr?r.format():pr.prototype.format.call(r)}pr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(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=Sx.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Ko[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function MU(r,t){return Uh(r,!1,!0).resolve(t)}pr.prototype.resolve=function(r){return this.resolveObject(Uh(r,!1,!0)).format()};function BU(r,t){return r?Uh(r,!1,!0).resolveObject(t):t}pr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new pr;t.parse(r,!1,!0),r=t}for(var e=new pr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=r[h])}return Ko[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Ko[r.protocol]){for(var l=Object.keys(r),c=0;c<l.length;c++){var u=l[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Tx[r.protocol]){for(var _=(r.pathname||"").split("/");_.length&&!(r.host=_.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),_[0]!==""&&_.unshift(""),_.length<2&&_.unshift(""),e.pathname=_.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,b=g,y=e.pathname&&e.pathname.split("/")||[],_=r.pathname&&r.pathname.split("/")||[],T=e.protocol&&!Ko[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(_[0]===""?_[0]=r.host:_.unshift(r.host)),r.host=null),g=g&&(_[0]===""||y[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,y=_;else if(_.length)y||(y=[]),y.pop(),y=y.concat(_),e.search=r.search,e.query=r.query;else if(r.search!=null){if(T){e.host=y.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=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!y.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=y.slice(-1)[0],w=(e.host||r.host||y.length>1)&&(S==="."||S==="..")||S==="",M=0,C=y.length;C>=0;C--)S=y[C],S==="."?y.splice(C,1):S===".."?(y.splice(C,1),M++):M&&(y.splice(C,1),M--);if(!g&&!b)for(;M--;M)y.unshift("..");g&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),w&&y.join("/").substr(-1)!=="/"&&y.push("");var R=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(T){e.hostname=R?"":y.length?y.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 g=g||e.host&&y.length,g&&!R&&y.unshift(""),y.length>0?e.pathname=y.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=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};pr.prototype.parseHost=function(){var r=this.host,t=TU.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};Zo.parse=Uh;Zo.resolve=MU;Zo.resolveObject=BU;Zo.format=RU;Zo.Url=pr});var rB=()=>{let r=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))r.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};r.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of r.entries())n[a]=h;return n},clear:()=>r.clear(),size:()=>r.size,has:n=>r.has(n)}};P();var NS={extension:{type:v.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(DS(),cF))}};P();var VS={extension:{type:v.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(HS(),uF))}};P();P();Kl();zl();P();Rt();ya();var zc;function KS(r){return zc!==void 0||(zc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??ki.defaultOptions.failIfMajorPerformanceCaveat};try{if(!$.get().getWebGLRenderingContext())return!1;let i=$.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),zc}Rt();var $c;async function ZS(r={}){return $c!==void 0||($c=await(async()=>{let t=$.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),$c}ya();var c1=["webgl","webgpu","canvas"];async function u1(r){let t=[];r.preference?(t.push(r.preference),c1.forEach(o=>{o!==r.preference&&t.push(o)})):t=c1.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await ZS()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(Ow(),Uw));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&KS(r.failIfMajorPerformanceCaveat??ki.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(l1(),h1));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}_r();Om();Ht();var d1=class wg{constructor(...t){this.stage=new xt,t[0]!==void 0&&z(J,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await u1(t),wg._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return z(J,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=wg._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};d1._plugins=[];var fh=d1;k.handleByList(v.Application,fh._plugins);k.add(Ca);P();ii();Lf();Rt();P();ts();fe();_t();fm();ym();var ph=class extends yo{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=i[n.page],l=new ot(n.x+a.x,n.y+a.y,n.width,n.height),c=new A({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){ca.install(t)}static uninstall(t){ca.uninstall(t)}};var xu={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),b=g[0],y=g[1].replace(/"/gm,""),_=parseFloat(y),T=isNaN(_)?y:_;p[b]=T}e[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};i.baseLineOffset=i.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,i.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);i.chars[h[f]].kerning[h[d]]=p}return i}};Rt();var Ag={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let l=0;l<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(i.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 Pg={test(r){return typeof r=="string"&&r.includes("<font>")?Ag.test($.get().parseXML(r)):!1},parse(r){return Ag.parse($.get().parseXML(r))}};var $F=[".xml",".fnt"],f1={extension:{type:v.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof ph,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},p1={extension:{type:v.LoadParser,priority:pe.Normal},name:"loadBitmapFont",test(r){return $F.includes(ae.extname(r).toLowerCase())},async testParse(r){return xu.test(r)||Pg.test(r)},async parse(r,t,e){let i=xu.test(r)?xu.parse(r):Pg.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.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=ae.join(ae.dirname(s),d);f=On(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new ph({data:i,textures:l},s)},async load(r,t){return await(await $.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};wt();var yu=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 i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};Ai();P();_t();var m1={extension:{type:v.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof A),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};P();async function _u(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var g1={extension:{type:v.DetectionParser,priority:1},test:async()=>_u("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};P();var x1=["png","jpg","jpeg"],y1={extension:{type:v.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...x1],remove:async r=>r.filter(t=>!x1.includes(t))};P();var XF="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Io(r){return XF?!1:document.createElement("video").canPlayType(r)!==""}var _1={extension:{type:v.DetectionParser,priority:0},test:async()=>Io("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};P();var b1={extension:{type:v.DetectionParser,priority:0},test:async()=>Io("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};P();var v1={extension:{type:v.DetectionParser,priority:0},test:async()=>Io("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};P();var T1={extension:{type:v.DetectionParser,priority:0},test:async()=>_u("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};wt();ts();Un();Wl();var bu=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),i.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,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=es(t),n=Ie(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ae.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(++i/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 i=Ie(t,s=>({alias:[s],src:s})).map(async s=>{let o=ae.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(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Rt();P();function lr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}ts();function cr(r,t){let e=r.split("?")[0],i=ae.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}ii();var jF=".json",YF="application/json",S1={extension:{type:v.LoadParser,priority:pe.Low},name:"loadJson",test(r){return lr(r,YF)||cr(r,jF)},async load(r){return await(await $.get().fetch(r)).json()}};Rt();P();ii();var qF=".txt",KF="text/plain",E1={name:"loadTxt",extension:{type:v.LoadParser,priority:pe.Low,name:"loadTxt"},test(r){return lr(r,KF)||cr(r,qF)},async load(r){return await(await $.get().fetch(r)).text()}};Rt();P();wt();ts();Ai();ii();var ZF=["normal","bold","100","200","300","400","500","600","700","800","900"],QF=[".ttf",".otf",".woff",".woff2"],JF=["font/ttf","font/otf","font/woff","font/woff2"],tk=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ek(r){let t=ae.extname(r),s=ae.basename(r,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(tk)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var rk=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function ik(r){return rk.test(r)?r:encodeURI(r)}var w1={extension:{type:v.LoadParser,priority:pe.Low},name:"loadWebFont",test(r){return lr(r,JF)||cr(r,QF)},async load(r,t){let e=$.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??ek(r),o=t.data?.weights?.filter(a=>ZF.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${ik(r)})`,{...n,weight:h});await l.load(),e.add(l),i.push(l)}return bt.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return O("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{bt.remove(`${t.family}-and-url`),$.get().getFontFaceSet().delete(t)})}};Rt();P();js();Rc();$s();function Fo(r,t=1){let e=Ke.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}ii();_t();wt();Ai();function ko(r,t,e){r.label=e,r._sourceOrigin=e;let i=new A({source:r,label:e}),s=()=>{delete t.promiseCache[e],bt.has(e)&&bt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(O("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(O("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var sk=".svg",ok="image/svg+xml",A1={extension:{type:v.LoadParser,priority:pe.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return lr(r,ok)||cr(r,sk)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?ak(r):nk(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function nk(r,t,e,i){let o=await(await $.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||Fo(r),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new Ve({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return ko(m,e,r)}async function ak(r){let e=await(await $.get().fetch(r)).text(),i=new ke;return i.svg(e),i}Rt();P();js();var hk=`(function () {
1095
1095
  'use strict';
1096
1096
 
1097
1097
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
@@ -1141,14 +1141,14 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let i=Ie(t
1141
1141
  };
1142
1142
 
1143
1143
  })();
1144
- `,Oo=null,mh=class{constructor(){Oo||(Oo=URL.createObjectURL(new Blob([lk],{type:"application/javascript"}))),this.worker=new Worker(Oo)}};mh.revokeObjectURL=function(){Oo&&(URL.revokeObjectURL(Oo),Oo=null)};var P1=0,Cg,Rg=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 Uo;e.addEventListener("message",i=>{e.terminate(),Uo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Cg===void 0&&(Cg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Cg&&(this._createdWorkers++,t=new mh().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 i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[P1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:P1++,id:i})}},Mg=new Rg;ii();var ck=[".jpeg",".jpg",".png",".webp",".avif"],uk=["image/jpeg","image/png","image/webp","image/avif"];async function dk(r,t){let e=await z.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var vu={name:"loadTextures",extension:{type:v.LoadParser,priority:pe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return lr(r,uk)||cr(r,ck)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mg.isImageBitmapSupported()?i=await Mg.loadImageBitmap(r,t):i=await dk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Fo(r),...t.data});return ko(s,e,r)},unload(r){r.destroy(!0)}};C();$f();zf();var C1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fk=C1.map(r=>`video/${r.substring(1)}`);function pk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=gk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function mk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function gk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var R1={name:"loadVideo",extension:{type:v.LoadParser,name:"loadVideo"},test(r){let t=lr(r,fk),e=cr(r,C1);return t||e},async load(r,t,e){let i={...Ys.defaultOptions,resolution:t.data?.resolution||Fo(r),alphaMode:t.data?.alphaMode||await Yl(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),i.muted===!0&&(s.muted=!0),pk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Ys.MIME_TYPES[h]||`video/${h}`}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Ys({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await mk(s),h(ko(c,e,r))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(r){r.destroy(!0)}};C();$s();C();$s();var Tu={extension:{type:v.ResolveParser,name:"resolveTexture"},test:vu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var M1={extension:{type:v.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Tu.parse};$s();Un();Wl();var Su=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new bu,this.cache=bt,this._backgroundLoader=new yu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=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:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=es(t),s=Ie(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 i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);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),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),bt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ie(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ie(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},ur=new Su;k.handleByList(v.LoadParser,ur.loader.parsers).handleByList(v.ResolveParser,ur.resolver.parsers).handleByList(v.CacheParser,ur.cache.parsers).handleByList(v.DetectionParser,ur.detections);k.add(m1,y1,g1,T1,_1,b1,v1,S1,E1,w1,A1,vu,R1,p1,f1,Tu,M1);var B1={loader:v.LoadParser,resolver:v.ResolveParser,cache:v.CacheParser,detection:v.DetectionParser};k.handle(v.Asset,r=>{let t=r.ref;Object.entries(B1).filter(([e])=>!!t[e]).forEach(([e,i])=>k.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(B1).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});_t();Bn();zs();Dn();var gh=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof A?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ne.shared.add(this.update,this,Br.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof A)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ne.shared.add(this.update,this),this._isConnectedToTicker=!0))}};El();Ht();Vl();var Eu=class extends Ei{constructor(t,e){let{text:i,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=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new _e({_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,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function I1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(W(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ha();cs();var Er=class extends Eu{constructor(...t){let e=I1(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ii();_t();Yf();_r();cm();Dn();ha();cs();Df();Ee();var xk=$i(uc(),1);k.add(NS,VS);var yk=new(window.AudioContext||window.webkitAudioContext),Bg={},_k=async(r,t)=>{if(!Bg[r]&&t.byteLength!==0)try{let e=await yk.decodeAudioData(t);Bg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},bk=r=>Bg[r],Lo={load:_k,getAsset:bk};var le=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Ig=({type:r,animate:t})=>({type:r,animate:t});var Fg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var F1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},kg={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var fs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ue={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var dr=(r,t)=>{let e={fill:t?.fill??Ue.fill,fontFamily:t?.fontFamily??Ue.fontFamily,fontSize:t?.fontSize??Ue.fontSize,align:t?.align??Ue.align,lineHeight:t?.lineHeight??Ue.lineHeight,wordWrap:t?.wordWrap??Ue.wordWrap,breakWords:t?.breakWords??Ue.breakWords,strokeColor:t?.strokeColor??Ue.strokeColor,strokeWidth:t?.strokeWidth??Ue.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ue.wordWrapWidth};r.style=e};async function et(r,t,{app:e,element:i,animations:s,signal:o,eventHandler:n}){let a=[];for(let h of s)if(h.targetId===r){let l=t.find(c=>c.type===h.type);if(!l)throw new Error(`No animation plugin found for type: ${h.type}`);a.push(l.animate({app:e,element:i,animation:h,signal:o,eventHandler:n}))}return Promise.all(a)}var k1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new Er({label:e.id}),l=()=>{h.text=e.content,dr(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click,f=e?.rightClick,p={isHovering:!1,isPressed:!1,isRightPressed:!1},m=({isHovering:g,isPressed:b,isRightPressed:y})=>{y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):g&&u?.textStyle?dr(h,u.textStyle):dr(h,e.textStyle)};if(u){let{cursor:g,soundSrc:b,actionPayload:y}=u;h.eventMode="static";let _=()=>{p.isHovering=!0,y&&s&&s("hover",{_event:{id:h.label},...y}),g&&(h.cursor=g),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1}),m(p)},T=()=>{p.isHovering=!1,h.cursor="auto",m(p)};h.on("pointerover",_),h.on("pointerout",T)}if(d){let{soundSrc:g,actionPayload:b}=d;h.eventMode="static";let y=()=>{p.isPressed=!0,m(p)},_=()=>{p.isPressed=!1,m(p),b&&s&&s("click",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isPressed=!1,m(p)};h.on("pointerdown",y),h.on("pointerup",_),h.on("pointerupoutside",T)}if(f){let{soundSrc:g,actionPayload:b}=f;h.eventMode="static";let y=()=>{p.isRightPressed=!0,m(p)},_=()=>{p.isRightPressed=!1,m(p),b&&s&&s("rightclick",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isRightPressed=!1,m(p)};h.on("rightdown",y),h.on("rightup",_),h.on("rightupoutside",T)}t.addChild(h),i&&i.length>0&&(a=!1,await et(e.id,o,{app:r,element:h,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",c)};var G1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.text=i.content,dr(h,i.textStyle),h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m={isHovering:!1,isPressed:!1,isRightPressed:!1},g=({isHovering:b,isPressed:y,isRightPressed:_})=>{_&&p?.textStyle?dr(h,p.textStyle):y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):dr(h,i.textStyle)};if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{m.isHovering=!0,_&&s&&s("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1}),g(m)},E=()=>{m.isHovering=!1,h.cursor="auto",g(m)};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{m.isPressed=!0,g(m)},T=()=>{m.isPressed=!1,g(m),y&&s&&s("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isPressed=!1,g()};h.on("pointerdown",_),h.on("pointerup",T),h.on("pointerupoutside",E)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{m.isRightPressed=!0,g(m)},T=()=>{m.isRightPressed=!1,g(m),y&&s&&s("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isRightPressed=!1,g(m)};h.on("rightdown",_),h.on("rightup",T),h.on("rightupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await et(i.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l=!0),c(),a.removeEventListener("abort",u))};var U1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var O1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var Ae=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===fs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=O1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var L1=({state:r})=>{let t={...Ue,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let{width:e,height:i}=qt.measureText(r.content??"",new Mt(t)),s=Math.round(e),o=Math.round(i);return{...Ae({...r,width:s,height:o}),content:r.content??"",textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var vk=le({type:"text",add:k1,update:G1,delete:U1,parse:L1});var D1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,alpha:p}=e,m=new he;m.label=a;let g=!0,b=()=>{m.clear(),m.rect(0,0,Math.round(c),Math.round(u)).fill(d),m.x=Math.round(h),m.y=Math.round(l),m.alpha=p,f&&m.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},y=async()=>{g||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S=e?.scroll,w=e?.drag;if(_){let{cursor:M,soundSrc:P,actionPayload:R}=_;m.eventMode="static";let B=()=>{R&&o&&o("hover",{_event:{id:m.label},...R}),M&&(m.cursor=M),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{m.cursor="auto"};m.on("pointerover",B),m.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:P}=T;m.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:m.label},...P}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};m.on("pointerup",R)}if(E){let{soundSrc:M,actionPayload:P}=E;m.eventMode="static";let R=()=>{P&&o&&o("rightclick",{_event:{id:m.label},...P}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})};m.on("rightclick",R)}if(S){m.eventMode="static";let M=P=>{if(P.deltaY<0&&S.up){let{actionPayload:R}=S.up;R&&o&&o("scrollup",{_event:{id:m.label},...R})}else if(P.deltaY>0&&S.down){let{actionPayload:R}=S.down;R&&o&&o("scrolldown",{_event:{id:m.label},...R})}};m.on("wheel",M)}if(w){let{start:M,end:P,move:R}=w;m.eventMode="static";let B=()=>{m._isDragging=!0,M&&o&&o("drag-start",{_event:{id:m.label},...typeof M?.actionPayload=="object"?M.actionPayload:{}})},F=()=>{m._isDragging=!1,P&&o&&o("drag-end",{_event:{id:m.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},X=L=>{R&&o&&m._isDragging&&o("drag-move",{_event:{id:m.label,x:L.global.x,y:L.global.y},...typeof R?.actionPayload=="object"?R.actionPayload:{}})};m.on("pointerdown",B),m.on("pointerup",F),m.on("globalpointermove",X),m.on("pointerupoutside",F)}t.addChild(m),i&&i.length>0&&(g=!1,await et(a,s,{app:r,element:m,animations:i,signal:n,eventHandler:o})),g=!0,n.removeEventListener("abort",y)};var N1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.clear(),h.rect(0,0,Math.round(i.width),Math.round(i.height)).fill(i.fill),h.x=Math.round(i.x),h.y=Math.round(i.y),h.alpha=i.alpha,i.border&&h.stroke({color:i.border.color,alpha:i.border.alpha,width:Math.round(i.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m=i?.scroll,g=i?.drag;if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{_&&n&&n("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1})},E=()=>{h.cursor="auto"};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{y&&n&&n("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})};h.on("pointerup",_)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{y&&n&&n("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})};h.on("rightclick",_)}if(m){h.eventMode="static";let b=y=>{if(y.deltaY<0&&m.up){let{actionPayload:_}=m.up;_&&n&&n("scrollup",{_event:{id:h.label},..._})}else if(y.deltaY>0&&m.down){let{actionPayload:_}=m.down;_&&n&&n("scrolldown",{_event:{id:h.label},..._})}};h.on("wheel",b)}if(g){let{start:b,end:y,move:_}=g;h.eventMode="static";let T=()=>{h._isDragging=!0,b&&n&&n("drag-start",{_event:{id:h.label},...typeof b?.actionPayload=="object"?b.actionPayload:{}})},E=()=>{h._isDragging=!1,y&&n&&n("drag-end",{_event:{id:h.label},...typeof y?.actionPayload=="object"?y.actionPayload:{}})},S=w=>{_&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:w.global.x,y:w.global.y},...typeof _?.actionPayload=="object"?_.actionPayload:{}})};h.on("pointerdown",T),h.on("pointerup",E),h.on("globalpointermove",S),h.on("pointerupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var H1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var V1=({state:r})=>{let t=Ae(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,cursor:r.cursor??"",fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var Tk=le({type:"rect",add:D1,update:N1,delete:H1,parse:V1});var W1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?A.from(f):A.EMPTY,g=new kt(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},y=async()=>{a||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:M,isPressed:P,isRightPressed:R})=>{if(R&&E?.src){let B=A.from(E.src);g.texture=B}else if(P&&T?.src){let B=A.from(T.src);g.texture=B}else if(M&&_?.src){let B=A.from(_.src);g.texture=B}else g.texture=m};if(_){let{cursor:M,soundSrc:P,actionPayload:R}=_;g.eventMode="static";let B=()=>{S.isHovering=!0,R&&s&&s("hover",{_event:{id:g.label},...R}),M&&(g.cursor=M),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1}),w(S)},F=()=>{S.isHovering=!1,g.cursor="auto",w(S)};g.on("pointerover",B),g.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:P}=T;g.eventMode="static";let R=()=>{S.isPressed=!0,w(S)},B=()=>{S.isPressed=!1,w(S),P&&s&&s("click",{_event:{id:g.label},...P}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isPressed=!1,w(S)};g.on("pointerdown",R),g.on("pointerup",B),g.on("pointerupoutside",F)}if(E){let{soundSrc:M,actionPayload:P}=E;g.eventMode="static";let R=()=>{S.isRightPressed=!0,w(S)},B=()=>{S.isRightPressed=!1,w(S),P&&s&&s("rightclick",{_event:{id:g.label},...P}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isRightPressed=!1,w(S)};g.on("rightdown",R),g.on("rightup",B),g.on("rightupoutside",F)}t.addChild(g),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:g,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",y)};var z1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){let d=i.src?A.from(i.src):A.EMPTY;h.texture=d,h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let f=i?.hover,p=i?.click,m=i?.rightClick,g={isHovering:!1,isPressed:!1,isRightPressed:!1},b=({isHovering:y,isPressed:_,isRightPressed:T})=>{if(T&&m?.src){let E=A.from(m.src);h.texture=E}else if(_&&p?.src){let E=A.from(p.src);h.texture=E}else if(y&&f?.src){let E=A.from(f.src);h.texture=E}else h.texture=d};if(f){let{cursor:y,soundSrc:_,actionPayload:T}=f;h.eventMode="static";let E=()=>{g.isHovering=!0,T&&n&&n("hover",{_event:{id:h.label},...T}),y&&(h.cursor=y),_&&r.audioStage.add({id:`hover-${Date.now()}`,url:_,loop:!1}),b(g)},S=()=>{g.isHovering=!1,h.cursor="auto",b(g)};h.on("pointerover",E),h.on("pointerout",S)}if(p){let{soundSrc:y,actionPayload:_}=p;h.eventMode="static";let T=()=>{g.isPressed=!0,b(g)},E=()=>{g.isPressed=!1,b(g),_&&n&&n("click",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`click-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isPressed=!1,b(g)};h.on("pointerdown",T),h.on("pointerup",E),h.on("pointerupoutside",S)}if(m){let{soundSrc:y,actionPayload:_}=m;h.eventMode="static";let T=()=>{g.isRightPressed=!0,b(g)},E=()=>{g.isRightPressed=!1,b(g),_&&n&&n("rightclick",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isRightPressed=!1,b(g)};h.on("rightdown",T),h.on("rightup",E),h.on("rightupoutside",S)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var $1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var X1=({state:r})=>({...Ae(r),src:r.src??"",alpha:r.alpha??1,cursor:r.cursor??"",...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Sk=le({type:"sprite",add:W1,update:z1,delete:$1,parse:X1});var j1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,volume:p,loop:m,alpha:g}=e,b=A.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=p/1e3,y.muted=!1,y.play();let _=new kt(b);_.label=h;let T=()=>{_.x=Math.round(l),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=g??1},E=async()=>{a||T()};n.addEventListener("abort",E),T(),t.addChild(_),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:_,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",E)};var Y1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){if(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha??1,e.src!==i.src){let d=h.texture.source.resource;d&&d.pause();let f=A.from(i.src);h.texture=f;let p=f.source.resource;p.muted=!1,p.pause(),p.currentTime=0,p.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var q1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{if(a&&!a.destroyed){let u=a.texture.source.resource;u&&u.pause(),t.removeChild(a),a.destroy()}},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var K1=({state:r})=>({...Ae(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Ek=le({type:"video",add:j1,update:Y1,delete:q1,parse:K1});var Z1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:y,step:_,initialValue:T,originX:E,originY:S,hover:w,change:M}=e,P=new xt;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,B=m?A.from(m):A.EMPTY,F=new kt(B);F.label=`${h}-bar`,F.eventMode="static";let X=p?A.from(p):A.EMPTY,L=new kt(X);L.label=`${h}-thumb`,L.eventMode="static";let nt=T??b,D=y-b,$=St=>{let ut=(St-b)/D;g==="horizontal"?(L.x=ut*(F.width-L.width),L.y=(F.height-L.height)/2):(L.x=(F.width-L.width)/2,L.y=ut*(F.height-L.height))},H=()=>{F.width=u,F.height=d;let St=g==="horizontal"?d-R*2:u-R*2,ut=p?A.from(p):A.EMPTY,yt=ut.width,Ft=ut.height,Qt=St/yt,Jt=St/Ft,De=Math.min(Qt,Jt);L.width=yt*De,L.height=Ft*De,$(nt)},U=async()=>{a||H()};n.addEventListener("abort",U),H();let tt=X,vt=B,gt=!1,Dt=St=>{let ut;if(g==="horizontal"){let Ft=St.x-L.width/2;ut=Math.max(0,Math.min(1,Ft/(F.width-L.width)))}else{let Ft=St.y-L.height/2;ut=Math.max(0,Math.min(1,Ft/(F.height-L.height)))}let yt=b+ut*D;return _>0&&(yt=Math.round((yt-b)/_)*_+b,yt=Math.max(b,Math.min(y,yt))),yt},Nt=St=>{let ut=P.toLocal(St.global),yt=Dt(ut);yt!==nt&&(nt=yt,$(nt),M?.actionPayload&&o&&o("change",{_event:{id:h,value:nt},...M.actionPayload}))},Zt=St=>{gt=!0,Nt(St)},oe=St=>{gt&&Nt(St)},Te=()=>{gt&&(gt=!1)};if(P.on("pointerdown",Zt),P.on("globalpointermove",oe),P.on("pointerup",Te),P.on("pointerupoutside",Te),w){let{cursor:St,soundSrc:ut,thumbSrc:yt,barSrc:Ft}=w,Qt=()=>{St&&(F.cursor=St,L.cursor=St),ut&&r.audioStage.add({id:`hover-${Date.now()}`,url:ut,loop:!1}),yt&&(L.texture=A.from(yt)),Ft&&(F.texture=A.from(Ft))},Jt=()=>{gt||(F.cursor="auto",L.cursor="auto",L.texture=tt,F.texture=vt)};P.on("pointerover",Qt),P.on("pointerout",Jt),P.on("pointerupoutside",Jt)}P.addChild(F),P.addChild(L),t.addChild(P),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:P,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",U)};var Q1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let c=h.getChildByLabel(`${i.id}-bar`),u=h.getChildByLabel(`${i.id}-thumb`);if(c&&u){c.width=i.width,c.height=i.height;let d=0,f=i.direction==="horizontal"?i.height-d*2:i.width-d*2,p=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY,m=p.width||16,g=p.height||16,b=f/m,y=f/g,_=Math.min(b,y);if(u.width=m*_,u.height=g*_,e.barSrc!==i.barSrc){let S=i.barSrc?A.from(i.barSrc):A.EMPTY;c.texture=S}if(e.thumbSrc!==i.thumbSrc){let S=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY;u.texture=S}let T=i.max-i.min,E=(i.initialValue-i.min)/T;i.direction==="horizontal"?(u.x=E*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=E*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:y}=i,_=y??p,T=m-p;h.eventMode="static";let E=L=>{let nt=(L-p)/T;b==="horizontal"?(u.x=nt*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=nt*(c.height-u.height))},S=L=>{let nt;if(b==="horizontal"){let $=L.x-u.width/2;nt=Math.max(0,Math.min(1,$/(c.width-u.width)))}else{let $=L.y-u.height/2;nt=Math.max(0,Math.min(1,$/(c.height-u.height)))}let D=p+nt*T;return g>0&&(D=Math.round((D-p)/g)*g+p,D=Math.max(p,Math.min(m,D))),D},w=u.texture,M=c.texture,P=!1,R=L=>{let nt=h.toLocal(L.global),D=S(nt);D!==_&&(_=D,E(_),f?.actionPayload&&s&&s("change",{_event:{id,value:_},...f.actionPayload}))},B=L=>{P=!0,R(L)},F=L=>{P&&R(L)},X=()=>{P&&(P=!1)};if(h.on("pointerdown",B),h.on("globalpointermove",F),h.on("pointerup",X),h.on("pointerupoutside",X),d){let{cursor:L,soundSrc:nt,thumbSrc:D,barSrc:$}=d,H=()=>{L&&(h.cursor=L,u.cursor=L),nt&&r.audioStage.add({id:`hover-${Date.now()}`,url:nt,loop:!1}),D&&(u.texture=A.from(D)),$&&(c.texture=A.from($))},U=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=w,c.texture=M)};h.on("pointerover",H),h.on("pointerout",U),h.on("pointerupoutside",U)}}}};h&&(o&&o.length>0&&await et(e.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l())};var J1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{if(o?.aborted)return;let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy({children:!0})},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var tP=({state:r})=>{let t=Ae(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue??0,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var wk=le({type:"slider",add:Z1,update:Q1,delete:J1,parse:tP});var xh=({container:r,element:t})=>{let e=0,i=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),i=Math.max(n.height+n.y,i)});let s=t.scroll&&t.height&&i>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new xt({label:`${r.label}-content`});[...r.children].forEach(f=>{n.addChild(f)}),r.addChild(n);let h=new he({label:`${r.label}-clip`}).rect(0,0,t.width||e,t.height||i).fill({color:16711680,alpha:0});r.addChild(h),n.mask=h,r.eventMode="static";let l=0,c=0,u=-(i-(t.height||i)),d=-(e-(t.width||e));r.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}},Gg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.removeAllListeners("wheel")};var eP=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new xt;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let y of u){let _=n.find(T=>T.type===y.type);if(!_)throw new Error(`No plugin found for child element type: ${y.type}`);await _.add({app:r,parent:p,element:y,animations:i,eventHandler:s,animationPlugins:o,animateElements:et,elementPlugins:n,signal:a})}d&&xh({container:p,element:e}),i&&i.length>0&&(m=!1,await et(h,o,{app:r,element:p,animations:i,signal:a,eventHandler:s})),m=!0,a.removeEventListener("abort",b)};var rP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of r)i.add(l.id),s.set(l.id,l);for(let l of t)i.add(l.id),o.set(l.id,l);for(let l of i){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var yh=async({app:r,parent:t,prevASTTree:e,nextASTTree:i,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=rP(e,i,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:r,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:r,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:r,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),Ak(t,i)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},Ak=(r,t)=>{r.children=r.children.sort((e,i)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===i.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1}).map((e,i)=>(e.zIndex=i,e))};var iP=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(i)&&(l.x=Math.round(i.x),l.y=Math.round(i.y),l.label=i.id,l.alpha=i.alpha,e.scroll!==i.scroll?i.scroll?xh({container:l,element:i}):Gg({container:l}):i.scroll&&(Gg({container:l}),xh({container:l,element:i})),JSON.stringify(e.children)!==JSON.stringify(i.children)&&await yh({app:r,parent:i.scroll?l.children.find(f=>f.label===`${i.id}-content`):l,nextASTTree:i.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await et(e.id,n,{app:r,element:l,animations:o,signal:h,eventHandler:s})),c=!0,await u(),h.removeEventListener("abort",d))};var sP=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))},c=async()=>{h||l()};o.addEventListener("abort",c),s&&s.length>0&&(h=!1,await et(e.id,i,{app:r,element:a,animations:s,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var oP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let y=0;y<o.length;y++){let _=y<o.length-1?s:0,T=o[y];y>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let E=t.find(S=>S.type===T.type);E&&(T=E.parse({state:T,parserPlugins:t})),e==="horizontal"?(r.width&&T.width+m>r.width&&!i?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+_,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"?(r.height&&T.height+g>r.height&&!i?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+_,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)):(a=Math.max(T.width+T.x,a),h=Math.max(T.height+T.y,h)),n.push(T)}return{...Ae({...r,width:r.width?r.width:a,height:r.height?r.height:h}),children:n,direction:e,gap:s,scroll:i,rotation:r.rotation??0}};var Pk=le({type:"container",add:eP,update:iP,delete:sP,parse:oP});function Do(r,t){let e=r.text.substring(0,t),s=qt.measureText(e,r.style).width;return r.x+s}var Ck=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},r),o=()=>{clearTimeout(s),i(t.reason)};t?.addEventListener("abort",o,{once:!0})}),No=Ck;var nP=async({parent:r,element:t,signal:e,eventHandler:i})=>{let s=t.speed??50,o=t.revealEffect??"typewriter",n=t?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=new xt;c.label=t.id;let u=new kt(A.EMPTY);if(t?.indicator?.revealing?.src){let d=t.indicator.revealing.src?A.from(t.indicator.revealing.src):A.EMPTY;u=new kt(d),u.width=t.indicator.revealing.width??d.width,u.height=t.indicator.revealing.height??d.height}c.addChild(u),t.x!==void 0&&(c.x=Math.round(t.x)),t.y!==void 0&&(c.y=Math.round(t.y)),t.alpha!==void 0&&(c.alpha=t.alpha),r.addChild(c);for(let d=0;d<t.content.length;d++){let f=t.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(e?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new Er({text:"",style:g,x:Math.round(m.x),y:Math.round(m.y)}),y=null;if(m.furigana){let E=new Mt(m.furigana.textStyle);y=new Er({text:"",style:E,x:Math.round(m.furigana.x),y:Math.round(m.furigana.y)}),c.addChild(y)}c.addChild(b);let _=m.text,T=m.furigana?.text||"";if(a||e?.aborted)b.text=_,u.x=Do(b,_.length-1)+n,y&&(y.text=T);else{let E=T.length;for(let S=0;S<_.length;S++){if(e?.aborted)return;b.text=_.substring(0,S+1),u.x=Do(b,S)+n;let w=Math.round((S+1)/_.length*E);if(y&&(y.text=T.substring(0,w)),S<_.length-1)try{await No(h,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(d<t.content.length-1)try{await No(l,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let d=t.indicator.complete.src?A.from(t.indicator.complete.src):A.EMPTY;u.texture=d,u.width=t.indicator.complete.width??d.width,u.height=t.indicator.complete.height??d.height}i&&t?.complete?.actionPayload&&i("complete",{_event:{id:t.id},...t?.complete?.actionPayload??{}})};var aP=async r=>{let{parent:t,nextElement:e,signal:i,eventHandler:s}=r,o=e.speed??50,n=e.revealEffect??"typewriter",a=e?.indicator?.offset??12,h=n==="none",l=h?0:Math.max(1,Math.floor(1e3/o)),c=h?0:Math.max(1,Math.floor(4e3/o)),u=t.children.find(d=>d.label===e.id);if(u){u.removeChildren();let d=new kt(A.EMPTY);if(e?.indicator?.revealing?.src){let f=e.indicator.revealing.src?A.from(e.indicator.revealing.src):A.EMPTY;d=new kt(f),d.width=e.indicator.revealing.width??f.width,d.height=e.indicator.revealing.height??f.height}u.addChild(d),e.x!==void 0&&(u.x=e.x),e.y!==void 0&&(u.y=e.y),e.alpha!==void 0&&(u.alpha=e.alpha);for(let f=0;f<e.content.length;f++){let p=e.content[f];d.x=a,d.y=p.y+(p.lineMaxHeight-d.height);for(let m=0;m<p.lineParts.length;m++){if(i?.aborted)return;let g=p.lineParts[m],b=new Mt(g.textStyle),y=new Er({text:"",style:b,x:g.x,y:g.y}),_=null;if(g.furigana){let S=new Mt(g.furigana.textStyle);_=new Er({text:"",style:S,x:g.furigana.x,y:g.furigana.y}),u.addChild(_)}u.addChild(y);let T=g.text,E=g.furigana?.text||"";if(h||i?.aborted)y.text=T,d.x=Do(y,T.length-1)+a,_&&(_.text=E);else{let S=E.length;for(let w=0;w<T.length;w++){y.text=T.substring(0,w+1),d.x=Do(y,w)+a;let M=Math.round((w+1)/T.length*S);if(_&&(_.text=E.substring(0,M)),w<T.length-1)try{await No(l,i)}catch(P){if(P.name==="AbortError")return;throw P}}}}if(f<e.content.length-1)try{await No(c,i)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let f=e.indicator.complete.src?A.from(e.indicator.complete.src):A.EMPTY;d.texture=f,d.width=e.indicator.complete.width??f.width,d.height=e.indicator.complete.height??f.height}s&&e?.complete?.actionPayload&&s("complete",{_event:{id:e.id},...e?.complete?.actionPayload??{}})}};var hP=async({parent:r,element:t,signal:e})=>{if(e?.aborted)return;let i=r.getChildByLabel(t.id);if(i){let s=!0,o=()=>{i&&!i.destroyed&&i.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var Rk=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,h=[...r],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},p=qt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=qt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let _=qt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(p.lineWidths[0]-_.width)/2),y:T};b.furigana=E}i.push(b),n=Math.max(n,g.height),s+=Math.round(p.lineWidths[0]),a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},lP=({state:r})=>{let t={...Ue,wordWrap:!0},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),r.width&&(f.wordWrapWidth=r.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Rk(e,i),a=r.width||o,l=Ae({...r,width:a,height:n});if(l.alpha=r.alpha??1,r.indicator){let c=r.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Mk=le({type:"text-revealing",add:nP,update:aP,delete:hP,parse:lP});var wu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Au=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var cP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:p,animation:m,alpha:g}=e,b=p,y=Object.keys(b.frames),_=new wi(A.from(f),b);await _.parse();let T=m.frames.map(M=>_.textures[y[M]]),E=new gh(T);E.label=h,E.animationSpeed=m.animationSpeed??.5,E.loop=m.loop??!0,r.debug?wu(E,h,r.debug):E.play();let S=()=>{E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=g},w=async()=>{a||S()};n.addEventListener("abort",w),S(),t.addChild(E),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:E,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",w)};var uP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=async()=>{if(JSON.stringify(e)!==JSON.stringify(i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,JSON.stringify(e.animation)!==JSON.stringify(i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let d=i.spritesheetData,f=Object.keys(d.frames),p=new wi(A.from(i.spritesheetSrc),d);await p.parse();let m=i.animation.frames.map(g=>p.textures[f[g]]);h.textures=m,r.debug?e.id!==i.id&&(Au(h),wu(h,i.id,r.debug)):h.play()}},u=async()=>{l||await c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),await c(),a.removeEventListener("abort",u))};var dP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{r.debug&&Au(a),a&&!a.destroyed&&(a.stop(),a.destroy())},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var fP=({state:r})=>({...Ae(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Bk=le({type:"animated-sprite",add:cP,update:uP,delete:dP,parse:fP});var Ik={linear:r=>r},Fk=(r,t,e,i)=>r+(t-r)*Ik[i](e),kk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s of t){if(i==null)return e;i=i[s]}return i===void 0?e:i},Gk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s=0;s<t.length-1;s++){let o=t[s];o in i||(i[o]={}),i=i[o]}return i[t[t.length-1]]=e,r},Uk=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(i=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?i=i+s:i=s,t.push({time:e,value:i,easing:n}))}),t},Ok=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let h=(t-i)/(n-i);return Fk(s,a,h,o)}}return r[r.length-1].value},Lk=r=>Math.max.apply(null,r),pP=async({app:r,element:t,animation:e,signal:i,eventHandler:s})=>new Promise((o,n)=>{if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}let{properties:a,complete:h,id:l,targetId:c}=e,u=Object.entries(a).map(([_,T])=>{if(!F1[_])throw new Error(`${_} is not a supported property for transition.`);return{...T,property:_}}),d=u.map(_=>_.keyframes.reduce((T,E)=>T+E.duration||0,0)),f=Lk(d),p={};u.forEach(_=>{p[_.property]=kk(t,_.property)});let m=u.map(_=>{let T=[];_.initialValue!==void 0?T=[{value:_.initialValue}]:T=[{value:p[_.property]}],T=T.concat(_.keyframes);let E=Uk(T);return{property:_.property,timeline:E}}),g=0,b=_=>{m.forEach(({property:T,timeline:E})=>{let S=Ok(E,_);t&&!t.destroyed&&Gk(t,T,S)})};i&&i.addEventListener("abort",()=>{r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"))});let y=_=>{if(g+=_.deltaMS,g>=f){if(r.ticker.remove(y),b(f),s&&h){let T=h?.actionPayload;s("complete",{_event:{id:l,targetId:c},...T??{}})}o();return}b(g)};if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}r?.debug?window.addEventListener("snapShotKeyFrame",_=>{_?.detail?.deltaMS&&y({deltaMS:Number(_.detail.deltaMS)})}):r.ticker.add(y)});var Dk=Ig({type:"tween",animate:pP});var mP=({app:r,element:t,signal:e})=>{if(e?.aborted)return;let i={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||r.audioStage.add(i)},t.delay):r.audioStage.add(i)};var gP=({app:r,prevElement:t,nextElement:e,signal:i})=>{if(!i?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=r.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var xP=({app:r,element:t,signal:e})=>{e?.aborted||r.audioStage.remove(t.id)};var Nk=Fg({type:"sound",add:mP,update:gP,delete:xP});var _h=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ug(r){let t=new he;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Og(r){let t=new he;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Lg(r){let t=new he;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function bh(r,t,e){return r+(t-r)*e}function Cu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function yP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,h=t&255,l=Math.round(bh(i,n,e)),c=Math.round(bh(s,a,e)),u=Math.round(bh(o,h,e));return l<<16|c<<8|u}var Pu=class r{constructor(t,e,i=!1){this.value=i?Cu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},wr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Pu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?yP(e.value,e.next.value,i):bh(e.value,e.next.value,i)}};var Ru=class{static type="alpha";constructor(t){this.list=new wr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Mu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Bu=class{static type="scale";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Iu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Hk=Math.PI/180,Fu=class{static type="speed";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},ku=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Gu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Hk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Alt=Math.PI/180,Uu=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Ou=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Oi=Math.PI/180,Lu=class{static type="rotation";constructor(t){this.minStart=t.minStart*Oi,this.maxStart=t.maxStart*Oi,this.minSpeed=t.minSpeed*Oi,this.maxSpeed=t.maxSpeed*Oi,this.accel=(t.accel??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Du=class{static type="rotationStatic";constructor(t){this.min=t.min*Oi,this.max=t.max*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Nu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var Hu=class{static type="color";constructor(t){this.list=new wr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Vu=class{static type="colorStatic";constructor(t){this.color=Cu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var Wu=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},zu=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Dg=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Ng=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},Vk={rect:Wu,rectangle:Wu,torus:zu,circle:zu,point:Dg,line:Ng};var $u=class{static type="spawnShape";constructor(t){let e=Vk[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},Xu=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var _P=new Map,bP=new Map;function Hg(r,t){_P.set(r,t)}function Pe(r){bP.set(r.type,r)}function vP(r,t){let e=_P.get(r);return e?e(t):null}function TP(r){return bP.get(r)}Hg("circle",Lg);Hg("snowflake",Ug);Hg("raindrop",Og);Pe(Ru);Pe(Mu);Pe(Bu);Pe(Iu);Pe(Fu);Pe(ku);Pe(Gu);Pe(Uu);Pe(Ou);Pe(Lu);Pe(Du);Pe(Nu);Pe(Hu);Pe(Vu);Pe($u);Pe(Xu);var ju=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var vh=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new ju(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=TP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new _h(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function Wk(r,t){let e=new he,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Th=async({app:r,parent:t,element:e,signal:i})=>{if(i?.aborted)return;let s=new xt;s.label=e.id,t.addChild(s);let o=e.width,n=e.height;s.x=e.x??0,s.y=e.y??0;let a={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},h;if(typeof e.texture=="object"&&e.texture.shape)h=Wk(r,e.texture);else{let u=e.texture??"circle";if(h=vP(u,r),!h)try{h=A.from(u)}catch{console.warn(`Failed to load particle texture: ${u}`);return}}a.texture=h;let l=new vh(s,a);if(s.emitter=l,a.recycleOnBounds){let u=Math.min(e.count??100,a.maxParticles);l.spawn(u);let d=l._activeFirst;for(;d;)d.y=l.random()*n,d.age=l.random()*d.maxLife*.8,d=d.next}let c=u=>{if(l.destroyed){r.ticker.remove(c);return}l.update(u.deltaTime/60)};if(s.tickerCallback=c,r?.debug){let u=d=>{if(l.destroyed){window.removeEventListener("snapShotKeyFrame",u);return}d?.detail?.deltaMS&&l.update(Number(d.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",u),s.customTickerHandler=u}else r.ticker.add(c);e.alpha!==void 0&&(s.alpha=e.alpha)};var Yu=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await et(e.id,i,{app:r,element:n,animations:s,signal:o}),a()}};var SP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(c=>c.label===e.id);if(!h){await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a});return}zk(e,i)?(await Yu({app:r,parent:t,element:e,animations:s,animationPlugins:o,eventHandler:n,signal:a}),await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})):(i.alpha!==void 0&&(h.alpha=i.alpha),i.x!==void 0&&(h.x=i.x),i.y!==void 0&&(h.y=i.y))};function zk(r,t){return r.count!==t.count||JSON.stringify(r.texture)!==JSON.stringify(t.texture)||JSON.stringify(r.behaviors)!==JSON.stringify(t.behaviors)||JSON.stringify(r.emitter)!==JSON.stringify(t.emitter)||r.width!==t.width||r.height!==t.height}function EP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function wP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function AP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function PP(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function CP(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function RP(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var MP=({state:r})=>{EP(r),wP(r),AP(r),PP(r),CP(r),RP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var $k=le({type:"particles",add:Th,update:SP,delete:Yu,parse:MP});var BP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let h of r)e.add(h.id),i.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=i.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vg=async({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=BP(t,e),h=[];for(let l of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:r,element:l,signal:s}))}for(let l of o){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:r,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=i.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:r,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),Wg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Wg||{}),qu=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(qu||{}),Z=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Z||{}),Ho=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ho||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),ci=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(ci||{}),it=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(it||{}),N=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(N||{}),fr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(fr||{}),Sh=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sh||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),Qe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Qe||{}),Li=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Li||{}),Ku=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Ku||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),re=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(re||{});var Pt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pt||{}),Xe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Xe||{});var zg={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:zg,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Cf();var Xk=Si.default??Si,Pr=Xk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var bs=$i(FP(),1),OU=$i(uc(),1);var Ex=$i(qR(),1);var KR={};function lt(r,t,e=3){if(KR[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1144
+ `,Oo=null,mh=class{constructor(){Oo||(Oo=URL.createObjectURL(new Blob([lk],{type:"application/javascript"}))),this.worker=new Worker(Oo)}};mh.revokeObjectURL=function(){Oo&&(URL.revokeObjectURL(Oo),Oo=null)};var P1=0,Cg,Rg=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 Uo;e.addEventListener("message",i=>{e.terminate(),Uo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Cg===void 0&&(Cg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Cg&&(this._createdWorkers++,t=new mh().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 i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[P1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:P1++,id:i})}},Mg=new Rg;ii();var ck=[".jpeg",".jpg",".png",".webp",".avif"],uk=["image/jpeg","image/png","image/webp","image/avif"];async function dk(r,t){let e=await $.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var vu={name:"loadTextures",extension:{type:v.LoadParser,priority:pe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return lr(r,uk)||cr(r,ck)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mg.isImageBitmapSupported()?i=await Mg.loadImageBitmap(r,t):i=await dk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Fo(r),...t.data});return ko(s,e,r)},unload(r){r.destroy(!0)}};P();$f();zf();var C1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fk=C1.map(r=>`video/${r.substring(1)}`);function pk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=gk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function mk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function gk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var R1={name:"loadVideo",extension:{type:v.LoadParser,name:"loadVideo"},test(r){let t=lr(r,fk),e=cr(r,C1);return t||e},async load(r,t,e){let i={...Ys.defaultOptions,resolution:t.data?.resolution||Fo(r),alphaMode:t.data?.alphaMode||await Yl(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),i.muted===!0&&(s.muted=!0),pk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Ys.MIME_TYPES[h]||`video/${h}`}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Ys({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await mk(s),h(ko(c,e,r))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(r){r.destroy(!0)}};P();$s();P();$s();var Tu={extension:{type:v.ResolveParser,name:"resolveTexture"},test:vu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var M1={extension:{type:v.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Tu.parse};$s();Un();Wl();var Su=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new bu,this.cache=bt,this._backgroundLoader=new yu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=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:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=es(t),s=Ie(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 i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);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),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),bt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ie(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ie(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},ur=new Su;k.handleByList(v.LoadParser,ur.loader.parsers).handleByList(v.ResolveParser,ur.resolver.parsers).handleByList(v.CacheParser,ur.cache.parsers).handleByList(v.DetectionParser,ur.detections);k.add(m1,y1,g1,T1,_1,b1,v1,S1,E1,w1,A1,vu,R1,p1,f1,Tu,M1);var B1={loader:v.LoadParser,resolver:v.ResolveParser,cache:v.CacheParser,detection:v.DetectionParser};k.handle(v.Asset,r=>{let t=r.ref;Object.entries(B1).filter(([e])=>!!t[e]).forEach(([e,i])=>k.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(B1).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});_t();Bn();zs();Dn();var gh=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof A?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ne.shared.add(this.update,this,Br.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof A)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ne.shared.add(this.update,this),this._isConnectedToTicker=!0))}};El();Ht();Vl();var Eu=class extends Ei{constructor(t,e){let{text:i,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=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new _e({_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,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function I1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(z(J,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ha();cs();var Er=class extends Eu{constructor(...t){let e=I1(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ii();_t();Yf();_r();cm();Dn();ha();cs();Df();Ee();var xk=$i(uc(),1);k.add(NS,VS);var yk=new(window.AudioContext||window.webkitAudioContext),Bg={},_k=async(r,t)=>{if(!Bg[r]&&t.byteLength!==0)try{let e=await yk.decodeAudioData(t);Bg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},bk=r=>Bg[r],Lo={load:_k,getAsset:bk};var le=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Ig=({type:r,animate:t})=>({type:r,animate:t});var Fg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var F1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},kg={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var fs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ue={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var dr=(r,t)=>{let e={fill:t?.fill??Ue.fill,fontFamily:t?.fontFamily??Ue.fontFamily,fontSize:t?.fontSize??Ue.fontSize,align:t?.align??Ue.align,lineHeight:t?.lineHeight??Ue.lineHeight,wordWrap:t?.wordWrap??Ue.wordWrap,breakWords:t?.breakWords??Ue.breakWords,strokeColor:t?.strokeColor??Ue.strokeColor,strokeWidth:t?.strokeWidth??Ue.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ue.wordWrapWidth};r.style=e};async function et(r,t,{app:e,element:i,animations:s,signal:o,eventHandler:n}){let a=[];for(let h of s)if(h.targetId===r){let l=t.find(c=>c.type===h.type);if(!l)throw new Error(`No animation plugin found for type: ${h.type}`);a.push(l.animate({app:e,element:i,animation:h,signal:o,eventHandler:n}))}return Promise.all(a)}var k1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new Er({label:e.id}),l=()=>{h.text=e.content,dr(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click,f=e?.rightClick,p={isHovering:!1,isPressed:!1,isRightPressed:!1},m=({isHovering:g,isPressed:b,isRightPressed:y})=>{y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):g&&u?.textStyle?dr(h,u.textStyle):dr(h,e.textStyle)};if(u){let{cursor:g,soundSrc:b,actionPayload:y}=u;h.eventMode="static";let _=()=>{p.isHovering=!0,y&&s&&s("hover",{_event:{id:h.label},...y}),g&&(h.cursor=g),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1}),m(p)},T=()=>{p.isHovering=!1,h.cursor="auto",m(p)};h.on("pointerover",_),h.on("pointerout",T)}if(d){let{soundSrc:g,actionPayload:b}=d;h.eventMode="static";let y=()=>{p.isPressed=!0,m(p)},_=()=>{p.isPressed=!1,m(p),b&&s&&s("click",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isPressed=!1,m(p)};h.on("pointerdown",y),h.on("pointerup",_),h.on("pointerupoutside",T)}if(f){let{soundSrc:g,actionPayload:b}=f;h.eventMode="static";let y=()=>{p.isRightPressed=!0,m(p)},_=()=>{p.isRightPressed=!1,m(p),b&&s&&s("rightclick",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isRightPressed=!1,m(p)};h.on("rightdown",y),h.on("rightup",_),h.on("rightupoutside",T)}t.addChild(h),i&&i.length>0&&(a=!1,await et(e.id,o,{app:r,element:h,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",c)};var G1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.text=i.content,dr(h,i.textStyle),h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m={isHovering:!1,isPressed:!1,isRightPressed:!1},g=({isHovering:b,isPressed:y,isRightPressed:_})=>{_&&p?.textStyle?dr(h,p.textStyle):y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):dr(h,i.textStyle)};if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{m.isHovering=!0,_&&s&&s("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1}),g(m)},E=()=>{m.isHovering=!1,h.cursor="auto",g(m)};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{m.isPressed=!0,g(m)},T=()=>{m.isPressed=!1,g(m),y&&s&&s("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isPressed=!1,g()};h.on("pointerdown",_),h.on("pointerup",T),h.on("pointerupoutside",E)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{m.isRightPressed=!0,g(m)},T=()=>{m.isRightPressed=!1,g(m),y&&s&&s("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isRightPressed=!1,g(m)};h.on("rightdown",_),h.on("rightup",T),h.on("rightupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await et(i.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l=!0),c(),a.removeEventListener("abort",u))};var U1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var O1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var Ae=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===fs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=O1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var L1=({state:r})=>{let t={...Ue,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let{width:e,height:i}=qt.measureText(r.content??"",new Mt(t)),s=Math.round(e),o=Math.round(i);return{...Ae({...r,width:s,height:o}),content:r.content??"",textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var vk=le({type:"text",add:k1,update:G1,delete:U1,parse:L1});var D1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,alpha:p}=e,m=new he;m.label=a;let g=!0,b=()=>{m.clear(),m.rect(0,0,Math.round(c),Math.round(u)).fill(d),m.x=Math.round(h),m.y=Math.round(l),m.alpha=p,f&&m.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},y=async()=>{g||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S=e?.scroll,w=e?.drag;if(_){let{cursor:M,soundSrc:C,actionPayload:R}=_;m.eventMode="static";let B=()=>{R&&o&&o("hover",{_event:{id:m.label},...R}),M&&(m.cursor=M),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},F=()=>{m.cursor="auto"};m.on("pointerover",B),m.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:C}=T;m.eventMode="static";let R=()=>{C&&o&&o("click",{_event:{id:m.label},...C}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};m.on("pointerup",R)}if(E){let{soundSrc:M,actionPayload:C}=E;m.eventMode="static";let R=()=>{C&&o&&o("rightclick",{_event:{id:m.label},...C}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})};m.on("rightclick",R)}if(S){m.eventMode="static";let M=C=>{if(C.deltaY<0&&S.up){let{actionPayload:R}=S.up;R&&o&&o("scrollup",{_event:{id:m.label},...R})}else if(C.deltaY>0&&S.down){let{actionPayload:R}=S.down;R&&o&&o("scrolldown",{_event:{id:m.label},...R})}};m.on("wheel",M)}if(w){let{start:M,end:C,move:R}=w;m.eventMode="static";let B=()=>{m._isDragging=!0,M&&o&&o("drag-start",{_event:{id:m.label},...typeof M?.actionPayload=="object"?M.actionPayload:{}})},F=()=>{m._isDragging=!1,C&&o&&o("drag-end",{_event:{id:m.label},...typeof C?.actionPayload=="object"?C.actionPayload:{}})},j=W=>{R&&o&&m._isDragging&&o("drag-move",{_event:{id:m.label,x:W.global.x,y:W.global.y},...typeof R?.actionPayload=="object"?R.actionPayload:{}})};m.on("pointerdown",B),m.on("pointerup",F),m.on("globalpointermove",j),m.on("pointerupoutside",F)}t.addChild(m),i&&i.length>0&&(g=!1,await et(a,s,{app:r,element:m,animations:i,signal:n,eventHandler:o})),g=!0,n.removeEventListener("abort",y)};var N1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.clear(),h.rect(0,0,Math.round(i.width),Math.round(i.height)).fill(i.fill),h.x=Math.round(i.x),h.y=Math.round(i.y),h.alpha=i.alpha,i.border&&h.stroke({color:i.border.color,alpha:i.border.alpha,width:Math.round(i.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m=i?.scroll,g=i?.drag;if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{_&&n&&n("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1})},E=()=>{h.cursor="auto"};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{y&&n&&n("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})};h.on("pointerup",_)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{y&&n&&n("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})};h.on("rightclick",_)}if(m){h.eventMode="static";let b=y=>{if(y.deltaY<0&&m.up){let{actionPayload:_}=m.up;_&&n&&n("scrollup",{_event:{id:h.label},..._})}else if(y.deltaY>0&&m.down){let{actionPayload:_}=m.down;_&&n&&n("scrolldown",{_event:{id:h.label},..._})}};h.on("wheel",b)}if(g){let{start:b,end:y,move:_}=g;h.eventMode="static";let T=()=>{h._isDragging=!0,b&&n&&n("drag-start",{_event:{id:h.label},...typeof b?.actionPayload=="object"?b.actionPayload:{}})},E=()=>{h._isDragging=!1,y&&n&&n("drag-end",{_event:{id:h.label},...typeof y?.actionPayload=="object"?y.actionPayload:{}})},S=w=>{_&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:w.global.x,y:w.global.y},...typeof _?.actionPayload=="object"?_.actionPayload:{}})};h.on("pointerdown",T),h.on("pointerup",E),h.on("globalpointermove",S),h.on("pointerupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var H1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var V1=({state:r})=>{let t=Ae(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,cursor:r.cursor??"",fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var Tk=le({type:"rect",add:D1,update:N1,delete:H1,parse:V1});var W1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?A.from(f):A.EMPTY,g=new kt(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},y=async()=>{a||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:M,isPressed:C,isRightPressed:R})=>{if(R&&E?.src){let B=A.from(E.src);g.texture=B}else if(C&&T?.src){let B=A.from(T.src);g.texture=B}else if(M&&_?.src){let B=A.from(_.src);g.texture=B}else g.texture=m};if(_){let{cursor:M,soundSrc:C,actionPayload:R}=_;g.eventMode="static";let B=()=>{S.isHovering=!0,R&&s&&s("hover",{_event:{id:g.label},...R}),M&&(g.cursor=M),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1}),w(S)},F=()=>{S.isHovering=!1,g.cursor="auto",w(S)};g.on("pointerover",B),g.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:C}=T;g.eventMode="static";let R=()=>{S.isPressed=!0,w(S)},B=()=>{S.isPressed=!1,w(S),C&&s&&s("click",{_event:{id:g.label},...C}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isPressed=!1,w(S)};g.on("pointerdown",R),g.on("pointerup",B),g.on("pointerupoutside",F)}if(E){let{soundSrc:M,actionPayload:C}=E;g.eventMode="static";let R=()=>{S.isRightPressed=!0,w(S)},B=()=>{S.isRightPressed=!1,w(S),C&&s&&s("rightclick",{_event:{id:g.label},...C}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isRightPressed=!1,w(S)};g.on("rightdown",R),g.on("rightup",B),g.on("rightupoutside",F)}t.addChild(g),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:g,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",y)};var z1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){let d=i.src?A.from(i.src):A.EMPTY;h.texture=d,h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let f=i?.hover,p=i?.click,m=i?.rightClick,g={isHovering:!1,isPressed:!1,isRightPressed:!1},b=({isHovering:y,isPressed:_,isRightPressed:T})=>{if(T&&m?.src){let E=A.from(m.src);h.texture=E}else if(_&&p?.src){let E=A.from(p.src);h.texture=E}else if(y&&f?.src){let E=A.from(f.src);h.texture=E}else h.texture=d};if(f){let{cursor:y,soundSrc:_,actionPayload:T}=f;h.eventMode="static";let E=()=>{g.isHovering=!0,T&&n&&n("hover",{_event:{id:h.label},...T}),y&&(h.cursor=y),_&&r.audioStage.add({id:`hover-${Date.now()}`,url:_,loop:!1}),b(g)},S=()=>{g.isHovering=!1,h.cursor="auto",b(g)};h.on("pointerover",E),h.on("pointerout",S)}if(p){let{soundSrc:y,actionPayload:_}=p;h.eventMode="static";let T=()=>{g.isPressed=!0,b(g)},E=()=>{g.isPressed=!1,b(g),_&&n&&n("click",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`click-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isPressed=!1,b(g)};h.on("pointerdown",T),h.on("pointerup",E),h.on("pointerupoutside",S)}if(m){let{soundSrc:y,actionPayload:_}=m;h.eventMode="static";let T=()=>{g.isRightPressed=!0,b(g)},E=()=>{g.isRightPressed=!1,b(g),_&&n&&n("rightclick",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isRightPressed=!1,b(g)};h.on("rightdown",T),h.on("rightup",E),h.on("rightupoutside",S)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var $1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var X1=({state:r})=>({...Ae(r),src:r.src??"",alpha:r.alpha??1,cursor:r.cursor??"",...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Sk=le({type:"sprite",add:W1,update:z1,delete:$1,parse:X1});var j1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,volume:p,loop:m,alpha:g}=e,b=A.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=p/1e3,y.muted=!1,y.play();let _=new kt(b);_.label=h;let T=()=>{_.x=Math.round(l),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=g??1},E=async()=>{a||T()};n.addEventListener("abort",E),T(),t.addChild(_),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:_,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",E)};var Y1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){if(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha??1,e.src!==i.src){let d=h.texture.source.resource;d&&d.pause();let f=A.from(i.src);h.texture=f;let p=f.source.resource;p.muted=!1,p.pause(),p.currentTime=0,p.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var q1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{if(a&&!a.destroyed){let u=a.texture.source.resource;u&&u.pause(),t.removeChild(a),a.destroy()}},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var K1=({state:r})=>({...Ae(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Ek=le({type:"video",add:j1,update:Y1,delete:q1,parse:K1});var Z1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:y,step:_,initialValue:T,originX:E,originY:S,hover:w,change:M}=e,C=new xt;C.label=h,C.x=l,C.y=c,C.alpha=f,C.sortableChildren=!0,C.eventMode="static";let R=0,B=m?A.from(m):A.EMPTY,F=new kt(B);F.label=`${h}-bar`,F.eventMode="static";let j=p?A.from(p):A.EMPTY,W=new kt(j);W.label=`${h}-thumb`,W.eventMode="static";let st=T??b,L=y-b,H=St=>{let ut=(St-b)/L;g==="horizontal"?(W.x=ut*(F.width-W.width),W.y=(F.height-W.height)/2):(W.x=(F.width-W.width)/2,W.y=ut*(F.height-W.height))},N=()=>{F.width=u,F.height=d;let St=g==="horizontal"?d-R*2:u-R*2,ut=p?A.from(p):A.EMPTY,yt=ut.width,Ft=ut.height,Qt=St/yt,Jt=St/Ft,De=Math.min(Qt,Jt);W.width=yt*De,W.height=Ft*De,H(st)},U=async()=>{a||N()};n.addEventListener("abort",U),N();let Q=j,vt=B,gt=!1,Dt=St=>{let ut;if(g==="horizontal"){let Ft=St.x-W.width/2;ut=Math.max(0,Math.min(1,Ft/(F.width-W.width)))}else{let Ft=St.y-W.height/2;ut=Math.max(0,Math.min(1,Ft/(F.height-W.height)))}let yt=b+ut*L;return _>0&&(yt=Math.round((yt-b)/_)*_+b,yt=Math.max(b,Math.min(y,yt))),yt},Nt=St=>{let ut=C.toLocal(St.global),yt=Dt(ut);yt!==st&&(st=yt,H(st),M?.actionPayload&&o&&o("change",{_event:{id:h,value:st},...M.actionPayload}))},Zt=St=>{gt=!0,Nt(St)},oe=St=>{gt&&Nt(St)},Te=()=>{gt&&(gt=!1)};if(C.on("pointerdown",Zt),C.on("globalpointermove",oe),C.on("pointerup",Te),C.on("pointerupoutside",Te),w){let{cursor:St,soundSrc:ut,thumbSrc:yt,barSrc:Ft}=w,Qt=()=>{St&&(F.cursor=St,W.cursor=St),ut&&r.audioStage.add({id:`hover-${Date.now()}`,url:ut,loop:!1}),yt&&(W.texture=A.from(yt)),Ft&&(F.texture=A.from(Ft))},Jt=()=>{gt||(F.cursor="auto",W.cursor="auto",W.texture=Q,F.texture=vt)};C.on("pointerover",Qt),C.on("pointerout",Jt),C.on("pointerupoutside",Jt)}C.addChild(F),C.addChild(W),t.addChild(C),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:C,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",U)};var Q1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let c=h.getChildByLabel(`${i.id}-bar`),u=h.getChildByLabel(`${i.id}-thumb`),d=JSON.stringify(e.hover)!==JSON.stringify(i.hover)||JSON.stringify(e.change)!==JSON.stringify(i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(c&&u){c.width=i.width,c.height=i.height;let f=0,p=i.direction==="horizontal"?i.height-f*2:i.width-f*2,m=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY,g=m.width||16,b=m.height||16,y=p/g,_=p/b,T=Math.min(y,_);if(u.width=g*T,u.height=b*T,e.barSrc!==i.barSrc){let w=i.barSrc?A.from(i.barSrc):A.EMPTY;c.texture=w}if(e.thumbSrc!==i.thumbSrc){let w=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY;u.texture=w}let E=i.max-i.min,S=(i.initialValue-i.min)/E;i.direction==="horizontal"?(u.x=S*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=S*(c.height-u.height))}if(d&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),s&&d){let{hover:f,change:p,min:m,max:g,step:b,direction:y,initialValue:_}=i,T=_??m,E=g-m;h.eventMode="static";let S=st=>{let L=(st-m)/E;y==="horizontal"?(u.x=L*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=L*(c.height-u.height))},w=st=>{let L;if(y==="horizontal"){let N=st.x-u.width/2;L=Math.max(0,Math.min(1,N/(c.width-u.width)))}else{let N=st.y-u.height/2;L=Math.max(0,Math.min(1,N/(c.height-u.height)))}let H=m+L*E;return b>0&&(H=Math.round((H-m)/b)*b+m,H=Math.max(m,Math.min(g,H))),H},M=u.texture,C=c.texture,R=!1,B=st=>{let L=h.toLocal(st.global),H=w(L);H!==T&&(T=H,S(T),p?.actionPayload&&s&&s("change",{_event:{id,value:T},...p.actionPayload}))},F=st=>{R=!0,B(st)},j=st=>{R&&B(st)},W=()=>{R&&(R=!1)};if(h.on("pointerdown",F),h.on("globalpointermove",j),h.on("pointerup",W),h.on("pointerupoutside",W),f){let{cursor:st,soundSrc:L,thumbSrc:H,barSrc:N}=f,U=()=>{st&&(h.cursor=st,u.cursor=st),L&&r.audioStage.add({id:`hover-${Date.now()}`,url:L,loop:!1}),H&&(u.texture=A.from(H)),N&&(c.texture=A.from(N))},Q=()=>{R||(h.cursor="auto",u.cursor="auto",u.texture=M,c.texture=C)};h.on("pointerover",U),h.on("pointerout",Q),h.on("pointerupoutside",Q)}}}};h&&(o&&o.length>0&&await et(e.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l())};var J1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{if(o?.aborted)return;let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy({children:!0})},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var tP=({state:r})=>{let t=Ae(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue??0,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var wk=le({type:"slider",add:Z1,update:Q1,delete:J1,parse:tP});var xh=({container:r,element:t})=>{let e=0,i=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),i=Math.max(n.height+n.y,i)});let s=t.scroll&&t.height&&i>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new xt({label:`${r.label}-content`});[...r.children].forEach(f=>{n.addChild(f)}),r.addChild(n);let h=new he({label:`${r.label}-clip`}).rect(0,0,t.width||e,t.height||i).fill({color:16711680,alpha:0});r.addChild(h),n.mask=h,r.eventMode="static";let l=0,c=0,u=-(i-(t.height||i)),d=-(e-(t.width||e));r.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}},Gg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.removeAllListeners("wheel")};var eP=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new xt;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let y of u){let _=n.find(T=>T.type===y.type);if(!_)throw new Error(`No plugin found for child element type: ${y.type}`);await _.add({app:r,parent:p,element:y,animations:i,eventHandler:s,animationPlugins:o,animateElements:et,elementPlugins:n,signal:a})}d&&xh({container:p,element:e}),i&&i.length>0&&(m=!1,await et(h,o,{app:r,element:p,animations:i,signal:a,eventHandler:s})),m=!0,a.removeEventListener("abort",b)};var rP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of r)i.add(l.id),s.set(l.id,l);for(let l of t)i.add(l.id),o.set(l.id,l);for(let l of i){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var yh=async({app:r,parent:t,prevASTTree:e,nextASTTree:i,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=rP(e,i,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:r,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:r,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:r,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),Ak(t,i)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},Ak=(r,t)=>{r.children=r.children.sort((e,i)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===i.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1}).map((e,i)=>(e.zIndex=i,e))};var iP=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(i)&&(l.x=Math.round(i.x),l.y=Math.round(i.y),l.label=i.id,l.alpha=i.alpha,e.scroll!==i.scroll?i.scroll?xh({container:l,element:i}):Gg({container:l}):i.scroll&&(Gg({container:l}),xh({container:l,element:i})),JSON.stringify(e.children)!==JSON.stringify(i.children)&&await yh({app:r,parent:i.scroll?l.children.find(f=>f.label===`${i.id}-content`):l,nextASTTree:i.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await et(e.id,n,{app:r,element:l,animations:o,signal:h,eventHandler:s})),c=!0,await u(),h.removeEventListener("abort",d))};var sP=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))},c=async()=>{h||l()};o.addEventListener("abort",c),s&&s.length>0&&(h=!1,await et(e.id,i,{app:r,element:a,animations:s,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var oP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let y=0;y<o.length;y++){let _=y<o.length-1?s:0,T=o[y];y>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let E=t.find(S=>S.type===T.type);E&&(T=E.parse({state:T,parserPlugins:t})),e==="horizontal"?(r.width&&T.width+m>r.width&&!i?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+_,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"?(r.height&&T.height+g>r.height&&!i?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+_,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)):(a=Math.max(T.width+T.x,a),h=Math.max(T.height+T.y,h)),n.push(T)}return{...Ae({...r,width:r.width?r.width:a,height:r.height?r.height:h}),children:n,direction:e,gap:s,scroll:i,rotation:r.rotation??0}};var Pk=le({type:"container",add:eP,update:iP,delete:sP,parse:oP});function Do(r,t){let e=r.text.substring(0,t),s=qt.measureText(e,r.style).width;return r.x+s}var Ck=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},r),o=()=>{clearTimeout(s),i(t.reason)};t?.addEventListener("abort",o,{once:!0})}),No=Ck;var nP=async({parent:r,element:t,signal:e,eventHandler:i})=>{let s=t.speed??50,o=t.revealEffect??"typewriter",n=t?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=new xt;c.label=t.id;let u=new kt(A.EMPTY);if(t?.indicator?.revealing?.src){let d=t.indicator.revealing.src?A.from(t.indicator.revealing.src):A.EMPTY;u=new kt(d),u.width=t.indicator.revealing.width??d.width,u.height=t.indicator.revealing.height??d.height}c.addChild(u),t.x!==void 0&&(c.x=Math.round(t.x)),t.y!==void 0&&(c.y=Math.round(t.y)),t.alpha!==void 0&&(c.alpha=t.alpha),r.addChild(c);for(let d=0;d<t.content.length;d++){let f=t.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(e?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new Er({text:"",style:g,x:Math.round(m.x),y:Math.round(m.y)}),y=null;if(m.furigana){let E=new Mt(m.furigana.textStyle);y=new Er({text:"",style:E,x:Math.round(m.furigana.x),y:Math.round(m.furigana.y)}),c.addChild(y)}c.addChild(b);let _=m.text,T=m.furigana?.text||"";if(a||e?.aborted)b.text=_,u.x=Do(b,_.length-1)+n,y&&(y.text=T);else{let E=T.length;for(let S=0;S<_.length;S++){if(e?.aborted)return;b.text=_.substring(0,S+1),u.x=Do(b,S)+n;let w=Math.round((S+1)/_.length*E);if(y&&(y.text=T.substring(0,w)),S<_.length-1)try{await No(h,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(d<t.content.length-1)try{await No(l,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let d=t.indicator.complete.src?A.from(t.indicator.complete.src):A.EMPTY;u.texture=d,u.width=t.indicator.complete.width??d.width,u.height=t.indicator.complete.height??d.height}i&&t?.complete?.actionPayload&&i("complete",{_event:{id:t.id},...t?.complete?.actionPayload??{}})};var aP=async r=>{let{parent:t,nextElement:e,signal:i,eventHandler:s}=r,o=e.speed??50,n=e.revealEffect??"typewriter",a=e?.indicator?.offset??12,h=n==="none",l=h?0:Math.max(1,Math.floor(1e3/o)),c=h?0:Math.max(1,Math.floor(4e3/o)),u=t.children.find(d=>d.label===e.id);if(u){u.removeChildren();let d=new kt(A.EMPTY);if(e?.indicator?.revealing?.src){let f=e.indicator.revealing.src?A.from(e.indicator.revealing.src):A.EMPTY;d=new kt(f),d.width=e.indicator.revealing.width??f.width,d.height=e.indicator.revealing.height??f.height}u.addChild(d),e.x!==void 0&&(u.x=e.x),e.y!==void 0&&(u.y=e.y),e.alpha!==void 0&&(u.alpha=e.alpha);for(let f=0;f<e.content.length;f++){let p=e.content[f];d.x=a,d.y=p.y+(p.lineMaxHeight-d.height);for(let m=0;m<p.lineParts.length;m++){if(i?.aborted)return;let g=p.lineParts[m],b=new Mt(g.textStyle),y=new Er({text:"",style:b,x:g.x,y:g.y}),_=null;if(g.furigana){let S=new Mt(g.furigana.textStyle);_=new Er({text:"",style:S,x:g.furigana.x,y:g.furigana.y}),u.addChild(_)}u.addChild(y);let T=g.text,E=g.furigana?.text||"";if(h||i?.aborted)y.text=T,d.x=Do(y,T.length-1)+a,_&&(_.text=E);else{let S=E.length;for(let w=0;w<T.length;w++){y.text=T.substring(0,w+1),d.x=Do(y,w)+a;let M=Math.round((w+1)/T.length*S);if(_&&(_.text=E.substring(0,M)),w<T.length-1)try{await No(l,i)}catch(C){if(C.name==="AbortError")return;throw C}}}}if(f<e.content.length-1)try{await No(c,i)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let f=e.indicator.complete.src?A.from(e.indicator.complete.src):A.EMPTY;d.texture=f,d.width=e.indicator.complete.width??f.width,d.height=e.indicator.complete.height??f.height}s&&e?.complete?.actionPayload&&s("complete",{_event:{id:e.id},...e?.complete?.actionPayload??{}})}};var hP=async({parent:r,element:t,signal:e})=>{if(e?.aborted)return;let i=r.getChildByLabel(t.id);if(i){let s=!0,o=()=>{i&&!i.destroyed&&i.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var Rk=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,h=[...r],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},p=qt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=qt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let _=qt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(p.lineWidths[0]-_.width)/2),y:T};b.furigana=E}i.push(b),n=Math.max(n,g.height),s+=Math.round(p.lineWidths[0]),a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},lP=({state:r})=>{let t={...Ue,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),r.width&&(f.wordWrapWidth=r.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Rk(e,i),a=r.width||o,l=Ae({...r,width:a,height:n});if(l.alpha=r.alpha??1,r.indicator){let c=r.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Mk=le({type:"text-revealing",add:nP,update:aP,delete:hP,parse:lP});var wu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Au=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var cP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:p,animation:m,alpha:g}=e,b=p,y=Object.keys(b.frames),_=new wi(A.from(f),b);await _.parse();let T=m.frames.map(M=>_.textures[y[M]]),E=new gh(T);E.label=h,E.animationSpeed=m.animationSpeed??.5,E.loop=m.loop??!0,r.debug?wu(E,h,r.debug):E.play();let S=()=>{E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=g},w=async()=>{a||S()};n.addEventListener("abort",w),S(),t.addChild(E),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:E,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",w)};var uP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=async()=>{if(JSON.stringify(e)!==JSON.stringify(i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,JSON.stringify(e.animation)!==JSON.stringify(i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let d=i.spritesheetData,f=Object.keys(d.frames),p=new wi(A.from(i.spritesheetSrc),d);await p.parse();let m=i.animation.frames.map(g=>p.textures[f[g]]);h.textures=m,r.debug?e.id!==i.id&&(Au(h),wu(h,i.id,r.debug)):h.play()}},u=async()=>{l||await c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),await c(),a.removeEventListener("abort",u))};var dP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{r.debug&&Au(a),a&&!a.destroyed&&(a.stop(),a.destroy())},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var fP=({state:r})=>({...Ae(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Bk=le({type:"animated-sprite",add:cP,update:uP,delete:dP,parse:fP});var Ik={linear:r=>r},Fk=(r,t,e,i)=>r+(t-r)*Ik[i](e),kk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s of t){if(i==null)return e;i=i[s]}return i===void 0?e:i},Gk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s=0;s<t.length-1;s++){let o=t[s];o in i||(i[o]={}),i=i[o]}return i[t[t.length-1]]=e,r},Uk=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(i=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?i=i+s:i=s,t.push({time:e,value:i,easing:n}))}),t},Ok=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let h=(t-i)/(n-i);return Fk(s,a,h,o)}}return r[r.length-1].value},Lk=r=>Math.max.apply(null,r),pP=async({app:r,element:t,animation:e,signal:i,eventHandler:s})=>new Promise((o,n)=>{if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}let{properties:a,complete:h,id:l,targetId:c}=e,u=Object.entries(a).map(([_,T])=>{if(!F1[_])throw new Error(`${_} is not a supported property for transition.`);return{...T,property:_}}),d=u.map(_=>_.keyframes.reduce((T,E)=>T+E.duration||0,0)),f=Lk(d),p={};u.forEach(_=>{p[_.property]=kk(t,_.property)});let m=u.map(_=>{let T=[];_.initialValue!==void 0?T=[{value:_.initialValue}]:T=[{value:p[_.property]}],T=T.concat(_.keyframes);let E=Uk(T);return{property:_.property,timeline:E}}),g=0,b=_=>{m.forEach(({property:T,timeline:E})=>{let S=Ok(E,_);t&&!t.destroyed&&Gk(t,T,S)})};i&&i.addEventListener("abort",()=>{r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"))});let y=_=>{if(g+=_.deltaMS,g>=f){if(r.ticker.remove(y),b(f),s&&h){let T=h?.actionPayload;s("complete",{_event:{id:l,targetId:c},...T??{}})}o();return}b(g)};if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}r?.debug?window.addEventListener("snapShotKeyFrame",_=>{_?.detail?.deltaMS&&y({deltaMS:Number(_.detail.deltaMS)})}):r.ticker.add(y)});var Dk=Ig({type:"tween",animate:pP});var mP=({app:r,element:t,signal:e})=>{if(e?.aborted)return;let i={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||r.audioStage.add(i)},t.delay):r.audioStage.add(i)};var gP=({app:r,prevElement:t,nextElement:e,signal:i})=>{if(!i?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=r.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var xP=({app:r,element:t,signal:e})=>{e?.aborted||r.audioStage.remove(t.id)};var Nk=Fg({type:"sound",add:mP,update:gP,delete:xP});var _h=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ug(r){let t=new he;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Og(r){let t=new he;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Lg(r){let t=new he;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function bh(r,t,e){return r+(t-r)*e}function Cu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function yP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,h=t&255,l=Math.round(bh(i,n,e)),c=Math.round(bh(s,a,e)),u=Math.round(bh(o,h,e));return l<<16|c<<8|u}var Pu=class r{constructor(t,e,i=!1){this.value=i?Cu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},wr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Pu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?yP(e.value,e.next.value,i):bh(e.value,e.next.value,i)}};var Ru=class{static type="alpha";constructor(t){this.list=new wr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Mu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Bu=class{static type="scale";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Iu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Hk=Math.PI/180,Fu=class{static type="speed";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},ku=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Gu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Hk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Alt=Math.PI/180,Uu=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Ou=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Oi=Math.PI/180,Lu=class{static type="rotation";constructor(t){this.minStart=t.minStart*Oi,this.maxStart=t.maxStart*Oi,this.minSpeed=t.minSpeed*Oi,this.maxSpeed=t.maxSpeed*Oi,this.accel=(t.accel??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Du=class{static type="rotationStatic";constructor(t){this.min=t.min*Oi,this.max=t.max*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Nu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var Hu=class{static type="color";constructor(t){this.list=new wr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Vu=class{static type="colorStatic";constructor(t){this.color=Cu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var Wu=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},zu=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Dg=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Ng=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},Vk={rect:Wu,rectangle:Wu,torus:zu,circle:zu,point:Dg,line:Ng};var $u=class{static type="spawnShape";constructor(t){let e=Vk[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},Xu=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var _P=new Map,bP=new Map;function Hg(r,t){_P.set(r,t)}function Pe(r){bP.set(r.type,r)}function vP(r,t){let e=_P.get(r);return e?e(t):null}function TP(r){return bP.get(r)}Hg("circle",Lg);Hg("snowflake",Ug);Hg("raindrop",Og);Pe(Ru);Pe(Mu);Pe(Bu);Pe(Iu);Pe(Fu);Pe(ku);Pe(Gu);Pe(Uu);Pe(Ou);Pe(Lu);Pe(Du);Pe(Nu);Pe(Hu);Pe(Vu);Pe($u);Pe(Xu);var ju=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var vh=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new ju(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=TP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new _h(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function Wk(r,t){let e=new he,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Th=async({app:r,parent:t,element:e,signal:i})=>{if(i?.aborted)return;let s=new xt;s.label=e.id,t.addChild(s);let o=e.width,n=e.height;s.x=e.x??0,s.y=e.y??0;let a={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},h;if(typeof e.texture=="object"&&e.texture.shape)h=Wk(r,e.texture);else{let u=e.texture??"circle";if(h=vP(u,r),!h)try{h=A.from(u)}catch{console.warn(`Failed to load particle texture: ${u}`);return}}a.texture=h;let l=new vh(s,a);if(s.emitter=l,a.recycleOnBounds){let u=Math.min(e.count??100,a.maxParticles);l.spawn(u);let d=l._activeFirst;for(;d;)d.y=l.random()*n,d.age=l.random()*d.maxLife*.8,d=d.next}let c=u=>{if(l.destroyed){r.ticker.remove(c);return}l.update(u.deltaTime/60)};if(s.tickerCallback=c,r?.debug){let u=d=>{if(l.destroyed){window.removeEventListener("snapShotKeyFrame",u);return}d?.detail?.deltaMS&&l.update(Number(d.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",u),s.customTickerHandler=u}else r.ticker.add(c);e.alpha!==void 0&&(s.alpha=e.alpha)};var Yu=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await et(e.id,i,{app:r,element:n,animations:s,signal:o}),a()}};var SP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(c=>c.label===e.id);if(!h){await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a});return}zk(e,i)?(await Yu({app:r,parent:t,element:e,animations:s,animationPlugins:o,eventHandler:n,signal:a}),await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})):(i.alpha!==void 0&&(h.alpha=i.alpha),i.x!==void 0&&(h.x=i.x),i.y!==void 0&&(h.y=i.y))};function zk(r,t){return r.count!==t.count||JSON.stringify(r.texture)!==JSON.stringify(t.texture)||JSON.stringify(r.behaviors)!==JSON.stringify(t.behaviors)||JSON.stringify(r.emitter)!==JSON.stringify(t.emitter)||r.width!==t.width||r.height!==t.height}function EP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function wP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function AP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function PP(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function CP(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function RP(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var MP=({state:r})=>{EP(r),wP(r),AP(r),PP(r),CP(r),RP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var $k=le({type:"particles",add:Th,update:SP,delete:Yu,parse:MP});var BP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let h of r)e.add(h.id),i.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=i.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vg=async({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=BP(t,e),h=[];for(let l of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:r,element:l,signal:s}))}for(let l of o){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:r,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=i.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:r,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),Wg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Wg||{}),qu=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(qu||{}),Z=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Z||{}),Ho=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ho||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),ci=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(ci||{}),it=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(it||{}),D=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(D||{}),fr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(fr||{}),Sh=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sh||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),Qe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Qe||{}),Li=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Li||{}),Ku=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Ku||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),re=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(re||{});var Pt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pt||{}),Xe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Xe||{});var zg={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:zg,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Cf();var Xk=Si.default??Si,Pr=Xk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var bs=$i(FP(),1),OU=$i(uc(),1);var Ex=$i(qR(),1);var KR={};function lt(r,t,e=3){if(KR[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1145
1145
  Deprecated since v${r}`):(i=i.split(`
1146
1146
  `).splice(e).join(`
1147
1147
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
1148
1148
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
1149
1149
  Deprecated since v${r}`),console.warn(i))),KR[t]=!0}var wx;function Ax(){return typeof wx>"u"&&(wx=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Y.ADAPTER.getWebGLRenderingContext())return!1;let t=Y.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),wx}Jd();tf();Tl([Sl]);var Qo=class fd{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 fd)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((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,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,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,i,s,o]=fd.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<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,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=fd.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};Qo.shared=new Qo,Qo.temp=new Qo,Qo.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Cr=Qo;function IU(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[Z.NORMAL_NPM]=Z.NORMAL,r[Z.ADD_NPM]=Z.ADD,r[Z.SCREEN_NPM]=Z.SCREEN,t[Z.NORMAL]=Z.NORMAL_NPM,t[Z.ADD]=Z.ADD_NPM,t[Z.SCREEN]=Z.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var Px=IU();function Jo(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function _s(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function pd(r){return!(r&r-1)&&!!r}function md(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Cx(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var FU=0;function di(){return++FU}var ZR=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};ZR.EMPTY=new ZR(0,0,0,0);var gd={},Je=Object.create(null),jr=Object.create(null);function Rx(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function xd(r,t=1){let e=Y.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var V=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(V||{}),Mx=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},JR=(r,t)=>Mx(r).priority??t,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Mx).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Mx).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>JR(o,e)-JR(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var Oh=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 LU=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1150
1150
  `);function DU(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
1151
- else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function yd(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=LU.replace(/%forloop%/gi,DU(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var Bx=0,Ix=1,Fx=2,kx=3,Gx=4,Ux=5,Yr=class r{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bx)}set blend(t){!!(this.data&1<<Bx)!==t&&(this.data^=1<<Bx)}get offsets(){return!!(this.data&1<<Ix)}set offsets(t){!!(this.data&1<<Ix)!==t&&(this.data^=1<<Ix)}get culling(){return!!(this.data&1<<Fx)}set culling(t){!!(this.data&1<<Fx)!==t&&(this.data^=1<<Fx)}get depthTest(){return!!(this.data&1<<kx)}set depthTest(t){!!(this.data&1<<kx)!==t&&(this.data^=1<<kx)}get depthMask(){return!!(this.data&1<<Ux)}set depthMask(t){!!(this.data&1<<Ux)!==t&&(this.data^=1<<Ux)}get clockwiseFrontFace(){return!!(this.data&1<<Gx)}set clockwiseFrontFace(t){!!(this.data&1<<Gx)!==t&&(this.data^=1<<Gx)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};Yr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Lh=[];function tn(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Lh.length-1;i>=0;--i){let s=Lh[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Kt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,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,i,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(Kt.prototype,{dispatch:{value:Kt.prototype.emit},run:{value:Kt.prototype.emit}});var tr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Kt("setRealSize"),this.onUpdate=new Kt("update"),this.onError=new Kt("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,i){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 vs=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.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 NU={scaleMode:fr.NEAREST,alphaMode:Qe.NPM},Ox=class en extends bs.default{constructor(t=null,e=null){super(),e=Object.assign({},en.defaultOptions,e);let{alphaMode:i,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 tr)&&(t=tn(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=di(),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 i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=pd(this.realWidth)&&pd(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 jr[this.cacheId],delete Je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),en.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,i=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${di()}`}o=t._pixiId}let n=jr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new en(t,e),n.cacheId=o,en.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new vs(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=G.RGBA,a=it.FLOAT):t instanceof Int32Array?(n=G.RGBA_INTEGER,a=it.INT):t instanceof Uint32Array?(n=G.RGBA_INTEGER,a=it.UNSIGNED_INT):t instanceof Int16Array?(n=G.RGBA_INTEGER,a=it.SHORT):t instanceof Uint16Array?(n=G.RGBA_INTEGER,a=it.UNSIGNED_SHORT):t instanceof Int8Array?(n=G.RGBA,a=it.BYTE):(n=G.RGBA,a=it.UNSIGNED_BYTE),o.internal=!0,new en(o,Object.assign({},NU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),jr[e]&&jr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),jr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=jr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete jr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete jr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ox.defaultOptions={mipmap:Ar.POW2,anisotropicLevel:0,scaleMode:fr.LINEAR,wrapMode:Sh.CLAMP,alphaMode:Qe.UNPACK,target:ci.TEXTURE_2D,format:G.RGBA,type:it.UNSIGNED_BYTE},Ox._globalBatch=0;var dt=Ox;var Dh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ho.TRIANGLES,this.start=0,this.size=0,this.data=null}};var HU=0,ie=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=HU++,this.disposeRunner=new Kt("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?Xe.ELEMENT_ARRAY_BUFFER:Xe.ARRAY_BUFFER}get index(){return this.type===Xe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var rn=class r{constructor(t,e=0,i=!1,s=it.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var VU={Float32Array,Uint32Array,Int32Array,Uint8Array};function tM(r,t){let e=0,i=0,s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<r.length;h++){let l=t[h],c=r[h],u=Jo(c);s[u]||(s[u]=new VU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*i+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var eM={5126:4,5123:2,5121:1},WU=0,zU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},fi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=WU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Kt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof ie||(e instanceof Array&&(e=new Float32Array(e)),e=new ie(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,i,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 rn(c,i,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 ie||(t instanceof Array&&(t=new Uint16Array(t)),t=new ie(t)),t.type=Xe.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=[],i=new ie,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*eM[o.type]/4),o.buffer=0}for(i.data=tM(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],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 r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new ie(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new rn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Xe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],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++)i[a]=new zU[Jo(n.buffers[a].data)](s[a]),e.buffers[a]=new ie(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)i[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=Xe.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*eM[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 Nh=class extends fi{constructor(t=!1){super(),this._buffer=new ie(null,t,!1),this._indexBuffer=new ie(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,it.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,it.FLOAT).addAttribute("aColor",this._buffer,4,!0,it.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,it.FLOAT).addIndex(this._indexBuffer)}};var Lx=Math.PI*2,$U=180/Math.PI,XU=Math.PI/180,mr=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(mr||{});var se=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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}};se.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var _d=[new se,new se,new se,new se],mt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=mr.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 r(0,0,0,0)}clone(){return new r(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 i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=_d[0].set(t.left,t.top),h=_d[1].set(t.left,t.bottom),l=_d[2].set(t.right,t.top),c=_d[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)<=i||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*i+f*o,m=d*s+f*o,g=d*i+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let y=u*(a.y-l.y),_=u*(l.x-a.x),T=y*i+_*o,E=y*s+_*o,S=y*i+_*n,w=y*s+_*n;return!(Math.max(T,E,S,w)<=y*a.x+_*a.y||Math.min(T,E,S,w)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};mt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var bd=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=mr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new mt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};bd.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var vd=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=mr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new mt(this.x-this.width,this.y-this.height,this.width,this.height)}};vd.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Td=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=mr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!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&&(i=!i)}return i}};Td.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var Sd=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=mr.RREC}clone(){return new r(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};Sd.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Bt=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new se;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new se;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,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-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Lx-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*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 r;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 r}static get TEMP_MATRIX(){return new r}};Bt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var Ts=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ss=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Es=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ws=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Dx=[],rM=[],Ed=Math.sign;function jU(){for(let r=0;r<16;r++){let t=[];Dx.push(t);for(let e=0;e<16;e++){let i=Ed(Ts[r]*Ts[e]+Es[r]*Ss[e]),s=Ed(Ss[r]*Ts[e]+ws[r]*Ss[e]),o=Ed(Ts[r]*Es[e]+Es[r]*ws[e]),n=Ed(Ss[r]*Es[e]+ws[r]*ws[e]);for(let a=0;a<16;a++)if(Ts[a]===i&&Ss[a]===s&&Es[a]===o&&ws[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Bt;t.set(Ts[r],Ss[r],Es[r],ws[r],0,0),rM.push(t)}}jU();var Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Ts[r],uY:r=>Ss[r],vX:r=>Es[r],vY:r=>ws[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Dx[r][t],sub:(r,t)=>Dx[r][Gt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Gt.E:Gt.W:t>0?r>0?Gt.SE:Gt.SW:r>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=rM[Gt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var pi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(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))}};pi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Nx=class{constructor(){this.worldTransform=new Bt,this.localTransform=new Bt,this.position=new pi(this.onChange,this,0,0),this.scale=new pi(this.onChange,this,1,1),this.pivot=new pi(this.onChange,this,0,0),this.skew=new pi(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 r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){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!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Nx.IDENTITY=new Nx;var wd=Nx;wd.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 iM=`varying vec2 vTextureCoord;
1151
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function yd(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=LU.replace(/%forloop%/gi,DU(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var Bx=0,Ix=1,Fx=2,kx=3,Gx=4,Ux=5,Yr=class r{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bx)}set blend(t){!!(this.data&1<<Bx)!==t&&(this.data^=1<<Bx)}get offsets(){return!!(this.data&1<<Ix)}set offsets(t){!!(this.data&1<<Ix)!==t&&(this.data^=1<<Ix)}get culling(){return!!(this.data&1<<Fx)}set culling(t){!!(this.data&1<<Fx)!==t&&(this.data^=1<<Fx)}get depthTest(){return!!(this.data&1<<kx)}set depthTest(t){!!(this.data&1<<kx)!==t&&(this.data^=1<<kx)}get depthMask(){return!!(this.data&1<<Ux)}set depthMask(t){!!(this.data&1<<Ux)!==t&&(this.data^=1<<Ux)}get clockwiseFrontFace(){return!!(this.data&1<<Gx)}set clockwiseFrontFace(t){!!(this.data&1<<Gx)!==t&&(this.data^=1<<Gx)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};Yr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Lh=[];function tn(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Lh.length-1;i>=0;--i){let s=Lh[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Kt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,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,i,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(Kt.prototype,{dispatch:{value:Kt.prototype.emit},run:{value:Kt.prototype.emit}});var tr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Kt("setRealSize"),this.onUpdate=new Kt("update"),this.onError=new Kt("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,i){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 vs=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.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 NU={scaleMode:fr.NEAREST,alphaMode:Qe.NPM},Ox=class en extends bs.default{constructor(t=null,e=null){super(),e=Object.assign({},en.defaultOptions,e);let{alphaMode:i,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 tr)&&(t=tn(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=di(),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 i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=pd(this.realWidth)&&pd(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 jr[this.cacheId],delete Je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),en.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,i=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${di()}`}o=t._pixiId}let n=jr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new en(t,e),n.cacheId=o,en.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new vs(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=G.RGBA,a=it.FLOAT):t instanceof Int32Array?(n=G.RGBA_INTEGER,a=it.INT):t instanceof Uint32Array?(n=G.RGBA_INTEGER,a=it.UNSIGNED_INT):t instanceof Int16Array?(n=G.RGBA_INTEGER,a=it.SHORT):t instanceof Uint16Array?(n=G.RGBA_INTEGER,a=it.UNSIGNED_SHORT):t instanceof Int8Array?(n=G.RGBA,a=it.BYTE):(n=G.RGBA,a=it.UNSIGNED_BYTE),o.internal=!0,new en(o,Object.assign({},NU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),jr[e]&&jr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),jr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=jr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete jr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete jr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ox.defaultOptions={mipmap:Ar.POW2,anisotropicLevel:0,scaleMode:fr.LINEAR,wrapMode:Sh.CLAMP,alphaMode:Qe.UNPACK,target:ci.TEXTURE_2D,format:G.RGBA,type:it.UNSIGNED_BYTE},Ox._globalBatch=0;var dt=Ox;var Dh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ho.TRIANGLES,this.start=0,this.size=0,this.data=null}};var HU=0,ie=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=HU++,this.disposeRunner=new Kt("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?Xe.ELEMENT_ARRAY_BUFFER:Xe.ARRAY_BUFFER}get index(){return this.type===Xe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var rn=class r{constructor(t,e=0,i=!1,s=it.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var VU={Float32Array,Uint32Array,Int32Array,Uint8Array};function tM(r,t){let e=0,i=0,s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<r.length;h++){let l=t[h],c=r[h],u=Jo(c);s[u]||(s[u]=new VU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*i+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var eM={5126:4,5123:2,5121:1},WU=0,zU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},fi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=WU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Kt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof ie||(e instanceof Array&&(e=new Float32Array(e)),e=new ie(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,i,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 rn(c,i,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 ie||(t instanceof Array&&(t=new Uint16Array(t)),t=new ie(t)),t.type=Xe.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=[],i=new ie,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*eM[o.type]/4),o.buffer=0}for(i.data=tM(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],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 r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new ie(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new rn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Xe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],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++)i[a]=new zU[Jo(n.buffers[a].data)](s[a]),e.buffers[a]=new ie(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)i[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=Xe.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*eM[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 Nh=class extends fi{constructor(t=!1){super(),this._buffer=new ie(null,t,!1),this._indexBuffer=new ie(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,it.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,it.FLOAT).addAttribute("aColor",this._buffer,4,!0,it.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,it.FLOAT).addIndex(this._indexBuffer)}};var Lx=Math.PI*2,$U=180/Math.PI,XU=Math.PI/180,mr=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(mr||{});var se=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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}};se.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var _d=[new se,new se,new se,new se],mt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=mr.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 r(0,0,0,0)}clone(){return new r(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 C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=_d[0].set(t.left,t.top),h=_d[1].set(t.left,t.bottom),l=_d[2].set(t.right,t.top),c=_d[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)<=i||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*i+f*o,m=d*s+f*o,g=d*i+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let y=u*(a.y-l.y),_=u*(l.x-a.x),T=y*i+_*o,E=y*s+_*o,S=y*i+_*n,w=y*s+_*n;return!(Math.max(T,E,S,w)<=y*a.x+_*a.y||Math.min(T,E,S,w)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};mt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var bd=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=mr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new mt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};bd.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var vd=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=mr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new mt(this.x-this.width,this.y-this.height,this.width,this.height)}};vd.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Td=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=mr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!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&&(i=!i)}return i}};Td.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var Sd=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=mr.RREC}clone(){return new r(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};Sd.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Bt=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new se;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new se;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,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-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Lx-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*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 r;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 r}static get TEMP_MATRIX(){return new r}};Bt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var Ts=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ss=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Es=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ws=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Dx=[],rM=[],Ed=Math.sign;function jU(){for(let r=0;r<16;r++){let t=[];Dx.push(t);for(let e=0;e<16;e++){let i=Ed(Ts[r]*Ts[e]+Es[r]*Ss[e]),s=Ed(Ss[r]*Ts[e]+ws[r]*Ss[e]),o=Ed(Ts[r]*Es[e]+Es[r]*ws[e]),n=Ed(Ss[r]*Es[e]+ws[r]*ws[e]);for(let a=0;a<16;a++)if(Ts[a]===i&&Ss[a]===s&&Es[a]===o&&ws[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Bt;t.set(Ts[r],Ss[r],Es[r],ws[r],0,0),rM.push(t)}}jU();var Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Ts[r],uY:r=>Ss[r],vX:r=>Es[r],vY:r=>ws[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Dx[r][t],sub:(r,t)=>Dx[r][Gt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Gt.E:Gt.W:t>0?r>0?Gt.SE:Gt.SW:r>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=rM[Gt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var pi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(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))}};pi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Nx=class{constructor(){this.worldTransform=new Bt,this.localTransform=new Bt,this.position=new pi(this.onChange,this,0,0),this.scale=new pi(this.onChange,this,1,1),this.pivot=new pi(this.onChange,this,0,0),this.skew=new pi(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 r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){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!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Nx.IDENTITY=new Nx;var wd=Nx;wd.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 iM=`varying vec2 vTextureCoord;
1152
1152
 
1153
1153
  uniform sampler2D uSampler;
1154
1154
 
@@ -1625,7 +1625,7 @@ void main(void)
1625
1625
  `)}}return o.push(`
1626
1626
  renderer.buffer.update(buffer);
1627
1627
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
1628
- `))}}var iO=0,Od={textureCount:0,uboCount:0},Vi=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=iO++}systemCheck(){if(!Id())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 i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Od.textureCount=0,Od.uboCount=0,this.syncUniformGroup(t.uniformGroup,Od)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Vx(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Od,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=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]=Zx(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,i){let s=t.uniforms,o=[`${i}-`];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,i=t.program,s=Kx(e,i);return i.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}};Vi.extension={type:V.RendererSystem,name:"shader"};q.add(Vi);var yi=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(){}};yi.defaultOptions={hello:!1},yi.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(yi);function CM(r,t=[]){return t[Z.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[r.ONE,r.ONE],t[Z.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[Z.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[Z.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[Z.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[Z.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[Z.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[Z.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var sO=0,oO=1,nO=2,aO=3,hO=4,lO=5,RM=class Qx{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[sO]=this.setBlend,this.map[oO]=this.setOffset,this.map[nO]=this.setCullFace,this.map[aO]=this.setDepthTest,this.map[hO]=this.setFrontFace,this.map[lO]=this.setDepthMask,this.checks=[],this.defaultState=new Yr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=CM(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(Qx.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Qx.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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};RM.extension={type:V.RendererSystem,name:"state"};var Jx=RM;q.add(Jx);var xn=class extends bs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Kt(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var ol=class Ld{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Ld.defaultMaxIdle,this.checkCountMax=Ld.defaultCheckCountMax,this.mode=Ld.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Ku.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!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,i=!0)}if(i){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,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};ol.defaultMode=Ku.AUTO,ol.defaultMaxIdle=60*60,ol.defaultCheckCountMax=60*10,ol.extension={type:V.RendererSystem,name:"textureGC"};var Zr=ol;q.add(Zr);var Fs=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=it.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}};function MM(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:N.FLOAT,[r.RGBA]:N.FLOAT,[r.ALPHA]:N.FLOAT,[r.LUMINANCE]:N.FLOAT,[r.LUMINANCE_ALPHA]:N.FLOAT,[r.R8]:N.FLOAT,[r.R8_SNORM]:N.FLOAT,[r.RG8]:N.FLOAT,[r.RG8_SNORM]:N.FLOAT,[r.RGB8]:N.FLOAT,[r.RGB8_SNORM]:N.FLOAT,[r.RGB565]:N.FLOAT,[r.RGBA4]:N.FLOAT,[r.RGB5_A1]:N.FLOAT,[r.RGBA8]:N.FLOAT,[r.RGBA8_SNORM]:N.FLOAT,[r.RGB10_A2]:N.FLOAT,[r.RGB10_A2UI]:N.FLOAT,[r.SRGB8]:N.FLOAT,[r.SRGB8_ALPHA8]:N.FLOAT,[r.R16F]:N.FLOAT,[r.RG16F]:N.FLOAT,[r.RGB16F]:N.FLOAT,[r.RGBA16F]:N.FLOAT,[r.R32F]:N.FLOAT,[r.RG32F]:N.FLOAT,[r.RGB32F]:N.FLOAT,[r.RGBA32F]:N.FLOAT,[r.R11F_G11F_B10F]:N.FLOAT,[r.RGB9_E5]:N.FLOAT,[r.R8I]:N.INT,[r.R8UI]:N.UINT,[r.R16I]:N.INT,[r.R16UI]:N.UINT,[r.R32I]:N.INT,[r.R32UI]:N.UINT,[r.RG8I]:N.INT,[r.RG8UI]:N.UINT,[r.RG16I]:N.INT,[r.RG16UI]:N.UINT,[r.RG32I]:N.INT,[r.RG32UI]:N.UINT,[r.RGB8I]:N.INT,[r.RGB8UI]:N.UINT,[r.RGB16I]:N.INT,[r.RGB16UI]:N.UINT,[r.RGB32I]:N.INT,[r.RGB32UI]:N.UINT,[r.RGBA8I]:N.INT,[r.RGBA8UI]:N.UINT,[r.RGBA16I]:N.INT,[r.RGBA16UI]:N.UINT,[r.RGBA32I]:N.INT,[r.RGBA32UI]:N.UINT,[r.DEPTH_COMPONENT16]:N.FLOAT,[r.DEPTH_COMPONENT24]:N.FLOAT,[r.DEPTH_COMPONENT32F]:N.FLOAT,[r.DEPTH_STENCIL]:N.FLOAT,[r.DEPTH24_STENCIL8]:N.FLOAT,[r.DEPTH32F_STENCIL8]:N.FLOAT}:t={[r.RGB]:N.FLOAT,[r.RGBA]:N.FLOAT,[r.ALPHA]:N.FLOAT,[r.LUMINANCE]:N.FLOAT,[r.LUMINANCE_ALPHA]:N.FLOAT,[r.DEPTH_STENCIL]:N.FLOAT},t}function BM(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[it.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA8,[G.RGB]:r.RGB8,[G.RG]:r.RG8,[G.RED]:r.R8,[G.RGBA_INTEGER]:r.RGBA8UI,[G.RGB_INTEGER]:r.RGB8UI,[G.RG_INTEGER]:r.RG8UI,[G.RED_INTEGER]:r.R8UI,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[it.BYTE]:{[G.RGBA]:r.RGBA8_SNORM,[G.RGB]:r.RGB8_SNORM,[G.RG]:r.RG8_SNORM,[G.RED]:r.R8_SNORM,[G.RGBA_INTEGER]:r.RGBA8I,[G.RGB_INTEGER]:r.RGB8I,[G.RG_INTEGER]:r.RG8I,[G.RED_INTEGER]:r.R8I},[it.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:r.RGBA16UI,[G.RGB_INTEGER]:r.RGB16UI,[G.RG_INTEGER]:r.RG16UI,[G.RED_INTEGER]:r.R16UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[it.SHORT]:{[G.RGBA_INTEGER]:r.RGBA16I,[G.RGB_INTEGER]:r.RGB16I,[G.RG_INTEGER]:r.RG16I,[G.RED_INTEGER]:r.R16I},[it.UNSIGNED_INT]:{[G.RGBA_INTEGER]:r.RGBA32UI,[G.RGB_INTEGER]:r.RGB32UI,[G.RG_INTEGER]:r.RG32UI,[G.RED_INTEGER]:r.R32UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[it.INT]:{[G.RGBA_INTEGER]:r.RGBA32I,[G.RGB_INTEGER]:r.RGB32I,[G.RG_INTEGER]:r.RG32I,[G.RED_INTEGER]:r.R32I},[it.FLOAT]:{[G.RGBA]:r.RGBA32F,[G.RGB]:r.RGB32F,[G.RG]:r.RG32F,[G.RED]:r.R32F,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[it.HALF_FLOAT]:{[G.RGBA]:r.RGBA16F,[G.RGB]:r.RGB16F,[G.RG]:r.RG16F,[G.RED]:r.R16F},[it.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB565},[it.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA4},[it.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGB5_A1},[it.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:r.RGB10_A2,[G.RGBA_INTEGER]:r.RGB10_A2UI},[it.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:r.R11F_G11F_B10F},[it.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:r.RGB9_E5},[it.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[it.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[it.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA,[G.RGB]:r.RGB,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[it.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB},[it.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA},[it.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGBA}},t}var yn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new dt,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=BM(t),this.samplerTypes=MM(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 i=new Fs(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.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]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Fs(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:i}=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,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.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:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==N.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Fs(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]??N.FLOAT,this.webGLVersion===2&&t.type===it.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 i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==N.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.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:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.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&&Cx(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ar.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Sh.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Ar.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===fr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};yn.extension={type:V.RendererSystem,name:"texture"};q.add(yn);var _n=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:i}=this,s=t._glTransformFeedbacks[i]||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:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,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&&(i.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 i=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))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};_n.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(_n);var _i=class{constructor(t){this.renderer=t}init(t){this.screen=new mt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,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}};_i.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},_i.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(_i);Y.PREFER_ENV=Ze.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...xi.defaultOptions,...gi.defaultOptions,..._i.defaultOptions,...yi.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return dt.defaultOptions.wrapMode},set(r){lt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),dt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return dt.defaultOptions.scaleMode},set(r){lt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),dt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return dt.defaultOptions.mipmap},set(r){lt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),dt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return dt.defaultOptions.anisotropicLevel},set(r){lt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),dt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return lt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Kr.defaultResolution},set(r){Kr.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return lt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Kr.defaultMultisample},set(r){Kr.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return mi.defaultMaxTextures},set(r){lt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),mi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return mi.defaultBatchSize},set(r){lt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),mi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return mi.canUploadSameBuffer},set(r){lt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),mi.canUploadSameBuffer=r}},GC_MODE:{get(){return Zr.defaultMode},set(r){lt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Zr.defaultMode=r}},GC_MAX_IDLE:{get(){return Zr.defaultMaxIdle},set(r){lt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Zr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Zr.defaultCheckCountMax},set(r){lt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Zr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return gr.defaultVertexPrecision},set(r){lt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),gr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return gr.defaultFragmentPrecision},set(r){lt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),gr.defaultFragmentPrecision=r}}});var ks=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ks||{});var bn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){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 IM=class rr{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 bn(null,null,1/0),this.deltaMS=1/rr.targetFPMS,this.elapsedMS=1/rr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=ks.NORMAL){return this._addListener(new bn(t,e,i))}addOnce(t,e,i=ks.NORMAL){return this._addListener(new bn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*rr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,rr.targetFPMS);this._maxElapsedMS=1/i}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(!rr._shared){let t=rr._shared=new rr;t.autoStart=!0,t._protected=!0}return rr._shared}static get system(){if(!rr._system){let t=rr._system=new rr;t.autoStart=!0,t._protected=!0}return rr._system}};IM.targetFPMS=.06;var xr=IM;Object.defineProperties(Y,{TARGET_FPMS:{get(){return xr.targetFPMS},set(r){lt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),xr.targetFPMS=r}}});var nl=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,ks.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?xr.shared:new xr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};nl.extension=V.Application;q.add(nl);var cO=[];q.handleByList(V.Renderer,cO);var al=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Pt.HIGH?this.multisample=Pt.HIGH:e>=Pt.MEDIUM?this.multisample=Pt.MEDIUM:e>=Pt.LOW?this.multisample=Pt.LOW:this.multisample=Pt.NONE}destroy(){}};al.extension={type:V.RendererSystem,name:"_multisample"};q.add(al);var Dd=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var hl=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:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||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 i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Dd(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};hl.extension={type:V.RendererSystem,name:"buffer"};q.add(hl);var ll=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};ll.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(ll);var Nd=class ty extends xn{constructor(t){super(),this.type=Wg.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new er({projectionMatrix:new Bt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:ty.__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&&(lt("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=ty.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Ax()}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 lt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return lt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return lt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return lt("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)}};Nd.extension={type:V.Renderer,priority:1},Nd.__plugins={},Nd.__systems={};var Hd=Nd;q.handleByMap(V.RendererPlugin,Hd.__plugins);q.handleByMap(V.RendererSystem,Hd.__systems);q.add(Hd);var Wi=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new dt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof tr?this.addResourceAt(t[i],i):this.addResourceAt(tn(t[i],e),i))}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:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var cl=class extends Wi{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,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=ci.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.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,i.type,l.resource.source))}return!0}};var ul=class extends ue{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var FM=class dl extends Wi{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==dl.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<dl.SIDES;a++)this.items[a].target=ci.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=ci.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=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=ci.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,i){let s=this.itemDirtyIds;for(let o=0;o<dl.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===dl.SIDES}};FM.SIDES=6;var ey=FM;var fl=class r extends ue{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),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 i=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(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 r._EMPTY=r._EMPTY??Y.ADAPTER.createCanvas(0,0),r._EMPTY}};var ry=class Vd extends ue{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Vd.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;ue.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,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${di()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Vd.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}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"&&Vd.SVG_XML.test(t)}};ry.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,ry.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var iy=ry;var Wd=class extends ue{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var sy=class oy extends ue{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ue.crossOrigin(i,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||oy.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),i.appendChild(n)}t=i}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=xr.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,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,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&&(xr.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||(xr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(xr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||oy.TYPES.includes(e)}};sy.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sy.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var ny=sy;Lh.push(fl,Rs,ul,ny,Wd,iy,vs,ey,cl);var uO={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},dO={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function kM(r,t,e,i,s){let o=0,n=null,a=null,h=s.gl;for(let l in r.uniforms){let c=t[l],u=i[l],d=e[l],f=r.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?uO:dO)[c.type].call(null,h,d.location,d.value,u)}}function fO(){Object.assign(Vi.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;kM(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}fO();var pl=new(window.AudioContext||window.webkitAudioContext),pO=(r,t)=>{let e,i=pl.createGain();i.gain.value=t.volume??1,i.connect(pl.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Lo.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=pl.createBufferSource(),e.buffer=m,e.loop=s.loop,i.gain.setValueAtTime(s.volume,pl.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(pl.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:i}},GM=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=r.find(c=>c.id===h.id);if(!l){let c=pO(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});r.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of r)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));r=r.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var mO=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);return s?s.parse({state:i,parserPlugins:t}):r}),ay=mO;var UM=({type:r,parse:t})=>({type:r,parse:t});var hy=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function ly(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function ml(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function DM(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function NM(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function gO(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function HM(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var yl={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":hy?173:189,"=":hy?61:187,";":hy?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Mr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},gl={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},ve={16:!1,18:!1,17:!1,91:!1},zt={};for(let r=1;r<20;r++)yl[`f${r}`]=111+r;var Lt=[],xl=null,VM="all",bi=new Map,vn=r=>yl[r.toLowerCase()]||Mr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),xO=r=>Object.keys(yl).find(t=>yl[t]===r),yO=r=>Object.keys(Mr).find(t=>Mr[t]===r),WM=r=>{VM=r||"all"},_l=()=>VM||"all",_O=()=>Lt.slice(0),bO=()=>Lt.map(r=>xO(r)||yO(r)||String.fromCharCode(r)),vO=()=>{let r=[];return Object.keys(zt).forEach(t=>{zt[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>vn(n))})})}),r},zM=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},TO=r=>(typeof r=="string"&&(r=vn(r)),Lt.indexOf(r)!==-1),SO=(r,t)=>{let e,i;r||(r=_l());for(let s in zt)if(Object.prototype.hasOwnProperty.call(zt,s))for(e=zt[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>uy(o)):i++;_l()===r&&WM(t||"all")};function EO(r){let t=HM(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=vn(r.key));let e=Lt.indexOf(t);if(e>=0&&Lt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Lt.splice(0,Lt.length),(t===93||t===224)&&(t=91),t in ve){ve[t]=!1;for(let i in Mr)Mr[i]===t&&(yr[i]=!1)}}var $M=(r,...t)=>{if(typeof r>"u")Object.keys(zt).forEach(e=>{Array.isArray(zt[e])&&zt[e].forEach(i=>zd(i)),delete zt[e]}),uy(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&zd(e)});else if(typeof r=="object")r.key&&zd(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),zd({key:r,scope:e,method:i,splitKey:"+"})}},zd=({key:r,scope:t,method:e,splitKey:i="+"})=>{NM(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],h=a==="*"?"*":vn(a);if(!zt[h])return;t||(t=_l());let l=n>1?DM(Mr,o):[],c=[];zt[h]=zt[h].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&gO(u.mods,l);return d&&c.push(u.element),!d}),c.forEach(u=>uy(u))})};function OM(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in ve)Object.prototype.hasOwnProperty.call(ve,o)&&(!ve[o]&&t.mods.indexOf(+o)>-1||ve[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!ve[16]&&!ve[18]&&!ve[17]&&!ve[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Lt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function LM(r,t){let e=zt["*"],i=HM(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(yr.filter||zM).call(this,r))return;if((i===93||i===224)&&(i=91),Lt.indexOf(i)===-1&&i!==229&&Lt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let h=gl[a];r[a]&&Lt.indexOf(h)===-1?Lt.push(h):!r[a]&&Lt.indexOf(h)>-1?Lt.splice(Lt.indexOf(h),1):a==="metaKey"&&r[a]&&(Lt=Lt.filter(l=>l in gl||l===i))}),i in ve){ve[i]=!0;for(let a in Mr)if(Object.prototype.hasOwnProperty.call(Mr,a)){let h=gl[Mr[a]];yr[a]=r[h]}if(!e)return}for(let a in ve)Object.prototype.hasOwnProperty.call(ve,a)&&(ve[a]=r[gl[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Lt.indexOf(17)===-1&&Lt.push(17),Lt.indexOf(18)===-1&&Lt.push(18),ve[17]=!0,ve[18]=!0);let s=_l();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&OM(r,e[a],s,t);if(!(i in zt))return;let o=zt[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let h=o[a],{splitKey:l}=h,c=h.key.split(l),u=[];for(let d=0;d<c.length;d++)u.push(vn(c[d]));u.sort().join("")===Lt.sort().join("")&&OM(r,h,s,t)}}var yr=function(r,t,e){Lt=[];let i=NM(r),s=[],o="all",n=document,a=0,h=!1,l=!0,c="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(h=f.keyup),f.keydown!==void 0&&(l=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(c=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&$M(r,o);a<i.length;a++){let f=i[a].split(c);s=[],f.length>1&&(s=DM(Mr,f));let p=f[f.length-1];p=p==="*"?"*":vn(p),p in zt||(zt[p]=[]),zt[p].push({keyup:h,keydown:l,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!bi.has(n)){let f=(m=window.event)=>LM(m,n),p=(m=window.event)=>{LM(m,n),EO(m)};bi.set(n,{keydownListener:f,keyupListenr:p,capture:u}),ly(n,"keydown",f,u),ly(n,"keyup",p,u)}if(!xl){let f=()=>{Lt=[]};xl={listener:f,capture:u},ly(window,"focus",f,u)}}};function wO(r,t="all"){Object.keys(zt).forEach(e=>{zt[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function uy(r){let t=Object.values(zt).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=bi.get(r)||{};e&&i&&(ml(r,"keyup",i,s),ml(r,"keydown",e,s),bi.delete(r))}if((t.length<=0||bi.size<=0)&&(Array.from(bi.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=bi.get(e)||{};i&&s&&(ml(e,"keyup",s,o),ml(e,"keydown",i,o),bi.delete(e))}),bi.clear(),Object.keys(zt).forEach(e=>delete zt[e]),xl)){let{listener:e,capture:i}=xl;ml(window,"focus",e,i),xl=null}}var cy={getPressedKeyString:bO,setScope:WM,getScope:_l,deleteScope:SO,getPressedKeyCodes:_O,getAllKeyCodes:vO,isPressed:TO,filter:zM,trigger:wO,unbind:$M,keyMap:yl,modifier:Mr,modifierMap:gl};for(let r in cy){let t=r;Object.prototype.hasOwnProperty.call(cy,t)&&(yr[t]=cy[t])}if(typeof window<"u"){let r=window.hotkeys;yr.noConflict=t=>(t&&window.hotkeys===yr&&(window.hotkeys=r),yr),window.hotkeys=yr}var XM=r=>{let t=new Map;return{registerHotkeys:(i={})=>{if(typeof i!="object"||i===null)return;let s=[],o=[],n=[];Object.keys(i).forEach(a=>{let h=t.get(a);h?JSON.stringify(h.payload)!==JSON.stringify(i[a].actionPayload)&&(o.push(a),yr.unbind(a)):s.push(a)}),t.forEach((a,h)=>{i.hasOwnProperty(h)||n.push(h)}),n.forEach(a=>{yr.unbind(a),t.delete(a)}),[...s,...o].forEach(a=>{let l=i[a].actionPayload??{};yr(a,()=>{r&&r("keydown",{_event:{key:a},...l})}),t.set(a,{value:a,payload:l})})}}};var AO=r=>r.split("/").pop(),PO=r=>({name:"advancedBufferLoader",priority:2,bufferMap:r,load:async t=>{let e=t.startsWith("file:")?t:AO(t),i=r[e];if(!i)throw new Error(`Buffer not found for key: ${e}`);return{data:i.buffer,type:i.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof A)return t;let e=new Blob([t.data],{type:t.type}),i=await createImageBitmap(e);return new A.from(i)},unload:async t=>t.destroy(!0)}),CO=()=>{let r,t=GM(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a=!1,h,l=f=>f?f.startsWith("audio/")?"audio":f.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(f)?"font":f.startsWith("video/")?"video":"texture":"texture",c=(f,p,m)=>{o&&o.registerHotkeys(m?.keyboard??{}),f.renderer.events.cursorStyles||(f.renderer.events.cursorStyles={}),f.renderer.events.cursorStyles.default||(f.renderer.events.cursorStyles.default="default"),f.renderer.events.cursorStyles.hover||(f.renderer.events.cursorStyles.hover="pointer");let g=p?.cursorStyles,b=m?.cursorStyles;JSON.stringify(g)!==JSON.stringify(b)&&(b?(b.default&&(f.renderer.events.cursorStyles.default=b.default,f.canvas.style.cursor=b.default),b.hover&&(f.renderer.events.cursorStyles.hover=b.hover)):g&&(f.renderer.events.cursorStyles.default="default",f.renderer.events.cursorStyles.hover="pointer"))},u=async(f,p,m,g)=>{c(f,e.global,m.global),n&&a&&n.abort(),n=new AbortController;let b=n.signal;for(;a;)await new Promise(y=>setTimeout(y,0));a=!0,await yh({app:f,parent:p,prevASTTree:e.elements,nextASTTree:m.elements,animations:m.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:g,signal:b}),await Vg({app:f,prevAudioTree:e.audio,nextAudioTree:m.audio,audioPlugins:s.audio,signal:b}),a=!1,n=null,e=m},d={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:f=>{if(r.stage.children&&r.stage.children.length>0)for(let p of r.stage.children){let m=findElementByLabel(p,f);if(m)return m}return null},extractBase64:async f=>{let p=r.stage.getChildByLabel(f,!0);if(!p)throw new Error(`Element with label '${f}' not found`);return await r.renderer.extract.base64(p)},assignStageEvent:(f,p)=>{r.stage.eventMode="static",r.stage.on(f,p)},init:async f=>{let{eventHandler:p,plugins:m,width:g,height:b,backgroundColor:y,debug:_=!1}=f,T=[];m?.elements?.forEach(S=>{S?.parse&&T.push(UM({type:S.type,parse:S.parse}))}),s={animations:m.animations??[],elements:m.elements??[],audio:m.audio??[],parsers:T},i=p,o=XM(p),r=new fh,r.audioStage=t,await r.init({width:g,height:b,backgroundColor:y,preference:"webgl"}),r.debug=_;let E=new he;return E.rect(0,0,g,b),E.fill(y||0),r.stage.addChild(E),r.stage.width=g,r.stage.height=b,r.ticker.add(r.audioStage.tick),d},destroy:()=>{r.audioStage.destroy(),r.destroy()},loadAssets:async f=>{if(!f)throw new Error("assetBufferMap is required");let p={audio:{},font:{},video:{},texture:{}};for(let[g,b]of Object.entries(f)){let y=l(b.type);p[y][g]=b}await Promise.all(Object.entries(p.audio).map(([g,b])=>Lo.load(g,b.buffer))),await Promise.all(Object.entries(p.font).map(async([g,b])=>{let y=new Blob([b.buffer],{type:b.type}),_=URL.createObjectURL(y),T=new FontFace(g,`url(${_})`);try{await T.load(),document.fonts.add(T)}catch(E){console.error(`Failed to load font ${g}:`,E)}finally{URL.revokeObjectURL(_)}})),h?Object.assign(h.bufferMap,p.texture):(h=PO(p.texture),ur.loader.parsers.length=0,ur.reset(),k.add({name:"advanced-buffer-loader",extension:v.Asset,priority:pe.High,loader:h}),typeof ur.registerPlugin=="function"&&ur.registerPlugin(h));let m=Object.keys(p.texture);return Promise.all(m.map(g=>ur.load(g)))},loadAudioAssets:async f=>Promise.all(f.map(async p=>{let g=await(await fetch(p)).arrayBuffer();return Lo.load(p,g)})),updatedBackgroundColor:f=>{r.renderer.background.color=f},render:f=>{let p=ay({JSONObject:f.elements,parserPlugins:s.parsers}),m={...f,elements:p};u(r,r.stage,m,i)},parse:f=>{let p=ay({JSONObject:f.elements,parserPlugins:s.parsers});return{...f,elements:p}}};return d},jM=CO;var bSt=jM;export{fh as Application,ur as Assets,Lo as AudioAsset,Bk as animatedSpritePlugin,Pk as containerPlugin,Ig as createAnimationPlugin,rB as createAssetBufferManager,Fg as createAudioPlugin,le as createElementPlugin,bSt as default,$k as particlesPlugin,Tk as rectPlugin,Vg as renderAudio,yh as renderElements,wk as sliderPlugin,Nk as soundPlugin,Sk as spritePlugin,vk as textPlugin,Mk as textRevealingPlugin,Dk as tweenPlugin,Ek as videoPlugin};
1628
+ `))}}var iO=0,Od={textureCount:0,uboCount:0},Vi=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=iO++}systemCheck(){if(!Id())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 i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Od.textureCount=0,Od.uboCount=0,this.syncUniformGroup(t.uniformGroup,Od)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Vx(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Od,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=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]=Zx(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,i){let s=t.uniforms,o=[`${i}-`];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,i=t.program,s=Kx(e,i);return i.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}};Vi.extension={type:V.RendererSystem,name:"shader"};q.add(Vi);var yi=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(){}};yi.defaultOptions={hello:!1},yi.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(yi);function CM(r,t=[]){return t[Z.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[r.ONE,r.ONE],t[Z.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[Z.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[Z.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[Z.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[Z.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[Z.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[Z.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var sO=0,oO=1,nO=2,aO=3,hO=4,lO=5,RM=class Qx{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[sO]=this.setBlend,this.map[oO]=this.setOffset,this.map[nO]=this.setCullFace,this.map[aO]=this.setDepthTest,this.map[hO]=this.setFrontFace,this.map[lO]=this.setDepthMask,this.checks=[],this.defaultState=new Yr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=CM(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(Qx.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Qx.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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};RM.extension={type:V.RendererSystem,name:"state"};var Jx=RM;q.add(Jx);var xn=class extends bs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Kt(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var ol=class Ld{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Ld.defaultMaxIdle,this.checkCountMax=Ld.defaultCheckCountMax,this.mode=Ld.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Ku.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!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,i=!0)}if(i){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,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};ol.defaultMode=Ku.AUTO,ol.defaultMaxIdle=60*60,ol.defaultCheckCountMax=60*10,ol.extension={type:V.RendererSystem,name:"textureGC"};var Zr=ol;q.add(Zr);var Fs=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=it.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}};function MM(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:D.FLOAT,[r.RGBA]:D.FLOAT,[r.ALPHA]:D.FLOAT,[r.LUMINANCE]:D.FLOAT,[r.LUMINANCE_ALPHA]:D.FLOAT,[r.R8]:D.FLOAT,[r.R8_SNORM]:D.FLOAT,[r.RG8]:D.FLOAT,[r.RG8_SNORM]:D.FLOAT,[r.RGB8]:D.FLOAT,[r.RGB8_SNORM]:D.FLOAT,[r.RGB565]:D.FLOAT,[r.RGBA4]:D.FLOAT,[r.RGB5_A1]:D.FLOAT,[r.RGBA8]:D.FLOAT,[r.RGBA8_SNORM]:D.FLOAT,[r.RGB10_A2]:D.FLOAT,[r.RGB10_A2UI]:D.FLOAT,[r.SRGB8]:D.FLOAT,[r.SRGB8_ALPHA8]:D.FLOAT,[r.R16F]:D.FLOAT,[r.RG16F]:D.FLOAT,[r.RGB16F]:D.FLOAT,[r.RGBA16F]:D.FLOAT,[r.R32F]:D.FLOAT,[r.RG32F]:D.FLOAT,[r.RGB32F]:D.FLOAT,[r.RGBA32F]:D.FLOAT,[r.R11F_G11F_B10F]:D.FLOAT,[r.RGB9_E5]:D.FLOAT,[r.R8I]:D.INT,[r.R8UI]:D.UINT,[r.R16I]:D.INT,[r.R16UI]:D.UINT,[r.R32I]:D.INT,[r.R32UI]:D.UINT,[r.RG8I]:D.INT,[r.RG8UI]:D.UINT,[r.RG16I]:D.INT,[r.RG16UI]:D.UINT,[r.RG32I]:D.INT,[r.RG32UI]:D.UINT,[r.RGB8I]:D.INT,[r.RGB8UI]:D.UINT,[r.RGB16I]:D.INT,[r.RGB16UI]:D.UINT,[r.RGB32I]:D.INT,[r.RGB32UI]:D.UINT,[r.RGBA8I]:D.INT,[r.RGBA8UI]:D.UINT,[r.RGBA16I]:D.INT,[r.RGBA16UI]:D.UINT,[r.RGBA32I]:D.INT,[r.RGBA32UI]:D.UINT,[r.DEPTH_COMPONENT16]:D.FLOAT,[r.DEPTH_COMPONENT24]:D.FLOAT,[r.DEPTH_COMPONENT32F]:D.FLOAT,[r.DEPTH_STENCIL]:D.FLOAT,[r.DEPTH24_STENCIL8]:D.FLOAT,[r.DEPTH32F_STENCIL8]:D.FLOAT}:t={[r.RGB]:D.FLOAT,[r.RGBA]:D.FLOAT,[r.ALPHA]:D.FLOAT,[r.LUMINANCE]:D.FLOAT,[r.LUMINANCE_ALPHA]:D.FLOAT,[r.DEPTH_STENCIL]:D.FLOAT},t}function BM(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[it.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA8,[G.RGB]:r.RGB8,[G.RG]:r.RG8,[G.RED]:r.R8,[G.RGBA_INTEGER]:r.RGBA8UI,[G.RGB_INTEGER]:r.RGB8UI,[G.RG_INTEGER]:r.RG8UI,[G.RED_INTEGER]:r.R8UI,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[it.BYTE]:{[G.RGBA]:r.RGBA8_SNORM,[G.RGB]:r.RGB8_SNORM,[G.RG]:r.RG8_SNORM,[G.RED]:r.R8_SNORM,[G.RGBA_INTEGER]:r.RGBA8I,[G.RGB_INTEGER]:r.RGB8I,[G.RG_INTEGER]:r.RG8I,[G.RED_INTEGER]:r.R8I},[it.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:r.RGBA16UI,[G.RGB_INTEGER]:r.RGB16UI,[G.RG_INTEGER]:r.RG16UI,[G.RED_INTEGER]:r.R16UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[it.SHORT]:{[G.RGBA_INTEGER]:r.RGBA16I,[G.RGB_INTEGER]:r.RGB16I,[G.RG_INTEGER]:r.RG16I,[G.RED_INTEGER]:r.R16I},[it.UNSIGNED_INT]:{[G.RGBA_INTEGER]:r.RGBA32UI,[G.RGB_INTEGER]:r.RGB32UI,[G.RG_INTEGER]:r.RG32UI,[G.RED_INTEGER]:r.R32UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[it.INT]:{[G.RGBA_INTEGER]:r.RGBA32I,[G.RGB_INTEGER]:r.RGB32I,[G.RG_INTEGER]:r.RG32I,[G.RED_INTEGER]:r.R32I},[it.FLOAT]:{[G.RGBA]:r.RGBA32F,[G.RGB]:r.RGB32F,[G.RG]:r.RG32F,[G.RED]:r.R32F,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[it.HALF_FLOAT]:{[G.RGBA]:r.RGBA16F,[G.RGB]:r.RGB16F,[G.RG]:r.RG16F,[G.RED]:r.R16F},[it.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB565},[it.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA4},[it.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGB5_A1},[it.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:r.RGB10_A2,[G.RGBA_INTEGER]:r.RGB10_A2UI},[it.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:r.R11F_G11F_B10F},[it.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:r.RGB9_E5},[it.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[it.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[it.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA,[G.RGB]:r.RGB,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[it.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB},[it.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA},[it.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGBA}},t}var yn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new dt,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=BM(t),this.samplerTypes=MM(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 i=new Fs(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.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]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Fs(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:i}=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,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.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:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==D.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Fs(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??D.FLOAT,this.webGLVersion===2&&t.type===it.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 i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==D.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.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:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.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&&Cx(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ar.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Sh.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Ar.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===fr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===fr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};yn.extension={type:V.RendererSystem,name:"texture"};q.add(yn);var _n=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:i}=this,s=t._glTransformFeedbacks[i]||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:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,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&&(i.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 i=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))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};_n.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(_n);var _i=class{constructor(t){this.renderer=t}init(t){this.screen=new mt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,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}};_i.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},_i.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(_i);Y.PREFER_ENV=Ze.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...xi.defaultOptions,...gi.defaultOptions,..._i.defaultOptions,...yi.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return dt.defaultOptions.wrapMode},set(r){lt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),dt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return dt.defaultOptions.scaleMode},set(r){lt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),dt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return dt.defaultOptions.mipmap},set(r){lt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),dt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return dt.defaultOptions.anisotropicLevel},set(r){lt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),dt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return lt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Kr.defaultResolution},set(r){Kr.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return lt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Kr.defaultMultisample},set(r){Kr.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return mi.defaultMaxTextures},set(r){lt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),mi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return mi.defaultBatchSize},set(r){lt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),mi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return mi.canUploadSameBuffer},set(r){lt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),mi.canUploadSameBuffer=r}},GC_MODE:{get(){return Zr.defaultMode},set(r){lt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Zr.defaultMode=r}},GC_MAX_IDLE:{get(){return Zr.defaultMaxIdle},set(r){lt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Zr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Zr.defaultCheckCountMax},set(r){lt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Zr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return gr.defaultVertexPrecision},set(r){lt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),gr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return gr.defaultFragmentPrecision},set(r){lt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),gr.defaultFragmentPrecision=r}}});var ks=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ks||{});var bn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){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 IM=class rr{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 bn(null,null,1/0),this.deltaMS=1/rr.targetFPMS,this.elapsedMS=1/rr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=ks.NORMAL){return this._addListener(new bn(t,e,i))}addOnce(t,e,i=ks.NORMAL){return this._addListener(new bn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*rr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,rr.targetFPMS);this._maxElapsedMS=1/i}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(!rr._shared){let t=rr._shared=new rr;t.autoStart=!0,t._protected=!0}return rr._shared}static get system(){if(!rr._system){let t=rr._system=new rr;t.autoStart=!0,t._protected=!0}return rr._system}};IM.targetFPMS=.06;var xr=IM;Object.defineProperties(Y,{TARGET_FPMS:{get(){return xr.targetFPMS},set(r){lt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),xr.targetFPMS=r}}});var nl=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,ks.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?xr.shared:new xr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};nl.extension=V.Application;q.add(nl);var cO=[];q.handleByList(V.Renderer,cO);var al=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Pt.HIGH?this.multisample=Pt.HIGH:e>=Pt.MEDIUM?this.multisample=Pt.MEDIUM:e>=Pt.LOW?this.multisample=Pt.LOW:this.multisample=Pt.NONE}destroy(){}};al.extension={type:V.RendererSystem,name:"_multisample"};q.add(al);var Dd=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var hl=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:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||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 i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Dd(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};hl.extension={type:V.RendererSystem,name:"buffer"};q.add(hl);var ll=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};ll.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(ll);var Nd=class ty extends xn{constructor(t){super(),this.type=Wg.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new er({projectionMatrix:new Bt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:ty.__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&&(lt("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=ty.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Ax()}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 lt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return lt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return lt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return lt("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)}};Nd.extension={type:V.Renderer,priority:1},Nd.__plugins={},Nd.__systems={};var Hd=Nd;q.handleByMap(V.RendererPlugin,Hd.__plugins);q.handleByMap(V.RendererSystem,Hd.__systems);q.add(Hd);var Wi=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new dt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof tr?this.addResourceAt(t[i],i):this.addResourceAt(tn(t[i],e),i))}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:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var cl=class extends Wi{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,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=ci.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.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,i.type,l.resource.source))}return!0}};var ul=class extends ue{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var FM=class dl extends Wi{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==dl.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<dl.SIDES;a++)this.items[a].target=ci.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=ci.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=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=ci.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,i){let s=this.itemDirtyIds;for(let o=0;o<dl.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===dl.SIDES}};FM.SIDES=6;var ey=FM;var fl=class r extends ue{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),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 i=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(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 r._EMPTY=r._EMPTY??Y.ADAPTER.createCanvas(0,0),r._EMPTY}};var ry=class Vd extends ue{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Vd.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;ue.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,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${di()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Vd.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}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"&&Vd.SVG_XML.test(t)}};ry.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,ry.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var iy=ry;var Wd=class extends ue{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var sy=class oy extends ue{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ue.crossOrigin(i,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||oy.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),i.appendChild(n)}t=i}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=xr.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,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,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&&(xr.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||(xr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(xr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||oy.TYPES.includes(e)}};sy.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sy.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var ny=sy;Lh.push(fl,Rs,ul,ny,Wd,iy,vs,ey,cl);var uO={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},dO={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function kM(r,t,e,i,s){let o=0,n=null,a=null,h=s.gl;for(let l in r.uniforms){let c=t[l],u=i[l],d=e[l],f=r.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?uO:dO)[c.type].call(null,h,d.location,d.value,u)}}function fO(){Object.assign(Vi.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;kM(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}fO();var pl=new(window.AudioContext||window.webkitAudioContext),pO=(r,t)=>{let e,i=pl.createGain();i.gain.value=t.volume??1,i.connect(pl.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Lo.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=pl.createBufferSource(),e.buffer=m,e.loop=s.loop,i.gain.setValueAtTime(s.volume,pl.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(pl.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:i}},GM=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=r.find(c=>c.id===h.id);if(!l){let c=pO(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});r.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of r)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));r=r.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var mO=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);return s?s.parse({state:i,parserPlugins:t}):r}),ay=mO;var UM=({type:r,parse:t})=>({type:r,parse:t});var hy=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function ly(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function ml(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function DM(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function NM(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function gO(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function HM(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var yl={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":hy?173:189,"=":hy?61:187,";":hy?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Mr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},gl={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},ve={16:!1,18:!1,17:!1,91:!1},zt={};for(let r=1;r<20;r++)yl[`f${r}`]=111+r;var Lt=[],xl=null,VM="all",bi=new Map,vn=r=>yl[r.toLowerCase()]||Mr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),xO=r=>Object.keys(yl).find(t=>yl[t]===r),yO=r=>Object.keys(Mr).find(t=>Mr[t]===r),WM=r=>{VM=r||"all"},_l=()=>VM||"all",_O=()=>Lt.slice(0),bO=()=>Lt.map(r=>xO(r)||yO(r)||String.fromCharCode(r)),vO=()=>{let r=[];return Object.keys(zt).forEach(t=>{zt[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>vn(n))})})}),r},zM=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},TO=r=>(typeof r=="string"&&(r=vn(r)),Lt.indexOf(r)!==-1),SO=(r,t)=>{let e,i;r||(r=_l());for(let s in zt)if(Object.prototype.hasOwnProperty.call(zt,s))for(e=zt[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>uy(o)):i++;_l()===r&&WM(t||"all")};function EO(r){let t=HM(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=vn(r.key));let e=Lt.indexOf(t);if(e>=0&&Lt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Lt.splice(0,Lt.length),(t===93||t===224)&&(t=91),t in ve){ve[t]=!1;for(let i in Mr)Mr[i]===t&&(yr[i]=!1)}}var $M=(r,...t)=>{if(typeof r>"u")Object.keys(zt).forEach(e=>{Array.isArray(zt[e])&&zt[e].forEach(i=>zd(i)),delete zt[e]}),uy(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&zd(e)});else if(typeof r=="object")r.key&&zd(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),zd({key:r,scope:e,method:i,splitKey:"+"})}},zd=({key:r,scope:t,method:e,splitKey:i="+"})=>{NM(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],h=a==="*"?"*":vn(a);if(!zt[h])return;t||(t=_l());let l=n>1?DM(Mr,o):[],c=[];zt[h]=zt[h].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&gO(u.mods,l);return d&&c.push(u.element),!d}),c.forEach(u=>uy(u))})};function OM(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in ve)Object.prototype.hasOwnProperty.call(ve,o)&&(!ve[o]&&t.mods.indexOf(+o)>-1||ve[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!ve[16]&&!ve[18]&&!ve[17]&&!ve[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Lt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function LM(r,t){let e=zt["*"],i=HM(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(yr.filter||zM).call(this,r))return;if((i===93||i===224)&&(i=91),Lt.indexOf(i)===-1&&i!==229&&Lt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let h=gl[a];r[a]&&Lt.indexOf(h)===-1?Lt.push(h):!r[a]&&Lt.indexOf(h)>-1?Lt.splice(Lt.indexOf(h),1):a==="metaKey"&&r[a]&&(Lt=Lt.filter(l=>l in gl||l===i))}),i in ve){ve[i]=!0;for(let a in Mr)if(Object.prototype.hasOwnProperty.call(Mr,a)){let h=gl[Mr[a]];yr[a]=r[h]}if(!e)return}for(let a in ve)Object.prototype.hasOwnProperty.call(ve,a)&&(ve[a]=r[gl[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Lt.indexOf(17)===-1&&Lt.push(17),Lt.indexOf(18)===-1&&Lt.push(18),ve[17]=!0,ve[18]=!0);let s=_l();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&OM(r,e[a],s,t);if(!(i in zt))return;let o=zt[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let h=o[a],{splitKey:l}=h,c=h.key.split(l),u=[];for(let d=0;d<c.length;d++)u.push(vn(c[d]));u.sort().join("")===Lt.sort().join("")&&OM(r,h,s,t)}}var yr=function(r,t,e){Lt=[];let i=NM(r),s=[],o="all",n=document,a=0,h=!1,l=!0,c="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(h=f.keyup),f.keydown!==void 0&&(l=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(c=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&$M(r,o);a<i.length;a++){let f=i[a].split(c);s=[],f.length>1&&(s=DM(Mr,f));let p=f[f.length-1];p=p==="*"?"*":vn(p),p in zt||(zt[p]=[]),zt[p].push({keyup:h,keydown:l,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!bi.has(n)){let f=(m=window.event)=>LM(m,n),p=(m=window.event)=>{LM(m,n),EO(m)};bi.set(n,{keydownListener:f,keyupListenr:p,capture:u}),ly(n,"keydown",f,u),ly(n,"keyup",p,u)}if(!xl){let f=()=>{Lt=[]};xl={listener:f,capture:u},ly(window,"focus",f,u)}}};function wO(r,t="all"){Object.keys(zt).forEach(e=>{zt[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function uy(r){let t=Object.values(zt).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=bi.get(r)||{};e&&i&&(ml(r,"keyup",i,s),ml(r,"keydown",e,s),bi.delete(r))}if((t.length<=0||bi.size<=0)&&(Array.from(bi.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=bi.get(e)||{};i&&s&&(ml(e,"keyup",s,o),ml(e,"keydown",i,o),bi.delete(e))}),bi.clear(),Object.keys(zt).forEach(e=>delete zt[e]),xl)){let{listener:e,capture:i}=xl;ml(window,"focus",e,i),xl=null}}var cy={getPressedKeyString:bO,setScope:WM,getScope:_l,deleteScope:SO,getPressedKeyCodes:_O,getAllKeyCodes:vO,isPressed:TO,filter:zM,trigger:wO,unbind:$M,keyMap:yl,modifier:Mr,modifierMap:gl};for(let r in cy){let t=r;Object.prototype.hasOwnProperty.call(cy,t)&&(yr[t]=cy[t])}if(typeof window<"u"){let r=window.hotkeys;yr.noConflict=t=>(t&&window.hotkeys===yr&&(window.hotkeys=r),yr),window.hotkeys=yr}var XM=r=>{let t=new Map;return{registerHotkeys:(i={})=>{if(typeof i!="object"||i===null)return;let s=[],o=[],n=[];Object.keys(i).forEach(a=>{let h=t.get(a);h?JSON.stringify(h.payload)!==JSON.stringify(i[a].actionPayload)&&(o.push(a),yr.unbind(a)):s.push(a)}),t.forEach((a,h)=>{i.hasOwnProperty(h)||n.push(h)}),n.forEach(a=>{yr.unbind(a),t.delete(a)}),[...s,...o].forEach(a=>{let l=i[a].actionPayload??{};yr(a,()=>{r&&r("keydown",{_event:{key:a},...l})}),t.set(a,{value:a,payload:l})})}}};var AO=r=>r.split("/").pop(),PO=r=>({name:"advancedBufferLoader",priority:2,bufferMap:r,load:async t=>{let e=t.startsWith("file:")?t:AO(t),i=r[e];if(!i)throw new Error(`Buffer not found for key: ${e}`);return{data:i.buffer,type:i.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof A)return t;let e=new Blob([t.data],{type:t.type}),i=await createImageBitmap(e);return new A.from(i)},unload:async t=>t.destroy(!0)}),CO=()=>{let r,t=GM(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a=!1,h,l=f=>f?f.startsWith("audio/")?"audio":f.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(f)?"font":f.startsWith("video/")?"video":"texture":"texture",c=(f,p,m)=>{o&&o.registerHotkeys(m?.keyboard??{}),f.renderer.events.cursorStyles||(f.renderer.events.cursorStyles={}),f.renderer.events.cursorStyles.default||(f.renderer.events.cursorStyles.default="default"),f.renderer.events.cursorStyles.hover||(f.renderer.events.cursorStyles.hover="pointer");let g=p?.cursorStyles,b=m?.cursorStyles;JSON.stringify(g)!==JSON.stringify(b)&&(b?(b.default&&(f.renderer.events.cursorStyles.default=b.default,f.canvas.style.cursor=b.default),b.hover&&(f.renderer.events.cursorStyles.hover=b.hover)):g&&(f.renderer.events.cursorStyles.default="default",f.renderer.events.cursorStyles.hover="pointer"))},u=async(f,p,m,g)=>{c(f,e.global,m.global),n&&a&&n.abort(),n=new AbortController;let b=n.signal;for(;a;)await new Promise(y=>setTimeout(y,0));a=!0,await yh({app:f,parent:p,prevASTTree:e.elements,nextASTTree:m.elements,animations:m.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:g,signal:b}),await Vg({app:f,prevAudioTree:e.audio,nextAudioTree:m.audio,audioPlugins:s.audio,signal:b}),a=!1,n=null,e=m},d={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:f=>{if(r.stage.children&&r.stage.children.length>0)for(let p of r.stage.children){let m=findElementByLabel(p,f);if(m)return m}return null},extractBase64:async f=>{let p=r.stage.getChildByLabel(f,!0);if(!p)throw new Error(`Element with label '${f}' not found`);return await r.renderer.extract.base64(p)},assignStageEvent:(f,p)=>{r.stage.eventMode="static",r.stage.on(f,p)},init:async f=>{let{eventHandler:p,plugins:m,width:g,height:b,backgroundColor:y,debug:_=!1}=f,T=[];m?.elements?.forEach(S=>{S?.parse&&T.push(UM({type:S.type,parse:S.parse}))}),s={animations:m.animations??[],elements:m.elements??[],audio:m.audio??[],parsers:T},i=p,o=XM(p),r=new fh,r.audioStage=t,await r.init({width:g,height:b,backgroundColor:y,preference:"webgl"}),r.debug=_;let E=new he;return E.rect(0,0,g,b),E.fill(y||0),r.stage.addChild(E),r.stage.width=g,r.stage.height=b,r.ticker.add(r.audioStage.tick),d},destroy:()=>{r.audioStage.destroy(),r.destroy()},loadAssets:async f=>{if(!f)throw new Error("assetBufferMap is required");let p={audio:{},font:{},video:{},texture:{}};for(let[g,b]of Object.entries(f)){let y=l(b.type);p[y][g]=b}await Promise.all(Object.entries(p.audio).map(([g,b])=>Lo.load(g,b.buffer))),await Promise.all(Object.entries(p.font).map(async([g,b])=>{let y=new Blob([b.buffer],{type:b.type}),_=URL.createObjectURL(y),T=new FontFace(g,`url(${_})`);try{await T.load(),document.fonts.add(T)}catch(E){console.error(`Failed to load font ${g}:`,E)}finally{URL.revokeObjectURL(_)}})),h?Object.assign(h.bufferMap,p.texture):(h=PO(p.texture),ur.loader.parsers.length=0,ur.reset(),k.add({name:"advanced-buffer-loader",extension:v.Asset,priority:pe.High,loader:h}),typeof ur.registerPlugin=="function"&&ur.registerPlugin(h));let m=Object.keys(p.texture);return Promise.all(m.map(g=>ur.load(g)))},loadAudioAssets:async f=>Promise.all(f.map(async p=>{let g=await(await fetch(p)).arrayBuffer();return Lo.load(p,g)})),updatedBackgroundColor:f=>{r.renderer.background.color=f},render:f=>{let p=ay({JSONObject:f.elements,parserPlugins:s.parsers}),m={...f,elements:p};u(r,r.stage,m,i)},parse:f=>{let p=ay({JSONObject:f.elements,parserPlugins:s.parsers});return{...f,elements:p}}};return d},jM=CO;var bSt=jM;export{fh as Application,ur as Assets,Lo as AudioAsset,Bk as animatedSpritePlugin,Pk as containerPlugin,Ig as createAnimationPlugin,rB as createAssetBufferManager,Fg as createAudioPlugin,le as createElementPlugin,bSt as default,$k as particlesPlugin,Tk as rectPlugin,Vg as renderAudio,yh as renderElements,wk as sliderPlugin,Nk as soundPlugin,Sk as spritePlugin,vk as textPlugin,Mk as textRevealingPlugin,Dk as tweenPlugin,Ek as videoPlugin};
1629
1629
  /*! Bundled license information:
1630
1630
 
1631
1631
  punycode/punycode.js: