@drincs/pixi-vn 1.2.16 → 1.2.18

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 Fx=Object.create;var Ys=Object.defineProperty;var Bx=Object.getOwnPropertyDescriptor;var kx=Object.getOwnPropertyNames;var Gx=Object.getPrototypeOf,Ox=Object.prototype.hasOwnProperty;var Yh=i=>{throw TypeError(i)};var Dx=(i,t,e)=>t in i?Ys(i,t,{enumerable:true,configurable:true,writable:true,value:e}):i[t]=e;var Wn=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var x=(i,t)=>()=>(i&&(t=i(i=0)),t);var $s=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ux=(i,t)=>{for(var e in t)Ys(i,e,{get:t[e],enumerable:true});},zx=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of kx(t))!Ox.call(i,s)&&s!==e&&Ys(i,s,{get:()=>t[s],enumerable:!(r=Bx(t,s))||r.enumerable});return i};var Hn=(i,t,e)=>(e=i!=null?Fx(Gx(i)):{},zx(Ys(e,"default",{value:i,enumerable:true}),i));var M=(i,t,e)=>Dx(i,typeof t!="symbol"?t+"":t,e),Yn=(i,t,e)=>t.has(i)||Yh("Cannot "+e);var _=(i,t,e)=>(Yn(i,t,"read from private field"),e?e.call(i):t.get(i)),tt=(i,t,e)=>t.has(i)?Yh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),V=(i,t,e,r)=>(Yn(i,t,"write to private field"),t.set(i,e),e),B=(i,t,e)=>(Yn(i,t,"access private method"),e);var Xs=(i,t,e,r)=>({set _(s){V(i,t,s);},get _(){return _(i,t,r)}});var w,$n,Bi,W,U=x(()=>{w=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(w||{}),$n=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i};}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Bi=(i,t)=>$n(i).priority??t,W={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map($n).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map($n).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t));});}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref);},e=>{e.name&&delete t[e.name];})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Bi(n.value,e)-Bi(o.value,e)));},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1);})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Bi(o,e)-Bi(s,e)));},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1);})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e));}};});var Kh=$s((qb,Xn)=>{var Nx=Object.prototype.hasOwnProperty,Ot="~";function ki(){}Object.create&&(ki.prototype=Object.create(null),new ki().__proto__||(Ot=false));function Vx(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function jh(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new Vx(e,r||i,s),n=Ot?Ot+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function to(i,t){--i._eventsCount===0?i._events=new ki:delete i._events[t];}function Bt(){this._events=new ki,this._eventsCount=0;}Bt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Nx.call(e,r)&&t.push(Ot?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Bt.prototype.listeners=function(t){var e=Ot?Ot+t:t,r=this._events[e];if(!r)return [];if(r.fn)return [r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};Bt.prototype.listenerCount=function(t){var e=Ot?Ot+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Bt.prototype.emit=function(t,e,r,s,o,n){var a=Ot?Ot+t:t;if(!this._events[a])return false;var l=this._events[a],h=arguments.length,u,c;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,true),h){case 1:return l.fn.call(l.context),true;case 2:return l.fn.call(l.context,e),true;case 3:return l.fn.call(l.context,e,r),true;case 4:return l.fn.call(l.context,e,r,s),true;case 5:return l.fn.call(l.context,e,r,s,o),true;case 6:return l.fn.call(l.context,e,r,s,o,n),true}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u);}else {var f=l.length,d;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,true),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,s);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u);}}return true};Bt.prototype.on=function(t,e,r){return jh(this,t,e,r,false)};Bt.prototype.once=function(t,e,r){return jh(this,t,e,r,true)};Bt.prototype.removeListener=function(t,e,r,s){var o=Ot?Ot+t:t;if(!this._events[o])return this;if(!e)return to(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&to(this,o);else {for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:to(this,o);}return this};Bt.prototype.removeAllListeners=function(t){var e;return t?(e=Ot?Ot+t:t,this._events[e]&&to(this,e)):(this._events=new ki,this._eventsCount=0),this};Bt.prototype.off=Bt.prototype.removeListener;Bt.prototype.addListener=Bt.prototype.on;Bt.prefixed=Ot;Bt.EventEmitter=Bt;typeof Xn<"u"&&(Xn.exports=Bt);});var qh,et,Yt=x(()=>{qh=Hn(Kh()),et=qh.default;});var Wx,Ge,Et,ne,su,Zh,jn,Hx,eo,ou,nu,Qh,Jh,tu,Gi,Yx,$x,Xx,jx,Zn,eu,Kx,Kn,qn,ru,Qn,ue,iu,au,lu=x(()=>{Wx={grad:.9,turn:360,rad:360/(2*Math.PI)},Ge=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},Et=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},ne=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},su=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},Zh=function(i){return {r:ne(i.r,0,255),g:ne(i.g,0,255),b:ne(i.b,0,255),a:ne(i.a)}},jn=function(i){return {r:Et(i.r),g:Et(i.g),b:Et(i.b),a:Et(i.a,3)}},Hx=/^#([0-9a-f]{3,8})$/i,eo=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},ou=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return {h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},nu=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),l=r*(1-(1-t+o)*e),h=o%6;return {r:255*[r,a,n,n,l,r][h],g:255*[l,r,r,a,n,n][h],b:255*[n,n,l,r,r,a][h],a:s}},Qh=function(i){return {h:su(i.h),s:ne(i.s,0,100),l:ne(i.l,0,100),a:ne(i.a)}},Jh=function(i){return {h:Et(i.h),s:Et(i.s),l:Et(i.l),a:Et(i.a,3)}},tu=function(i){return nu((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r;},Gi=function(i){return {h:(t=ou(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s;},Yx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$x=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zn={string:[[function(i){var t=Hx.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?Et(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?Et(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Xx.exec(i)||jx.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Zh({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Yx.exec(i)||$x.exec(i);if(!t)return null;var e,r,s=Qh({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Wx[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return tu(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Ge(t)&&Ge(e)&&Ge(r)?Zh({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Ge(t)||!Ge(e)||!Ge(r))return null;var n=Qh({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return tu(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Ge(t)||!Ge(e)||!Ge(r))return null;var n=function(a){return {h:su(a.h),s:ne(a.s,0,100),v:ne(a.v,0,100),a:ne(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return nu(n)},"hsv"]]},eu=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return [r,t[e][1]]}return [null,void 0]},Kx=function(i){return typeof i=="string"?eu(i.trim(),Zn.string):typeof i=="object"&&i!==null?eu(i,Zn.object):[null,void 0]},Kn=function(i,t){var e=Gi(i);return {h:e.h,s:ne(e.s+100*t,0,100),l:e.l,a:e.a}},qn=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},ru=function(i,t){var e=Gi(i);return {h:e.h,s:e.s,l:ne(e.l+100*t,0,100),a:e.a}},Qn=function(){function i(t){this.parsed=Kx(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return Et(qn(this.rgba),2)},i.prototype.isDark=function(){return qn(this.rgba)<.5},i.prototype.isLight=function(){return qn(this.rgba)>=.5},i.prototype.toHex=function(){return t=jn(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?eo(Et(255*o)):"","#"+eo(e)+eo(r)+eo(s)+n;var t,e,r,s,o,n;},i.prototype.toRgb=function(){return jn(this.rgba)},i.prototype.toRgbString=function(){return t=jn(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o;},i.prototype.toHsl=function(){return Jh(Gi(this.rgba))},i.prototype.toHslString=function(){return t=Jh(Gi(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o;},i.prototype.toHsv=function(){return t=ou(this.rgba),{h:Et(t.h),s:Et(t.s),v:Et(t.v),a:Et(t.a,3)};var t;},i.prototype.invert=function(){return ue({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t;},i.prototype.saturate=function(t){return t===void 0&&(t=.1),ue(Kn(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ue(Kn(this.rgba,-t))},i.prototype.grayscale=function(){return ue(Kn(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ue(ru(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ue(ru(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?ue({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Et(this.rgba.a,3);var e;},i.prototype.hue=function(t){var e=Gi(this.rgba);return typeof t=="number"?ue({h:t,s:e.s,l:e.l,a:e.a}):Et(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ue(t).toHex()},i}(),ue=function(i){return i instanceof Qn?i:new Qn(i)},iu=[],au=function(i){i.forEach(function(t){iu.indexOf(t)<0&&(t(Qn,Zn),iu.push(t));});};});function hu(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return "transparent";var a,l,h=r[this.toHex()];if(h)return h;if(n?.closest){var u=this.toRgb(),c=1/0,f="black";if(!o.length)for(var d in e)o[d]=new i(e[d]).toRgb();for(var g in e){var y=(a=u,l=o[g],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<c&&(c=y,f=g);}return f}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new i(l).toRgb():null},"name"]);}var uu=x(()=>{});var Or,J,$t=x(()=>{lu();uu();au([hu]);Or=class Oi{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 Oi)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else {if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value));}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return false;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?false: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?false:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return {r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return {r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return `rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return (r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return (t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=Oi._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=true){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=true){if(t===1)return (255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return `#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1;}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Oi.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`);}let n=ue(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255);}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0);}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r);}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Oi||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}};Or.shared=new Or;Or._temp=new Or;Or.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;J=Or;});var cu,du=x(()=>{cu={cullArea:null,cullable:false,cullableChildren:true};});var fu,pu,mu,Jn=x(()=>{fu=Math.PI*2,pu=180/Math.PI,mu=Math.PI/180;});var rt,ta,we=x(()=>{rt=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e;}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return `[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ta.x=0,ta.y=0,ta}},ta=new rt;});var F,qx,Zx,ut=x(()=>{Jn();we();F=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n;}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5];}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new rt;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new rt;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(r*n+o*-s),u=t.x,c=t.y;return e.x=n*h*u+-o*h*c+(l*o-a*n)*h,e.y=r*h*c+-s*h*u+(-l*r+a*s)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,u=e.b,c=e.c,f=e.d;return this.a=r*h+s*c,this.b=r*u+s*f,this.c=o*h+n*c,this.d=o*u+n*f,this.tx=a*h+l*c+e.tx,this.ty=a*u+l*f+e.ty,this}setTransform(t,e,r,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d;}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(r,e),h=Math.abs(a+l);return h<1e-5||Math.abs(fu-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Zx.identity()}static get shared(){return qx.identity()}},qx=new F,Zx=new F;});var Dt,ea=x(()=>{Dt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t;}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return (this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return (this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return `[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this));}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this));}};});function it(i="default"){return ra[i]===void 0&&(ra[i]=-1),++ra[i]}var ra,Ut=x(()=>{ra={default:-1};});function N(i,t,e=3){if(gu[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var Fx=Object.create;var Ys=Object.defineProperty;var Bx=Object.getOwnPropertyDescriptor;var kx=Object.getOwnPropertyNames;var Gx=Object.getPrototypeOf,Ox=Object.prototype.hasOwnProperty;var Yh=i=>{throw TypeError(i)};var Dx=(i,t,e)=>t in i?Ys(i,t,{enumerable:true,configurable:true,writable:true,value:e}):i[t]=e;var Wn=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var g=(i,t)=>()=>(i&&(t=i(i=0)),t);var $s=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ux=(i,t)=>{for(var e in t)Ys(i,e,{get:t[e],enumerable:true});},zx=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of kx(t))!Ox.call(i,s)&&s!==e&&Ys(i,s,{get:()=>t[s],enumerable:!(r=Bx(t,s))||r.enumerable});return i};var Hn=(i,t,e)=>(e=i!=null?Fx(Gx(i)):{},zx(Ys(e,"default",{value:i,enumerable:true}),i));var M=(i,t,e)=>Dx(i,typeof t!="symbol"?t+"":t,e),Yn=(i,t,e)=>t.has(i)||Yh("Cannot "+e);var _=(i,t,e)=>(Yn(i,t,"read from private field"),e?e.call(i):t.get(i)),tt=(i,t,e)=>t.has(i)?Yh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),V=(i,t,e,r)=>(Yn(i,t,"write to private field"),t.set(i,e),e),B=(i,t,e)=>(Yn(i,t,"access private method"),e);var Xs=(i,t,e,r)=>({set _(s){V(i,t,s);},get _(){return _(i,t,r)}});var w,$n,Bi,W,U=g(()=>{w=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(w||{}),$n=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i};}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Bi=(i,t)=>$n(i).priority??t,W={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map($n).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map($n).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t));});}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref);},e=>{e.name&&delete t[e.name];})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Bi(n.value,e)-Bi(o.value,e)));},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1);})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Bi(o,e)-Bi(s,e)));},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1);})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e));}};});var Kh=$s((qb,Xn)=>{var Nx=Object.prototype.hasOwnProperty,Ot="~";function ki(){}Object.create&&(ki.prototype=Object.create(null),new ki().__proto__||(Ot=false));function Vx(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function jh(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new Vx(e,r||i,s),n=Ot?Ot+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function to(i,t){--i._eventsCount===0?i._events=new ki:delete i._events[t];}function Bt(){this._events=new ki,this._eventsCount=0;}Bt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Nx.call(e,r)&&t.push(Ot?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Bt.prototype.listeners=function(t){var e=Ot?Ot+t:t,r=this._events[e];if(!r)return [];if(r.fn)return [r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};Bt.prototype.listenerCount=function(t){var e=Ot?Ot+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Bt.prototype.emit=function(t,e,r,s,o,n){var a=Ot?Ot+t:t;if(!this._events[a])return false;var l=this._events[a],h=arguments.length,u,c;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,true),h){case 1:return l.fn.call(l.context),true;case 2:return l.fn.call(l.context,e),true;case 3:return l.fn.call(l.context,e,r),true;case 4:return l.fn.call(l.context,e,r,s),true;case 5:return l.fn.call(l.context,e,r,s,o),true;case 6:return l.fn.call(l.context,e,r,s,o,n),true}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u);}else {var f=l.length,d;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,true),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,s);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u);}}return true};Bt.prototype.on=function(t,e,r){return jh(this,t,e,r,false)};Bt.prototype.once=function(t,e,r){return jh(this,t,e,r,true)};Bt.prototype.removeListener=function(t,e,r,s){var o=Ot?Ot+t:t;if(!this._events[o])return this;if(!e)return to(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&to(this,o);else {for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:to(this,o);}return this};Bt.prototype.removeAllListeners=function(t){var e;return t?(e=Ot?Ot+t:t,this._events[e]&&to(this,e)):(this._events=new ki,this._eventsCount=0),this};Bt.prototype.off=Bt.prototype.removeListener;Bt.prototype.addListener=Bt.prototype.on;Bt.prefixed=Ot;Bt.EventEmitter=Bt;typeof Xn<"u"&&(Xn.exports=Bt);});var qh,et,Yt=g(()=>{qh=Hn(Kh()),et=qh.default;});var Wx,Ge,Et,ne,su,Zh,jn,Hx,eo,ou,nu,Qh,Jh,tu,Gi,Yx,$x,Xx,jx,Zn,eu,Kx,Kn,qn,ru,Qn,ue,iu,au,lu=g(()=>{Wx={grad:.9,turn:360,rad:360/(2*Math.PI)},Ge=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},Et=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},ne=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},su=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},Zh=function(i){return {r:ne(i.r,0,255),g:ne(i.g,0,255),b:ne(i.b,0,255),a:ne(i.a)}},jn=function(i){return {r:Et(i.r),g:Et(i.g),b:Et(i.b),a:Et(i.a,3)}},Hx=/^#([0-9a-f]{3,8})$/i,eo=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},ou=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return {h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},nu=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),l=r*(1-(1-t+o)*e),h=o%6;return {r:255*[r,a,n,n,l,r][h],g:255*[l,r,r,a,n,n][h],b:255*[n,n,l,r,r,a][h],a:s}},Qh=function(i){return {h:su(i.h),s:ne(i.s,0,100),l:ne(i.l,0,100),a:ne(i.a)}},Jh=function(i){return {h:Et(i.h),s:Et(i.s),l:Et(i.l),a:Et(i.a,3)}},tu=function(i){return nu((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r;},Gi=function(i){return {h:(t=ou(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s;},Yx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$x=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zn={string:[[function(i){var t=Hx.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?Et(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?Et(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Xx.exec(i)||jx.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Zh({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Yx.exec(i)||$x.exec(i);if(!t)return null;var e,r,s=Qh({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Wx[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return tu(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Ge(t)&&Ge(e)&&Ge(r)?Zh({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Ge(t)||!Ge(e)||!Ge(r))return null;var n=Qh({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return tu(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Ge(t)||!Ge(e)||!Ge(r))return null;var n=function(a){return {h:su(a.h),s:ne(a.s,0,100),v:ne(a.v,0,100),a:ne(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return nu(n)},"hsv"]]},eu=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return [r,t[e][1]]}return [null,void 0]},Kx=function(i){return typeof i=="string"?eu(i.trim(),Zn.string):typeof i=="object"&&i!==null?eu(i,Zn.object):[null,void 0]},Kn=function(i,t){var e=Gi(i);return {h:e.h,s:ne(e.s+100*t,0,100),l:e.l,a:e.a}},qn=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},ru=function(i,t){var e=Gi(i);return {h:e.h,s:e.s,l:ne(e.l+100*t,0,100),a:e.a}},Qn=function(){function i(t){this.parsed=Kx(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return Et(qn(this.rgba),2)},i.prototype.isDark=function(){return qn(this.rgba)<.5},i.prototype.isLight=function(){return qn(this.rgba)>=.5},i.prototype.toHex=function(){return t=jn(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?eo(Et(255*o)):"","#"+eo(e)+eo(r)+eo(s)+n;var t,e,r,s,o,n;},i.prototype.toRgb=function(){return jn(this.rgba)},i.prototype.toRgbString=function(){return t=jn(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o;},i.prototype.toHsl=function(){return Jh(Gi(this.rgba))},i.prototype.toHslString=function(){return t=Jh(Gi(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o;},i.prototype.toHsv=function(){return t=ou(this.rgba),{h:Et(t.h),s:Et(t.s),v:Et(t.v),a:Et(t.a,3)};var t;},i.prototype.invert=function(){return ue({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t;},i.prototype.saturate=function(t){return t===void 0&&(t=.1),ue(Kn(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ue(Kn(this.rgba,-t))},i.prototype.grayscale=function(){return ue(Kn(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ue(ru(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ue(ru(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?ue({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Et(this.rgba.a,3);var e;},i.prototype.hue=function(t){var e=Gi(this.rgba);return typeof t=="number"?ue({h:t,s:e.s,l:e.l,a:e.a}):Et(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ue(t).toHex()},i}(),ue=function(i){return i instanceof Qn?i:new Qn(i)},iu=[],au=function(i){i.forEach(function(t){iu.indexOf(t)<0&&(t(Qn,Zn),iu.push(t));});};});function hu(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return "transparent";var a,l,h=r[this.toHex()];if(h)return h;if(n?.closest){var u=this.toRgb(),c=1/0,f="black";if(!o.length)for(var d in e)o[d]=new i(e[d]).toRgb();for(var x in e){var y=(a=u,l=o[x],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<c&&(c=y,f=x);}return f}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new i(l).toRgb():null},"name"]);}var uu=g(()=>{});var Or,J,$t=g(()=>{lu();uu();au([hu]);Or=class Oi{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 Oi)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else {if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value));}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return false;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?false: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?false:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return {r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return {r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return `rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return (r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return (t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=Oi._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=true){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=true){if(t===1)return (255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return `#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1;}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Oi.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`);}let n=ue(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255);}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0);}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r);}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Oi||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}};Or.shared=new Or;Or._temp=new Or;Or.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;J=Or;});var cu,du=g(()=>{cu={cullArea:null,cullable:false,cullableChildren:true};});var fu,pu,mu,Jn=g(()=>{fu=Math.PI*2,pu=180/Math.PI,mu=Math.PI/180;});var rt,ta,we=g(()=>{rt=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e;}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return `[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ta.x=0,ta.y=0,ta}},ta=new rt;});var F,qx,Zx,ut=g(()=>{Jn();we();F=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n;}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5];}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new rt;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new rt;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(r*n+o*-s),u=t.x,c=t.y;return e.x=n*h*u+-o*h*c+(l*o-a*n)*h,e.y=r*h*c+-s*h*u+(-l*r+a*s)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,u=e.b,c=e.c,f=e.d;return this.a=r*h+s*c,this.b=r*u+s*f,this.c=o*h+n*c,this.d=o*u+n*f,this.tx=a*h+l*c+e.tx,this.ty=a*u+l*f+e.ty,this}setTransform(t,e,r,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d;}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(r,e),h=Math.abs(a+l);return h<1e-5||Math.abs(fu-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Zx.identity()}static get shared(){return qx.identity()}},qx=new F,Zx=new F;});var Dt,ea=g(()=>{Dt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t;}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return (this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return (this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return `[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this));}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this));}};});function it(i="default"){return ra[i]===void 0&&(ra[i]=-1),++ra[i]}var ra,Ut=g(()=>{ra={default:-1};});function N(i,t,e=3){if(gu[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
2
  Deprecated since v${i}`):(r=r.split(`
3
3
  `).splice(e).join(`
4
4
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
5
5
  Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${i}`),console.warn(r))),gu[t]=true;}var gu,q,xu,yt=x(()=>{gu={},q="8.0.0",xu="8.3.4";});var fr,ia=x(()=>{fr=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 sa,wt,pr=x(()=>{ia();sa=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 fr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize};}),t}},wt=new sa;});var _u,yu=x(()=>{yt();_u={get isCachedAsTexture(){return !!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===false?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===true?{}:i));},updateCacheTexture(){this.renderGroup?.updateCacheTexture();},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){N("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i);}};});function ro(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o;}var oa=x(()=>{});var bu,vu=x(()=>{oa();yt();bu={allowChildren:true,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null);}ro(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this);}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t);},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||N(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(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1);}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=true,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=true),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=true),this._didContainerChangeTick++;},removeFromParent(){this.parent?.removeChild(this);},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}};});var Su,Tu=x(()=>{Su={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e));},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e);},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i);}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i);}}};});var Di,wu=x(()=>{Di=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 na,io,Cu=x(()=>{U();pr();na=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=false;}init(){this._initialized||(this._initialized=true,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t});}));}add(t){this._tests.push(t);}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return wt.get(r.maskClass,t)}return t}returnMaskEffect(t){wt.return(t);}},io=new na;W.handleByList(w.MaskEffect,io._effectClasses);});var Pu,Mu=x(()=>{wu();Cu();Pu={_maskEffect:null,_maskOptions:{inverse:false},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=true);},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple());},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple());},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),io.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=io.getMaskEffect(i),this.addEffect(this._maskEffect)));},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged();},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Di);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null));},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Di),this._filterEffect.filterArea=i;},get filterArea(){return this._filterEffect?.filterArea}};});var Eu,Au=x(()=>{yt();Eu={label:null,get name(){return N(q,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){N(q,"Container.name property has been removed, use Container.label instead"),this.label=i;},getChildByName(i,t=false){return this.getChildByLabel(i,t)},getChildByLabel(i,t=false){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,true);if(o)return o}return null},getChildrenByLabel(i,t=false,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o);}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,true,e);return e}};});var so,st,Xt=x(()=>{we();so=[new rt,new rt,new rt,new rt],st=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s);}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?false:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return false;let a=this.x,l=this.y,h=r*(1-s),u=r-h,c=a-h,f=a+o+h,d=l-h,g=l+n+h,y=a+u,m=a+o-u,p=l+u,b=l+n-u;return t>=c&&t<=f&&e>=d&&e<=g&&!(t>y&&t<m&&e>p&&e<b)}intersects(t,e){if(!e){let G=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=G)return false;let L=this.y<t.y?t.y:this.y;return (this.bottom>t.bottom?t.bottom:this.bottom)>L}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return false;let a=so[0].set(t.left,t.top),l=so[1].set(t.left,t.bottom),h=so[2].set(t.right,t.top),u=so[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return false;let c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(u,u),Math.max(a.x,l.x,h.x,u.x)<=r||Math.min(a.x,l.x,h.x,u.x)>=s||Math.max(a.y,l.y,h.y,u.y)<=o||Math.min(a.y,l.y,h.y,u.y)>=n))return false;let f=c*(l.y-a.y),d=c*(a.x-l.x),g=f*r+d*o,y=f*s+d*o,m=f*r+d*n,p=f*s+d*n;if(Math.max(g,y,m,p)<=f*a.x+d*a.y||Math.min(g,y,m,p)>=f*u.x+d*u.y)return false;let b=c*(a.y-h.y),v=c*(h.x-a.x),S=b*r+v*o,P=b*s+v*o,T=b*r+v*n,C=b*s+v*n;return !(Math.max(S,P,T,C)<=b*a.x+v*a.y||Math.min(S,P,T,C)>=b*u.x+v*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return false;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}set(t,e,r,s){return this.x=t,this.y=e,this.width=r,this.height=s,this}toString(){return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};});var Iu,mt,ce=x(()=>{ut();Xt();Iu=new F,mt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Iu,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new 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=Iu,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,u=o.tx,c=o.ty,f=this.minX,d=this.minY,g=this.maxX,y=this.maxY,m=n*t+l*e+u,p=a*t+h*e+c;m<f&&(f=m),p<d&&(d=p),m>g&&(g=m),p>y&&(y=p),m=n*r+l*e+u,p=a*r+h*e+c,m<f&&(f=m),p<d&&(d=p),m>g&&(g=m),p>y&&(y=p),m=n*t+l*s+u,p=a*t+h*s+c,m<f&&(f=m),p<d&&(d=p),m>g&&(g=m),p>y&&(y=p),m=n*r+l*s+u,p=a*r+h*s+c,m<f&&(f=m),p<d&&(d=p),m>g&&(g=m),p>y&&(y=p),this.minX=f,this.minY=d,this.maxX=g,this.maxY=y;}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e);}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e);}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY;}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:h,tx:u,ty:c}=t,f=n*e+l*r+u,d=a*e+h*r+c;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+l*r+u,d=a*s+h*r+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*e+l*o+u,d=a*e+h*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*s+l*o+u,d=a*s+h*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY;}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e;}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e;}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t;}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t;}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,u=s.b,c=s.c,f=s.d,d=s.tx,g=s.ty;for(let y=e;y<r;y+=2){let m=t[y],p=t[y+1],b=h*m+c*p+d,v=u*m+f*p+g;o=b<o?b:o,n=v<n?v:n,a=b>a?b:a,l=v>l?v:l;}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l;}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}};});var bt,Zt,mr=x(()=>{ut();ia();ce();bt=new fr(F),Zt=new fr(mt);});var Qx,Lu,Ru=x(()=>{ut();ce();mr();Qx=new F,Lu={getFastGlobalBounds(i,t){t||(t=new mt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Zt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else {if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform);}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e);}if(s){let o=false,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=true,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,true));o&&(r.applyMatrix(n.worldTransform.copyTo(Qx).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Zt.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Zt.return(r));}};});function oo(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=bt.get().identity(),r=no(i,s)):r=F.IDENTITY,Fu(i,e,r,t),s&&bt.return(s),e.isValid||e.set(0,0,0,0),e}function Fu(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=bt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Zt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else {i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)Fu(i.children[a],t,s,r);}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,F.IDENTITY),Zt.return(t);}r||bt.return(s);}function no(i,t){let e=i.parent;return e&&(no(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var ao=x(()=>{ut();mr();});function lo(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=r*n/255|0,u=s*a/255|0;return (l<<16)+(h<<8)+u}var aa=x(()=>{});function la(i,t){return i===Bu?t:t===Bu?i:lo(i,t)}var Bu,ku=x(()=>{aa();Bu=16777215;});function Ui(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var Gu,Ou=x(()=>{ao();mr();ku();Gu={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=no(this,bt.get().identity());return i.appendFrom(this.localTransform,e),bt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Ui(this.renderGroup.worldColor):this.parentRenderGroup?Ui(la(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=la(t,e.localColor),e=e.parent;return Ui(t)}};});function ho(i,t,e){return t.clear(),e||(e=F.IDENTITY),Du(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function Du(i,t,e,r,s){let o;if(s)o=bt.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let l=i.localTransform;o=bt.get(),o.appendFrom(l,e);}let n=t,a=!!i.effects.length;if(a&&(t=Zt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else {i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let l=i.children;for(let h=0;h<l.length;h++)Du(l[h],t,o,r,false);}if(a){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(t,r);n.addBounds(t,F.IDENTITY),Zt.return(t);}bt.return(o);}var ha=x(()=>{ut();mr();});function ua(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=true),t.index=a+2,s.children.length&&ua(s,t);}return t.didChange}var Uu=x(()=>{});var Jx,zu,Nu=x(()=>{ut();ce();ao();ha();Uu();Jx=new F,zu={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e;},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e;},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:false,localBounds:new mt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=false,i.data[0]!==this._didViewChangeTick&&(i.didChange=true,i.data[0]=this._didViewChangeTick),ua(this,i),i.didChange&&ho(this,i.localBounds,Jx),i.localBounds},getBounds(i,t){return oo(this,i,t||new mt)}};});var Vu,Wu=x(()=>{Vu={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i;},get onRender(){return this._onRender}};});function t_(i,t){return i._zIndex-t._zIndex}var Hu,Yu=x(()=>{Hu={_zIndex:0,sortDirty:false,sortableChildren:false,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified());},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=true,this.parent.sortDirty=true),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true);},sortChildren(){this.sortDirty&&(this.sortDirty=false,this.children.sort(t_));}};});var $u,Xu=x(()=>{we();mr();$u={getGlobalPosition(i=new rt,t=false){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=false){let r=this.getGlobalTransform(bt.get(),e);return t=r.apply(i,t),bt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(bt.get(),r);return e=s.applyInverse(i,e),bt.return(s),e}};});var Dr,ca=x(()=>{Ut();Dr=class{constructor(){this.uid=it("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 Oe(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function da(i){return !(i&i-1)&&!!i}var zi=x(()=>{});function uo(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var fa=x(()=>{});function e_(i){let t=ju[i];return t===void 0&&(ju[i]=it("resource")),t}var ju,Ku,ae,Ur=x(()=>{Yt();Ut();yt();ju=Object.create(null);Ku=class qu extends et{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...qu.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){N(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=e_(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};Ku.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};ae=Ku;});var Zu,Ct,De=x(()=>{Yt();zi();fa();Ut();Ur();Zu=class Qu extends et{constructor(t={}){super(),this.options=t,this.uid=it("textureSource"),this._resourceType="textureSource",this._resourceId=it("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=false,this.format="rgba8unorm",this.dimension="2d",this.antialias=false,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Qu.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 ae(uo(t)),this.destroyed=false,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=true,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=it("resource"),this.emit("change",this),this.emit("unload",this);}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t);}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?false:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=it("resource"),this.emit("change",this),true)}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=da(this.pixelWidth)&&da(this.pixelHeight);}static test(t){throw new Error("Unimplemented")}};Zu.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};Ct=Zu;});function r_(){for(let i=0;i<16;i++){let t=[];pa.push(t);for(let e=0;e<16;e++){let r=co(gr[i]*gr[e]+_r[i]*xr[e]),s=co(xr[i]*gr[e]+yr[i]*xr[e]),o=co(gr[i]*_r[e]+_r[i]*yr[e]),n=co(xr[i]*_r[e]+yr[i]*yr[e]);for(let a=0;a<16;a++)if(gr[a]===r&&xr[a]===s&&_r[a]===o&&yr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new F;t.set(gr[i],xr[i],_r[i],yr[i],0,0),Ju.push(t);}}var gr,xr,_r,yr,pa,Ju,co,ft,tc=x(()=>{ut();gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_r=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],yr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],pa=[],Ju=[],co=Math.sign;r_();ft={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>gr[i],uY:i=>xr[i],vX:i=>_r[i],vY:i=>yr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>pa[i][t],sub:(i,t)=>pa[i][ft.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ft.S:ft.N:Math.abs(t)*2<=Math.abs(i)?i>0?ft.E:ft.W:t>0?i>0?ft.SE:ft.SW:i>0?ft.NE:ft.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Ju[ft.inv(t)];s.tx=e,s.ty=r,i.append(s);}};});var ma,ec=x(()=>{ma=()=>{};});var br,ga=x(()=>{U();De();br=class extends Ct{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer";}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};br.extension=w.TextureSource;});var rc,fo,ic=x(()=>{ut();rc=new F,fo=class{constructor(t,e){this.mapCoord=new F,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=false,this.texture=t;}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update());}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty;}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(rc.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(rc));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/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,true}};});var D,Rt=x(()=>{Yt();tc();Xt();Ut();yt();ec();ga();De();ic();D=class extends et{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=it("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=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new Ct,this.noFrame=!r,r)this.frame.copyFrom(r);else {let{width:u,height:c}=this._source;this.frame.width=u,this.frame.height=c;}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=false,this.dynamic=h||false,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 fo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,l=e.height/s,h=this.rotate;if(h){let u=a/2,c=l/2,f=o+u,d=n+c;h=ft.add(h,ft.NW),t.x0=f+u*ft.uX(h),t.y0=d+c*ft.uY(h),h=ft.add(h,2),t.x1=f+u*ft.uX(h),t.y1=d+c*ft.uY(h),h=ft.add(h,2),t.x2=f+u*ft.uX(h),t.y2=d+c*ft.uY(h),h=ft.add(h,2),t.x3=f+u*ft.uX(h),t.y3=d+c*ft.uY(h);}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l;}destroy(t=false){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=true,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 N(q,"Texture.baseTexture is now Texture.source"),this._source}};D.EMPTY=new D({label:"EMPTY",source:new Ct({label:"EMPTY"})});D.EMPTY.destroy=ma;D.WHITE=new D({source:new br({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});D.WHITE.destroy=ma;});var i_,xa,kt,zr=x(()=>{zi();De();Rt();Ur();i_=0,xa=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false,this.textureStyle=new ae(this.textureOptions);}createTexture(t,e,r){let s=new Ct({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new D({source:s,label:`texturePool_${i_++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Oe(o),n=Oe(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=r,l.source.width=o/r,l.source.height=n/r,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=false){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=false){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].push(t);}clear(t){if(t=t!==false,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(true);}this._texturePool={};}},kt=new xa;});var po,sc=x(()=>{ut();ca();zr();po=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=false,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new F,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=true,this.instructionSet=new Dr,this._onRenderContainers=[],this.textureNeedsUpdate=true,this.isCachedAsTexture=false,this._matrixDirty=7;}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=true;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s);}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=true,this.textureNeedsUpdate=true;}disableCacheAsTexture(){this.isCachedAsTexture=false,this.texture&&(kt.returnTexture(this.texture),this.texture=null);}updateCacheTexture(){this.textureNeedsUpdate=true;}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=true,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=true,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=true,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r]);}removeChild(t){if(this.structureDidChange=true,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r]);}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e]);}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t;}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=false);}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t;}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t);}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1);}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t);}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null;}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7;}get inverseWorldTransform(){return (this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new F),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return (this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new F),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 F),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 oc(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r]);}var nc=x(()=>{});var _a,ya,ba,ac,s_,va,de,Ni=x(()=>{Yt();$t();du();U();ut();Jn();ea();Ut();yt();pr();yu();vu();Tu();Mu();Au();Ru();Ou();Nu();Wu();Yu();Xu();sc();nc();_a=new Dt(null),ya=new Dt(null),ba=new Dt(null,1,1),ac=1,s_=2,va=4,de=class i extends et{constructor(t={}){super(),this.uid=it("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=false,this.didViewUpdate=false,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=true,this.measurable=true,this.isSimple=true,this.updateTick=-1,this.localTransform=new F,this.relativeGroupTransform=new F,this.groupTransform=this.relativeGroupTransform,this.destroyed=false,this._position=new Dt(this,0,0),this._scale=ba,this._pivot=ya,this._skew=_a,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=[],oc(this,t,{children:true,parent:true,effects:true}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this);}static mixin(t){N("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),W.mixin(i,t);}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095;}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||N(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],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=true),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=true),e.parent=this,e.didChange=true,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=true,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=wt.get(po,this),this.groupTransform=F.IDENTITY,t?.addChild(this),this._updateIsSimple();}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),wt.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 F),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*pu}set angle(t){this.rotation=t*mu;}get pivot(){return this._pivot===ya&&(this._pivot=new Dt(this,0,0)),this._pivot}set pivot(t){this._pivot===ya&&(this._pivot=new Dt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===_a&&(this._skew=new Dt(this,0,0)),this._skew}set skew(t){this._skew===_a&&(this._skew=new Dt(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===ba&&(this._scale=new Dt(this,1,1)),this._scale}set scale(t){this._scale===ba&&(this._scale=new Dt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t);}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e);}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e);}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height);}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x);}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this);}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,l=s._x,h=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-(l*e.a+h*e.c),e.ty=o._y-(l*e.b+h*e.d);}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=ac,this._onUpdate());}get alpha(){return this.localAlpha}set tint(t){let r=J.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=ac,this._onUpdate());}get tint(){return Ui(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=s_,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=true),this._updateFlags|=va,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=true),this._updateFlags|=va,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|=va,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._onUpdate());}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=false){if(this.destroyed)return;this.destroyed=true;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;}};W.mixin(de,bu,Lu,$u,Vu,zu,Pu,Eu,Hu,cu,_u,Gu,Su);});var Xe,mo=x(()=>{we();Xe=class i{constructor(t){this.bubbles=true,this.cancelBubble=true,this.cancelable=false,this.composed=false,this.defaultPrevented=false,this.eventPhase=i.prototype.NONE,this.propagationStopped=false,this.propagationImmediatelyStopped=false,this.layer=new rt,this.page=new rt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t;}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=true;}stopImmediatePropagation(){this.propagationImmediatelyStopped=true;}stopPropagation(){this.propagationStopped=true;}};});function o_(i){return function(t){return t.test(i)}}function Vi(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=o_(e),o={apple:{phone:s(Sa)&&!s(Ue),ipod:s(lc),tablet:!s(Sa)&&(s(hc)||_c(t))&&!s(Ue),universal:s(uc),device:(s(Sa)||s(lc)||s(hc)||s(uc)||_c(t))&&!s(Ue)},amazon:{phone:s(Nr),tablet:!s(Nr)&&s(go),device:s(Nr)||s(go)},android:{phone:!s(Ue)&&s(Nr)||!s(Ue)&&s(Ta),tablet:!s(Ue)&&!s(Nr)&&!s(Ta)&&(s(go)||s(cc)),device:!s(Ue)&&(s(Nr)||s(go)||s(Ta)||s(cc))||s(/\bokhttp\b/i)},windows:{phone:s(Ue),tablet:s(dc),device:s(Ue)||s(dc)},other:{blackberry:s(fc),blackberry10:s(pc),opera:s(mc),firefox:s(xc),chrome:s(gc),device:s(fc)||s(pc)||s(mc)||s(xc)||s(gc)},any:false,phone:false,tablet:false};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 Sa,lc,hc,uc,Ta,cc,Nr,go,Ue,dc,fc,pc,mc,gc,xc,_c,wa=x(()=>{Sa=/iPhone/i,lc=/iPod/i,hc=/iPad/i,uc=/\biOS-universal(?:.+)Mac\b/i,Ta=/\bAndroid(?:.+)Mobile\b/i,cc=/Android/i,Nr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,go=/Silk/i,Ue=/Windows Phone/i,dc=/\bWindows(?:.+)ARM\b/i,fc=/BlackBerry/i,pc=/BB10/i,mc=/Opera Mini/i,gc=/\b(CriOS|Chrome)(?:.+)Mobile/i,xc=/Mobile(?:.+)Firefox\b/i,_c=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var yc=x(()=>{wa();wa();});var n_,bc,vc=x(()=>{yc();n_=Vi.default??Vi,bc=n_(globalThis.navigator);});var a_,xo,l_,h_,Sc,Tc,u_,c_,d_,Ca,Cc,Pc=x(()=>{mo();U();vc();oa();a_=9,xo=100,l_=0,h_=0,Sc=2,Tc=1,u_=-1e3,c_=-1e3,d_=2,Ca=class wc{constructor(t,e=bc){this._mobileInfo=e,this.debug=false,this._activateOnTab=true,this._deactivateOnMouseMove=true,this._isActive=false,this._isMobileAccessibility=false,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=`${Tc}px`,t.style.height=`${Tc}px`,t.style.position="absolute",t.style.top=`${u_}px`,t.style.left=`${c_}px`,t.style.zIndex=d_.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=true,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=true,this._div||(this._div=document.createElement("div"),this._div.style.width=`${xo}px`,this._div.style.height=`${xo}px`,this._div.style.position="absolute",this._div.style.top=`${l_}px`,this._div.style.left=`${h_}px`,this._div.style.zIndex=Sc.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,true));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:true,subtree:true});}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=false,globalThis.document.removeEventListener("mousemove",this._onMouseMove,true),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,false),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=false;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t);}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[];}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r]);}init(t){let r={accessibilityOptions:{...wc.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._renderer.runners.postrender.remove(this);}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r));}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=false,ro(this._children,r,1));}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`;}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,l=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*h}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*h}px`;}else {this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}px`;}}this._renderId++;}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`;}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y);}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
6
+ Deprecated since v${i}`),console.warn(r))),gu[t]=true;}var gu,q,xu,yt=g(()=>{gu={},q="8.0.0",xu="8.3.4";});var fr,ia=g(()=>{fr=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 sa,wt,pr=g(()=>{ia();sa=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 fr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize};}),t}},wt=new sa;});var _u,yu=g(()=>{yt();_u={get isCachedAsTexture(){return !!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===false?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===true?{}:i));},updateCacheTexture(){this.renderGroup?.updateCacheTexture();},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){N("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i);}};});function ro(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o;}var oa=g(()=>{});var bu,vu=g(()=>{oa();yt();bu={allowChildren:true,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null);}ro(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this);}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t);},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||N(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(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1);}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=true,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=true),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=true),this._didContainerChangeTick++;},removeFromParent(){this.parent?.removeChild(this);},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}};});var Su,Tu=g(()=>{Su={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e));},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e);},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i);}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i);}}};});var Di,wu=g(()=>{Di=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 na,io,Cu=g(()=>{U();pr();na=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=false;}init(){this._initialized||(this._initialized=true,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t});}));}add(t){this._tests.push(t);}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return wt.get(r.maskClass,t)}return t}returnMaskEffect(t){wt.return(t);}},io=new na;W.handleByList(w.MaskEffect,io._effectClasses);});var Pu,Mu=g(()=>{wu();Cu();Pu={_maskEffect:null,_maskOptions:{inverse:false},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=true);},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple());},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple());},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),io.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=io.getMaskEffect(i),this.addEffect(this._maskEffect)));},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged();},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Di);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null));},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Di),this._filterEffect.filterArea=i;},get filterArea(){return this._filterEffect?.filterArea}};});var Eu,Au=g(()=>{yt();Eu={label:null,get name(){return N(q,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){N(q,"Container.name property has been removed, use Container.label instead"),this.label=i;},getChildByName(i,t=false){return this.getChildByLabel(i,t)},getChildByLabel(i,t=false){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,true);if(o)return o}return null},getChildrenByLabel(i,t=false,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o);}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,true,e);return e}};});var so,st,Xt=g(()=>{we();so=[new rt,new rt,new rt,new rt],st=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s);}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?false:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return false;let a=this.x,l=this.y,h=r*(1-s),u=r-h,c=a-h,f=a+o+h,d=l-h,x=l+n+h,y=a+u,m=a+o-u,p=l+u,b=l+n-u;return t>=c&&t<=f&&e>=d&&e<=x&&!(t>y&&t<m&&e>p&&e<b)}intersects(t,e){if(!e){let G=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=G)return false;let L=this.y<t.y?t.y:this.y;return (this.bottom>t.bottom?t.bottom:this.bottom)>L}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return false;let a=so[0].set(t.left,t.top),l=so[1].set(t.left,t.bottom),h=so[2].set(t.right,t.top),u=so[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return false;let c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(u,u),Math.max(a.x,l.x,h.x,u.x)<=r||Math.min(a.x,l.x,h.x,u.x)>=s||Math.max(a.y,l.y,h.y,u.y)<=o||Math.min(a.y,l.y,h.y,u.y)>=n))return false;let f=c*(l.y-a.y),d=c*(a.x-l.x),x=f*r+d*o,y=f*s+d*o,m=f*r+d*n,p=f*s+d*n;if(Math.max(x,y,m,p)<=f*a.x+d*a.y||Math.min(x,y,m,p)>=f*u.x+d*u.y)return false;let b=c*(a.y-h.y),v=c*(h.x-a.x),S=b*r+v*o,P=b*s+v*o,T=b*r+v*n,C=b*s+v*n;return !(Math.max(S,P,T,C)<=b*a.x+v*a.y||Math.min(S,P,T,C)>=b*u.x+v*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return false;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}set(t,e,r,s){return this.x=t,this.y=e,this.width=r,this.height=s,this}toString(){return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};});var Iu,mt,ce=g(()=>{ut();Xt();Iu=new F,mt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Iu,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new 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=Iu,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,u=o.tx,c=o.ty,f=this.minX,d=this.minY,x=this.maxX,y=this.maxY,m=n*t+l*e+u,p=a*t+h*e+c;m<f&&(f=m),p<d&&(d=p),m>x&&(x=m),p>y&&(y=p),m=n*r+l*e+u,p=a*r+h*e+c,m<f&&(f=m),p<d&&(d=p),m>x&&(x=m),p>y&&(y=p),m=n*t+l*s+u,p=a*t+h*s+c,m<f&&(f=m),p<d&&(d=p),m>x&&(x=m),p>y&&(y=p),m=n*r+l*s+u,p=a*r+h*s+c,m<f&&(f=m),p<d&&(d=p),m>x&&(x=m),p>y&&(y=p),this.minX=f,this.minY=d,this.maxX=x,this.maxY=y;}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e);}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e);}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY;}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:h,tx:u,ty:c}=t,f=n*e+l*r+u,d=a*e+h*r+c;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+l*r+u,d=a*s+h*r+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*e+l*o+u,d=a*e+h*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*s+l*o+u,d=a*s+h*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY;}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e;}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e;}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t;}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t;}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,u=s.b,c=s.c,f=s.d,d=s.tx,x=s.ty;for(let y=e;y<r;y+=2){let m=t[y],p=t[y+1],b=h*m+c*p+d,v=u*m+f*p+x;o=b<o?b:o,n=v<n?v:n,a=b>a?b:a,l=v>l?v:l;}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l;}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}};});var bt,Zt,mr=g(()=>{ut();ia();ce();bt=new fr(F),Zt=new fr(mt);});var Qx,Lu,Ru=g(()=>{ut();ce();mr();Qx=new F,Lu={getFastGlobalBounds(i,t){t||(t=new mt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Zt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else {if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform);}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e);}if(s){let o=false,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=true,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,true));o&&(r.applyMatrix(n.worldTransform.copyTo(Qx).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Zt.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Zt.return(r));}};});function oo(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=bt.get().identity(),r=no(i,s)):r=F.IDENTITY,Fu(i,e,r,t),s&&bt.return(s),e.isValid||e.set(0,0,0,0),e}function Fu(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=bt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Zt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else {i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)Fu(i.children[a],t,s,r);}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,F.IDENTITY),Zt.return(t);}r||bt.return(s);}function no(i,t){let e=i.parent;return e&&(no(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var ao=g(()=>{ut();mr();});function lo(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=r*n/255|0,u=s*a/255|0;return (l<<16)+(h<<8)+u}var aa=g(()=>{});function la(i,t){return i===Bu?t:t===Bu?i:lo(i,t)}var Bu,ku=g(()=>{aa();Bu=16777215;});function Ui(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var Gu,Ou=g(()=>{ao();mr();ku();Gu={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=no(this,bt.get().identity());return i.appendFrom(this.localTransform,e),bt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Ui(this.renderGroup.worldColor):this.parentRenderGroup?Ui(la(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=la(t,e.localColor),e=e.parent;return Ui(t)}};});function ho(i,t,e){return t.clear(),e||(e=F.IDENTITY),Du(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function Du(i,t,e,r,s){let o;if(s)o=bt.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let l=i.localTransform;o=bt.get(),o.appendFrom(l,e);}let n=t,a=!!i.effects.length;if(a&&(t=Zt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else {i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let l=i.children;for(let h=0;h<l.length;h++)Du(l[h],t,o,r,false);}if(a){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(t,r);n.addBounds(t,F.IDENTITY),Zt.return(t);}bt.return(o);}var ha=g(()=>{ut();mr();});function ua(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=true),t.index=a+2,s.children.length&&ua(s,t);}return t.didChange}var Uu=g(()=>{});var Jx,zu,Nu=g(()=>{ut();ce();ao();ha();Uu();Jx=new F,zu={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e;},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e;},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:false,localBounds:new mt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=false,i.data[0]!==this._didViewChangeTick&&(i.didChange=true,i.data[0]=this._didViewChangeTick),ua(this,i),i.didChange&&ho(this,i.localBounds,Jx),i.localBounds},getBounds(i,t){return oo(this,i,t||new mt)}};});var Vu,Wu=g(()=>{Vu={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i;},get onRender(){return this._onRender}};});function t_(i,t){return i._zIndex-t._zIndex}var Hu,Yu=g(()=>{Hu={_zIndex:0,sortDirty:false,sortableChildren:false,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified());},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=true,this.parent.sortDirty=true),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true);},sortChildren(){this.sortDirty&&(this.sortDirty=false,this.children.sort(t_));}};});var $u,Xu=g(()=>{we();mr();$u={getGlobalPosition(i=new rt,t=false){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=false){let r=this.getGlobalTransform(bt.get(),e);return t=r.apply(i,t),bt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(bt.get(),r);return e=s.applyInverse(i,e),bt.return(s),e}};});var Dr,ca=g(()=>{Ut();Dr=class{constructor(){this.uid=it("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 Oe(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function da(i){return !(i&i-1)&&!!i}var zi=g(()=>{});function uo(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var fa=g(()=>{});function e_(i){let t=ju[i];return t===void 0&&(ju[i]=it("resource")),t}var ju,Ku,ae,Ur=g(()=>{Yt();Ut();yt();ju=Object.create(null);Ku=class qu extends et{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...qu.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){N(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=e_(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};Ku.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};ae=Ku;});var Zu,Ct,De=g(()=>{Yt();zi();fa();Ut();Ur();Zu=class Qu extends et{constructor(t={}){super(),this.options=t,this.uid=it("textureSource"),this._resourceType="textureSource",this._resourceId=it("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=false,this.format="rgba8unorm",this.dimension="2d",this.antialias=false,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Qu.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 ae(uo(t)),this.destroyed=false,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=true,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=it("resource"),this.emit("change",this),this.emit("unload",this);}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t);}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?false:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=it("resource"),this.emit("change",this),true)}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=da(this.pixelWidth)&&da(this.pixelHeight);}static test(t){throw new Error("Unimplemented")}};Zu.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};Ct=Zu;});function r_(){for(let i=0;i<16;i++){let t=[];pa.push(t);for(let e=0;e<16;e++){let r=co(gr[i]*gr[e]+_r[i]*xr[e]),s=co(xr[i]*gr[e]+yr[i]*xr[e]),o=co(gr[i]*_r[e]+_r[i]*yr[e]),n=co(xr[i]*_r[e]+yr[i]*yr[e]);for(let a=0;a<16;a++)if(gr[a]===r&&xr[a]===s&&_r[a]===o&&yr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new F;t.set(gr[i],xr[i],_r[i],yr[i],0,0),Ju.push(t);}}var gr,xr,_r,yr,pa,Ju,co,ft,tc=g(()=>{ut();gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_r=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],yr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],pa=[],Ju=[],co=Math.sign;r_();ft={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>gr[i],uY:i=>xr[i],vX:i=>_r[i],vY:i=>yr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>pa[i][t],sub:(i,t)=>pa[i][ft.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ft.S:ft.N:Math.abs(t)*2<=Math.abs(i)?i>0?ft.E:ft.W:t>0?i>0?ft.SE:ft.SW:i>0?ft.NE:ft.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Ju[ft.inv(t)];s.tx=e,s.ty=r,i.append(s);}};});var ma,ec=g(()=>{ma=()=>{};});var br,ga=g(()=>{U();De();br=class extends Ct{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer";}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};br.extension=w.TextureSource;});var rc,fo,ic=g(()=>{ut();rc=new F,fo=class{constructor(t,e){this.mapCoord=new F,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=false,this.texture=t;}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update());}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty;}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(rc.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(rc));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/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,true}};});var D,Rt=g(()=>{Yt();tc();Xt();Ut();yt();ec();ga();De();ic();D=class extends et{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=it("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=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new Ct,this.noFrame=!r,r)this.frame.copyFrom(r);else {let{width:u,height:c}=this._source;this.frame.width=u,this.frame.height=c;}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=false,this.dynamic=h||false,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 fo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,l=e.height/s,h=this.rotate;if(h){let u=a/2,c=l/2,f=o+u,d=n+c;h=ft.add(h,ft.NW),t.x0=f+u*ft.uX(h),t.y0=d+c*ft.uY(h),h=ft.add(h,2),t.x1=f+u*ft.uX(h),t.y1=d+c*ft.uY(h),h=ft.add(h,2),t.x2=f+u*ft.uX(h),t.y2=d+c*ft.uY(h),h=ft.add(h,2),t.x3=f+u*ft.uX(h),t.y3=d+c*ft.uY(h);}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l;}destroy(t=false){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=true,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 N(q,"Texture.baseTexture is now Texture.source"),this._source}};D.EMPTY=new D({label:"EMPTY",source:new Ct({label:"EMPTY"})});D.EMPTY.destroy=ma;D.WHITE=new D({source:new br({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});D.WHITE.destroy=ma;});var i_,xa,kt,zr=g(()=>{zi();De();Rt();Ur();i_=0,xa=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false,this.textureStyle=new ae(this.textureOptions);}createTexture(t,e,r){let s=new Ct({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new D({source:s,label:`texturePool_${i_++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Oe(o),n=Oe(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=r,l.source.width=o/r,l.source.height=n/r,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=false){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=false){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].push(t);}clear(t){if(t=t!==false,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(true);}this._texturePool={};}},kt=new xa;});var po,sc=g(()=>{ut();ca();zr();po=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=false,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new F,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=true,this.instructionSet=new Dr,this._onRenderContainers=[],this.textureNeedsUpdate=true,this.isCachedAsTexture=false,this._matrixDirty=7;}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=true;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s);}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=true,this.textureNeedsUpdate=true;}disableCacheAsTexture(){this.isCachedAsTexture=false,this.texture&&(kt.returnTexture(this.texture),this.texture=null);}updateCacheTexture(){this.textureNeedsUpdate=true;}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=true,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=true,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=true,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r]);}removeChild(t){if(this.structureDidChange=true,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r]);}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e]);}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t;}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=false);}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t;}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t);}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1);}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t);}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null;}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7;}get inverseWorldTransform(){return (this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new F),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return (this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new F),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 F),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 oc(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r]);}var nc=g(()=>{});var _a,ya,ba,ac,s_,va,de,Ni=g(()=>{Yt();$t();du();U();ut();Jn();ea();Ut();yt();pr();yu();vu();Tu();Mu();Au();Ru();Ou();Nu();Wu();Yu();Xu();sc();nc();_a=new Dt(null),ya=new Dt(null),ba=new Dt(null,1,1),ac=1,s_=2,va=4,de=class i extends et{constructor(t={}){super(),this.uid=it("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=false,this.didViewUpdate=false,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=true,this.measurable=true,this.isSimple=true,this.updateTick=-1,this.localTransform=new F,this.relativeGroupTransform=new F,this.groupTransform=this.relativeGroupTransform,this.destroyed=false,this._position=new Dt(this,0,0),this._scale=ba,this._pivot=ya,this._skew=_a,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=[],oc(this,t,{children:true,parent:true,effects:true}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this);}static mixin(t){N("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),W.mixin(i,t);}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095;}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||N(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],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=true),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=true),e.parent=this,e.didChange=true,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=true,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=wt.get(po,this),this.groupTransform=F.IDENTITY,t?.addChild(this),this._updateIsSimple();}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),wt.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 F),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*pu}set angle(t){this.rotation=t*mu;}get pivot(){return this._pivot===ya&&(this._pivot=new Dt(this,0,0)),this._pivot}set pivot(t){this._pivot===ya&&(this._pivot=new Dt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===_a&&(this._skew=new Dt(this,0,0)),this._skew}set skew(t){this._skew===_a&&(this._skew=new Dt(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===ba&&(this._scale=new Dt(this,1,1)),this._scale}set scale(t){this._scale===ba&&(this._scale=new Dt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t);}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e);}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e);}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height);}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x);}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this);}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,l=s._x,h=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-(l*e.a+h*e.c),e.ty=o._y-(l*e.b+h*e.d);}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=ac,this._onUpdate());}get alpha(){return this.localAlpha}set tint(t){let r=J.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=ac,this._onUpdate());}get tint(){return Ui(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=s_,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=true),this._updateFlags|=va,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=true),this._updateFlags|=va,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|=va,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._onUpdate());}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=false){if(this.destroyed)return;this.destroyed=true;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;}};W.mixin(de,bu,Lu,$u,Vu,zu,Pu,Eu,Hu,cu,_u,Gu,Su);});var Xe,mo=g(()=>{we();Xe=class i{constructor(t){this.bubbles=true,this.cancelBubble=true,this.cancelable=false,this.composed=false,this.defaultPrevented=false,this.eventPhase=i.prototype.NONE,this.propagationStopped=false,this.propagationImmediatelyStopped=false,this.layer=new rt,this.page=new rt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t;}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=true;}stopImmediatePropagation(){this.propagationImmediatelyStopped=true;}stopPropagation(){this.propagationStopped=true;}};});function o_(i){return function(t){return t.test(i)}}function Vi(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=o_(e),o={apple:{phone:s(Sa)&&!s(Ue),ipod:s(lc),tablet:!s(Sa)&&(s(hc)||_c(t))&&!s(Ue),universal:s(uc),device:(s(Sa)||s(lc)||s(hc)||s(uc)||_c(t))&&!s(Ue)},amazon:{phone:s(Nr),tablet:!s(Nr)&&s(go),device:s(Nr)||s(go)},android:{phone:!s(Ue)&&s(Nr)||!s(Ue)&&s(Ta),tablet:!s(Ue)&&!s(Nr)&&!s(Ta)&&(s(go)||s(cc)),device:!s(Ue)&&(s(Nr)||s(go)||s(Ta)||s(cc))||s(/\bokhttp\b/i)},windows:{phone:s(Ue),tablet:s(dc),device:s(Ue)||s(dc)},other:{blackberry:s(fc),blackberry10:s(pc),opera:s(mc),firefox:s(xc),chrome:s(gc),device:s(fc)||s(pc)||s(mc)||s(xc)||s(gc)},any:false,phone:false,tablet:false};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 Sa,lc,hc,uc,Ta,cc,Nr,go,Ue,dc,fc,pc,mc,gc,xc,_c,wa=g(()=>{Sa=/iPhone/i,lc=/iPod/i,hc=/iPad/i,uc=/\biOS-universal(?:.+)Mac\b/i,Ta=/\bAndroid(?:.+)Mobile\b/i,cc=/Android/i,Nr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,go=/Silk/i,Ue=/Windows Phone/i,dc=/\bWindows(?:.+)ARM\b/i,fc=/BlackBerry/i,pc=/BB10/i,mc=/Opera Mini/i,gc=/\b(CriOS|Chrome)(?:.+)Mobile/i,xc=/Mobile(?:.+)Firefox\b/i,_c=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var yc=g(()=>{wa();wa();});var n_,bc,vc=g(()=>{yc();n_=Vi.default??Vi,bc=n_(globalThis.navigator);});var a_,xo,l_,h_,Sc,Tc,u_,c_,d_,Ca,Cc,Pc=g(()=>{mo();U();vc();oa();a_=9,xo=100,l_=0,h_=0,Sc=2,Tc=1,u_=-1e3,c_=-1e3,d_=2,Ca=class wc{constructor(t,e=bc){this._mobileInfo=e,this.debug=false,this._activateOnTab=true,this._deactivateOnMouseMove=true,this._isActive=false,this._isMobileAccessibility=false,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=`${Tc}px`,t.style.height=`${Tc}px`,t.style.position="absolute",t.style.top=`${u_}px`,t.style.left=`${c_}px`,t.style.zIndex=d_.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=true,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=true,this._div||(this._div=document.createElement("div"),this._div.style.width=`${xo}px`,this._div.style.height=`${xo}px`,this._div.style.position="absolute",this._div.style.top=`${l_}px`,this._div.style.left=`${h_}px`,this._div.style.zIndex=Sc.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,true));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:true,subtree:true});}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=false,globalThis.document.removeEventListener("mousemove",this._onMouseMove,true),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,false),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=false;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t);}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[];}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r]);}init(t){let r={accessibilityOptions:{...wc.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._renderer.runners.postrender.remove(this);}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r));}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=false,ro(this._children,r,1));}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`;}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,l=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*h}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*h}px`;}else {this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}px`;}}this._renderId++;}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`;}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y);}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
7
7
  color: transparent;
8
8
  pointer-events: none;
9
9
  padding: 0;
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),gu[t]=true;}var gu,q,xu,yt=x(()=>{gu=
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=`${xo}px`,e.style.height=`${xo}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Sc.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=true,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex);}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Xe(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n));}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"]);}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"]);}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"]);}_onKeyDown(t){t.keyCode!==a_||!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();}};Ca.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};Ca.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};Cc=Ca;});var Mc,Ec=x(()=>{Mc={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_accessibleActive:false,_accessibleDiv:null,_renderId:-1};});var Ac=x(()=>{U();Ni();Pc();Ec();W.add(Cc);W.mixin(de,Mc);});var Wi,Ic=x(()=>{U();Wi=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize());},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()));},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null);},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else {let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o;}this.renderer.resize(e,r),this.render();},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null;}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null;}};Wi.extension=w.Application;});var je,_o=x(()=>{je=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(je||{});});var Vr,Lc=x(()=>{Vr=class{constructor(t,e=null,r=0,s=false){this.next=null,this.previous=null,this._destroyed=false,this._fn=t,this._context=e,this.priority=r,this._once=s;}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(true),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=false){this._destroyed=true,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 Rc,Pt,Hi=x(()=>{_o();Lc();Rc=class Qt{constructor(){this.autoStart=false,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=false,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=false,this._lastFrame=-1,this._head=new Vr(null,null,1/0),this.deltaMS=1/Qt.targetFPMS,this.elapsedMS=1/Qt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)));};}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick));}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null);}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start();}add(t,e,r=je.NORMAL){return this._addListener(new Vr(t,e,r))}addOnce(t,e,r=je.NORMAL){return this._addListener(new Vr(t,e,r,true))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else {for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next;}t.previous||t.connect(r);}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=true,this._requestIfNeeded());}stop(){this.started&&(this.started=false,this._cancelIfNeeded());}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(true);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*Qt.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded();}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t;}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Qt.targetFPMS);this._maxElapsedMS=1/r;}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else {let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3);}}static get shared(){if(!Qt._shared){let t=Qt._shared=new Qt;t.autoStart=true,t._protected=true;}return Qt._shared}static get system(){if(!Qt._system){let t=Qt._system=new Qt;t.autoStart=true,t._protected=true;}return Qt._system}};Rc.targetFPMS=.06;Pt=Rc;});var Yi,Fc=x(()=>{U();_o();Hi();Yi=class{static init(t){t=Object.assign({autoStart:true,sharedTicker:false},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,je.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?Pt.shared:new Pt,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Yi.extension=w.Application;});var Pa=x(()=>{U();Ic();Fc();W.add(Wi);W.add(Yi);});function Z(...i){Ma!==Bc&&(Ma++,Ma===Bc?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var Ma,Bc,zt=x(()=>{Ma=0,Bc=500;});var Ea,Ce,Aa=x(()=>{_o();Hi();Ea=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t;}addTickerListener(){this._tickerAdded||!this.domElement||(Pt.system.add(this._tickerUpdate,this,je.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(Pt.system.remove(this._tickerUpdate,this),this._tickerAdded=false);}pointerMoved(){this._didMove=true;}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=false;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}));}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update());}},Ce=new Ea;});var ze,yo=x(()=>{we();mo();ze=class extends Xe{constructor(){super(...arguments),this.client=new rt,this.movement=new rt,this.offset=new rt,this.global=new rt,this.screen=new rt;}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return "getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,l,h,u,c,f,d,g,y){throw new Error("Method not implemented.")}};});var Nt,Ia=x(()=>{yo();Nt=class extends ze{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=false;}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}};});var Pe,La=x(()=>{yo();Pe=class extends ze{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};Pe.DOM_DELTA_PIXEL=0;Pe.DOM_DELTA_LINE=1;Pe.DOM_DELTA_PAGE=2;});var f_,p_,$i,bo,kc=x(()=>{Yt();we();zt();Aa();yo();Ia();La();f_=2048,p_=new rt,$i=new rt,bo=class{constructor(t){this.dispatch=new et,this.moveOnAll=false,this.enableGlobalMoveEvents=true,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=false,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel);}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority);}dispatchEvent(t,e){t.propagationStopped=false,t.propagationImmediatelyStopped=false,this.propagate(t,e),this.dispatch.emit(e||t.type,t);}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else Z(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Ce.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,p_.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n);});}propagationPath(t){let e=[t];for(let r=0;r<f_&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent;}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=false){let a=false;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ce.pauseUpdate=false),t.interactiveChildren&&t.children){let u=t.children;for(let c=u.length-1;c>=0;c--){let f=u[c],d=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,s,o,n||o(t,r));if(d){if(d.length>0&&!d[d.length-1].parent)continue;let g=t.isInteractive();(d.length>0||g)&&(g&&this._allInteractiveElements.push(t),d.push(t)),this._hitElements.length===0&&(this._hitElements=d),a=true;}}}let l=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,r)&&s(t,r)?h?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ce.pauseUpdate=false),t.interactiveChildren&&t.children){let l=t.children,h=r;for(let u=l.length-1;u>=0;u--){let c=l[u],f=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,h,s,o);if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();return (f.length>0||d)&&f.push(t),f}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return !t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,$i),!t.hitArea.contains($i.x,$i.y)))return true;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return true}return false}hitTestFn(t,e){return t.hitArea?true:t?.containsPoint?(t.worldTransform.applyInverse(e,$i),t.containsPoint($i)):false}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e);}mapPointerDown(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown");}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e);}mapPointerMove(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=true;let e=this.createPointerEvent(t);this._isPointerMoveEvent=false;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),r&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let u=this.createPointerEvent(t,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u);}this.freeEvent(h);}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),r&&this.dispatchEvent(h,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==o&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),r&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f);}this.freeEvent(h);}let n=[],a=this.enableGlobalMoveEvents??true;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e);}mapPointerOver(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o);}mapPointerOut(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n);}this.cursor=null;}mapPointerUp(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup");}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside");}a=a.parent;}delete s.pressTargetsByButton[t.button],n=a;}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click");}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a);}this.freeEvent(r);}mapPointerUpOutside(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button];}this.freeEvent(s);}mapWheel(t){if(!(t instanceof Pe)){Z("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e);}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Nt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Pe);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Nt);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;}copyPointerData(t,e){t instanceof Nt&&e instanceof Nt&&(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 ze&&e instanceof ze&&(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=false,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t);}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,true),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,true),r[s].fn.call(r[s].context,t);}};});var m_,g_,Fa,vo,Ba=x(()=>{U();kc();Aa();Ia();La();m_=1,g_={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Fa=class Ra{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bo(null),Ce.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Nt(null),this._rootWheelEvent=new Pe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Ra.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,true)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this);}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Ra._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=true;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=false),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case "string":e&&(this.domElement.style.cursor=r);break;case "function":r(t);break;case "object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t);}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n);}this.setCursor(this.rootBoundary.cursor);}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ce.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a);}this.setCursor(this.rootBoundary.cursor);}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e);}setTargetElement(t){this._removeEvents(),this.domElement=t,Ce.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Ce.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,true),this.domElement.addEventListener("pointerdown",this._onPointerDown,true),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.addEventListener("pointerover",this._onPointerOverOut,true),globalThis.addEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,true),this.domElement.addEventListener("mousedown",this._onPointerDown,true),this.domElement.addEventListener("mouseout",this._onPointerOverOut,true),this.domElement.addEventListener("mouseover",this._onPointerOverOut,true),globalThis.addEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,true),this.domElement.addEventListener("touchend",this._onPointerUp,true),this.domElement.addEventListener("touchmove",this._onPointerMove,true))),this.domElement.addEventListener("wheel",this.onWheel,{passive:true,capture:true}),this._eventsAdded=true;}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Ce.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,true),this.domElement.removeEventListener("pointerdown",this._onPointerDown,true),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,true),globalThis.removeEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,true),this.domElement.removeEventListener("mousedown",this._onPointerDown,true),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,true),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,true),globalThis.removeEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,true),this.domElement.removeEventListener("touchend",this._onPointerUp,true),this.domElement.removeEventListener("touchmove",this._onPointerMove,true))),this.domElement.removeEventListener("wheel",this.onWheel,true),this.domElement=null,this._eventsAdded=false;}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o;}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=true,o.type=t.type,e.push(o);}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=true),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=m_),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=true,e.push(r);}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=g_[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;}};Fa.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};Fa.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};vo=Fa;});var Gc,Oc=x(()=>{Ba();mo();Gc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive";},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??vo.defaultEventMode},set eventMode(i){this._internalEventMode=i;},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:true,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===true:false,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(i,a,n);}),o?l.once(i,a,n):l.on(i,a,n);},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s);},dispatchEvent(i){if(!(i instanceof Xe))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=false,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};});var Dc=x(()=>{U();Ni();Ba();Oc();W.add(vo);W.mixin(de,Gc);});var Xi,Uc=x(()=>{U();Xi=class{constructor(t){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);}updateRenderable(t){}validateRenderable(t){return true}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);let r=parseFloat(e.style.width)/e.width*this._renderer.resolution,s=parseFloat(e.style.height)/e.height*this._renderer.resolution;this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px) scale(${r}, ${s})`;for(let o=0;o<t.length;o++){let n=t[o],a=n.element;if(!n.parent||n.globalDisplayStatus<7)a?.remove(),t.splice(o,1),o--;else {this._domElement.contains(a)||(a.style.position="absolute",a.style.pointerEvents="auto",this._domElement.appendChild(a));let l=n.worldTransform,h=n._anchor,u=n.width*h.x,c=n.height*h.y;a.style.transformOrigin=`${u}px ${c}px`,a.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, ${l.tx-u}, ${l.ty-c})`,a.style.opacity=n.groupAlpha.toString();}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null;}};Xi.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"dom"};});var Wr,ka=x(()=>{ce();Ni();Wr=class extends de{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new mt(0,1,0,0),this._boundsDirty=true;}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=false,this._bounds):this._bounds}get roundPixels(){return !!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0;}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=true,this.didViewUpdate)return;this.didViewUpdate=true;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this);}destroy(t){super.destroy(t),this._bounds=null;for(let e in this._gpuData)this._gpuData[e].destroy?.();this._gpuData=null;}collectRenderablesSimple(t,e,r){let{renderPipes:s}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=false;let n=this.children,a=n.length;for(let l=0;l<a;l++)n[l].collectRenderables(t,e,r);}};});var zc=x(()=>{U();Uc();W.add(Xi);});var Hr,Ga=x(()=>{Hr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Hr||{});});var Nc,Vc=x(()=>{Nc={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};});var Wc,gt,fe=x(()=>{Vc();Wc=Nc,gt={get(){return Wc},set(i){Wc=i;}};});function pe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ji(i){return i.split("?")[0].split("#")[0]}function x_(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function __(i,t,e){return i.replace(new RegExp(x_(t),"g"),e)}function y_(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else {if(n===47)break;n=47;}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0;}else n===46&&o!==-1?++o:o=-1;}return e}var jt,So=x(()=>{fe();jt={toPosix(i){return __(i,"\\","/")},isUrl(i){return /^https?:/.test(this.toPosix(i))},isDataUrl(i){return /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return /^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){pe(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(pe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=ji(this.toPosix(t??gt.get().getBaseUrl())),s=ji(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?jt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(pe(i),i.length===0)return ".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=y_(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return pe(i),i=this.toPosix(i),this.hasProtocol(i)?true:i.startsWith("/")},join(...i){if(i.length===0)return ".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(pe(r),r.length>0)if(t===void 0)t=r;else {let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`;}}return t===void 0?".":this.normalize(t)},dirname(i){if(pe(i),i.length===0)return ".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=true,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=false;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){pe(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/");}return t},basename(i,t){pe(i),t&&pe(t),i=ji(this.toPosix(i));let e=0,r=-1,s=true,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return "";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let l=i.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=false,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a));}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=false,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){pe(i),i=ji(this.toPosix(i));let t=-1,e=0,r=-1,s=true,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=false,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1);}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){pe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ji(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s;t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,l=-1,h=true,u=i.length-1,c=0;for(;u>=s;--u){if(e=i.charCodeAt(u),e===47){if(!h){a=u+1;break}continue}l===-1&&(h=false,l=u+1),e===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1);}return n===-1||l===-1||c===0||c===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&r?t.base=t.name=i.slice(1,l):t.base=t.name=i.slice(a,l)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,l)):(t.name=i.slice(a,n),t.base=i.slice(a,l)),t.ext=i.slice(n,l)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};});var Ke,Oa=x(()=>{Ke=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Hc(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Hc(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Yc(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n);}),Hc(i,s,0,e,r);}else r.push(i);return r}var $c=x(()=>{});var Da,Xc=x(()=>{Da=i=>!Array.isArray(i);});function b_(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Ki,jc=x(()=>{zt();So();Oa();$c();Xc();Ki=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={};}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params));}),this._resolverHash={};}set basePath(t){this._basePath=t;}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t;}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null;}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else {let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&");}}getAlias(t){let{alias:e,src:r}=t;return Ke(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,true)}addManifest(t){this._manifest&&Z("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets);});}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);r.push(h),l=[a,h];}else {let h=a.map(u=>this._createBundleAssetId(t,u));r.push(...h),l=[...a,...h];}this.add({...o,alias:l,src:n});}),this._bundles[t]=r;}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&Z(`[Resolver] already has key: ${o} overwriting`);},Ke(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,u=Ke(n).map(d=>typeof d=="string"?Yc(d):Array.isArray(d)?d:[d]),c=this.getAlias(o);Array.isArray(c)?c.forEach(r):r(c);let f=[];u.forEach(d=>{d.forEach(g=>{let y={};if(typeof g!="object"){y.src=g;for(let m=0;m<this._parsers.length;m++){let p=this._parsers[m];if(p.test(g)){y=p.parse(g);break}}}else a=g.data??a,l=g.format??l,h=g.loadParser??h,y={...y,...g};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:c,data:a,format:l,loadParser:h}),f.push(y);});}),c.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Da(t);t=Ke(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let h=n[l];a[this._extractAssetIdFromBundle(s,l)]=h;}r[s]=a;}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Da(t);t=Ke(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(u=>u[a]?u[a]===l:false);h.length&&(o=h);});}),this._resolverHash[s]=o[0];}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s];}),e?r[t[0]]:r}hasKey(t){return !!this._assetMap[t]}hasBundle(t){return !!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return `${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return (this._basePath||this._rootPath)&&(t.src=jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??b_(t.src),t}};Ki.RETINA_PREFIX=/@([0-9\.]+)x/;});var Ua,Kc=x(()=>{Ua=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var qc,za,Zc=x(()=>{Xt();De();Rt();qc=class qi{constructor(t,e){this.linkedSheets=[];let r=t;t?.source instanceof Ct&&(r={texture:t,data:e});let{texture:s,data:o,cachePrefix:n=""}=r;this.cachePrefix=n,this._texture=s instanceof D?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=o;let a=parseFloat(o.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.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<=qi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=qi.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==false&&o.sourceSize?o.sourceSize:o.frame,u=new st(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.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!==false&&o.spriteSourceSize&&(l=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 D({source:this.textureSource,frame:a,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()});}e++;}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s]);}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures);}_nextBatch(){this._processFrames(this._batchIndex*qi.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qi.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete());},0);}destroy(t=false){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=[];}};qc.BATCH_SIZE=1e3;za=qc;});function Qc(i,t,e){let r={};if(i.forEach(s=>{r[s]=t;}),Object.keys(t.textures).forEach(s=>{r[`${t.cachePrefix}${s}`]=t.textures[s];}),!e){let s=jt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Qc([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var v_,Jc,td=x(()=>{Ga();jc();Kc();U();Rt();So();Zc();v_=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Jc={extension:w.Asset,cache:{test:i=>i instanceof za,getCacheableAssets:(i,t)=>Qc(i,t,false)},resolver:{extension:{type:w.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&v_.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(Ki.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:w.LoadParser,priority:Hr.Normal,name:"spritesheetLoader"},async testParse(i,t){return jt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o,cachePrefix:n}=t?.data??{},a=jt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof D)l=r;else {let c=Ua(a+(s??i.meta.image),t.src);l=(await e.load([{src:c,data:o}]))[c];}let h=new za({texture:l.source,data:i,cachePrefix:n});await h.parse();let u=i?.meta?.related_multi_packs;if(Array.isArray(u)){let c=[];for(let d of u){if(typeof d!="string")continue;let g=a+d;t.data?.ignoreMultiPack||(g=Ua(g,t.src),c.push(e.load({src:g,data:{textureOptions:o,ignoreMultiPack:true}})));}let f=await Promise.all(c);h.linkedSheets=f,f.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(g=>g!==d));});}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(false);}}};});var To=x(()=>{U();td();W.add(Jc);});function wo(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a;}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s;}var Na=x(()=>{});var Zi,ed=x(()=>{ea();Rt();Na();yt();ka();Zi=class i extends Wr{constructor(t=D.EMPTY){t instanceof D&&(t={texture:t});let{texture:e=D.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=true,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Dt({_onUpdate:()=>{this.onViewUpdate();}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=false,this.roundPixels=s??false,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n);}static from(t,e=false){return t instanceof D?new i(t):new i(D.from(t,e))}set texture(t){t||(t=D.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 wo(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return N("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o;}destroy(t=false){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r);}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null,this._gpuData=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 Co(i,t,e){let r=S_;i.measurable=true,oo(i,e,r),t.addBoundsMask(r),i.measurable=false;}var S_,Va=x(()=>{ce();ao();S_=new mt;});function Po(i,t,e){let r=Zt.get();i.measurable=true;let s=bt.get().identity(),o=rd(i,e,s);ho(i,r,o),i.measurable=false,t.addBoundsMask(r),bt.return(s),Zt.return(r);}function rd(i,t,e){return i?(i!==t&&(rd(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(Z("Mask bounds, renderable is not inside the root container"),e)}var Wa=x(()=>{ha();mr();zt();});var Qi,id=x(()=>{U();ed();Va();Wa();Qi=class{constructor(t){this.priority=0,this.inverse=false,this.pipe="alphaMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Zi),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask=null;}addBounds(t,e){this.inverse||Co(this.mask,t,e);}addLocalBounds(t,e){Po(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Zi}};Qi.extension=w.MaskEffect;});var Ji,sd=x(()=>{U();Ji=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"}};Ji.extension=w.MaskEffect;});var ts,od=x(()=>{U();Ni();Va();Wa();ts=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.mask.includeInBuild=false,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask.includeInBuild=true,this.mask=null;}addBounds(t,e){Co(this.mask,t,e);}addLocalBounds(t,e){Po(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof de}};ts.extension=w.MaskEffect;});var Yr,nd=x(()=>{fe();U();De();Yr=class extends Ct{constructor(t){t.resource||(t.resource=gt.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent;}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight);}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Yr.extension=w.TextureSource;});var Me,Mo=x(()=>{U();De();Me=class extends Ct{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=true;}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Me.extension=w.TextureSource;});async function ad(){return Ha??(Ha=(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=false,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load();});if(!e)return "premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ha}var Ha,ld=x(()=>{});var Eo,ud,cd=x(()=>{U();Hi();ld();De();Eo=class hd extends Ct{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...hd.defaultOptions,...t},this._autoUpdate=true,this._isConnectedToTicker=false,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==false,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!==false&&this.load();}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Pt.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=true),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,true)),this.alphaMode=await ad(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`));})),t.load());}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,true),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=true,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,true),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&&(Pt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,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||(Pt.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Pt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Eo.extension=w.TextureSource;Eo.defaultOptions={...Ct.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};Eo.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ud=Eo;});var Ya,vt,es=x(()=>{zt();Oa();Ya=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||Z(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ke(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(l=>{o.set(l,e);});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(l=>{this._cacheMap.set(l,a);}),n.forEach(l=>{let h=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&Z("[Cache] already has key:",l),this._cache.set(l,o.get(l));});}remove(t){if(!this._cacheMap.has(t)){Z(`[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}},vt=new Ya;});function dd(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<$a.length;s++){let o=$a[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function fd(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&vt.has(r))return vt.get(r);let o=new D({source:dd(s)});return o.on("destroy",()=>{vt.has(r)&&vt.remove(r);}),t||vt.set(r,o),o}function pd(i,t=false){return typeof i=="string"?vt.get(i):i instanceof Ct?new D({source:i}):fd(i,t)}var $a,Xa=x(()=>{es();U();De();Rt();$a=[];W.handleByList(w.TextureSource,$a);D.from=pd;Ct.from=dd;});var Ao=x(()=>{U();id();sd();od();ga();nd();Mo();cd();Xa();W.add(Qi,Ji,ts,ud,Me,Yr,br);});var le,rs=x(()=>{le=class{constructor(t){this.resources=Object.create(null),this._dirty=true;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++);}this._updateKey();}_updateKey(){if(!this._dirty)return;this._dirty=false;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|");}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=true);}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t;}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null;}onResourceChange(t){if(this._dirty=true,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null);}else this._updateKey();}};});function gd(i,t,e){let r=2166136261;for(let s=0;s<t;s++)r^=i[s].uid,r=Math.imul(r,16777619),r>>>=0;return md[r]||T_(i,t,r,e)}function T_(i,t,e,r){let s={},o=0;for(let a=0;a<r;a++){let l=a<t?i[a]:D.EMPTY.source;s[o++]=l.source,s[o++]=l.style;}let n=new le(s);return md[e]=n,n}var md,xd=x(()=>{rs();Rt();md={};});var Ee,ja=x(()=>{Ee=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength;}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null;}static sizeOf(t){switch(t){case "int8":case "uint8":return 1;case "int16":case "uint16":return 2;case "int32":case "uint32":case "float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};});function Ka(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n);}}var _d=x(()=>{});var yd,bd=x(()=>{yd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function Ne(i,t){return t.alphaMode==="no-premultiply-alpha"&&yd[i]||i}var is=x(()=>{bd();});function Lo(){return (!Io||Io?.isContextLost())&&(Io=gt.get().createCanvas().getContext("webgl",{})),Io}var Io,qa=x(()=>{fe();});function C_(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
- else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function vd(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=w_.replace(/%forloop%/gi,C_(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e);}return i}var w_,Sd=x(()=>{w_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `);});function Td(){if($r)return $r;let i=Lo();return $r=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),$r=vd($r,i),i.getExtension("WEBGL_lose_context")?.loseContext(),$r}var $r,wd=x(()=>{qa();Sd();$r=null;});var Ro,Cd=x(()=>{Ro=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 Pd(){return Qa>0?Ed[--Qa]:new Za}function Md(i){Ed[Qa++]=i;}var Za,Ed,Qa,ss,Ad,Ld,Rd=x(()=>{Ut();ja();yt();_d();is();wd();Cd();Za=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ro,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},Ed=[],Qa=0;ss=0,Ad=class Id{constructor(t){this.uid=it("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],t={...Id.defaultOptions,...t},t.maxTextures||(N("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Td());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ee(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e;}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Md(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=true;}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize;}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return !r&&r!==0?false:(t._textureId=r,t.texture=e,true)}updateElement(t){this.dirty=true;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId);}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=Pd(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ne(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 l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",g=this.maxTextures;for(let y=this.elementStart;y<this.elementSize;++y){let m=e[y];e[y]=null;let b=m.texture._source,v=Ne(m.blendMode,b),S=n!==v||a!==m.topology;if(b._batchTick===ss&&!S){m._textureId=b._textureBindLocation,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r;continue}b._batchTick=ss,(s.count>=g||S)&&(this._finishBatch(r,f,c-f,s,n,a,t,d),d="renderBatch",f=c,n=v,a=m.topology,r=Pd(),s=r.textures,s.clear(),++ss),m._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,m._batch=r,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,c-f,s,n,a,t,d),f=c,++ss),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c;}_finishBatch(t,e,r,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ss,this.batches[this.batchIndex++]=t,a.add(t);}finish(t){this.break(t);}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4);}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t);}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ee(e);Ka(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r;}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Ka(e.buffer,s.buffer);this.indexBuffer=s;}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[r++]=s+o[h+a]-l;}destroy(){for(let t=0;t<this.batches.length;t++)Md(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;}};Ad.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ld=Ad;});var lt,Xr=x(()=>{lt=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(lt||{});});var Ft,jr=x(()=>{Yt();Ut();Xr();Ft=class extends et{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=it("buffer"),this._resourceType="buffer",this._resourceId=it("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=true,this.destroyed=false,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??true;}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,true);}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return !!(this.descriptor.usage&lt.STATIC)}set static(t){t?this.descriptor.usage|=lt.STATIC:this.descriptor.usage&=~lt.STATIC;}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=it("resource"),this.emit("change",this));return}r&&this.emit("update",this);}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners();}};});function Ja(i,t){if(!(i instanceof Ft)){let e=t?lt.INDEX:lt.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=lt.INDEX|lt.COPY_DST):(i=new Float32Array(i),e=lt.VERTEX|lt.COPY_DST)),i=new Ft({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var Fd=x(()=>{jr();Xr();});function Bd(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,u=(r.offset||0)/h,c=(r.stride||2*4)/h;for(let f=u;f<s.length;f+=c){let d=s[f],g=s[f+1];d>a&&(a=d),g>l&&(l=g),d<o&&(o=d),g<n&&(n=g);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var kd=x(()=>{});function P_(i){return (i instanceof Ft||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Ja(i.buffer,false),i}var Ae,os=x(()=>{Yt();ce();Ut();jr();Fd();kd();Ae=class extends et{constructor(t={}){super(),this.uid=it("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new mt,this._boundsDirty=true;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list";}onBufferUpdate(){this._boundsDirty=true,this.emit("update",this);}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=P_(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r;}addIndex(t){this.indexBuffer=Ja(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,Bd(this,"aPosition",this._bounds)):this._bounds}destroy(t=false){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 M_,E_,Fo,Gd=x(()=>{jr();Xr();os();M_=new Float32Array(1),E_=new Uint32Array(1),Fo=class extends Ae{constructor(){let e=new Ft({data:M_,label:"attribute-batch-buffer",usage:lt.VERTEX|lt.COPY_DST,shrinkToFit:false}),r=new Ft({data:E_,label:"index-batch-buffer",usage:lt.INDEX|lt.COPY_DST,shrinkToFit:false}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r});}};});function Kr(i,t){let e=Od[i];return e===void 0&&(tl[t]===void 0&&(tl[t]=1),Od[i]=e=tl[t]++),e}var tl,Od,Bo=x(()=>{tl=Object.create(null),Od=Object.create(null);});function Dd(){if(!ko){ko="mediump";let i=Lo();i&&i.getShaderPrecisionFormat&&(ko=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return ko}var ko,Ud=x(()=>{qa();});function zd(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${xo}px`,e.style.height=`${xo}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Sc.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=true,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex);}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Xe(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n));}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"]);}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"]);}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"]);}_onKeyDown(t){t.keyCode!==a_||!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();}};Ca.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};Ca.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};Cc=Ca;});var Mc,Ec=g(()=>{Mc={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_accessibleActive:false,_accessibleDiv:null,_renderId:-1};});var Ac=g(()=>{U();Ni();Pc();Ec();W.add(Cc);W.mixin(de,Mc);});var Wi,Ic=g(()=>{U();Wi=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize());},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()));},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null);},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else {let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o;}this.renderer.resize(e,r),this.render();},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null;}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null;}};Wi.extension=w.Application;});var je,_o=g(()=>{je=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(je||{});});var Vr,Lc=g(()=>{Vr=class{constructor(t,e=null,r=0,s=false){this.next=null,this.previous=null,this._destroyed=false,this._fn=t,this._context=e,this.priority=r,this._once=s;}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(true),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=false){this._destroyed=true,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 Rc,Pt,Hi=g(()=>{_o();Lc();Rc=class Qt{constructor(){this.autoStart=false,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=false,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=false,this._lastFrame=-1,this._head=new Vr(null,null,1/0),this.deltaMS=1/Qt.targetFPMS,this.elapsedMS=1/Qt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)));};}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick));}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null);}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start();}add(t,e,r=je.NORMAL){return this._addListener(new Vr(t,e,r))}addOnce(t,e,r=je.NORMAL){return this._addListener(new Vr(t,e,r,true))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else {for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next;}t.previous||t.connect(r);}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=true,this._requestIfNeeded());}stop(){this.started&&(this.started=false,this._cancelIfNeeded());}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(true);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*Qt.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded();}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t;}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Qt.targetFPMS);this._maxElapsedMS=1/r;}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else {let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3);}}static get shared(){if(!Qt._shared){let t=Qt._shared=new Qt;t.autoStart=true,t._protected=true;}return Qt._shared}static get system(){if(!Qt._system){let t=Qt._system=new Qt;t.autoStart=true,t._protected=true;}return Qt._system}};Rc.targetFPMS=.06;Pt=Rc;});var Yi,Fc=g(()=>{U();_o();Hi();Yi=class{static init(t){t=Object.assign({autoStart:true,sharedTicker:false},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,je.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?Pt.shared:new Pt,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Yi.extension=w.Application;});var Pa=g(()=>{U();Ic();Fc();W.add(Wi);W.add(Yi);});function Z(...i){Ma!==Bc&&(Ma++,Ma===Bc?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var Ma,Bc,zt=g(()=>{Ma=0,Bc=500;});var Ea,Ce,Aa=g(()=>{_o();Hi();Ea=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t;}addTickerListener(){this._tickerAdded||!this.domElement||(Pt.system.add(this._tickerUpdate,this,je.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(Pt.system.remove(this._tickerUpdate,this),this._tickerAdded=false);}pointerMoved(){this._didMove=true;}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=false;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}));}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update());}},Ce=new Ea;});var ze,yo=g(()=>{we();mo();ze=class extends Xe{constructor(){super(...arguments),this.client=new rt,this.movement=new rt,this.offset=new rt,this.global=new rt,this.screen=new rt;}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return "getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,l,h,u,c,f,d,x,y){throw new Error("Method not implemented.")}};});var Nt,Ia=g(()=>{yo();Nt=class extends ze{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=false;}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}};});var Pe,La=g(()=>{yo();Pe=class extends ze{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};Pe.DOM_DELTA_PIXEL=0;Pe.DOM_DELTA_LINE=1;Pe.DOM_DELTA_PAGE=2;});var f_,p_,$i,bo,kc=g(()=>{Yt();we();zt();Aa();yo();Ia();La();f_=2048,p_=new rt,$i=new rt,bo=class{constructor(t){this.dispatch=new et,this.moveOnAll=false,this.enableGlobalMoveEvents=true,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=false,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel);}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority);}dispatchEvent(t,e){t.propagationStopped=false,t.propagationImmediatelyStopped=false,this.propagate(t,e),this.dispatch.emit(e||t.type,t);}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else Z(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Ce.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,p_.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n);});}propagationPath(t){let e=[t];for(let r=0;r<f_&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent;}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=false){let a=false;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ce.pauseUpdate=false),t.interactiveChildren&&t.children){let u=t.children;for(let c=u.length-1;c>=0;c--){let f=u[c],d=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,s,o,n||o(t,r));if(d){if(d.length>0&&!d[d.length-1].parent)continue;let x=t.isInteractive();(d.length>0||x)&&(x&&this._allInteractiveElements.push(t),d.push(t)),this._hitElements.length===0&&(this._hitElements=d),a=true;}}}let l=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,r)&&s(t,r)?h?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ce.pauseUpdate=false),t.interactiveChildren&&t.children){let l=t.children,h=r;for(let u=l.length-1;u>=0;u--){let c=l[u],f=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,h,s,o);if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();return (f.length>0||d)&&f.push(t),f}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return !t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,$i),!t.hitArea.contains($i.x,$i.y)))return true;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return true}return false}hitTestFn(t,e){return t.hitArea?true:t?.containsPoint?(t.worldTransform.applyInverse(e,$i),t.containsPoint($i)):false}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e);}mapPointerDown(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown");}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e);}mapPointerMove(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=true;let e=this.createPointerEvent(t);this._isPointerMoveEvent=false;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),r&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let u=this.createPointerEvent(t,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u);}this.freeEvent(h);}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),r&&this.dispatchEvent(h,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==o&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),r&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f);}this.freeEvent(h);}let n=[],a=this.enableGlobalMoveEvents??true;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e);}mapPointerOver(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o);}mapPointerOut(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n);}this.cursor=null;}mapPointerUp(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup");}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside");}a=a.parent;}delete s.pressTargetsByButton[t.button],n=a;}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click");}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a);}this.freeEvent(r);}mapPointerUpOutside(t){if(!(t instanceof Nt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button];}this.freeEvent(s);}mapWheel(t){if(!(t instanceof Pe)){Z("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e);}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Nt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Pe);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Nt);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;}copyPointerData(t,e){t instanceof Nt&&e instanceof Nt&&(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 ze&&e instanceof ze&&(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=false,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t);}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,true),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,true),r[s].fn.call(r[s].context,t);}};});var m_,g_,Fa,vo,Ba=g(()=>{U();kc();Aa();Ia();La();m_=1,g_={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Fa=class Ra{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bo(null),Ce.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Nt(null),this._rootWheelEvent=new Pe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Ra.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,true)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this);}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Ra._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=true;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=false),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case "string":e&&(this.domElement.style.cursor=r);break;case "function":r(t);break;case "object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t);}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n);}this.setCursor(this.rootBoundary.cursor);}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ce.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a);}this.setCursor(this.rootBoundary.cursor);}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e);}setTargetElement(t){this._removeEvents(),this.domElement=t,Ce.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Ce.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,true),this.domElement.addEventListener("pointerdown",this._onPointerDown,true),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.addEventListener("pointerover",this._onPointerOverOut,true),globalThis.addEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,true),this.domElement.addEventListener("mousedown",this._onPointerDown,true),this.domElement.addEventListener("mouseout",this._onPointerOverOut,true),this.domElement.addEventListener("mouseover",this._onPointerOverOut,true),globalThis.addEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,true),this.domElement.addEventListener("touchend",this._onPointerUp,true),this.domElement.addEventListener("touchmove",this._onPointerMove,true))),this.domElement.addEventListener("wheel",this.onWheel,{passive:true,capture:true}),this._eventsAdded=true;}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Ce.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,true),this.domElement.removeEventListener("pointerdown",this._onPointerDown,true),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,true),globalThis.removeEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,true),this.domElement.removeEventListener("mousedown",this._onPointerDown,true),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,true),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,true),globalThis.removeEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,true),this.domElement.removeEventListener("touchend",this._onPointerUp,true),this.domElement.removeEventListener("touchmove",this._onPointerMove,true))),this.domElement.removeEventListener("wheel",this.onWheel,true),this.domElement=null,this._eventsAdded=false;}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o;}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=true,o.type=t.type,e.push(o);}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=true),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=m_),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=true,e.push(r);}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=g_[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;}};Fa.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};Fa.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};vo=Fa;});var Gc,Oc=g(()=>{Ba();mo();Gc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive";},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??vo.defaultEventMode},set eventMode(i){this._internalEventMode=i;},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:true,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===true:false,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(i,a,n);}),o?l.once(i,a,n):l.on(i,a,n);},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s);},dispatchEvent(i){if(!(i instanceof Xe))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=false,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};});var Dc=g(()=>{U();Ni();Ba();Oc();W.add(vo);W.mixin(de,Gc);});var Xi,Uc=g(()=>{U();Xi=class{constructor(t){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);}updateRenderable(t){}validateRenderable(t){return true}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);let r=parseFloat(e.style.width)/e.width*this._renderer.resolution,s=parseFloat(e.style.height)/e.height*this._renderer.resolution;this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px) scale(${r}, ${s})`;for(let o=0;o<t.length;o++){let n=t[o],a=n.element;if(!n.parent||n.globalDisplayStatus<7)a?.remove(),t.splice(o,1),o--;else {this._domElement.contains(a)||(a.style.position="absolute",a.style.pointerEvents="auto",this._domElement.appendChild(a));let l=n.worldTransform,h=n._anchor,u=n.width*h.x,c=n.height*h.y;a.style.transformOrigin=`${u}px ${c}px`,a.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, ${l.tx-u}, ${l.ty-c})`,a.style.opacity=n.groupAlpha.toString();}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null;}};Xi.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"dom"};});var Wr,ka=g(()=>{ce();Ni();Wr=class extends de{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new mt(0,1,0,0),this._boundsDirty=true;}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=false,this._bounds):this._bounds}get roundPixels(){return !!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0;}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=true,this.didViewUpdate)return;this.didViewUpdate=true;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this);}destroy(t){super.destroy(t),this._bounds=null;for(let e in this._gpuData)this._gpuData[e].destroy?.();this._gpuData=null;}collectRenderablesSimple(t,e,r){let{renderPipes:s}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=false;let n=this.children,a=n.length;for(let l=0;l<a;l++)n[l].collectRenderables(t,e,r);}};});var zc=g(()=>{U();Uc();W.add(Xi);});var Hr,Ga=g(()=>{Hr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Hr||{});});var Nc,Vc=g(()=>{Nc={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};});var Wc,gt,fe=g(()=>{Vc();Wc=Nc,gt={get(){return Wc},set(i){Wc=i;}};});function pe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ji(i){return i.split("?")[0].split("#")[0]}function x_(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function __(i,t,e){return i.replace(new RegExp(x_(t),"g"),e)}function y_(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else {if(n===47)break;n=47;}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0;}else n===46&&o!==-1?++o:o=-1;}return e}var jt,So=g(()=>{fe();jt={toPosix(i){return __(i,"\\","/")},isUrl(i){return /^https?:/.test(this.toPosix(i))},isDataUrl(i){return /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return /^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){pe(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(pe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=ji(this.toPosix(t??gt.get().getBaseUrl())),s=ji(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?jt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(pe(i),i.length===0)return ".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=y_(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return pe(i),i=this.toPosix(i),this.hasProtocol(i)?true:i.startsWith("/")},join(...i){if(i.length===0)return ".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(pe(r),r.length>0)if(t===void 0)t=r;else {let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`;}}return t===void 0?".":this.normalize(t)},dirname(i){if(pe(i),i.length===0)return ".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=true,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=false;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){pe(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/");}return t},basename(i,t){pe(i),t&&pe(t),i=ji(this.toPosix(i));let e=0,r=-1,s=true,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return "";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let l=i.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=false,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a));}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=false,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){pe(i),i=ji(this.toPosix(i));let t=-1,e=0,r=-1,s=true,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=false,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1);}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){pe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ji(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s;t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,l=-1,h=true,u=i.length-1,c=0;for(;u>=s;--u){if(e=i.charCodeAt(u),e===47){if(!h){a=u+1;break}continue}l===-1&&(h=false,l=u+1),e===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1);}return n===-1||l===-1||c===0||c===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&r?t.base=t.name=i.slice(1,l):t.base=t.name=i.slice(a,l)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,l)):(t.name=i.slice(a,n),t.base=i.slice(a,l)),t.ext=i.slice(n,l)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};});var Ke,Oa=g(()=>{Ke=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Hc(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Hc(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Yc(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n);}),Hc(i,s,0,e,r);}else r.push(i);return r}var $c=g(()=>{});var Da,Xc=g(()=>{Da=i=>!Array.isArray(i);});function b_(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Ki,jc=g(()=>{zt();So();Oa();$c();Xc();Ki=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={};}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params));}),this._resolverHash={};}set basePath(t){this._basePath=t;}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t;}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null;}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else {let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&");}}getAlias(t){let{alias:e,src:r}=t;return Ke(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,true)}addManifest(t){this._manifest&&Z("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets);});}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);r.push(h),l=[a,h];}else {let h=a.map(u=>this._createBundleAssetId(t,u));r.push(...h),l=[...a,...h];}this.add({...o,alias:l,src:n});}),this._bundles[t]=r;}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&Z(`[Resolver] already has key: ${o} overwriting`);},Ke(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,u=Ke(n).map(d=>typeof d=="string"?Yc(d):Array.isArray(d)?d:[d]),c=this.getAlias(o);Array.isArray(c)?c.forEach(r):r(c);let f=[];u.forEach(d=>{d.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let m=0;m<this._parsers.length;m++){let p=this._parsers[m];if(p.test(x)){y=p.parse(x);break}}}else a=x.data??a,l=x.format??l,h=x.loadParser??h,y={...y,...x};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:c,data:a,format:l,loadParser:h}),f.push(y);});}),c.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Da(t);t=Ke(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let h=n[l];a[this._extractAssetIdFromBundle(s,l)]=h;}r[s]=a;}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Da(t);t=Ke(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(u=>u[a]?u[a]===l:false);h.length&&(o=h);});}),this._resolverHash[s]=o[0];}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s];}),e?r[t[0]]:r}hasKey(t){return !!this._assetMap[t]}hasBundle(t){return !!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return `${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return (this._basePath||this._rootPath)&&(t.src=jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??b_(t.src),t}};Ki.RETINA_PREFIX=/@([0-9\.]+)x/;});var Ua,Kc=g(()=>{Ua=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var qc,za,Zc=g(()=>{Xt();De();Rt();qc=class qi{constructor(t,e){this.linkedSheets=[];let r=t;t?.source instanceof Ct&&(r={texture:t,data:e});let{texture:s,data:o,cachePrefix:n=""}=r;this.cachePrefix=n,this._texture=s instanceof D?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=o;let a=parseFloat(o.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.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<=qi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=qi.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==false&&o.sourceSize?o.sourceSize:o.frame,u=new st(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.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!==false&&o.spriteSourceSize&&(l=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 D({source:this.textureSource,frame:a,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()});}e++;}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s]);}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures);}_nextBatch(){this._processFrames(this._batchIndex*qi.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qi.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete());},0);}destroy(t=false){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=[];}};qc.BATCH_SIZE=1e3;za=qc;});function Qc(i,t,e){let r={};if(i.forEach(s=>{r[s]=t;}),Object.keys(t.textures).forEach(s=>{r[`${t.cachePrefix}${s}`]=t.textures[s];}),!e){let s=jt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Qc([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var v_,Jc,td=g(()=>{Ga();jc();Kc();U();Rt();So();Zc();v_=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Jc={extension:w.Asset,cache:{test:i=>i instanceof za,getCacheableAssets:(i,t)=>Qc(i,t,false)},resolver:{extension:{type:w.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&v_.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(Ki.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:w.LoadParser,priority:Hr.Normal,name:"spritesheetLoader"},async testParse(i,t){return jt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o,cachePrefix:n}=t?.data??{},a=jt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof D)l=r;else {let c=Ua(a+(s??i.meta.image),t.src);l=(await e.load([{src:c,data:o}]))[c];}let h=new za({texture:l.source,data:i,cachePrefix:n});await h.parse();let u=i?.meta?.related_multi_packs;if(Array.isArray(u)){let c=[];for(let d of u){if(typeof d!="string")continue;let x=a+d;t.data?.ignoreMultiPack||(x=Ua(x,t.src),c.push(e.load({src:x,data:{textureOptions:o,ignoreMultiPack:true}})));}let f=await Promise.all(c);h.linkedSheets=f,f.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(x=>x!==d));});}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(false);}}};});var To=g(()=>{U();td();W.add(Jc);});function wo(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a;}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s;}var Na=g(()=>{});var Zi,ed=g(()=>{ea();Rt();Na();yt();ka();Zi=class i extends Wr{constructor(t=D.EMPTY){t instanceof D&&(t={texture:t});let{texture:e=D.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=true,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Dt({_onUpdate:()=>{this.onViewUpdate();}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=false,this.roundPixels=s??false,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n);}static from(t,e=false){return t instanceof D?new i(t):new i(D.from(t,e))}set texture(t){t||(t=D.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 wo(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return N("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o;}destroy(t=false){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r);}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null,this._gpuData=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 Co(i,t,e){let r=S_;i.measurable=true,oo(i,e,r),t.addBoundsMask(r),i.measurable=false;}var S_,Va=g(()=>{ce();ao();S_=new mt;});function Po(i,t,e){let r=Zt.get();i.measurable=true;let s=bt.get().identity(),o=rd(i,e,s);ho(i,r,o),i.measurable=false,t.addBoundsMask(r),bt.return(s),Zt.return(r);}function rd(i,t,e){return i?(i!==t&&(rd(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(Z("Mask bounds, renderable is not inside the root container"),e)}var Wa=g(()=>{ha();mr();zt();});var Qi,id=g(()=>{U();ed();Va();Wa();Qi=class{constructor(t){this.priority=0,this.inverse=false,this.pipe="alphaMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Zi),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask=null;}addBounds(t,e){this.inverse||Co(this.mask,t,e);}addLocalBounds(t,e){Po(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Zi}};Qi.extension=w.MaskEffect;});var Ji,sd=g(()=>{U();Ji=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"}};Ji.extension=w.MaskEffect;});var ts,od=g(()=>{U();Ni();Va();Wa();ts=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.mask.includeInBuild=false,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask.includeInBuild=true,this.mask=null;}addBounds(t,e){Co(this.mask,t,e);}addLocalBounds(t,e){Po(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof de}};ts.extension=w.MaskEffect;});var Yr,nd=g(()=>{fe();U();De();Yr=class extends Ct{constructor(t){t.resource||(t.resource=gt.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent;}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight);}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Yr.extension=w.TextureSource;});var Me,Mo=g(()=>{U();De();Me=class extends Ct{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=true;}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Me.extension=w.TextureSource;});async function ad(){return Ha??(Ha=(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=false,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load();});if(!e)return "premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ha}var Ha,ld=g(()=>{});var Eo,ud,cd=g(()=>{U();Hi();ld();De();Eo=class hd extends Ct{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...hd.defaultOptions,...t},this._autoUpdate=true,this._isConnectedToTicker=false,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==false,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!==false&&this.load();}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Pt.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=true),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,true)),this.alphaMode=await ad(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`));})),t.load());}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,true),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=true,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,true),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&&(Pt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,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||(Pt.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Pt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Eo.extension=w.TextureSource;Eo.defaultOptions={...Ct.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};Eo.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ud=Eo;});var Ya,vt,es=g(()=>{zt();Oa();Ya=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||Z(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ke(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(l=>{o.set(l,e);});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(l=>{this._cacheMap.set(l,a);}),n.forEach(l=>{let h=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&Z("[Cache] already has key:",l),this._cache.set(l,o.get(l));});}remove(t){if(!this._cacheMap.has(t)){Z(`[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}},vt=new Ya;});function dd(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<$a.length;s++){let o=$a[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function fd(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&vt.has(r))return vt.get(r);let o=new D({source:dd(s)});return o.on("destroy",()=>{vt.has(r)&&vt.remove(r);}),t||vt.set(r,o),o}function pd(i,t=false){return typeof i=="string"?vt.get(i):i instanceof Ct?new D({source:i}):fd(i,t)}var $a,Xa=g(()=>{es();U();De();Rt();$a=[];W.handleByList(w.TextureSource,$a);D.from=pd;Ct.from=dd;});var Ao=g(()=>{U();id();sd();od();ga();nd();Mo();cd();Xa();W.add(Qi,Ji,ts,ud,Me,Yr,br);});var le,rs=g(()=>{le=class{constructor(t){this.resources=Object.create(null),this._dirty=true;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++);}this._updateKey();}_updateKey(){if(!this._dirty)return;this._dirty=false;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|");}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=true);}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t;}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null;}onResourceChange(t){if(this._dirty=true,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null);}else this._updateKey();}};});function gd(i,t,e){let r=2166136261;for(let s=0;s<t;s++)r^=i[s].uid,r=Math.imul(r,16777619),r>>>=0;return md[r]||T_(i,t,r,e)}function T_(i,t,e,r){let s={},o=0;for(let a=0;a<r;a++){let l=a<t?i[a]:D.EMPTY.source;s[o++]=l.source,s[o++]=l.style;}let n=new le(s);return md[e]=n,n}var md,xd=g(()=>{rs();Rt();md={};});var Ee,ja=g(()=>{Ee=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength;}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null;}static sizeOf(t){switch(t){case "int8":case "uint8":return 1;case "int16":case "uint16":return 2;case "int32":case "uint32":case "float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};});function Ka(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n);}}var _d=g(()=>{});var yd,bd=g(()=>{yd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function Ne(i,t){return t.alphaMode==="no-premultiply-alpha"&&yd[i]||i}var is=g(()=>{bd();});function Lo(){return (!Io||Io?.isContextLost())&&(Io=gt.get().createCanvas().getContext("webgl",{})),Io}var Io,qa=g(()=>{fe();});function C_(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function vd(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=w_.replace(/%forloop%/gi,C_(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e);}return i}var w_,Sd=g(()=>{w_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
+ `);});function Td(){if($r)return $r;let i=Lo();return $r=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),$r=vd($r,i),i.getExtension("WEBGL_lose_context")?.loseContext(),$r}var $r,wd=g(()=>{qa();Sd();$r=null;});var Ro,Cd=g(()=>{Ro=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 Pd(){return Qa>0?Ed[--Qa]:new Za}function Md(i){Ed[Qa++]=i;}var Za,Ed,Qa,ss,Ad,Ld,Rd=g(()=>{Ut();ja();yt();_d();is();wd();Cd();Za=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ro,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},Ed=[],Qa=0;ss=0,Ad=class Id{constructor(t){this.uid=it("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],t={...Id.defaultOptions,...t},t.maxTextures||(N("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Td());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ee(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e;}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Md(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=true;}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize;}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return !r&&r!==0?false:(t._textureId=r,t.texture=e,true)}updateElement(t){this.dirty=true;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId);}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=Pd(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ne(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 l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",x=this.maxTextures;for(let y=this.elementStart;y<this.elementSize;++y){let m=e[y];e[y]=null;let b=m.texture._source,v=Ne(m.blendMode,b),S=n!==v||a!==m.topology;if(b._batchTick===ss&&!S){m._textureId=b._textureBindLocation,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r;continue}b._batchTick=ss,(s.count>=x||S)&&(this._finishBatch(r,f,c-f,s,n,a,t,d),d="renderBatch",f=c,n=v,a=m.topology,r=Pd(),s=r.textures,s.clear(),++ss),m._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,m._batch=r,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,c-f,s,n,a,t,d),f=c,++ss),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c;}_finishBatch(t,e,r,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ss,this.batches[this.batchIndex++]=t,a.add(t);}finish(t){this.break(t);}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4);}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t);}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ee(e);Ka(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r;}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Ka(e.buffer,s.buffer);this.indexBuffer=s;}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[r++]=s+o[h+a]-l;}destroy(){for(let t=0;t<this.batches.length;t++)Md(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;}};Ad.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ld=Ad;});var lt,Xr=g(()=>{lt=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(lt||{});});var Ft,jr=g(()=>{Yt();Ut();Xr();Ft=class extends et{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=it("buffer"),this._resourceType="buffer",this._resourceId=it("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=true,this.destroyed=false,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??true;}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,true);}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return !!(this.descriptor.usage&lt.STATIC)}set static(t){t?this.descriptor.usage|=lt.STATIC:this.descriptor.usage&=~lt.STATIC;}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=it("resource"),this.emit("change",this));return}r&&this.emit("update",this);}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners();}};});function Ja(i,t){if(!(i instanceof Ft)){let e=t?lt.INDEX:lt.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=lt.INDEX|lt.COPY_DST):(i=new Float32Array(i),e=lt.VERTEX|lt.COPY_DST)),i=new Ft({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var Fd=g(()=>{jr();Xr();});function Bd(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,u=(r.offset||0)/h,c=(r.stride||2*4)/h;for(let f=u;f<s.length;f+=c){let d=s[f],x=s[f+1];d>a&&(a=d),x>l&&(l=x),d<o&&(o=d),x<n&&(n=x);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var kd=g(()=>{});function P_(i){return (i instanceof Ft||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Ja(i.buffer,false),i}var Ae,os=g(()=>{Yt();ce();Ut();jr();Fd();kd();Ae=class extends et{constructor(t={}){super(),this.uid=it("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new mt,this._boundsDirty=true;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list";}onBufferUpdate(){this._boundsDirty=true,this.emit("update",this);}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=P_(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r;}addIndex(t){this.indexBuffer=Ja(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,Bd(this,"aPosition",this._bounds)):this._bounds}destroy(t=false){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 M_,E_,Fo,Gd=g(()=>{jr();Xr();os();M_=new Float32Array(1),E_=new Uint32Array(1),Fo=class extends Ae{constructor(){let e=new Ft({data:M_,label:"attribute-batch-buffer",usage:lt.VERTEX|lt.COPY_DST,shrinkToFit:false}),r=new Ft({data:E_,label:"index-batch-buffer",usage:lt.INDEX|lt.COPY_DST,shrinkToFit:false}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r});}};});function Kr(i,t){let e=Od[i];return e===void 0&&(tl[t]===void 0&&(tl[t]=1),Od[i]=e=tl[t]++),e}var tl,Od,Bo=g(()=>{tl=Object.create(null),Od=Object.create(null);});function Dd(){if(!ko){ko="mediump";let i=Lo();i&&i.getShaderPrecisionFormat&&(ko=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return ko}var ko,Ud=g(()=>{qa();});function zd(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -33,13 +33,13 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function vd(i,t){if(i===0)th
33
33
  #define out varying
34
34
  #endif
35
35
  ${i}
36
- `}var Nd=x(()=>{});function Vd(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
37
- ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Wd=x(()=>{});function Hd(i,t){return t?`#version 300 es
38
- ${i}`:i}var Yd=x(()=>{});function $d(i,{name:t="pixi-program"},e=true){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?A_:I_;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
39
- ${i}`}var A_,I_,Xd=x(()=>{A_={},I_={};});function jd(i,t){return t?i.replace("#version 300 es",""):i}var Kd=x(()=>{});var el,rl,qd,qr,Go=x(()=>{Bo();Ud();Nd();Wd();Yd();Xd();Kd();el={stripVersion:jd,ensurePrecision:Vd,addProgramDefines:zd,setProgramName:$d,insertVersion:Hd},rl=Object.create(null),qd=class il{constructor(t){t={...il.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Dd()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(el).forEach(n=>{let a=r[n];s=el[n](s,a,true),o=el[n](o,a,false);}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Kr(`${this.vertex}:${this.fragment}`,"gl-program");}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null;}static from(t){let e=`${t.vertex}:${t.fragment}`;return rl[e]||(rl[e]=new il(t)),rl[e]}};qd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};qr=qd;});function vr(i){return Zd[i]??Zd.float32}var Zd,Oo=x(()=>{Zd={uint8x2:{size:2,stride:2,normalised:false},uint8x4:{size:4,stride:4,normalised:false},sint8x2:{size:2,stride:2,normalised:false},sint8x4:{size:4,stride:4,normalised:false},unorm8x2:{size:2,stride:2,normalised:true},unorm8x4:{size:4,stride:4,normalised:true},snorm8x2:{size:2,stride:2,normalised:true},snorm8x4:{size:4,stride:4,normalised:true},uint16x2:{size:2,stride:4,normalised:false},uint16x4:{size:4,stride:8,normalised:false},sint16x2:{size:2,stride:4,normalised:false},sint16x4:{size:4,stride:8,normalised:false},unorm16x2:{size:2,stride:4,normalised:true},unorm16x4:{size:4,stride:8,normalised:true},snorm16x2:{size:2,stride:4,normalised:true},snorm16x4:{size:4,stride:8,normalised:true},float16x2:{size:2,stride:4,normalised:false},float16x4:{size:4,stride:8,normalised:false},float32:{size:1,stride:4,normalised:false},float32x2:{size:2,stride:8,normalised:false},float32x3:{size:3,stride:12,normalised:false},float32x4:{size:4,stride:16,normalised:false},uint32:{size:1,stride:4,normalised:false},uint32x2:{size:2,stride:8,normalised:false},uint32x3:{size:3,stride:12,normalised:false},uint32x4:{size:4,stride:16,normalised:false},sint32:{size:1,stride:4,normalised:false},sint32x2:{size:2,stride:8,normalised:false},sint32x3:{size:3,stride:12,normalised:false},sint32x4:{size:4,stride:16,normalised:false}};});function Qd({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let l=L_[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:vr(l).stride,offset:0,instance:false,start:0};}}}return e}var L_,Jd=x(()=>{Oo();L_={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};});function Do(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=i.match(t)?.map(c=>({group:parseInt(c.match(e)[1],10),binding:parseInt(c.match(r)[1],10),name:c.match(s)[2],isUniform:c.match(s)[1]==="<uniform>",type:c.match(o)[1]}));if(!h)return {groups:[],structs:[]};let u=i.match(n)?.map(c=>{let f=c.match(l)[1],d=c.match(a).reduce((g,y)=>{let[m,p]=y.split(":");return g[m.trim()]=p.trim(),g},{});return d?{name:f,members:d}:null}).filter(({name:c})=>h.some(f=>f.type===c))??[];return {groups:h,structs:u}}var tf=x(()=>{});var Zr,ef=x(()=>{Zr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Zr||{});});function rf({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:Zr.VERTEX|Zr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Zr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:Zr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:false}});}return t}var sf=x(()=>{ef();});function of({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding;}return t}var nf=x(()=>{});function af(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?false:(e.add(n.name),true)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?false:(r.add(a),true)});return {structs:s,groups:o}}var lf=x(()=>{});var sl,qe,Uo=x(()=>{Bo();Jd();tf();sf();nf();lf();sl=Object.create(null),qe=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Do(e.source);this.structsAndGroups=a;}else {let a=Do(r.source),l=Do(e.source);this.structsAndGroups=af(a,l);}this.layout=s??of(this.structsAndGroups),this.gpuLayout=o??rf(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey();}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Kr(r,"program");}get attributeData(){return this._attributeData??(this._attributeData=Qd(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null;}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return sl[e]||(sl[e]=new i(t)),sl[e]}};});function ol(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n);}else Z(`${r} placement hook does not exist in shader`);}}var hf=x(()=>{zt();});function nl(i){let t={};return (i.match(R_)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[];}),t}var R_,uf=x(()=>{R_=/\{\{(.*?)\}\}/g;});function cf(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function al(i,t,e=false){let r=[];cf(t,r),i.forEach(a=>{a.header&&cf(a.header,r);});let s=r;e&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(`
36
+ `}var Nd=g(()=>{});function Vd(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
37
+ ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Wd=g(()=>{});function Hd(i,t){return t?`#version 300 es
38
+ ${i}`:i}var Yd=g(()=>{});function $d(i,{name:t="pixi-program"},e=true){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?A_:I_;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
39
+ ${i}`}var A_,I_,Xd=g(()=>{A_={},I_={};});function jd(i,t){return t?i.replace("#version 300 es",""):i}var Kd=g(()=>{});var el,rl,qd,qr,Go=g(()=>{Bo();Ud();Nd();Wd();Yd();Xd();Kd();el={stripVersion:jd,ensurePrecision:Vd,addProgramDefines:zd,setProgramName:$d,insertVersion:Hd},rl=Object.create(null),qd=class il{constructor(t){t={...il.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Dd()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(el).forEach(n=>{let a=r[n];s=el[n](s,a,true),o=el[n](o,a,false);}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Kr(`${this.vertex}:${this.fragment}`,"gl-program");}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null;}static from(t){let e=`${t.vertex}:${t.fragment}`;return rl[e]||(rl[e]=new il(t)),rl[e]}};qd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};qr=qd;});function vr(i){return Zd[i]??Zd.float32}var Zd,Oo=g(()=>{Zd={uint8x2:{size:2,stride:2,normalised:false},uint8x4:{size:4,stride:4,normalised:false},sint8x2:{size:2,stride:2,normalised:false},sint8x4:{size:4,stride:4,normalised:false},unorm8x2:{size:2,stride:2,normalised:true},unorm8x4:{size:4,stride:4,normalised:true},snorm8x2:{size:2,stride:2,normalised:true},snorm8x4:{size:4,stride:4,normalised:true},uint16x2:{size:2,stride:4,normalised:false},uint16x4:{size:4,stride:8,normalised:false},sint16x2:{size:2,stride:4,normalised:false},sint16x4:{size:4,stride:8,normalised:false},unorm16x2:{size:2,stride:4,normalised:true},unorm16x4:{size:4,stride:8,normalised:true},snorm16x2:{size:2,stride:4,normalised:true},snorm16x4:{size:4,stride:8,normalised:true},float16x2:{size:2,stride:4,normalised:false},float16x4:{size:4,stride:8,normalised:false},float32:{size:1,stride:4,normalised:false},float32x2:{size:2,stride:8,normalised:false},float32x3:{size:3,stride:12,normalised:false},float32x4:{size:4,stride:16,normalised:false},uint32:{size:1,stride:4,normalised:false},uint32x2:{size:2,stride:8,normalised:false},uint32x3:{size:3,stride:12,normalised:false},uint32x4:{size:4,stride:16,normalised:false},sint32:{size:1,stride:4,normalised:false},sint32x2:{size:2,stride:8,normalised:false},sint32x3:{size:3,stride:12,normalised:false},sint32x4:{size:4,stride:16,normalised:false}};});function Qd({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let l=L_[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:vr(l).stride,offset:0,instance:false,start:0};}}}return e}var L_,Jd=g(()=>{Oo();L_={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};});function Do(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=i.match(t)?.map(c=>({group:parseInt(c.match(e)[1],10),binding:parseInt(c.match(r)[1],10),name:c.match(s)[2],isUniform:c.match(s)[1]==="<uniform>",type:c.match(o)[1]}));if(!h)return {groups:[],structs:[]};let u=i.match(n)?.map(c=>{let f=c.match(l)[1],d=c.match(a).reduce((x,y)=>{let[m,p]=y.split(":");return x[m.trim()]=p.trim(),x},{});return d?{name:f,members:d}:null}).filter(({name:c})=>h.some(f=>f.type===c))??[];return {groups:h,structs:u}}var tf=g(()=>{});var Zr,ef=g(()=>{Zr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Zr||{});});function rf({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:Zr.VERTEX|Zr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Zr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:Zr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:false}});}return t}var sf=g(()=>{ef();});function of({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding;}return t}var nf=g(()=>{});function af(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?false:(e.add(n.name),true)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?false:(r.add(a),true)});return {structs:s,groups:o}}var lf=g(()=>{});var sl,qe,Uo=g(()=>{Bo();Jd();tf();sf();nf();lf();sl=Object.create(null),qe=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Do(e.source);this.structsAndGroups=a;}else {let a=Do(r.source),l=Do(e.source);this.structsAndGroups=af(a,l);}this.layout=s??of(this.structsAndGroups),this.gpuLayout=o??rf(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey();}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Kr(r,"program");}get attributeData(){return this._attributeData??(this._attributeData=Qd(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null;}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return sl[e]||(sl[e]=new i(t)),sl[e]}};});function ol(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n);}else Z(`${r} placement hook does not exist in shader`);}}var hf=g(()=>{zt();});function nl(i){let t={};return (i.match(R_)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[];}),t}var R_,uf=g(()=>{R_=/\{\{(.*?)\}\}/g;});function cf(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function al(i,t,e=false){let r=[];cf(t,r),i.forEach(a=>{a.header&&cf(a.header,r);});let s=r;e&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(`
40
40
  `),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
41
41
  ${o}
42
- `),n}var df=x(()=>{});function ff(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function F_(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function B_(i){let t=/@.*?\s+/g;return i.replace(t,"")}function pf(i,t){let e=[];ff(t,e),i.forEach(l=>{l.header&&ff(l.header,e);});let r=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
42
+ `),n}var df=g(()=>{});function ff(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function F_(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function B_(i){let t=/@.*?\s+/g;return i.replace(t,"")}function pf(i,t){let e=[];ff(t,e),i.forEach(l=>{l.header&&ff(l.header,e);});let r=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
43
43
  `),o=e.sort().map(l=>` var ${B_(l)};`).join(`
44
44
  `),n=`return VSOutput(
45
45
  ${e.sort().map(l=>` ${F_(l)}`).join(`,
@@ -49,11 +49,11 @@ ${s}
49
49
  ${o}
50
50
  `),a=a.replace("{{return}}",`
51
51
  ${n}
52
- `),a}var mf=x(()=>{});function ll(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
52
+ `),a}var mf=g(()=>{});function ll(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
53
53
  `).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
54
54
  ${s.join(`
55
55
  `)}
56
- //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"");}return e}var gf=x(()=>{});function xf({template:i,bits:t}){let e=yf(i,t);if(Ze[e])return Ze[e];let{vertex:r,fragment:s}=G_(i,t);return Ze[e]=bf(r,s,t),Ze[e]}function _f({template:i,bits:t}){let e=yf(i,t);return Ze[e]||(Ze[e]=bf(i.vertex,i.fragment,t)),Ze[e]}function G_(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=al(e,i.vertex,true);s=pf(e,s);let o=al(r,i.fragment,true);return {vertex:s,fragment:o}}function yf(i,t){return t.map(e=>(hl.has(e)||hl.set(e,k_++),hl.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function bf(i,t,e){let r=nl(i),s=nl(t);return e.forEach(o=>{ol(o.vertex,r,o.name),ol(o.fragment,s,o.name);}),{vertex:ll(i,r),fragment:ll(t,s)}}var Ze,hl,k_,vf=x(()=>{hf();uf();df();mf();gf();Ze=Object.create(null),hl=new Map,k_=0;});var Sf,Tf,wf,Cf,Pf=x(()=>{Sf=`
56
+ //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"");}return e}var gf=g(()=>{});function xf({template:i,bits:t}){let e=yf(i,t);if(Ze[e])return Ze[e];let{vertex:r,fragment:s}=G_(i,t);return Ze[e]=bf(r,s,t),Ze[e]}function _f({template:i,bits:t}){let e=yf(i,t);return Ze[e]||(Ze[e]=bf(i.vertex,i.fragment,t)),Ze[e]}function G_(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=al(e,i.vertex,true);s=pf(e,s);let o=al(r,i.fragment,true);return {vertex:s,fragment:o}}function yf(i,t){return t.map(e=>(hl.has(e)||hl.set(e,k_++),hl.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function bf(i,t,e){let r=nl(i),s=nl(t);return e.forEach(o=>{ol(o.vertex,r,o.name),ol(o.fragment,s,o.name);}),{vertex:ll(i,r),fragment:ll(t,s)}}var Ze,hl,k_,vf=g(()=>{hf();uf();df();mf();gf();Ze=Object.create(null),hl=new Map,k_=0;});var Sf,Tf,wf,Cf,Pf=g(()=>{Sf=`
57
57
  @in aPosition: vec2<f32>;
58
58
  @in aUV: vec2<f32>;
59
59
 
@@ -177,7 +177,7 @@ ${s.join(`
177
177
 
178
178
  {{end}}
179
179
  }
180
- `;});var Mf,Ef,Af=x(()=>{Mf={name:"global-uniforms-bit",vertex:{header:`
180
+ `;});var Mf,Ef,Af=g(()=>{Mf={name:"global-uniforms-bit",vertex:{header:`
181
181
  struct GlobalUniforms {
182
182
  uProjectionMatrix:mat3x3<f32>,
183
183
  uWorldTransformMatrix:mat3x3<f32>,
@@ -191,7 +191,7 @@ ${s.join(`
191
191
  uniform mat3 uWorldTransformMatrix;
192
192
  uniform vec4 uWorldColorAlpha;
193
193
  uniform vec2 uResolution;
194
- `}};});function Qr({bits:i,name:t}){let e=xf({template:{fragment:Tf,vertex:Sf},bits:[Mf,...i]});return qe.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Jr({bits:i,name:t}){return new qr({name:t,..._f({template:{vertex:wf,fragment:Cf},bits:[Ef,...i]})})}var zo=x(()=>{Go();Uo();vf();Pf();Af();});var No,Vo,ul=x(()=>{No={name:"color-bit",vertex:{header:`
194
+ `}};});function Qr({bits:i,name:t}){let e=xf({template:{fragment:Tf,vertex:Sf},bits:[Mf,...i]});return qe.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Jr({bits:i,name:t}){return new qr({name:t,..._f({template:{vertex:wf,fragment:Cf},bits:[Ef,...i]})})}var zo=g(()=>{Go();Uo();vf();Pf();Af();});var No,Vo,ul=g(()=>{No={name:"color-bit",vertex:{header:`
195
195
  @in aColor: vec4<f32>;
196
196
  `,main:`
197
197
  vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
@@ -240,7 +240,7 @@ ${s.join(`
240
240
  `,main:`
241
241
 
242
242
  ${U_(i)}
243
- `}}),dl[i]}var cl,dl,fl=x(()=>{cl={};dl={};});var ti,ei,Yo=x(()=>{ti={name:"round-pixels-bit",vertex:{header:`
243
+ `}}),dl[i]}var cl,dl,fl=g(()=>{cl={};dl={};});var ti,ei,Yo=g(()=>{ti={name:"round-pixels-bit",vertex:{header:`
244
244
  fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
245
245
  {
246
246
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
@@ -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 pl,If,Lf=x(()=>{pl=["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>"],If=pl.reduce((i,t)=>(i[t]=true,i),{});});function Rf(i,t){switch(i){case "f32":return 0;case "vec2<f32>":return new Float32Array(2*t);case "vec3<f32>":return new Float32Array(3*t);case "vec4<f32>":return new Float32Array(4*t);case "mat2x2<f32>":return new Float32Array([1,0,0,1]);case "mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case "mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Ff=x(()=>{});var Bf,Vt,Qe=x(()=>{Ut();Bo();Lf();Ff();Bf=class kf{constructor(t,e){this._touched=0,this.uid=it("uniform"),this._resourceType="uniformGroup",this._resourceId=it("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...kf.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!If[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${pl.join(", ")}`);o.value??(o.value=Rf(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Kr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};Bf.defaultOptions={ubo:false,isStatic:false};Vt=Bf;});function $o(i){let t=Gf[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Gf[i]=new Vt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var Gf,ml=x(()=>{Qe();Gf={};});var Ie,ns=x(()=>{Ie=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Ie||{});});var Le,as=x(()=>{Yt();Ut();Go();rs();Uo();ns();Qe();Le=class i extends et{constructor(t){super(),this.uid=it("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Ie.WEBGPU),r&&(n|=Ie.WEBGL)),this.compatibleRenderers=n;let l={};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 h in a)for(let u in a[h]){let c=a[h][u];l[c]={group:h,binding:u,name:c};}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c;});let h=0;for(let u in o)l[u]||(s[99]||(s[99]=new le,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:h,name:u},a[99]=a[99]||{},a[99][h]=u,h++);for(let u in o){let c=u,f=o[u];!f.source&&!f._resourceType&&(f=new Vt(f));let d=l[c];d&&(s[d.group]||(s[d.group]=new le,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding));}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l);}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new le,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=qe.from(e)),r&&(n=qr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Xo,Of=x(()=>{zo();ul();fl();Yo();ml();as();Xo=class extends Le{constructor(t){let e=Jr({name:"batch",bits:[Vo,Ho(t),ei]}),r=Qr({name:"batch",bits:[No,Wo(t),ti]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:$o(t)}});}};});var gl,Df,zf,Nf=x(()=>{U();Rd();Gd();Of();gl=null,Df=class Uf extends Ld{constructor(t){super(t),this.geometry=new Fo,this.name=Uf.extension.name,this.vertexSize=6,gl??(gl=new Xo(t.maxTextures)),this.shader=gl;}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,{positions:g,uvs:y}=t,m=t.color,p=t.attributeOffset,b=p+t.attributeSize;for(let v=p;v<b;v++){let S=v*2,P=g[S],T=g[S+1];e[s++]=l*P+u*T+f,e[s++]=c*T+h*P+d,e[s++]=y[S],e[s++]=y[S+1],r[s++]=m,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,g=t.bounds,y=g.maxX,m=g.minX,p=g.maxY,b=g.minY,v=n.uvs,S=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=l*m+u*b+f,e[s+1]=c*b+h*m+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=P,e[s+6]=l*y+u*b+f,e[s+7]=c*b+h*y+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=P,e[s+12]=l*y+u*p+f,e[s+13]=c*p+h*y+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=P,e[s+18]=l*m+u*p+f,e[s+19]=c*p+h*m+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=P;}};Df.extension={type:[w.Batcher],name:"default"};zf=Df;});function Vf(i,t,e,r,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,u=a.b,c=a.c,f=a.d,d=a.tx,g=a.ty;for(;l<n;){let y=i[e],m=i[e+1];r[s]=h*y+c*m+d,r[s+1]=u*y+f*m+g,s+=o,e+=t,l++;}}function Wf(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Hf=x(()=>{});function xl(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let c=e*r;for(let f=0;f<s;f++){let d=i[c],g=i[c+1];i[c]=o*d+a*g+h,i[c+1]=n*d+l*g+u,c+=r;}}var Yf=x(()=>{});var z_,Sr,_l=x(()=>{ut();aa();z_=new F,Sr=class{constructor(){this.packAsQuad=false,this.batcherName="default",this.topology="triangle-list",this.applyTransform=true,this.roundPixels=0,this._batcher=null,this._batch=null;}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?lo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||z_}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=true,this.renderable=null,this.topology="triangle-list";}};});var ri,$f,Xf,jf=x(()=>{U();ri={extension:{type:w.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;if(n=a=S.radius,n<=0)return false;e=S.x,r=S.y,s=o=0;}else if(i.type==="ellipse"){let S=i;if(n=S.halfWidth,a=S.halfHeight,n<=0||a<=0)return false;e=S.x,r=S.y,s=o=0;}else {let S=i,P=S.width/2,T=S.height/2;e=S.x+P,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(P,T))),s=P-n,o=T-a;}if(s<0||o<0)return false;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return false;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,true;let u=0,c=l*4+(s?2:0)+2,f=c,d=h,g=s+n,y=o,m=e+g,p=e-g,b=r+y;if(t[u++]=m,t[u++]=b,t[--c]=b,t[--c]=p,o){let S=r-y;t[f++]=p,t[f++]=S,t[--d]=S,t[--d]=m;}for(let S=1;S<l;S++){let P=Math.PI/2*(S/l),T=s+Math.cos(P)*n,C=o+Math.sin(P)*a,G=e+T,E=e-T,L=r+C,R=r-C;t[u++]=G,t[u++]=L,t[--c]=L,t[--c]=E,t[f++]=E,t[f++]=R,t[--d]=R,t[--d]=G;}g=s,y=o+a,m=e+g,p=e-g,b=r+y;let v=r-y;return t[u++]=m,t[u++]=b,t[--d]=v,t[--d]=m,s&&(t[u++]=p,t[u++]=b,t[--d]=v,t[--d]=p),true},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let l=r;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let u=0;u<i.length;u+=2)t[l*e]=i[u],t[l*e+1]=i[u+1],u>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1;}},$f={...ri,extension:{...ri.extension,name:"ellipse"}},Xf={...ri,extension:{...ri.extension,name:"roundedRectangle"}};});function Kf(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a;}return e<0?-1:1}var qf=x(()=>{});function Zf(i,t,e,r,s,o,n,a){let l=i-e*s,h=t-r*s,u=i+e*o,c=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let g=l+f,y=h+d,m=u+f,p=c+d;return a.push(g,y),a.push(m,p),2}function Tr(i,t,e,r,s,o,n,a){let l=e-i,h=r-t,u=Math.atan2(l,h),c=Math.atan2(s-i,o-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,g=Math.abs(d),y=Math.sqrt(l*l+h*h),m=(15*g*Math.sqrt(y)/Math.PI>>0)+1,p=d/m;if(f+=p,a){n.push(i,t),n.push(e,r);for(let b=1,v=f;b<m;b++,v+=p)n.push(i,t),n.push(i+Math.sin(v)*y,t+Math.cos(v)*y);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let b=1,v=f;b<m;b++,v+=p)n.push(i+Math.sin(v)*y,t+Math.cos(v)*y),n.push(i,t);n.push(s,o),n.push(i,t);}return m*2}function Qf(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let ht=Kf(i);l=(l-.5)*ht+.5;}let h=new rt(i[0],i[1]),u=new rt(i[i.length-2],i[i.length-1]),c=r,f=Math.abs(h.x-u.x)<n&&Math.abs(h.y-u.y)<n;if(c){i=i.slice(),f&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let ht=(h.x+u.x)*.5,$e=(u.y+h.y)*.5;i.unshift(ht,$e),i.push(ht,$e);}let d=s,g=i.length/2,y=i.length,m=d.length/2,p=a.width/2,b=p*p,v=a.miterLimit*a.miterLimit,S=i[0],P=i[1],T=i[2],C=i[3],G=0,E=0,L=-(P-C),R=S-T,j=0,ot=0,Lt=Math.sqrt(L*L+R*R);L/=Lt,R/=Lt,L*=p,R*=p;let Ai=l,$=(1-Ai)*2,K=Ai*2;c||(a.cap==="round"?y+=Tr(S-L*($-K)*.5,P-R*($-K)*.5,S-L*$,P-R*$,S+L*K,P+R*K,d,true)+2:a.cap==="square"&&(y+=Zf(S,P,L,R,$,K,true,d))),d.push(S-L*$,P-R*$),d.push(S+L*K,P+R*K);for(let ht=1;ht<g-1;++ht){S=i[(ht-1)*2],P=i[(ht-1)*2+1],T=i[ht*2],C=i[ht*2+1],G=i[(ht+1)*2],E=i[(ht+1)*2+1],L=-(P-C),R=S-T,Lt=Math.sqrt(L*L+R*R),L/=Lt,R/=Lt,L*=p,R*=p,j=-(C-E),ot=T-G,Lt=Math.sqrt(j*j+ot*ot),j/=Lt,ot/=Lt,j*=p,ot*=p;let $e=T-S,Ii=P-C,Li=T-G,Ri=E-C,Nh=$e*Li+Ii*Ri,Vs=Ii*Li-Ri*$e,Fi=Vs<0;if(Math.abs(Vs)<.001*Math.abs(Nh)){d.push(T-L*$,C-R*$),d.push(T+L*K,C+R*K),Nh>=0&&(a.join==="round"?y+=Tr(T,C,T-L*$,C-R*$,T-j*$,C-ot*$,d,false)+4:y+=2,d.push(T-j*K,C-ot*K),d.push(T+j*$,C+ot*$));continue}let Vh=(-L+S)*(-R+C)-(-L+T)*(-R+P),Wh=(-j+G)*(-ot+C)-(-j+T)*(-ot+E),Ws=($e*Wh-Li*Vh)/Vs,Hs=(Ri*Vh-Ii*Wh)/Vs,Vn=(Ws-T)*(Ws-T)+(Hs-C)*(Hs-C),hr=T+(Ws-T)*$,ur=C+(Hs-C)*$,cr=T-(Ws-T)*K,dr=C-(Hs-C)*K,Lx=Math.min($e*$e+Ii*Ii,Li*Li+Ri*Ri),Hh=Fi?$:K,Rx=Lx+Hh*Hh*b;Vn<=Rx?a.join==="bevel"||Vn/b>v?(Fi?(d.push(hr,ur),d.push(T+L*K,C+R*K),d.push(hr,ur),d.push(T+j*K,C+ot*K)):(d.push(T-L*$,C-R*$),d.push(cr,dr),d.push(T-j*$,C-ot*$),d.push(cr,dr)),y+=2):a.join==="round"?Fi?(d.push(hr,ur),d.push(T+L*K,C+R*K),y+=Tr(T,C,T+L*K,C+R*K,T+j*K,C+ot*K,d,true)+4,d.push(hr,ur),d.push(T+j*K,C+ot*K)):(d.push(T-L*$,C-R*$),d.push(cr,dr),y+=Tr(T,C,T-L*$,C-R*$,T-j*$,C-ot*$,d,false)+4,d.push(T-j*$,C-ot*$),d.push(cr,dr)):(d.push(hr,ur),d.push(cr,dr)):(d.push(T-L*$,C-R*$),d.push(T+L*K,C+R*K),a.join==="round"?Fi?y+=Tr(T,C,T+L*K,C+R*K,T+j*K,C+ot*K,d,true)+2:y+=Tr(T,C,T-L*$,C-R*$,T-j*$,C-ot*$,d,false)+2:a.join==="miter"&&Vn/b<=v&&(Fi?(d.push(cr,dr),d.push(cr,dr)):(d.push(hr,ur),d.push(hr,ur)),y+=2),d.push(T-j*$,C-ot*$),d.push(T+j*K,C+ot*K),y+=2);}S=i[(g-2)*2],P=i[(g-2)*2+1],T=i[(g-1)*2],C=i[(g-1)*2+1],L=-(P-C),R=S-T,Lt=Math.sqrt(L*L+R*R),L/=Lt,R/=Lt,L*=p,R*=p,d.push(T-L*$,C-R*$),d.push(T+L*K,C+R*K),c||(a.cap==="round"?y+=Tr(T-L*($-K)*.5,C-R*($-K)*.5,T-L*$,C-R*$,T+L*K,C+R*K,d,false)+2:a.cap==="square"&&(y+=Zf(T,C,L,R,$,K,false,d)));let Ix=1e-4*1e-4;for(let ht=m;ht<y+m-2;++ht)S=d[ht*2],P=d[ht*2+1],T=d[(ht+1)*2],C=d[(ht+1)*2+1],G=d[(ht+2)*2],E=d[(ht+2)*2+1],!(Math.abs(S*(C-E)+T*(E-P)+G*(P-C))<Ix)&&o.push(ht,ht+1,ht+2);}var Jf=x(()=>{we();qf();});function tp(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],l=i[i.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=e,c=i.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(i[d*2]),u.push(i[d*2+1]);for(let d=0;d<c-1;d++)r.push(f+d,f+d+1);h&&r.push(f+c-1,f);}var ep=x(()=>{});function qo(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length,o=ip(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;let a,l,h;if(r&&(o=X_(i,t,o,e)),i.length>80*e){a=1/0,l=1/0;let u=-1/0,c=-1/0;for(let f=e;f<s;f+=e){let d=i[f],g=i[f+1];d<a&&(a=d),g<l&&(l=g),d>u&&(u=d),g>c&&(c=g);}h=Math.max(u-a,c-l),h=h!==0?32767/h:0;}return hs(o,n,e,a,l,h,0),n}function ip(i,t,e,r,s){let o;if(s===sy(i,t,e,r)>0)for(let n=t;n<e;n+=r)o=rp(n/r|0,i[n],i[n+1],o);else for(let n=e-r;n>=t;n-=r)o=rp(n/r|0,i[n],i[n+1],o);return o&&ii(o,o.next)&&(cs(o),o=o.next),o}function wr(i,t){if(!i)return i;t||(t=i);let e=i,r;do if(r=false,!e.steiner&&(ii(e,e.next)||xt(e.prev,e,e.next)===0)){if(cs(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function hs(i,t,e,r,s,o,n){if(!i)return;!n&&o&&Q_(i,r,s,o);let a=i;for(;i.prev!==i.next;){let l=i.prev,h=i.next;if(o?H_(i,r,s,o):W_(i)){t.push(l.i,i.i,h.i),cs(i),i=h.next,a=h.next;continue}if(i=h,i===a){n?n===1?(i=Y_(wr(i),t),hs(i,t,e,r,s,o,2)):n===2&&$_(i,t,e,r,s,o):hs(wr(i),t,e,r,s,o,1);break}}}function W_(i){let t=i.prev,e=i,r=i.next;if(xt(t,e,r)>=0)return false;let s=t.x,o=e.x,n=r.x,a=t.y,l=e.y,h=r.y,u=Math.min(s,o,n),c=Math.min(a,l,h),f=Math.max(s,o,n),d=Math.max(a,l,h),g=r.next;for(;g!==t;){if(g.x>=u&&g.x<=f&&g.y>=c&&g.y<=d&&ls(s,a,o,l,n,h,g.x,g.y)&&xt(g.prev,g,g.next)>=0)return false;g=g.next;}return true}function H_(i,t,e,r){let s=i.prev,o=i,n=i.next;if(xt(s,o,n)>=0)return false;let a=s.x,l=o.x,h=n.x,u=s.y,c=o.y,f=n.y,d=Math.min(a,l,h),g=Math.min(u,c,f),y=Math.max(a,l,h),m=Math.max(u,c,f),p=yl(d,g,t,e,r),b=yl(y,m,t,e,r),v=i.prevZ,S=i.nextZ;for(;v&&v.z>=p&&S&&S.z<=b;){if(v.x>=d&&v.x<=y&&v.y>=g&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=d&&S.x<=y&&S.y>=g&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0))return false;S=S.nextZ;}for(;v&&v.z>=p;){if(v.x>=d&&v.x<=y&&v.y>=g&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;S&&S.z<=b;){if(S.x>=d&&S.x<=y&&S.y>=g&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0)return false;S=S.nextZ;}return true}function Y_(i,t){let e=i;do{let r=e.prev,s=e.next.next;!ii(r,s)&&op(r,e,e.next,s)&&us(r,s)&&us(s,r)&&(t.push(r.i,e.i,s.i),cs(e),cs(e.next),e=i=s),e=e.next;}while(e!==i);return wr(e)}function $_(i,t,e,r,s,o){let n=i;do{let a=n.next.next;for(;a!==n.prev;){if(n.i!==a.i&&ey(n,a)){let l=np(n,a);n=wr(n,n.next),l=wr(l,l.next),hs(n,t,e,r,s,o,0),hs(l,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function X_(i,t,e,r){let s=[];for(let o=0,n=t.length;o<n;o++){let a=t[o]*r,l=o<n-1?t[o+1]*r:i.length,h=ip(i,a,l,r,false);h===h.next&&(h.steiner=true),s.push(ty(h));}s.sort(j_);for(let o=0;o<s.length;o++)e=K_(s[o],e);return e}function j_(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let r=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=r-s;}return e}function K_(i,t){let e=q_(i,t);if(!e)return t;let r=np(e,i);return wr(r,r.next),wr(e,e.next)}function q_(i,t){let e=t,r=i.x,s=i.y,o=-1/0,n;if(ii(i,e))return e;do{if(ii(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let c=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(c<=r&&c>o&&(o=c,n=e.x<e.next.x?e:e.next,c===r))return n}e=e.next;}while(e!==t);if(!n)return null;let a=n,l=n.x,h=n.y,u=1/0;e=n;do{if(r>=e.x&&e.x>=l&&r!==e.x&&sp(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)){let c=Math.abs(s-e.y)/(r-e.x);us(e,i)&&(c<u||c===u&&(e.x>n.x||e.x===n.x&&Z_(n,e)))&&(n=e,u=c);}e=e.next;}while(e!==a);return n}function Z_(i,t){return xt(i.prev,i,t.prev)<0&&xt(t.next,i,i.next)<0}function Q_(i,t,e,r){let s=i;do s.z===0&&(s.z=yl(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,J_(s);}function J_(i){let t,e=1;do{let r=i,s;i=null;let o=null;for(t=0;r;){t++;let n=r,a=0;for(let h=0;h<e&&(a++,n=n.nextZ,!!n);h++);let l=e;for(;a>0||l>0&&n;)a!==0&&(l===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;r=n;}o.nextZ=null,e*=2;}while(t>1);return i}function yl(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ty(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function sp(i,t,e,r,s,o,n,a){return (s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function ls(i,t,e,r,s,o,n,a){return !(i===n&&t===a)&&sp(i,t,e,r,s,o,n,a)}function ey(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ry(i,t)&&(us(i,t)&&us(t,i)&&iy(i,t)&&(xt(i.prev,i,t.prev)||xt(i,t.prev,t))||ii(i,t)&&xt(i.prev,i,i.next)>0&&xt(t.prev,t,t.next)>0)}function xt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function ii(i,t){return i.x===t.x&&i.y===t.y}function op(i,t,e,r){let s=Ko(xt(i,t,e)),o=Ko(xt(i,t,r)),n=Ko(xt(e,r,i)),a=Ko(xt(e,r,t));return !!(s!==o&&n!==a||s===0&&jo(i,e,t)||o===0&&jo(i,r,t)||n===0&&jo(e,i,r)||a===0&&jo(e,t,r))}function jo(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Ko(i){return i>0?1:i<0?-1:0}function ry(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&op(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function us(i,t){return xt(i.prev,i,i.next)<0?xt(i,t,i.next)>=0&&xt(i,i.prev,t)>=0:xt(i,t,i.prev)<0||xt(i,i.next,t)<0}function iy(i,t){let e=i,r=false,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function np(i,t){let e=bl(i.i,i.x,i.y),r=bl(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function rp(i,t,e,r){let s=bl(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function cs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ);}function bl(i,t,e){return {i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:false}}function sy(i,t,e,r){let s=0;for(let o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}var ap=x(()=>{});var lp,hp=x(()=>{ap();Yt();lp=qo.default||qo;});function Zo(i,t,e,r,s,o,n){let a=lp(i,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)o[n++]=a[h]+s,o[n++]=a[h+1]+s,o[n++]=a[h+2]+s;let l=s*r;for(let h=0;h<i.length;h+=2)e[l]=i[h],e[l+1]=i[h+1],l+=r;}var vl=x(()=>{hp();});var oy,up,cp=x(()=>{U();vl();oy=[],up={extension:{type:w.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return true},triangulate(i,t,e,r,s,o){Zo(i,oy,t,e,r,s,o);}};});var dp,fp=x(()=>{U();dp={extension:{type:w.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>0&&n>0?(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n,true):false},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2;}};});var pp,mp=x(()=>{U();pp={extension:{type:w.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,true},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2;}};});function xp(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function _p(i,t){let e=gt.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function ny(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(N("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Kt.defaultLinearOptions.textureSize}),t}var gp,Tl,Kt,si=x(()=>{$t();fe();ut();Mo();Rt();Ut();yt();fa();gp=[{offset:0,color:"white"},{offset:1,color:"black"}],Tl=class Sl{constructor(...t){this.uid=it("fillGradient"),this.type="linear",this.colorStops=[];let e=ny(t);e={...e.type==="radial"?Sl.defaultRadialOptions:Sl.defaultLinearOptions,...uo(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:J.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let m=t;t=r,r=m,o*=-1;}if(n<0){let m=e;e=s,s=m,n*=-1;}}let l=this.colorStops.length?this.colorStops:gp,h=this._textureSize,{canvas:u,context:c}=_p(h,1),f=a?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);xp(f,l),c.fillStyle=f,c.fillRect(0,0,h,1),this.texture=new D({source:new Me({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),g=Math.atan2(n,o),y=new F;y.scale(d/h,1),y.rotate(g),y.translate(t,e),this.textureSpace==="local"&&y.scale(h,h),this.transform=y;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:gp,e=this._textureSize,{canvas:r,context:s}=_p(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,u=this.outerRadius,c=a-u,f=l-u,d=e/(u*2),g=(o-c)*d,y=(n-f)*d,m=s.createRadialGradient(g,y,h*d,(a-c)*d,(l-f)*d,u*d);xp(m,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=m,s.translate(g,y),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-g,-y),s.fillRect(0,0,e,e),this.texture=new D({source:new Me({resource:r,addressMode:this._wrapMode})});let p=new F;p.scale(1/d,1/d),p.translate(c,f),this.textureSpace==="local"&&p.scale(e,e),this.transform=p;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};Tl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Tl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Kt=Tl;});function yp(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(ly);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,u=1/n.height,c=-a*h,f=-l*u,d=s.a,g=s.b,y=s.c,m=s.d;s.a*=h,s.b*=h,s.c*=u,s.d*=u,s.tx=c*d+f*y+s.tx,s.ty=c*g+f*m+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 Kt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(ay.copyFrom(r).invert()),s}var ay,ly,bp=x(()=>{ut();Xt();si();ay=new F,ly=new st;});function Sp(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")cy(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,h=o.data.hole;n&&h&&vp(h.shapePath,l,true,r,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),vp(a,l,n,r,e);}}}function cy(i,t,e){let r=[],s=Qo.rectangle,o=hy;o.x=i.dx,o.y=i.dy,o.width=i.dw,o.height=i.dh;let n=i.transform;if(!s.build(o,r))return;let{vertices:a,uvs:l,indices:h}=e,u=h.length,c=a.length/2;n&&xl(r,n),s.triangulate(r,a,2,c,h,u);let f=i.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let g=wt.get(Sr);g.indexOffset=u,g.indexSize=h.length-u,g.attributeOffset=c,g.attributeSize=a.length/2-c,g.baseColor=i.style,g.alpha=i.alpha,g.texture=f,g.geometryData=e,t.push(g);}function vp(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:l,transform:h,holes:u})=>{let c=[],f=Qo[l.type];if(!f.build(l,c))return;let d=a.length,g=o.length/2,y="triangle-list";if(h&&xl(c,h),e){let v=l.closePath??true,S=t;S.pixelLine?(tp(c,v,o,a),y="line-list"):Qf(c,S,false,v,o,a);}else if(u){let v=[],S=c.slice();dy(u).forEach(T=>{v.push(S.length/2),S.push(...T);}),Zo(S,v,o,2,g,a,d);}else f.triangulate(c,o,2,g,a,d);let m=n.length/2,p=t.texture;if(p!==D.WHITE){let v=yp(uy,t,l,h);Vf(o,2,g,n,m,2,o.length/2-g,v);}else Wf(n,m,2,o.length/2-g);let b=wt.get(Sr);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=g,b.attributeSize=o.length/2-g,b.baseColor=t.color,b.alpha=t.alpha,b.texture=p,b.geometryData=s,b.topology=y,r.push(b);});}function dy(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Qo[r.type].build(r,s)&&t.push(s);}return t}var Qo,hy,uy,Tp=x(()=>{U();ut();Xt();Hf();Yf();Rt();pr();_l();jf();Jf();ep();cp();fp();mp();bp();vl();Qo={};W.handleByMap(w.ShapeBuilder,Qo);W.add(dp,up,pp,ri,$f,Xf);hy=new st,uy=new F;});var wl,Cl,Ml,oi,Jo=x(()=>{U();xd();Nf();ca();yt();pr();Tp();wl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},Cl=class{constructor(){this.instructions=new Dr;}init(t){this.batcher=new zf({maxTextures:t}),this.instructions.reset();}get geometry(){return N(xu,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Ml=class Pl{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){Pl.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Pl.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),Sp(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"?e.isBatchable=e.geometryData.vertices.length<400:e.isBatchable=true,t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=wt.get(Cl,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let c=r[u];a.add(c);}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,true),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,true);let h=a.batches;for(let u=0;u<h.length;u++){let c=h[u];c.bindGroup=gd(c.textures.textures,c.textures.count,this._renderer.limits.maxBatchableTextures);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wl;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]&&(wt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{wt.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};Ml.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};Ml.defaultOptions={bezierSmoothness:.5};oi=Ml;});var fy,El,Al,Il,Ll,Rl,Fl,Bl,Cr,tn=x(()=>{fy={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},El=0,Al=1,Il=2,Ll=3,Rl=4,Fl=5,Bl=class wp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<El)}set blend(t){!!(this.data&1<<El)!==t&&(this.data^=1<<El);}get offsets(){return !!(this.data&1<<Al)}set offsets(t){!!(this.data&1<<Al)!==t&&(this.data^=1<<Al);}set cullMode(t){if(t==="none"){this.culling=false;return}this.culling=true,this.clockwiseFrontFace=t==="front";}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return !!(this.data&1<<Il)}set culling(t){!!(this.data&1<<Il)!==t&&(this.data^=1<<Il);}get depthTest(){return !!(this.data&1<<Ll)}set depthTest(t){!!(this.data&1<<Ll)!==t&&(this.data^=1<<Ll);}get depthMask(){return !!(this.data&1<<Fl)}set depthMask(t){!!(this.data&1<<Fl)!==t&&(this.data^=1<<Fl);}get clockwiseFrontFace(){return !!(this.data&1<<Rl)}set clockwiseFrontFace(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=fy[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 wp;return t.depthTest=false,t.blend=true,t}};Bl.default2d=Bl.for2d();Cr=Bl;});function Je(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r;}var ds=x(()=>{});var kl,fs,Cp=x(()=>{U();tn();pr();ds();_l();kl=class{constructor(){this.batches=[],this.batched=false;}destroy(){this.batches.forEach(t=>{wt.return(t);}),this.batches.length=0;}},fs=class{constructor(t,e){this.state=Cr.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this);}contextChange(){this._adaptor.contextChange(this.renderer);}validateRenderable(t){let e=t.context,r=!!t._gpuData,s=this.renderer.graphicsContext.updateGpuContext(e);return !!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t));}updateRenderable(t){let r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let o=r[s];o._batcher.updateElement(o);}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Je(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e);}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new kl;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=s.batches.map(n=>{let a=wt.get(Sr);return n.copyTo(a),a.renderable=t,a.roundPixels=o,a});}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;}};fs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"};});var Gl=x(()=>{U();Jo();Cp();W.add(fs);W.add(oi);});var tr,en=x(()=>{tr=class{constructor(){this.batcherName="default",this.packAsQuad=false,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1;}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t;}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1;}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1);}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}};});var rn,ps,Pp=x(()=>{U();ut();rs();Qe();is();ds();en();rn=class{destroy(){}},ps=class{constructor(t,e){this.localUniforms=new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new le({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init();}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return true;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,true;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return false}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e);}else r.break(e),e.add(t);}updateRenderable(t){if(t.batched){let e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ne(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Je(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new rn),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new rn),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new tr;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};ps.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"};});var Ol=x(()=>{U();Pp();W.add(ps);});var sn,Mp=x(()=>{sn=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0);}};});function Dl(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var Ep=x(()=>{});function Ip(i){return {dynamicUpdate:Ap(i,true),staticUpdate:Ap(i,false)}}function Ap(i,t){let e=[];e.push(`
253
+ `}};});var pl,If,Lf=g(()=>{pl=["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>"],If=pl.reduce((i,t)=>(i[t]=true,i),{});});function Rf(i,t){switch(i){case "f32":return 0;case "vec2<f32>":return new Float32Array(2*t);case "vec3<f32>":return new Float32Array(3*t);case "vec4<f32>":return new Float32Array(4*t);case "mat2x2<f32>":return new Float32Array([1,0,0,1]);case "mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case "mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Ff=g(()=>{});var Bf,Vt,Qe=g(()=>{Ut();Bo();Lf();Ff();Bf=class kf{constructor(t,e){this._touched=0,this.uid=it("uniform"),this._resourceType="uniformGroup",this._resourceId=it("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...kf.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!If[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${pl.join(", ")}`);o.value??(o.value=Rf(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Kr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};Bf.defaultOptions={ubo:false,isStatic:false};Vt=Bf;});function $o(i){let t=Gf[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Gf[i]=new Vt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var Gf,ml=g(()=>{Qe();Gf={};});var Ie,ns=g(()=>{Ie=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Ie||{});});var Le,as=g(()=>{Yt();Ut();Go();rs();Uo();ns();Qe();Le=class i extends et{constructor(t){super(),this.uid=it("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Ie.WEBGPU),r&&(n|=Ie.WEBGL)),this.compatibleRenderers=n;let l={};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 h in a)for(let u in a[h]){let c=a[h][u];l[c]={group:h,binding:u,name:c};}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c;});let h=0;for(let u in o)l[u]||(s[99]||(s[99]=new le,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:h,name:u},a[99]=a[99]||{},a[99][h]=u,h++);for(let u in o){let c=u,f=o[u];!f.source&&!f._resourceType&&(f=new Vt(f));let d=l[c];d&&(s[d.group]||(s[d.group]=new le,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding));}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l);}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new le,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=qe.from(e)),r&&(n=qr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Xo,Of=g(()=>{zo();ul();fl();Yo();ml();as();Xo=class extends Le{constructor(t){let e=Jr({name:"batch",bits:[Vo,Ho(t),ei]}),r=Qr({name:"batch",bits:[No,Wo(t),ti]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:$o(t)}});}};});var gl,Df,zf,Nf=g(()=>{U();Rd();Gd();Of();gl=null,Df=class Uf extends Ld{constructor(t){super(t),this.geometry=new Fo,this.name=Uf.extension.name,this.vertexSize=6,gl??(gl=new Xo(t.maxTextures)),this.shader=gl;}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,{positions:x,uvs:y}=t,m=t.color,p=t.attributeOffset,b=p+t.attributeSize;for(let v=p;v<b;v++){let S=v*2,P=x[S],T=x[S+1];e[s++]=l*P+u*T+f,e[s++]=c*T+h*P+d,e[s++]=y[S],e[s++]=y[S+1],r[s++]=m,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,x=t.bounds,y=x.maxX,m=x.minX,p=x.maxY,b=x.minY,v=n.uvs,S=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=l*m+u*b+f,e[s+1]=c*b+h*m+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=P,e[s+6]=l*y+u*b+f,e[s+7]=c*b+h*y+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=P,e[s+12]=l*y+u*p+f,e[s+13]=c*p+h*y+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=P,e[s+18]=l*m+u*p+f,e[s+19]=c*p+h*m+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=P;}};Df.extension={type:[w.Batcher],name:"default"};zf=Df;});function Vf(i,t,e,r,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,u=a.b,c=a.c,f=a.d,d=a.tx,x=a.ty;for(;l<n;){let y=i[e],m=i[e+1];r[s]=h*y+c*m+d,r[s+1]=u*y+f*m+x,s+=o,e+=t,l++;}}function Wf(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Hf=g(()=>{});function xl(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let c=e*r;for(let f=0;f<s;f++){let d=i[c],x=i[c+1];i[c]=o*d+a*x+h,i[c+1]=n*d+l*x+u,c+=r;}}var Yf=g(()=>{});var z_,Sr,_l=g(()=>{ut();aa();z_=new F,Sr=class{constructor(){this.packAsQuad=false,this.batcherName="default",this.topology="triangle-list",this.applyTransform=true,this.roundPixels=0,this._batcher=null,this._batch=null;}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?lo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||z_}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=true,this.renderable=null,this.topology="triangle-list";}};});var ri,$f,Xf,jf=g(()=>{U();ri={extension:{type:w.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;if(n=a=S.radius,n<=0)return false;e=S.x,r=S.y,s=o=0;}else if(i.type==="ellipse"){let S=i;if(n=S.halfWidth,a=S.halfHeight,n<=0||a<=0)return false;e=S.x,r=S.y,s=o=0;}else {let S=i,P=S.width/2,T=S.height/2;e=S.x+P,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(P,T))),s=P-n,o=T-a;}if(s<0||o<0)return false;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return false;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,true;let u=0,c=l*4+(s?2:0)+2,f=c,d=h,x=s+n,y=o,m=e+x,p=e-x,b=r+y;if(t[u++]=m,t[u++]=b,t[--c]=b,t[--c]=p,o){let S=r-y;t[f++]=p,t[f++]=S,t[--d]=S,t[--d]=m;}for(let S=1;S<l;S++){let P=Math.PI/2*(S/l),T=s+Math.cos(P)*n,C=o+Math.sin(P)*a,G=e+T,E=e-T,L=r+C,R=r-C;t[u++]=G,t[u++]=L,t[--c]=L,t[--c]=E,t[f++]=E,t[f++]=R,t[--d]=R,t[--d]=G;}x=s,y=o+a,m=e+x,p=e-x,b=r+y;let v=r-y;return t[u++]=m,t[u++]=b,t[--d]=v,t[--d]=m,s&&(t[u++]=p,t[u++]=b,t[--d]=v,t[--d]=p),true},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let l=r;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let u=0;u<i.length;u+=2)t[l*e]=i[u],t[l*e+1]=i[u+1],u>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1;}},$f={...ri,extension:{...ri.extension,name:"ellipse"}},Xf={...ri,extension:{...ri.extension,name:"roundedRectangle"}};});function Kf(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a;}return e<0?-1:1}var qf=g(()=>{});function Zf(i,t,e,r,s,o,n,a){let l=i-e*s,h=t-r*s,u=i+e*o,c=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let x=l+f,y=h+d,m=u+f,p=c+d;return a.push(x,y),a.push(m,p),2}function Tr(i,t,e,r,s,o,n,a){let l=e-i,h=r-t,u=Math.atan2(l,h),c=Math.atan2(s-i,o-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,x=Math.abs(d),y=Math.sqrt(l*l+h*h),m=(15*x*Math.sqrt(y)/Math.PI>>0)+1,p=d/m;if(f+=p,a){n.push(i,t),n.push(e,r);for(let b=1,v=f;b<m;b++,v+=p)n.push(i,t),n.push(i+Math.sin(v)*y,t+Math.cos(v)*y);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let b=1,v=f;b<m;b++,v+=p)n.push(i+Math.sin(v)*y,t+Math.cos(v)*y),n.push(i,t);n.push(s,o),n.push(i,t);}return m*2}function Qf(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let ht=Kf(i);l=(l-.5)*ht+.5;}let h=new rt(i[0],i[1]),u=new rt(i[i.length-2],i[i.length-1]),c=r,f=Math.abs(h.x-u.x)<n&&Math.abs(h.y-u.y)<n;if(c){i=i.slice(),f&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let ht=(h.x+u.x)*.5,$e=(u.y+h.y)*.5;i.unshift(ht,$e),i.push(ht,$e);}let d=s,x=i.length/2,y=i.length,m=d.length/2,p=a.width/2,b=p*p,v=a.miterLimit*a.miterLimit,S=i[0],P=i[1],T=i[2],C=i[3],G=0,E=0,L=-(P-C),R=S-T,j=0,ot=0,Lt=Math.sqrt(L*L+R*R);L/=Lt,R/=Lt,L*=p,R*=p;let Ai=l,$=(1-Ai)*2,K=Ai*2;c||(a.cap==="round"?y+=Tr(S-L*($-K)*.5,P-R*($-K)*.5,S-L*$,P-R*$,S+L*K,P+R*K,d,true)+2:a.cap==="square"&&(y+=Zf(S,P,L,R,$,K,true,d))),d.push(S-L*$,P-R*$),d.push(S+L*K,P+R*K);for(let ht=1;ht<x-1;++ht){S=i[(ht-1)*2],P=i[(ht-1)*2+1],T=i[ht*2],C=i[ht*2+1],G=i[(ht+1)*2],E=i[(ht+1)*2+1],L=-(P-C),R=S-T,Lt=Math.sqrt(L*L+R*R),L/=Lt,R/=Lt,L*=p,R*=p,j=-(C-E),ot=T-G,Lt=Math.sqrt(j*j+ot*ot),j/=Lt,ot/=Lt,j*=p,ot*=p;let $e=T-S,Ii=P-C,Li=T-G,Ri=E-C,Nh=$e*Li+Ii*Ri,Vs=Ii*Li-Ri*$e,Fi=Vs<0;if(Math.abs(Vs)<.001*Math.abs(Nh)){d.push(T-L*$,C-R*$),d.push(T+L*K,C+R*K),Nh>=0&&(a.join==="round"?y+=Tr(T,C,T-L*$,C-R*$,T-j*$,C-ot*$,d,false)+4:y+=2,d.push(T-j*K,C-ot*K),d.push(T+j*$,C+ot*$));continue}let Vh=(-L+S)*(-R+C)-(-L+T)*(-R+P),Wh=(-j+G)*(-ot+C)-(-j+T)*(-ot+E),Ws=($e*Wh-Li*Vh)/Vs,Hs=(Ri*Vh-Ii*Wh)/Vs,Vn=(Ws-T)*(Ws-T)+(Hs-C)*(Hs-C),hr=T+(Ws-T)*$,ur=C+(Hs-C)*$,cr=T-(Ws-T)*K,dr=C-(Hs-C)*K,Lx=Math.min($e*$e+Ii*Ii,Li*Li+Ri*Ri),Hh=Fi?$:K,Rx=Lx+Hh*Hh*b;Vn<=Rx?a.join==="bevel"||Vn/b>v?(Fi?(d.push(hr,ur),d.push(T+L*K,C+R*K),d.push(hr,ur),d.push(T+j*K,C+ot*K)):(d.push(T-L*$,C-R*$),d.push(cr,dr),d.push(T-j*$,C-ot*$),d.push(cr,dr)),y+=2):a.join==="round"?Fi?(d.push(hr,ur),d.push(T+L*K,C+R*K),y+=Tr(T,C,T+L*K,C+R*K,T+j*K,C+ot*K,d,true)+4,d.push(hr,ur),d.push(T+j*K,C+ot*K)):(d.push(T-L*$,C-R*$),d.push(cr,dr),y+=Tr(T,C,T-L*$,C-R*$,T-j*$,C-ot*$,d,false)+4,d.push(T-j*$,C-ot*$),d.push(cr,dr)):(d.push(hr,ur),d.push(cr,dr)):(d.push(T-L*$,C-R*$),d.push(T+L*K,C+R*K),a.join==="round"?Fi?y+=Tr(T,C,T+L*K,C+R*K,T+j*K,C+ot*K,d,true)+2:y+=Tr(T,C,T-L*$,C-R*$,T-j*$,C-ot*$,d,false)+2:a.join==="miter"&&Vn/b<=v&&(Fi?(d.push(cr,dr),d.push(cr,dr)):(d.push(hr,ur),d.push(hr,ur)),y+=2),d.push(T-j*$,C-ot*$),d.push(T+j*K,C+ot*K),y+=2);}S=i[(x-2)*2],P=i[(x-2)*2+1],T=i[(x-1)*2],C=i[(x-1)*2+1],L=-(P-C),R=S-T,Lt=Math.sqrt(L*L+R*R),L/=Lt,R/=Lt,L*=p,R*=p,d.push(T-L*$,C-R*$),d.push(T+L*K,C+R*K),c||(a.cap==="round"?y+=Tr(T-L*($-K)*.5,C-R*($-K)*.5,T-L*$,C-R*$,T+L*K,C+R*K,d,false)+2:a.cap==="square"&&(y+=Zf(T,C,L,R,$,K,false,d)));let Ix=1e-4*1e-4;for(let ht=m;ht<y+m-2;++ht)S=d[ht*2],P=d[ht*2+1],T=d[(ht+1)*2],C=d[(ht+1)*2+1],G=d[(ht+2)*2],E=d[(ht+2)*2+1],!(Math.abs(S*(C-E)+T*(E-P)+G*(P-C))<Ix)&&o.push(ht,ht+1,ht+2);}var Jf=g(()=>{we();qf();});function tp(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],l=i[i.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=e,c=i.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(i[d*2]),u.push(i[d*2+1]);for(let d=0;d<c-1;d++)r.push(f+d,f+d+1);h&&r.push(f+c-1,f);}var ep=g(()=>{});function qo(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length,o=ip(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;let a,l,h;if(r&&(o=X_(i,t,o,e)),i.length>80*e){a=1/0,l=1/0;let u=-1/0,c=-1/0;for(let f=e;f<s;f+=e){let d=i[f],x=i[f+1];d<a&&(a=d),x<l&&(l=x),d>u&&(u=d),x>c&&(c=x);}h=Math.max(u-a,c-l),h=h!==0?32767/h:0;}return hs(o,n,e,a,l,h,0),n}function ip(i,t,e,r,s){let o;if(s===sy(i,t,e,r)>0)for(let n=t;n<e;n+=r)o=rp(n/r|0,i[n],i[n+1],o);else for(let n=e-r;n>=t;n-=r)o=rp(n/r|0,i[n],i[n+1],o);return o&&ii(o,o.next)&&(cs(o),o=o.next),o}function wr(i,t){if(!i)return i;t||(t=i);let e=i,r;do if(r=false,!e.steiner&&(ii(e,e.next)||xt(e.prev,e,e.next)===0)){if(cs(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function hs(i,t,e,r,s,o,n){if(!i)return;!n&&o&&Q_(i,r,s,o);let a=i;for(;i.prev!==i.next;){let l=i.prev,h=i.next;if(o?H_(i,r,s,o):W_(i)){t.push(l.i,i.i,h.i),cs(i),i=h.next,a=h.next;continue}if(i=h,i===a){n?n===1?(i=Y_(wr(i),t),hs(i,t,e,r,s,o,2)):n===2&&$_(i,t,e,r,s,o):hs(wr(i),t,e,r,s,o,1);break}}}function W_(i){let t=i.prev,e=i,r=i.next;if(xt(t,e,r)>=0)return false;let s=t.x,o=e.x,n=r.x,a=t.y,l=e.y,h=r.y,u=Math.min(s,o,n),c=Math.min(a,l,h),f=Math.max(s,o,n),d=Math.max(a,l,h),x=r.next;for(;x!==t;){if(x.x>=u&&x.x<=f&&x.y>=c&&x.y<=d&&ls(s,a,o,l,n,h,x.x,x.y)&&xt(x.prev,x,x.next)>=0)return false;x=x.next;}return true}function H_(i,t,e,r){let s=i.prev,o=i,n=i.next;if(xt(s,o,n)>=0)return false;let a=s.x,l=o.x,h=n.x,u=s.y,c=o.y,f=n.y,d=Math.min(a,l,h),x=Math.min(u,c,f),y=Math.max(a,l,h),m=Math.max(u,c,f),p=yl(d,x,t,e,r),b=yl(y,m,t,e,r),v=i.prevZ,S=i.nextZ;for(;v&&v.z>=p&&S&&S.z<=b;){if(v.x>=d&&v.x<=y&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=d&&S.x<=y&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0))return false;S=S.nextZ;}for(;v&&v.z>=p;){if(v.x>=d&&v.x<=y&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;S&&S.z<=b;){if(S.x>=d&&S.x<=y&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0)return false;S=S.nextZ;}return true}function Y_(i,t){let e=i;do{let r=e.prev,s=e.next.next;!ii(r,s)&&op(r,e,e.next,s)&&us(r,s)&&us(s,r)&&(t.push(r.i,e.i,s.i),cs(e),cs(e.next),e=i=s),e=e.next;}while(e!==i);return wr(e)}function $_(i,t,e,r,s,o){let n=i;do{let a=n.next.next;for(;a!==n.prev;){if(n.i!==a.i&&ey(n,a)){let l=np(n,a);n=wr(n,n.next),l=wr(l,l.next),hs(n,t,e,r,s,o,0),hs(l,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function X_(i,t,e,r){let s=[];for(let o=0,n=t.length;o<n;o++){let a=t[o]*r,l=o<n-1?t[o+1]*r:i.length,h=ip(i,a,l,r,false);h===h.next&&(h.steiner=true),s.push(ty(h));}s.sort(j_);for(let o=0;o<s.length;o++)e=K_(s[o],e);return e}function j_(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let r=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=r-s;}return e}function K_(i,t){let e=q_(i,t);if(!e)return t;let r=np(e,i);return wr(r,r.next),wr(e,e.next)}function q_(i,t){let e=t,r=i.x,s=i.y,o=-1/0,n;if(ii(i,e))return e;do{if(ii(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let c=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(c<=r&&c>o&&(o=c,n=e.x<e.next.x?e:e.next,c===r))return n}e=e.next;}while(e!==t);if(!n)return null;let a=n,l=n.x,h=n.y,u=1/0;e=n;do{if(r>=e.x&&e.x>=l&&r!==e.x&&sp(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)){let c=Math.abs(s-e.y)/(r-e.x);us(e,i)&&(c<u||c===u&&(e.x>n.x||e.x===n.x&&Z_(n,e)))&&(n=e,u=c);}e=e.next;}while(e!==a);return n}function Z_(i,t){return xt(i.prev,i,t.prev)<0&&xt(t.next,i,i.next)<0}function Q_(i,t,e,r){let s=i;do s.z===0&&(s.z=yl(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,J_(s);}function J_(i){let t,e=1;do{let r=i,s;i=null;let o=null;for(t=0;r;){t++;let n=r,a=0;for(let h=0;h<e&&(a++,n=n.nextZ,!!n);h++);let l=e;for(;a>0||l>0&&n;)a!==0&&(l===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;r=n;}o.nextZ=null,e*=2;}while(t>1);return i}function yl(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ty(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function sp(i,t,e,r,s,o,n,a){return (s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function ls(i,t,e,r,s,o,n,a){return !(i===n&&t===a)&&sp(i,t,e,r,s,o,n,a)}function ey(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ry(i,t)&&(us(i,t)&&us(t,i)&&iy(i,t)&&(xt(i.prev,i,t.prev)||xt(i,t.prev,t))||ii(i,t)&&xt(i.prev,i,i.next)>0&&xt(t.prev,t,t.next)>0)}function xt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function ii(i,t){return i.x===t.x&&i.y===t.y}function op(i,t,e,r){let s=Ko(xt(i,t,e)),o=Ko(xt(i,t,r)),n=Ko(xt(e,r,i)),a=Ko(xt(e,r,t));return !!(s!==o&&n!==a||s===0&&jo(i,e,t)||o===0&&jo(i,r,t)||n===0&&jo(e,i,r)||a===0&&jo(e,t,r))}function jo(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Ko(i){return i>0?1:i<0?-1:0}function ry(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&op(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function us(i,t){return xt(i.prev,i,i.next)<0?xt(i,t,i.next)>=0&&xt(i,i.prev,t)>=0:xt(i,t,i.prev)<0||xt(i,i.next,t)<0}function iy(i,t){let e=i,r=false,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function np(i,t){let e=bl(i.i,i.x,i.y),r=bl(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function rp(i,t,e,r){let s=bl(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function cs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ);}function bl(i,t,e){return {i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:false}}function sy(i,t,e,r){let s=0;for(let o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}var ap=g(()=>{});var lp,hp=g(()=>{ap();Yt();lp=qo.default||qo;});function Zo(i,t,e,r,s,o,n){let a=lp(i,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)o[n++]=a[h]+s,o[n++]=a[h+1]+s,o[n++]=a[h+2]+s;let l=s*r;for(let h=0;h<i.length;h+=2)e[l]=i[h],e[l+1]=i[h+1],l+=r;}var vl=g(()=>{hp();});var oy,up,cp=g(()=>{U();vl();oy=[],up={extension:{type:w.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return true},triangulate(i,t,e,r,s,o){Zo(i,oy,t,e,r,s,o);}};});var dp,fp=g(()=>{U();dp={extension:{type:w.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>0&&n>0?(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n,true):false},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2;}};});var pp,mp=g(()=>{U();pp={extension:{type:w.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,true},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2;}};});function xp(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function _p(i,t){let e=gt.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function ny(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(N("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Kt.defaultLinearOptions.textureSize}),t}var gp,Tl,Kt,si=g(()=>{$t();fe();ut();Mo();Rt();Ut();yt();fa();gp=[{offset:0,color:"white"},{offset:1,color:"black"}],Tl=class Sl{constructor(...t){this.uid=it("fillGradient"),this.type="linear",this.colorStops=[];let e=ny(t);e={...e.type==="radial"?Sl.defaultRadialOptions:Sl.defaultLinearOptions,...uo(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:J.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let m=t;t=r,r=m,o*=-1;}if(n<0){let m=e;e=s,s=m,n*=-1;}}let l=this.colorStops.length?this.colorStops:gp,h=this._textureSize,{canvas:u,context:c}=_p(h,1),f=a?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);xp(f,l),c.fillStyle=f,c.fillRect(0,0,h,1),this.texture=new D({source:new Me({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),x=Math.atan2(n,o),y=new F;y.scale(d/h,1),y.rotate(x),y.translate(t,e),this.textureSpace==="local"&&y.scale(h,h),this.transform=y;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:gp,e=this._textureSize,{canvas:r,context:s}=_p(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,u=this.outerRadius,c=a-u,f=l-u,d=e/(u*2),x=(o-c)*d,y=(n-f)*d,m=s.createRadialGradient(x,y,h*d,(a-c)*d,(l-f)*d,u*d);xp(m,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=m,s.translate(x,y),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-x,-y),s.fillRect(0,0,e,e),this.texture=new D({source:new Me({resource:r,addressMode:this._wrapMode})});let p=new F;p.scale(1/d,1/d),p.translate(c,f),this.textureSpace==="local"&&p.scale(e,e),this.transform=p;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};Tl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Tl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Kt=Tl;});function yp(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(ly);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,u=1/n.height,c=-a*h,f=-l*u,d=s.a,x=s.b,y=s.c,m=s.d;s.a*=h,s.b*=h,s.c*=u,s.d*=u,s.tx=c*d+f*y+s.tx,s.ty=c*x+f*m+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 Kt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(ay.copyFrom(r).invert()),s}var ay,ly,bp=g(()=>{ut();Xt();si();ay=new F,ly=new st;});function Sp(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")cy(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,h=o.data.hole;n&&h&&vp(h.shapePath,l,true,r,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),vp(a,l,n,r,e);}}}function cy(i,t,e){let r=[],s=Qo.rectangle,o=hy;o.x=i.dx,o.y=i.dy,o.width=i.dw,o.height=i.dh;let n=i.transform;if(!s.build(o,r))return;let{vertices:a,uvs:l,indices:h}=e,u=h.length,c=a.length/2;n&&xl(r,n),s.triangulate(r,a,2,c,h,u);let f=i.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let x=wt.get(Sr);x.indexOffset=u,x.indexSize=h.length-u,x.attributeOffset=c,x.attributeSize=a.length/2-c,x.baseColor=i.style,x.alpha=i.alpha,x.texture=f,x.geometryData=e,t.push(x);}function vp(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:l,transform:h,holes:u})=>{let c=[],f=Qo[l.type];if(!f.build(l,c))return;let d=a.length,x=o.length/2,y="triangle-list";if(h&&xl(c,h),e){let v=l.closePath??true,S=t;S.pixelLine?(tp(c,v,o,a),y="line-list"):Qf(c,S,false,v,o,a);}else if(u){let v=[],S=c.slice();dy(u).forEach(T=>{v.push(S.length/2),S.push(...T);}),Zo(S,v,o,2,x,a,d);}else f.triangulate(c,o,2,x,a,d);let m=n.length/2,p=t.texture;if(p!==D.WHITE){let v=yp(uy,t,l,h);Vf(o,2,x,n,m,2,o.length/2-x,v);}else Wf(n,m,2,o.length/2-x);let b=wt.get(Sr);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=x,b.attributeSize=o.length/2-x,b.baseColor=t.color,b.alpha=t.alpha,b.texture=p,b.geometryData=s,b.topology=y,r.push(b);});}function dy(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Qo[r.type].build(r,s)&&t.push(s);}return t}var Qo,hy,uy,Tp=g(()=>{U();ut();Xt();Hf();Yf();Rt();pr();_l();jf();Jf();ep();cp();fp();mp();bp();vl();Qo={};W.handleByMap(w.ShapeBuilder,Qo);W.add(dp,up,pp,ri,$f,Xf);hy=new st,uy=new F;});var wl,Cl,Ml,oi,Jo=g(()=>{U();xd();Nf();ca();yt();pr();Tp();wl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},Cl=class{constructor(){this.instructions=new Dr;}init(t){this.batcher=new zf({maxTextures:t}),this.instructions.reset();}get geometry(){return N(xu,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Ml=class Pl{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){Pl.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Pl.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),Sp(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"?e.isBatchable=e.geometryData.vertices.length<400:e.isBatchable=true,t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=wt.get(Cl,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let c=r[u];a.add(c);}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,true),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,true);let h=a.batches;for(let u=0;u<h.length;u++){let c=h[u];c.bindGroup=gd(c.textures.textures,c.textures.count,this._renderer.limits.maxBatchableTextures);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wl;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]&&(wt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{wt.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};Ml.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};Ml.defaultOptions={bezierSmoothness:.5};oi=Ml;});var fy,El,Al,Il,Ll,Rl,Fl,Bl,Cr,tn=g(()=>{fy={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},El=0,Al=1,Il=2,Ll=3,Rl=4,Fl=5,Bl=class wp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<El)}set blend(t){!!(this.data&1<<El)!==t&&(this.data^=1<<El);}get offsets(){return !!(this.data&1<<Al)}set offsets(t){!!(this.data&1<<Al)!==t&&(this.data^=1<<Al);}set cullMode(t){if(t==="none"){this.culling=false;return}this.culling=true,this.clockwiseFrontFace=t==="front";}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return !!(this.data&1<<Il)}set culling(t){!!(this.data&1<<Il)!==t&&(this.data^=1<<Il);}get depthTest(){return !!(this.data&1<<Ll)}set depthTest(t){!!(this.data&1<<Ll)!==t&&(this.data^=1<<Ll);}get depthMask(){return !!(this.data&1<<Fl)}set depthMask(t){!!(this.data&1<<Fl)!==t&&(this.data^=1<<Fl);}get clockwiseFrontFace(){return !!(this.data&1<<Rl)}set clockwiseFrontFace(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=fy[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 wp;return t.depthTest=false,t.blend=true,t}};Bl.default2d=Bl.for2d();Cr=Bl;});function Je(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r;}var ds=g(()=>{});var kl,fs,Cp=g(()=>{U();tn();pr();ds();_l();kl=class{constructor(){this.batches=[],this.batched=false;}destroy(){this.batches.forEach(t=>{wt.return(t);}),this.batches.length=0;}},fs=class{constructor(t,e){this.state=Cr.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this);}contextChange(){this._adaptor.contextChange(this.renderer);}validateRenderable(t){let e=t.context,r=!!t._gpuData,s=this.renderer.graphicsContext.updateGpuContext(e);return !!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t));}updateRenderable(t){let r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let o=r[s];o._batcher.updateElement(o);}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Je(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e);}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new kl;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=s.batches.map(n=>{let a=wt.get(Sr);return n.copyTo(a),a.renderable=t,a.roundPixels=o,a});}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;}};fs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"};});var Gl=g(()=>{U();Jo();Cp();W.add(fs);W.add(oi);});var tr,en=g(()=>{tr=class{constructor(){this.batcherName="default",this.packAsQuad=false,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1;}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t;}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1;}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1);}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}};});var rn,ps,Pp=g(()=>{U();ut();rs();Qe();is();ds();en();rn=class{destroy(){}},ps=class{constructor(t,e){this.localUniforms=new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new le({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init();}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return true;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,true;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return false}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e);}else r.break(e),e.add(t);}updateRenderable(t){if(t.batched){let e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ne(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Je(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new rn),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new rn),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new tr;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};ps.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"};});var Ol=g(()=>{U();Pp();W.add(ps);});var sn,Mp=g(()=>{sn=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0);}};});function Dl(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var Ep=g(()=>{});function Ip(i){return {dynamicUpdate:Ap(i,true),staticUpdate:Ap(i,false)}}function Ap(i,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 = ${r};
266
266
  `);let s=e.join(`
267
- `);return new Function("ps","f32v","u32v",s)}var Lp=x(()=>{Oo();});function py(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s");}return t.join("_")}var on,Rp=x(()=>{jr();Xr();os();Oo();ja();Ep();Lp();on=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let u in r){let c=r[u],f=vr(c.format);c.dynamic?o+=f.stride:s+=f.stride;}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ee(e*4*s),this.dynamicAttributeBuffer=new Ee(e*4*o),this.indexBuffer=Dl(e);let n=new Ae,a=0,l=0;this._staticBuffer=new Ft({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:false,usage:lt.VERTEX|lt.COPY_DST}),this._dynamicBuffer=new Ft({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:false,usage:lt.VERTEX|lt.COPY_DST});for(let u in r){let c=r[u],f=vr(c.format);c.dynamic?(n.addAttribute(c.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:c.format}),a+=f.size):(n.addAttribute(c.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:c.format}),l+=f.size);}n.addIndex(this.indexBuffer);let h=this.getParticleUpdate(r);this._dynamicUpload=h.dynamicUpdate,this._staticUpload=h.staticUpdate,this.geometry=n;}getParticleUpdate(t){let e=py(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Ip(t)}update(t,e){t.length>this._size&&(e=true,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ee(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ee(this._size*this._dynamicStride*4*4),this.indexBuffer=Dl(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,true));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,true),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,true);}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy();}};});var Fp,Bp=x(()=>{Fp=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var Lp=g(()=>{Oo();});function py(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s");}return t.join("_")}var on,Rp=g(()=>{jr();Xr();os();Oo();ja();Ep();Lp();on=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let u in r){let c=r[u],f=vr(c.format);c.dynamic?o+=f.stride:s+=f.stride;}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ee(e*4*s),this.dynamicAttributeBuffer=new Ee(e*4*o),this.indexBuffer=Dl(e);let n=new Ae,a=0,l=0;this._staticBuffer=new Ft({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:false,usage:lt.VERTEX|lt.COPY_DST}),this._dynamicBuffer=new Ft({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:false,usage:lt.VERTEX|lt.COPY_DST});for(let u in r){let c=r[u],f=vr(c.format);c.dynamic?(n.addAttribute(c.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:c.format}),a+=f.size):(n.addAttribute(c.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:c.format}),l+=f.size);}n.addIndex(this.indexBuffer);let h=this.getParticleUpdate(r);this._dynamicUpload=h.dynamicUpdate,this._staticUpload=h.staticUpdate,this.geometry=n;}getParticleUpdate(t){let e=py(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Ip(t)}update(t,e){t.length>this._size&&(e=true,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ee(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ee(this._size*this._dynamicStride*4*4),this.indexBuffer=Dl(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,true));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,true),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,true);}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy();}};});var Fp,Bp=g(()=>{Fp=`varying vec2 vUV;
268
268
  varying vec4 vColor;
269
269
 
270
270
  uniform sampler2D uTexture;
@@ -272,7 +272,7 @@ uniform sampler2D uTexture;
272
272
  void main(void){
273
273
  vec4 color = texture2D(uTexture, vUV) * vColor;
274
274
  gl_FragColor = color;
275
- }`;});var kp,Gp=x(()=>{kp=`attribute vec2 aVertex;
275
+ }`;});var kp,Gp=g(()=>{kp=`attribute vec2 aVertex;
276
276
  attribute vec2 aUV;
277
277
  attribute vec4 aColor;
278
278
 
@@ -311,7 +311,7 @@ void main(void){
311
311
  vUV = aUV;
312
312
  vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
313
313
  }
314
- `;});var Ul,Op=x(()=>{Ul=`
314
+ `;});var Ul,Op=g(()=>{Ul=`
315
315
  struct ParticleUniforms {
316
316
  uProjectionMatrix:mat3x3<f32>,
317
317
  uColor:vec4<f32>,
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`;});var nn,Dp=x(()=>{$t();ut();Go();Uo();as();Rt();Ur();Bp();Gp();Op();nn=class extends Le{constructor(){let t=qr.from({vertex:kp,fragment:Fp}),e=qe.from({fragment:{source:Ul,entryPoint:"mainFragment"},vertex:{source:Ul,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:D.WHITE.source,uSampler:new ae({}),uniforms:{uTranslationMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new J(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var ni,zl=x(()=>{ut();Qe();is();tn();ds();Rp();Dp();ni=class{constructor(t,e){this.state=Cr.for2d(),this.localUniforms=new Vt({uTranslationMatrix:{value:new F,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 nn,this.state=Cr.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new on({size:t.particleChildren.length,properties:t._properties}),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=Ne(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Je(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var ms,Up=x(()=>{U();Mp();zl();ms=class extends ni{constructor(t){super(t,new sn);}};ms.extension={type:[w.WebGLPipes],name:"particle"};});var an,zp=x(()=>{an=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,true),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6});}};});var gs,Np=x(()=>{U();zp();zl();gs=class extends ni{constructor(t){super(t,new an);}};gs.extension={type:[w.WebGPUPipes],name:"particle"};});var Nl=x(()=>{U();Up();Np();W.add(ms);W.add(gs);});function xs(i,t){let{texture:e,bounds:r}=i;wo(r,t._anchor,e);let s=t._style._getFinalPadding();r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s;}var Vl=x(()=>{Na();});var ai,Wl=x(()=>{ai=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=true,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null;}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null;}destroy(){}};});var ln,Vp=x(()=>{Wl();ln=class extends ai{constructor(t){super(),this._renderer=t,t.runners.resolutionChange.add(this);}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate();}destroy(){this._renderer.canvasText.returnTexture(this.texture),this._renderer=null;}};});var _s,Wp=x(()=>{U();Vl();Vp();_s=class{constructor(t){this._renderer=t;}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t),t._didTextUpdate=false),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e);}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.returnTexture(e.texture),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=e.texture=this._renderer.canvasText.getTexture(t),xs(e,t);}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new ln(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null;}};_s.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"};});var Hp,Ve,hn=x(()=>{ut();Ut();Hp={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"}},Ve=class{constructor(t,e){this.uid=it("fillPattern"),this.transform=new F,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Hp[e].addressModeU,t.source.style.addressModeV=Hp[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 $p=$s((C1,Yp)=>{Yp.exports=gy;var Hl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},my=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function gy(i){var t=[];return i.replace(my,function(e,r,s){var o=r.toLowerCase();for(s=_y(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Hl[o])return s.unshift(r),t.push(s);if(s.length<Hl[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Hl[o])));}}),t}var xy=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function _y(i){var t=i.match(xy);return t?t.map(Number):[]}});function jp(i,t){let e=(0, Xp.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],h=l[0],u=l;switch(h){case "M":o=u[1],n=u[2],t.moveTo(o,n);break;case "m":o+=u[1],n+=u[2],t.moveTo(o,n);break;case "H":o=u[1],t.lineTo(o,n);break;case "h":o+=u[1],t.lineTo(o,n);break;case "V":n=u[1],t.lineTo(o,n);break;case "v":n+=u[1],t.lineTo(o,n);break;case "L":o=u[1],n=u[2],t.lineTo(o,n);break;case "l":o+=u[1],n+=u[2],t.lineTo(o,n);break;case "C":o=u[5],n=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case "c":t.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case "S":o=u[3],n=u[4],t.bezierCurveToShort(u[1],u[2],o,n);break;case "s":t.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "Q":o=u[3],n=u[4],t.quadraticCurveTo(u[1],u[2],o,n);break;case "q":t.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "T":o=u[1],n=u[2],t.quadraticCurveToShort(o,n);break;case "t":o+=u[1],n+=u[2],t.quadraticCurveToShort(o,n);break;case "A":o=u[6],n=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "a":o+=u[6],n+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "Z":case "z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:Z(`Unknown SVG path command: ${h}`);}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s));}return t}var Xp,Kp=x(()=>{Xp=Hn($p());zt();});var un,qp=x(()=>{Xt();un=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r;}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return false;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return false;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*r,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(r-l)}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 cn,Zp=x(()=>{Xt();cn=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s;}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return false;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return false;let a=r*(1-s),l=r-a,h=o-l,u=n-l,c=o+a,f=n+a,d=t-this.x,g=e-this.y,y=d*d/(h*h)+g*g/(u*u),m=d*d/(c*c)+g*g/(f*f);return y>1&&m<=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 Qp(i,t,e,r,s,o){let n=i-e,a=t-r,l=s-e,h=o-r,u=n*l+a*h,c=l*l+h*h,f=-1;c!==0&&(f=u/c);let d,g;f<0?(d=e,g=r):f>1?(d=s,g=o):(d=e+f*l,g=r+f*h);let y=i-d,m=t-g;return y*y+m*m}var Jp=x(()=>{});var yy,by,li,tm=x(()=>{Jp();Xt();li=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r;}this.points=e,this.closePath=true;}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],l=e[(s+3)%r];t+=(a-o)*(l+n);}return t<0}containsPolygon(t){let e=this.getBounds(yy),r=t.getBounds(by);if(!e.containsRect(r))return false;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 false}return true}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=false,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],u=this.points[n*2+1];l>e!=u>e&&t<(h-a)*((e-l)/(u-l))+a&&(r=!r);}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let u=0;u<h;u+=2){let c=l[u],f=l[u+1],d=l[(u+2)%l.length],g=l[(u+3)%l.length],y=Qp(t,e,c,f,d,g),m=Math.sign((d-c)*(e-f)-(g-f)*(t-c));if(y<=(m<0?a:n))return true}return false}getBounds(t){t||(t=new st);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let h=e[a],u=e[a+1];r=h<r?h:r,s=h>s?h:s,o=u<o?u:o,n=u>n?u:n;}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}};});var dn,fn,em=x(()=>{Xt();dn=(i,t,e,r,s,o,n)=>{let a=i-e,l=t-r,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},fn=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o;}getBounds(t){return t||(t=new st),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return false;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return true;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return true}return false}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,u=r*(1-s),c=r-u,f=o+h,d=n+h,g=a-h*2,y=l-h*2,m=o+a,p=n+l;return (t>=o-u&&t<=o+c||t>=m-c&&t<=m+u)&&e>=d&&e<=d+y||(e>=n-u&&e<=n+c||e>=p-c&&e<=p+u)&&t>=f&&t<=f+g?true:t<f&&e<d&&dn(t,e,f,d,h,c,u)||t>m-h&&e<d&&dn(t,e,m-h,d,h,c,u)||t>m-h&&e>p-h&&dn(t,e,m-h,p-h,h,c,u)||t<f&&e>p-h&&dn(t,e,f,p-h,h,c,u)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function mn(i,t,e,r,s,o,n,a,l,h){let c=Math.min(.99,Math.max(0,h??oi.defaultOptions.bezierSmoothness)),f=(Sy-c)/1;return f*=f,Ty(t,e,r,s,o,n,a,l,i,f),i}function Ty(i,t,e,r,s,o,n,a,l,h){$l(i,t,e,r,s,o,n,a,l,h,0),l.push(n,a);}function $l(i,t,e,r,s,o,n,a,l,h,u){if(u>vy)return;let c=Math.PI,f=(i+e)/2,d=(t+r)/2,g=(e+s)/2,y=(r+o)/2,m=(s+n)/2,p=(o+a)/2,b=(f+g)/2,v=(d+y)/2,S=(g+m)/2,P=(y+p)/2,T=(b+S)/2,C=(v+P)/2;if(u>0){let G=n-i,E=a-t,L=Math.abs((e-n)*E-(r-a)*G),R=Math.abs((s-n)*E-(o-a)*G),j,ot;if(L>pn&&R>pn){if((L+R)*(L+R)<=h*(G*G+E*E)){if(hi<Yl){l.push(T,C);return}let Lt=Math.atan2(o-r,s-e);if(j=Math.abs(Lt-Math.atan2(r-t,e-i)),ot=Math.abs(Math.atan2(a-o,n-s)-Lt),j>=c&&(j=2*c-j),ot>=c&&(ot=2*c-ot),j+ot<hi){l.push(T,C);return}if(Pr!==0){if(j>Pr){l.push(e,r);return}if(ot>Pr){l.push(s,o);return}}}}else if(L>pn){if(L*L<=h*(G*G+E*E)){if(hi<Yl){l.push(T,C);return}if(j=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),j>=c&&(j=2*c-j),j<hi){l.push(e,r),l.push(s,o);return}if(Pr!==0&&j>Pr){l.push(e,r);return}}}else if(R>pn){if(R*R<=h*(G*G+E*E)){if(hi<Yl){l.push(T,C);return}if(j=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),j>=c&&(j=2*c-j),j<hi){l.push(e,r),l.push(s,o);return}if(Pr!==0&&j>Pr){l.push(s,o);return}}}else if(G=T-(i+n)/2,E=C-(t+a)/2,G*G+E*E<=h){l.push(T,C);return}}$l(i,t,f,d,b,v,T,C,l,h,u+1),$l(T,C,S,P,m,p,n,a,l,h,u+1);}var vy,pn,Sy,Yl,hi,Pr,Xl=x(()=>{Jo();vy=8,pn=11920929e-14,Sy=1,Yl=.01,hi=0,Pr=0;});function im(i,t,e,r,s,o,n,a){let h=Math.min(.99,Math.max(0,a??oi.defaultOptions.bezierSmoothness)),u=(Py-h)/1;return u*=u,Ey(t,e,r,s,o,n,i,u),i}function Ey(i,t,e,r,s,o,n,a){jl(n,i,t,e,r,s,o,a,0),n.push(s,o);}function jl(i,t,e,r,s,o,n,a,l){if(l>wy)return;let h=Math.PI,u=(t+r)/2,c=(e+s)/2,f=(r+o)/2,d=(s+n)/2,g=(u+f)/2,y=(c+d)/2,m=o-t,p=n-e,b=Math.abs((r-o)*p-(s-n)*m);if(b>Cy){if(b*b<=a*(m*m+p*p)){if(rm<My){i.push(g,y);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=h&&(v=2*h-v),v<rm){i.push(g,y);return}}}else if(m=g-(t+o)/2,p=y-(e+n)/2,m*m+p*p<=a){i.push(g,y);return}jl(i,t,e,u,c,g,y,a,l+1),jl(i,g,y,f,d,o,n,a,l+1);}var wy,Cy,Py,My,rm,sm=x(()=>{Jo();wy=8,Cy=11920929e-14,Py=1,My=.01,rm=0;});function gn(i,t,e,r,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,u=s;h*=n?-1:1;for(let c=0;c<a+1;c++){let f=Math.cos(u),d=Math.sin(u),g=t+f*r,y=e+d*r;i.push(g,y),u+=h;}}var Kl=x(()=>{});function om(i,t,e,r,s,o){let n=i[i.length-2],l=i[i.length-1]-e,h=n-t,u=s-e,c=r-t,f=Math.abs(l*c-h*u);if(f<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let d=l*l+h*h,g=u*u+c*c,y=l*u+h*c,m=o*Math.sqrt(d)/f,p=o*Math.sqrt(g)/f,b=m*y/d,v=p*y/g,S=m*c+p*h,P=m*u+p*l,T=h*(p+b),C=l*(p+b),G=c*(m+v),E=u*(m+v),L=Math.atan2(C-P,T-S),R=Math.atan2(E-P,G-S);gn(i,S+t,P+e,o,L,R,h*u>c*l);}var nm=x(()=>{Kl();});function Ay(i,t){let e=t===-1.5707963267948966?-0.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return [{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function lm(i,t,e,r,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let u=Math.sin(a*ys/360),c=Math.cos(a*ys/360),f=c*(t-r)/2+u*(e-s)/2,d=-u*(t-r)/2+c*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let g=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);g>1&&(o*=Math.sqrt(g),n*=Math.sqrt(g)),Iy(t,e,r,s,o,n,l,h,u,c,f,d,ql);let{ang1:y,ang2:m}=ql,{centerX:p,centerY:b}=ql,v=Math.abs(m)/(ys/4);Math.abs(1-v)<1e-7&&(v=1);let S=Math.max(Math.ceil(v),1);m/=S;let P=i[i.length-2],T=i[i.length-1],C={x:0,y:0};for(let G=0;G<S;G++){let E=Ay(y,m),{x:L,y:R}=Zl(E[0],o,n,c,u,p,b,C),{x:j,y:ot}=Zl(E[1],o,n,c,u,p,b,C),{x:Lt,y:Ai}=Zl(E[2],o,n,c,u,p,b,C);mn(i,P,T,L,R,j,ot,Lt,Ai),P=Lt,T=Ai,y+=m;}}var ys,ql,Zl,am,Iy,hm=x(()=>{Xl();ys=Math.PI*2,ql={centerX:0,centerY:0,ang1:0,ang2:0},Zl=({x:i,y:t},e,r,s,o,n,a,l)=>{i*=e,t*=r;let h=s*i-o*t,u=o*i+s*t;return l.x=h+n,l.y=u+a,l};am=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},Iy=(i,t,e,r,s,o,n,a,l,h,u,c,f)=>{let d=Math.pow(s,2),g=Math.pow(o,2),y=Math.pow(u,2),m=Math.pow(c,2),p=d*g-d*m-g*y;p<0&&(p=0),p/=d*m+g*y,p=Math.sqrt(p)*(n===a?-1:1);let b=p*s/o*c,v=p*-o/s*u,S=h*b-l*v+(i+e)/2,P=l*b+h*v+(t+r)/2,T=(u-b)/s,C=(c-v)/o,G=(-u-b)/s,E=(-c-v)/o,L=am(1,0,T,C),R=am(T,C,G,E);a===0&&R>0&&(R-=ys),a===1&&R<0&&(R+=ys),f.centerX=S,f.centerY=P,f.ang1=L,f.ang2=R;};});function um(i,t,e){let r=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,u=Math.sqrt(l*l+h*h),c=l/u,f=h/u;return {len:u,nx:c,ny:f}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y);},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let h=t[(n+1)%t.length],u=r(a,o),c=r(a,h);if(u.len<1e-4||c.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(u.nx*c.ny-u.ny*c.nx),d=1,g=false;u.nx*c.nx-u.ny*-c.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,g=true):f>0&&(d=-1,g=true);let y=f/2,m,p=Math.abs(Math.cos(y)*l/Math.sin(y));p>Math.min(u.len/2,c.len/2)?(p=Math.min(u.len/2,c.len/2),m=Math.abs(p*Math.sin(y)/Math.cos(y))):m=l;let b=a.x+c.nx*p+-c.ny*m*d,v=a.y+c.ny*p+c.nx*m*d,S=Math.atan2(u.ny,u.nx)+Math.PI/2*d,P=Math.atan2(c.ny,c.nx)-Math.PI/2*d;n===0&&i.moveTo(b+Math.cos(S)*m,v+Math.sin(S)*m),i.arc(b,v,m,S,P,g),o=a;}}function cm(i,t,e,r){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,h)=>({x:a.x+(l.x-a.x)*h,y:a.y+(l.y-a.y)*h}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],h=l.radius??e;if(h<=0){a===0?i.moveTo(l.x,l.y):i.lineTo(l.x,l.y);continue}let u=t[a],c=t[(a+2)%n],f=s(u,l),d;if(f<1e-4)d=l;else {let m=Math.min(f/2,h);d=o(l,u,m/f);}let g=s(c,l),y;if(g<1e-4)y=l;else {let m=Math.min(g/2,h);y=o(l,c,m/g);}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(l.x,l.y,y.x,y.y,r);}}var dm=x(()=>{});var Ly,xn,fm=x(()=>{qp();Zp();tm();Xt();em();ce();Xl();sm();Kl();nm();hm();dm();Ly=new st,xn=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new mt,this._graphicsPath2D=t,this.signed=t.checkForHoles;}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return (s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(false);let a=this._currentPoly.points;return gn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return om(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let l=this._currentPoly.points;return lm(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return mn(this._currentPoly.points,l.lastX,l.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return im(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(true),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(true),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data);}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let l=a.shape,h=o?.shape;h&&h.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a;}}}return this}finish(t=false){this.endPoly(t);}rect(t,e,r,s,o){return this.drawShape(new st(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new un(t,e,r),s),this}poly(t,e,r){let s=new li(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,h=[];for(let u=0;u<s;u++){let c=a-u*l;h.push(t+r*Math.cos(c),e+r*Math.sin(c));}return this.poly(h,true,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let l=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let h=-1*Math.PI/2+n,u=Math.PI*2/s,c=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*u+h,g=t+r*Math.cos(d),y=e+r*Math.sin(d),m=d+Math.PI+c,p=d-Math.PI-c,b=g+o*Math.cos(m),v=y+o*Math.sin(m),S=g+o*Math.cos(p),P=y+o*Math.sin(p);f===0?this.moveTo(b,v):this.lineTo(b,v),this.quadraticCurveTo(g,y,S,P,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?cm(this,t,e,s):um(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+r,h=e+s,u=a<0?-a:0,c=Math.abs(a);return this.moveTo(t,e+c).arcTo(t+u,e+u,t+c,e,c).lineTo(l-c,e).arcTo(l-u,e+u,l,e+c,c).lineTo(l,h-c).arcTo(l-u,h-u,t+r-c,h,c).lineTo(t+c,h).arcTo(t+u,h-u,t,h-c,c).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),l=t+r,h=e+s,u=[t+a,e,l-a,e,l,e+a,l,h-a,l-a,h,t+a,h,t,h-a,t,e+a];for(let c=u.length-1;c>=2;c-=2)u[c]===u[c-2]&&u[c-1]===u[c-3]&&u.splice(c-1,2);return this.poly(u,true,n)}ellipse(t,e,r,s,o){return this.drawShape(new cn(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new fn(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new li,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=false){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=true){if(!this._currentPoly&&(this._currentPoly=new li,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty;}this._currentPoly.points.push(r,s);}else this._currentPoly.points.push(0,0);}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data);}this.finish();}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Ly);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function bs(i,t){return i?i.prepend(t):t.clone()}var er,Ql=x(()=>{we();Ut();zt();Kp();fm();er=class i{constructor(t,e=false){this.instructions=[],this.uid=it("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?jp(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new xn(this)),this._dirty&&(this._dirty=false,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=true,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=true,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=true,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=true,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=true,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(rt.shared),l=0,h=0;if(!n||n.action!=="bezierCurveTo")l=a.x,h=a.y;else {l=n.data[2],h=n.data[3];let u=a.x,c=a.y;l=u+(u-l),h=c+(c-h);}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,r,s,o]}),this._dirty=true,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=true,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=true,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=true,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=true,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(rt.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 l=o.x,h=o.y;n=l+(l-n),a=h+(h-a);}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=true,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=true,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=true,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=true,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=true,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=true,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=true,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=true,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=true,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=true,this}star(t,e,r,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=r*2,u=Math.PI*2/h,c=[];for(let f=0;f<h;f++){let d=f%2?o:s,g=f*u+l;c.push(t+d*Math.cos(g),e+d*Math.sin(g));}return this.poly(c,true,a),this}clone(t=false){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()});}return e}clear(){return this.instructions.length=0,this._dirty=true,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,h=0,u=0,c=0,f=0,d=0,g=0,y=0;for(let m=0;m<this.instructions.length;m++){let p=this.instructions[m],b=p.data;switch(p.action){case "moveTo":case "lineTo":l=b[0],h=b[1],b[0]=e*l+s*h+n,b[1]=r*l+o*h+a;break;case "bezierCurveTo":u=b[0],c=b[1],f=b[2],d=b[3],l=b[4],h=b[5],b[0]=e*u+s*c+n,b[1]=r*u+o*c+a,b[2]=e*f+s*d+n,b[3]=r*f+o*d+a,b[4]=e*l+s*h+n,b[5]=r*l+o*h+a;break;case "quadraticCurveTo":u=b[0],c=b[1],l=b[2],h=b[3],b[0]=e*u+s*c+n,b[1]=r*u+o*c+a,b[2]=e*l+s*h+n,b[3]=r*l+o*h+a;break;case "arcToSvg":l=b[5],h=b[6],g=b[0],y=b[1],b[0]=e*g+s*y,b[1]=r*g+o*y,b[5]=e*l+s*h+n,b[6]=r*l+o*h+a;break;case "circle":b[4]=bs(b[3],t);break;case "rect":b[4]=bs(b[4],t);break;case "ellipse":b[8]=bs(b[8],t);break;case "roundRect":b[5]=bs(b[5],t);break;case "addPath":b[0].transform(t);break;case "poly":b[2]=bs(b[2],t);break;default:Z("unknown transform action",p.action);break}}return this._dirty=true,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e];}switch(r.action){case "moveTo":case "lineTo":t.x=r.data[0],t.y=r.data[1];break;case "quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case "bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case "arc":case "arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case "addPath":r.data[0].getLastPoint(t);break}return t}};});function pt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Jl=x(()=>{});function pm(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case "lineargradient":t.defs[n.id]=Ry(n);break;case "radialgradient":t.defs[n.id]=Fy();break;}}}}function Ry(i){let t=pt(i,"x1",0),e=pt(i,"y1",0),r=pt(i,"x2",1),s=pt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Kt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let l=i.children[a],h=pt(l,"offset",0),u=J.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(h,u);}return n}function Fy(i){return Z("[SVG Parser] Radial gradients are not yet supported"),new Kt(0,0,1,0)}var mm=x(()=>{$t();zt();si();Jl();});function th(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var gm=x(()=>{});function eh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in xm){let a=i.getAttribute(n);a&&_m(t,o,n,a.trim());}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[h,u]=l.split(":");xm[h]&&_m(t,o,h,u.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function _m(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=th(r);t.strokeStyle.fill=i.defs[s];}else t.strokeStyle.color=J.shared.setValue(r).toNumber();t.useStroke=true;}break;case "stroke-width":t.strokeStyle.width=Number(r);break;case "fill":if(r!=="none"){if(r.startsWith("url(")){let s=th(r);t.fillStyle.fill=i.defs[s];}else t.fillStyle.color=J.shared.setValue(r).toNumber();t.useFill=true;}break;case "fill-opacity":t.fillStyle.alpha=Number(r);break;case "stroke-opacity":t.strokeStyle.alpha=Number(r);break;case "opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var xm,ym=x(()=>{$t();gm();xm={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 bm(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg");}let e={context:t,defs:{},path:new er};pm(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=eh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&vm(a,e,s,o);}return t}function vm(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=eh(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let l,h,u,c,f,d,g,y,m,p,b,v,S,P,T,C,G;switch(i.nodeName.toLowerCase()){case "path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&Z("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new er(P,true),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":g=pt(i,"cx",0),y=pt(i,"cy",0),m=pt(i,"r",0),t.context.ellipse(g,y,m,m),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "rect":l=pt(i,"x",0),h=pt(i,"y",0),C=pt(i,"width",0),G=pt(i,"height",0),p=pt(i,"rx",0),b=pt(i,"ry",0),p||b?t.context.roundRect(l,h,C,G,p||b):t.context.rect(l,h,C,G),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "ellipse":g=pt(i,"cx",0),y=pt(i,"cy",0),p=pt(i,"rx",0),b=pt(i,"ry",0),t.context.beginPath(),t.context.ellipse(g,y,p,b),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "line":u=pt(i,"x1",0),c=pt(i,"y1",0),f=pt(i,"x2",0),d=pt(i,"y2",0),t.context.beginPath(),t.context.moveTo(u,c),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case "polygon":S=i.getAttribute("points"),v=S.match(/\d+/g).map(E=>parseInt(E,10)),t.context.poly(v,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":S=i.getAttribute("points"),v=S.match(/\d+/g).map(E=>parseInt(E,10)),t.context.poly(v,false),r&&t.context.stroke(r);break;case "g":case "svg":break;default:{Z(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let E=0;E<s.length;E++)vm(s[E],t,e,r);}var Sm=x(()=>{zt();Ql();mm();Jl();ym();});function By(i){return J.isColorLike(i)}function Tm(i){return i instanceof Ve}function wm(i){return i instanceof Kt}function ky(i){return i instanceof D}function Gy(i,t,e){let r=J.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=D.WHITE,{...e,...i}}function Oy(i,t,e){return i.texture=t,{...e,...i}}function Cm(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function Pm(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function Dy(i,t){let e={...t,...i},r=J.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function We(i,t){if(i==null)return null;let e={},r=i;return By(i)?Gy(e,i,t):ky(i)?Oy(e,i,t):Tm(i)?Cm(e,i,t):wm(i)?Pm(e,i,t):r.fill&&Tm(r.fill)?Cm(r,r.fill,t):r.fill&&wm(r.fill)?Pm(r,r.fill,t):Dy(r,t)}function ui(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=We(i,l);return h?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var rh=x(()=>{$t();Rt();si();hn();});var Uy,Mm,ih,Jt,sh=x(()=>{Yt();$t();ut();we();Rt();Ut();yt();ce();Ql();Sm();rh();Uy=new rt,Mm=new F,ih=class Re extends et{constructor(){super(...arguments),this.uid=it("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new er,this._transform=new F,this._fillStyle={...Re.defaultFillStyle},this._strokeStyle={...Re.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new mt,this._boundsDirty=true;}clone(){let t=new Re;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=true,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=We(t,Re.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ui(t,Re.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=We(t,Re.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=We(t,Re.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?J.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new er,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(N(q,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=We(t,Re.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(rt.shared);this._activePath.clear(),this._activePath.moveTo(t,e);}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ui(t,Re.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else {e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,bm(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof F?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof F?(this._transform.append(t),this):(Mm.set(t,e,r,s,o,n),this._transform.append(Mm),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=true,this._boundsDirty=true);}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds);}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform);}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a);}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return false;let e=this.instructions,r=false;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,h=a.shapePath.shapePrimitives;for(let u=0;u<h.length;u++){let c=h[u].shape;if(!l||!c)continue;let f=h[u].transform,d=f?f.applyInverse(t,Uy):t;if(o.action==="fill")r=c.contains(d.x,d.y);else {let y=l;r=c.strokeContains(d.x,d.y,y.width,y.alignment);}let g=n.hole;if(g){let y=g.shapePath?.shapePrimitives;if(y)for(let m=0;m<y.length;m++)y[m].shape.contains(d.x,d.y)&&(r=false);}if(r)return true}}return r}destroy(t=false){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r);}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null;}};ih.defaultFillStyle={color:16777215,alpha:1,texture:D.WHITE,matrix:null,fill:null,textureSpace:"local"};ih.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:D.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Jt=ih;});function Am(i){let t=[],e=0;for(let r=0;r<Em.length;r++){let s=`_${Em[r]}`;t[e++]=i[s];}return e=Im(i._fill,t,e),e=Ny(i._stroke,t,e),e=Vy(i.dropShadow,t,e),e=zy(i.filters,t,e),t.join("-")}function zy(i,t,e){if(!i)return e;for(let r of i)t[e++]=r.uid;return e}function Im(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Ny(i,t,e){return i&&(e=Im(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function Vy(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=J.shared.setValue(i.color).toNumber()),e}var Em,Lm=x(()=>{$t();Em=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function Wy(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=he.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance};}if(t.strokeThickness!==void 0){N(q,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(J.isColorLike(e))r.color=e;else if(e instanceof Kt||e instanceof Ve)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness};}if(Array.isArray(t.fillGradientStops)){N(q,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=he.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Kt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>J.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o);}),i.fill={fill:r};}}var oh,he,vs=x(()=>{Yt();$t();yt();si();hn();sh();rh();Lm();oh=class ci extends et{constructor(t={}){super(),Wy(t);let e={...ci.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r];}this.update();}get align(){return this._align}set align(t){this._align=t,this.update();}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update();}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ci.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ci.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 filters(){return this._filters}set filters(t){this._filters=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({...Jt.defaultFillStyle,...t},()=>{this._fill=We({...this._originalFill},Jt.defaultFillStyle);})),this._fill=We(t===0?"black":t,Jt.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Jt.defaultStrokeStyle,...t},()=>{this._stroke=ui({...this._originalStroke},Jt.defaultStrokeStyle);})),this._stroke=ui(t,Jt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=Am(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=ci.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ci({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,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=false){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r);}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null;}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),true)})}_isFillStyle(t){return (t??null)!==null&&!(J.isColorLike(t)||t instanceof Kt||t instanceof Ve)}};oh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};oh.defaultTextStyle={align:"left",breakWords:false,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:false,whiteSpace:"pre",wordWrap:false,wordWrapWidth:100};he=oh;});function _n(i,t,e,r){let s=Hy;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=kt.getOptimalTexture(s.width,s.height,r,false);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var Hy,nh=x(()=>{zr();ce();Hy=new mt;});var ah,Fe,Ss=x(()=>{fe();zi();ah=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=gt.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return {canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Oe(t),e=Oe(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Fe=new ah;});function Yy(i,t){Mr||(Mr=gt.get().createCanvas(256,128),He=Mr.getContext("2d",{willReadFrequently:true}),He.globalCompositeOperation="copy",He.globalAlpha=1),(Mr.width<i||Mr.height<t)&&(Mr.width=Oe(i),Mr.height=Oe(t));}function Rm(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return false;return true}function Fm(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return false;return true}function Bm(...i){let t=i[0];t.canvas||(t={canvas:i[0],resolution:i[1]});let{canvas:e}=t,r=Math.min(t.resolution??1,1),s=t.width??e.width,o=t.height??e.height,n=t.output;if(Yy(s,o),!He)throw new TypeError("Failed to get canvas 2D context");He.drawImage(e,0,0,s,o,0,0,s*r,o*r);let l=He.getImageData(0,0,s,o).data,h=0,u=0,c=s-1,f=o-1;for(;u<o&&Rm(l,s,u);)++u;if(u===o)return st.EMPTY;for(;Rm(l,s,f);)--f;for(;Fm(l,s,h,u,f);)++h;for(;Fm(l,s,c,u,f);)--c;return ++c,++f,He.globalCompositeOperation="source-over",He.strokeRect(h,u,c-h,f-u),He.globalCompositeOperation="copy",n??(n=new st),n.set(h/r,u/r,(c-h)/r,(f-u)/r),n}var Mr,He,km=x(()=>{fe();zi();Xt();Mr=null,He=null;});function Er(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!$y.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var $y,yn=x(()=>{$y=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var lh,Be,qt,Ts=x(()=>{fe();yn();lh={willReadFrequently:true},Be=class z{static get experimentalLetterSpacingSupported(){let t=z._experimentalLetterSpacingSupported;if(t===void 0){let e=gt.get().getCanvasRenderingContext2D().prototype;t=z._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e;}return t}constructor(t,e,r,s,o,n,a,l,h){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h;}static measureText(t=" ",e,r=z._canvas,s=e.wordWrap){let o=Er(e),n=z.measureFont(o);n.fontSize===0&&(n.fontSize=e.fontSize,n.ascent=e.fontSize);let a=z.__context;a.font=o;let h=(s?z._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),c=0;for(let p=0;p<h.length;p++){let b=z._measureText(h[p],e.letterSpacing,a);u[p]=b,c=Math.max(c,b);}let f=e._stroke?.width||0,d=c+f;e.dropShadow&&(d+=e.dropShadow.distance);let g=e.lineHeight||n.fontSize,y=Math.max(g,n.fontSize+f)+(h.length-1)*(g+e.leading);return e.dropShadow&&(y+=e.dropShadow.distance),new z(t,e,d,y,h,u,g+e.leading,c,n)}static _measureText(t,e,r){let s=false;z.experimentalLetterSpacingSupported&&(z.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=true):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,h=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,h-=e;else {let u=(z.graphemeSegmenter(t).length-1)*e;n+=u,h+=u;}return Math.max(n,h)}static _wordWrap(t,e,r=z._canvas){let s=r.getContext("2d",lh),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=e,c=z._collapseSpaces(u),f=z._collapseNewlines(u),d=!c,g=e.wordWrapWidth+h,y=z._tokenize(t);for(let m=0;m<y.length;m++){let p=y[m];if(z._isNewline(p)){if(!f){a+=z._addLine(n),d=!c,n="",o=0;continue}p=" ";}if(c){let v=z.isBreakingSpace(p),S=z.isBreakingSpace(n[n.length-1]);if(v&&S)continue}let b=z._getFromCache(p,h,l,s);if(b>g)if(n!==""&&(a+=z._addLine(n),n="",o=0),z.canBreakWords(p,e.breakWords)){let v=z.wordWrapSplit(p);for(let S=0;S<v.length;S++){let P=v[S],T=P,C=1;for(;v[S+C];){let E=v[S+C];if(!z.canBreakChars(T,E,p,S,e.breakWords))P+=E;else break;T=E,C++;}S+=C-1;let G=z._getFromCache(P,h,l,s);G+o>g&&(a+=z._addLine(n),d=false,n="",o=0),n+=P,o+=G;}}else {n.length>0&&(a+=z._addLine(n),n="",o=0);let v=m===y.length-1;a+=z._addLine(p,!v),d=false,n="",o=0;}else b+o>g&&(d=false,a+=z._addLine(n),n="",o=0),(n.length>0||!z.isBreakingSpace(p)||d)&&(n+=p,o+=b);}return a+=z._addLine(n,false),a}static _addLine(t,e=true){return t=z._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=z._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return "";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!z.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:z._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:z._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(z.isBreakingSpace(o,n)||z._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o;}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return true}static wordWrapSplit(t){return z.graphemeSegmenter(t)}static measureFont(t){if(z._fonts[t])return z._fonts[t];let e=z._context;e.font=t;let r=e.measureText(z.METRICS_STRING+z.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return z._fonts[t]=s,s}static clearMetrics(t=""){t?delete z._fonts[t]:z._fonts={};}static get _canvas(){if(!z.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",lh)?.measureText)return z.__canvas=e,e;t=gt.get().createCanvas();}catch{t=gt.get().createCanvas();}t.width=t.height=10,z.__canvas=t;}return z.__canvas}static get _context(){return z.__context||(z.__context=z._canvas.getContext("2d",lh)),z.__context}};Be.METRICS_STRING="|\xC9q\xC5";Be.BASELINE_SYMBOL="M";Be.BASELINE_MULTIPLIER=1.4;Be.HEIGHT_MULTIPLIER=2;Be.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>{let e=i.segment(t),r=[],s=0;for(let o of e)r[s++]=o.segment;return r}}return i=>[...i]})();Be.experimentalLetterSpacing=false;Be._fonts={};Be._newlines=[10,13];Be._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];qt=Be;});function di(i,t,e,r=0){if(i.texture===D.WHITE&&!i.fill)return J.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Ve){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(F.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Kt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+r,l=e.height+r);let h,u=false;if(o){let{start:c,end:f}=s;h=t.createLinearGradient(c.x*a,c.y*l,f.x*a,f.y*l),u=Math.abs(f.x-c.x)<Math.abs((f.y-c.y)*.1);}else {let{center:c,innerRadius:f,outerCenter:d,outerRadius:g}=s;h=t.createRadialGradient(c.x*a,c.y*l,f*a,d.x*a,d.y*l,g*a);}if(u&&n&&e){let c=e.lineHeight/l;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+r/2)/l;s.colorStops.forEach(g=>{let y=d+g.offset*c;h.addColorStop(Math.floor(y*Gm)/Gm,J.shared.setValue(g.color).toHex());});}}else s.colorStops.forEach(c=>{h.addColorStop(c.offset,J.shared.setValue(c.color).toHex());});return h}}else {let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(F.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return Z("FillStyle not recognised",i),"red"}var Gm,hh=x(()=>{$t();ut();Rt();zt();si();hn();Gm=1e5;});var Om,uh,bn,Dm=x(()=>{$t();Xt();Ss();km();Ts();yn();hh();Om=new st,uh=class{getCanvasAndContext(t){let{text:e,style:r,resolution:s=1}=t,o=r._getFinalPadding(),n=qt.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,n.width)+o*2)*s),l=Math.ceil(Math.ceil(Math.max(1,n.height)+o*2)*s),h=Fe.getOptimalCanvasAndContext(a,l);this._renderTextToCanvas(e,r,o,s,h);let u=r.trim?Bm({canvas:h.canvas,width:a,height:l,resolution:1,output:Om}):Om.set(0,0,a,l);return {canvasAndContext:h,frame:u}}returnCanvasAndContext(t){Fe.returnCanvasAndContext(t);}_renderTextToCanvas(t,e,r,s,o){let{canvas:n,context:a}=o,l=Er(e),h=qt.measureText(t||" ",e),u=h.lines,c=h.lineHeight,f=h.lineWidths,d=h.maxLineWidth,g=h.fontProperties,y=n.height;if(a.resetTransform(),a.scale(s,s),a.textBaseline=e.textBaseline,e._stroke?.width){let v=e._stroke;a.lineWidth=v.width,a.miterLimit=v.miterLimit,a.lineJoin=v.join,a.lineCap=v.cap;}a.font=l;let m,p,b=e.dropShadow?2:1;for(let v=0;v<b;++v){let S=e.dropShadow&&v===0,P=S?Math.ceil(Math.max(1,y)+r*2):0,T=P*s;if(S){a.fillStyle="black",a.strokeStyle="black";let E=e.dropShadow,L=E.color,R=E.alpha;a.shadowColor=J.shared.setValue(L).setAlpha(R).toRgbaString();let j=E.blur*s,ot=E.distance*s;a.shadowBlur=j,a.shadowOffsetX=Math.cos(E.angle)*ot,a.shadowOffsetY=Math.sin(E.angle)*ot+T;}else {if(a.fillStyle=e._fill?di(e._fill,a,h):null,e._stroke?.width){let E=e._stroke.width*e._stroke.alignment;a.strokeStyle=di(e._stroke,a,h,E);}a.shadowColor="black";}let C=(c-g.fontSize)/2;c-g.fontSize<0&&(C=0);let G=e._stroke?.width??0;for(let E=0;E<u.length;E++)m=G/2,p=G/2+E*c+g.ascent+C,e.align==="right"?m+=d-f[E]:e.align==="center"&&(m+=(d-f[E])/2),e._stroke?.width&&this._drawLetterSpacing(u[E],e,o,m+r,p+r-P,true),e._fill!==void 0&&this._drawLetterSpacing(u[E],e,o,m+r,p+r-P);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,l=e.letterSpacing,h=false;if(qt.experimentalLetterSpacingSupported&&(qt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=true):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||h){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let u=s,c=qt.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let g=0;g<c.length;++g){let y=c[g];n?a.strokeText(y,u,o):a.fillText(y,u,o);let m="";for(let p=g+1;p<c.length;++p)m+=c[p];d=a.measureText(m).width,u+=f-d+l,f=d;}}},bn=new uh;});var ws,Um=x(()=>{U();zr();Ur();yt();vs();nh();Dm();ws=class{constructor(t){this._renderer=t;}getTexture(t,e,r,s){typeof t=="string"&&(N("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof he||(t.style=new he(t.style)),t.textureStyle instanceof ae||(t.textureStyle=new ae(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:o,style:n,textureStyle:a}=t,l=t.resolution??this._renderer.resolution,{frame:h,canvasAndContext:u}=bn.getCanvasAndContext({text:o,style:n,resolution:l}),c=_n(u.canvas,h.width,h.height,l);if(a&&(c.source.style=a),n.trim&&(h.pad(n.padding),c.frame.copyFrom(h),c.updateUvs()),n.filters){let f=this._applyFilters(c,n.filters);return this.returnTexture(c),bn.returnCanvasAndContext(u),f}return this._renderer.texture.initSource(c._source),bn.returnCanvasAndContext(u),c}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",kt.returnTexture(t,true);}renderTextToCanvas(){N("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead");}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,s=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(r,false),s}destroy(){this._renderer=null;}};ws.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"};});var ch=x(()=>{U();Wp();Um();W.add(ws);W.add(_s);});var vn,zm=x(()=>{yt();ka();sh();vn=class i extends Wr{constructor(t){t instanceof Jt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Jt,this._context.on("update",this.onViewUpdate,this),this.didViewUpdate=true,this.allowChildren=false,this.roundPixels=r??false;}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===true||t?.context===true)&&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=false){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){N(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),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){N(q,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){N(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!==Jt.defaultStrokeStyle.width||t.color!==Jt.defaultStrokeStyle.color||t.alpha!==Jt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return N(q,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return N(q,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return N(q,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return N(q,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return N(q,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return N(q,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var Nm,Vm,Wm=x(()=>{Nm={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`;});var nn,Dp=g(()=>{$t();ut();Go();Uo();as();Rt();Ur();Bp();Gp();Op();nn=class extends Le{constructor(){let t=qr.from({vertex:kp,fragment:Fp}),e=qe.from({fragment:{source:Ul,entryPoint:"mainFragment"},vertex:{source:Ul,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:D.WHITE.source,uSampler:new ae({}),uniforms:{uTranslationMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new J(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var ni,zl=g(()=>{ut();Qe();is();tn();ds();Rp();Dp();ni=class{constructor(t,e){this.state=Cr.for2d(),this.localUniforms=new Vt({uTranslationMatrix:{value:new F,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 nn,this.state=Cr.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new on({size:t.particleChildren.length,properties:t._properties}),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=Ne(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Je(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var ms,Up=g(()=>{U();Mp();zl();ms=class extends ni{constructor(t){super(t,new sn);}};ms.extension={type:[w.WebGLPipes],name:"particle"};});var an,zp=g(()=>{an=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,true),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6});}};});var gs,Np=g(()=>{U();zp();zl();gs=class extends ni{constructor(t){super(t,new an);}};gs.extension={type:[w.WebGPUPipes],name:"particle"};});var Nl=g(()=>{U();Up();Np();W.add(ms);W.add(gs);});function xs(i,t){let{texture:e,bounds:r}=i;wo(r,t._anchor,e);let s=t._style._getFinalPadding();r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s;}var Vl=g(()=>{Na();});var ai,Wl=g(()=>{ai=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=true,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null;}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null;}destroy(){}};});var ln,Vp=g(()=>{Wl();ln=class extends ai{constructor(t){super(),this._renderer=t,t.runners.resolutionChange.add(this);}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate();}destroy(){this._renderer.canvasText.returnTexture(this.texture),this._renderer=null;}};});var _s,Wp=g(()=>{U();Vl();Vp();_s=class{constructor(t){this._renderer=t;}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t),t._didTextUpdate=false),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e);}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.returnTexture(e.texture),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=e.texture=this._renderer.canvasText.getTexture(t),xs(e,t);}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new ln(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null;}};_s.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"};});var Hp,Ve,hn=g(()=>{ut();Ut();Hp={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"}},Ve=class{constructor(t,e){this.uid=it("fillPattern"),this.transform=new F,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Hp[e].addressModeU,t.source.style.addressModeV=Hp[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 $p=$s((C1,Yp)=>{Yp.exports=gy;var Hl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},my=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function gy(i){var t=[];return i.replace(my,function(e,r,s){var o=r.toLowerCase();for(s=_y(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Hl[o])return s.unshift(r),t.push(s);if(s.length<Hl[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Hl[o])));}}),t}var xy=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function _y(i){var t=i.match(xy);return t?t.map(Number):[]}});function jp(i,t){let e=(0, Xp.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],h=l[0],u=l;switch(h){case "M":o=u[1],n=u[2],t.moveTo(o,n);break;case "m":o+=u[1],n+=u[2],t.moveTo(o,n);break;case "H":o=u[1],t.lineTo(o,n);break;case "h":o+=u[1],t.lineTo(o,n);break;case "V":n=u[1],t.lineTo(o,n);break;case "v":n+=u[1],t.lineTo(o,n);break;case "L":o=u[1],n=u[2],t.lineTo(o,n);break;case "l":o+=u[1],n+=u[2],t.lineTo(o,n);break;case "C":o=u[5],n=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case "c":t.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case "S":o=u[3],n=u[4],t.bezierCurveToShort(u[1],u[2],o,n);break;case "s":t.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "Q":o=u[3],n=u[4],t.quadraticCurveTo(u[1],u[2],o,n);break;case "q":t.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "T":o=u[1],n=u[2],t.quadraticCurveToShort(o,n);break;case "t":o+=u[1],n+=u[2],t.quadraticCurveToShort(o,n);break;case "A":o=u[6],n=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "a":o+=u[6],n+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "Z":case "z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:Z(`Unknown SVG path command: ${h}`);}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s));}return t}var Xp,Kp=g(()=>{Xp=Hn($p());zt();});var un,qp=g(()=>{Xt();un=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r;}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return false;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return false;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*r,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(r-l)}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 cn,Zp=g(()=>{Xt();cn=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s;}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return false;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return false;let a=r*(1-s),l=r-a,h=o-l,u=n-l,c=o+a,f=n+a,d=t-this.x,x=e-this.y,y=d*d/(h*h)+x*x/(u*u),m=d*d/(c*c)+x*x/(f*f);return y>1&&m<=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 Qp(i,t,e,r,s,o){let n=i-e,a=t-r,l=s-e,h=o-r,u=n*l+a*h,c=l*l+h*h,f=-1;c!==0&&(f=u/c);let d,x;f<0?(d=e,x=r):f>1?(d=s,x=o):(d=e+f*l,x=r+f*h);let y=i-d,m=t-x;return y*y+m*m}var Jp=g(()=>{});var yy,by,li,tm=g(()=>{Jp();Xt();li=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r;}this.points=e,this.closePath=true;}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],l=e[(s+3)%r];t+=(a-o)*(l+n);}return t<0}containsPolygon(t){let e=this.getBounds(yy),r=t.getBounds(by);if(!e.containsRect(r))return false;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 false}return true}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=false,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],u=this.points[n*2+1];l>e!=u>e&&t<(h-a)*((e-l)/(u-l))+a&&(r=!r);}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let u=0;u<h;u+=2){let c=l[u],f=l[u+1],d=l[(u+2)%l.length],x=l[(u+3)%l.length],y=Qp(t,e,c,f,d,x),m=Math.sign((d-c)*(e-f)-(x-f)*(t-c));if(y<=(m<0?a:n))return true}return false}getBounds(t){t||(t=new st);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let h=e[a],u=e[a+1];r=h<r?h:r,s=h>s?h:s,o=u<o?u:o,n=u>n?u:n;}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}};});var dn,fn,em=g(()=>{Xt();dn=(i,t,e,r,s,o,n)=>{let a=i-e,l=t-r,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},fn=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o;}getBounds(t){return t||(t=new st),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return false;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return true;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return true}return false}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,u=r*(1-s),c=r-u,f=o+h,d=n+h,x=a-h*2,y=l-h*2,m=o+a,p=n+l;return (t>=o-u&&t<=o+c||t>=m-c&&t<=m+u)&&e>=d&&e<=d+y||(e>=n-u&&e<=n+c||e>=p-c&&e<=p+u)&&t>=f&&t<=f+x?true:t<f&&e<d&&dn(t,e,f,d,h,c,u)||t>m-h&&e<d&&dn(t,e,m-h,d,h,c,u)||t>m-h&&e>p-h&&dn(t,e,m-h,p-h,h,c,u)||t<f&&e>p-h&&dn(t,e,f,p-h,h,c,u)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function mn(i,t,e,r,s,o,n,a,l,h){let c=Math.min(.99,Math.max(0,h??oi.defaultOptions.bezierSmoothness)),f=(Sy-c)/1;return f*=f,Ty(t,e,r,s,o,n,a,l,i,f),i}function Ty(i,t,e,r,s,o,n,a,l,h){$l(i,t,e,r,s,o,n,a,l,h,0),l.push(n,a);}function $l(i,t,e,r,s,o,n,a,l,h,u){if(u>vy)return;let c=Math.PI,f=(i+e)/2,d=(t+r)/2,x=(e+s)/2,y=(r+o)/2,m=(s+n)/2,p=(o+a)/2,b=(f+x)/2,v=(d+y)/2,S=(x+m)/2,P=(y+p)/2,T=(b+S)/2,C=(v+P)/2;if(u>0){let G=n-i,E=a-t,L=Math.abs((e-n)*E-(r-a)*G),R=Math.abs((s-n)*E-(o-a)*G),j,ot;if(L>pn&&R>pn){if((L+R)*(L+R)<=h*(G*G+E*E)){if(hi<Yl){l.push(T,C);return}let Lt=Math.atan2(o-r,s-e);if(j=Math.abs(Lt-Math.atan2(r-t,e-i)),ot=Math.abs(Math.atan2(a-o,n-s)-Lt),j>=c&&(j=2*c-j),ot>=c&&(ot=2*c-ot),j+ot<hi){l.push(T,C);return}if(Pr!==0){if(j>Pr){l.push(e,r);return}if(ot>Pr){l.push(s,o);return}}}}else if(L>pn){if(L*L<=h*(G*G+E*E)){if(hi<Yl){l.push(T,C);return}if(j=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),j>=c&&(j=2*c-j),j<hi){l.push(e,r),l.push(s,o);return}if(Pr!==0&&j>Pr){l.push(e,r);return}}}else if(R>pn){if(R*R<=h*(G*G+E*E)){if(hi<Yl){l.push(T,C);return}if(j=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),j>=c&&(j=2*c-j),j<hi){l.push(e,r),l.push(s,o);return}if(Pr!==0&&j>Pr){l.push(s,o);return}}}else if(G=T-(i+n)/2,E=C-(t+a)/2,G*G+E*E<=h){l.push(T,C);return}}$l(i,t,f,d,b,v,T,C,l,h,u+1),$l(T,C,S,P,m,p,n,a,l,h,u+1);}var vy,pn,Sy,Yl,hi,Pr,Xl=g(()=>{Jo();vy=8,pn=11920929e-14,Sy=1,Yl=.01,hi=0,Pr=0;});function im(i,t,e,r,s,o,n,a){let h=Math.min(.99,Math.max(0,a??oi.defaultOptions.bezierSmoothness)),u=(Py-h)/1;return u*=u,Ey(t,e,r,s,o,n,i,u),i}function Ey(i,t,e,r,s,o,n,a){jl(n,i,t,e,r,s,o,a,0),n.push(s,o);}function jl(i,t,e,r,s,o,n,a,l){if(l>wy)return;let h=Math.PI,u=(t+r)/2,c=(e+s)/2,f=(r+o)/2,d=(s+n)/2,x=(u+f)/2,y=(c+d)/2,m=o-t,p=n-e,b=Math.abs((r-o)*p-(s-n)*m);if(b>Cy){if(b*b<=a*(m*m+p*p)){if(rm<My){i.push(x,y);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=h&&(v=2*h-v),v<rm){i.push(x,y);return}}}else if(m=x-(t+o)/2,p=y-(e+n)/2,m*m+p*p<=a){i.push(x,y);return}jl(i,t,e,u,c,x,y,a,l+1),jl(i,x,y,f,d,o,n,a,l+1);}var wy,Cy,Py,My,rm,sm=g(()=>{Jo();wy=8,Cy=11920929e-14,Py=1,My=.01,rm=0;});function gn(i,t,e,r,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,u=s;h*=n?-1:1;for(let c=0;c<a+1;c++){let f=Math.cos(u),d=Math.sin(u),x=t+f*r,y=e+d*r;i.push(x,y),u+=h;}}var Kl=g(()=>{});function om(i,t,e,r,s,o){let n=i[i.length-2],l=i[i.length-1]-e,h=n-t,u=s-e,c=r-t,f=Math.abs(l*c-h*u);if(f<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let d=l*l+h*h,x=u*u+c*c,y=l*u+h*c,m=o*Math.sqrt(d)/f,p=o*Math.sqrt(x)/f,b=m*y/d,v=p*y/x,S=m*c+p*h,P=m*u+p*l,T=h*(p+b),C=l*(p+b),G=c*(m+v),E=u*(m+v),L=Math.atan2(C-P,T-S),R=Math.atan2(E-P,G-S);gn(i,S+t,P+e,o,L,R,h*u>c*l);}var nm=g(()=>{Kl();});function Ay(i,t){let e=t===-1.5707963267948966?-0.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return [{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function lm(i,t,e,r,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let u=Math.sin(a*ys/360),c=Math.cos(a*ys/360),f=c*(t-r)/2+u*(e-s)/2,d=-u*(t-r)/2+c*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let x=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);x>1&&(o*=Math.sqrt(x),n*=Math.sqrt(x)),Iy(t,e,r,s,o,n,l,h,u,c,f,d,ql);let{ang1:y,ang2:m}=ql,{centerX:p,centerY:b}=ql,v=Math.abs(m)/(ys/4);Math.abs(1-v)<1e-7&&(v=1);let S=Math.max(Math.ceil(v),1);m/=S;let P=i[i.length-2],T=i[i.length-1],C={x:0,y:0};for(let G=0;G<S;G++){let E=Ay(y,m),{x:L,y:R}=Zl(E[0],o,n,c,u,p,b,C),{x:j,y:ot}=Zl(E[1],o,n,c,u,p,b,C),{x:Lt,y:Ai}=Zl(E[2],o,n,c,u,p,b,C);mn(i,P,T,L,R,j,ot,Lt,Ai),P=Lt,T=Ai,y+=m;}}var ys,ql,Zl,am,Iy,hm=g(()=>{Xl();ys=Math.PI*2,ql={centerX:0,centerY:0,ang1:0,ang2:0},Zl=({x:i,y:t},e,r,s,o,n,a,l)=>{i*=e,t*=r;let h=s*i-o*t,u=o*i+s*t;return l.x=h+n,l.y=u+a,l};am=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},Iy=(i,t,e,r,s,o,n,a,l,h,u,c,f)=>{let d=Math.pow(s,2),x=Math.pow(o,2),y=Math.pow(u,2),m=Math.pow(c,2),p=d*x-d*m-x*y;p<0&&(p=0),p/=d*m+x*y,p=Math.sqrt(p)*(n===a?-1:1);let b=p*s/o*c,v=p*-o/s*u,S=h*b-l*v+(i+e)/2,P=l*b+h*v+(t+r)/2,T=(u-b)/s,C=(c-v)/o,G=(-u-b)/s,E=(-c-v)/o,L=am(1,0,T,C),R=am(T,C,G,E);a===0&&R>0&&(R-=ys),a===1&&R<0&&(R+=ys),f.centerX=S,f.centerY=P,f.ang1=L,f.ang2=R;};});function um(i,t,e){let r=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,u=Math.sqrt(l*l+h*h),c=l/u,f=h/u;return {len:u,nx:c,ny:f}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y);},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let h=t[(n+1)%t.length],u=r(a,o),c=r(a,h);if(u.len<1e-4||c.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(u.nx*c.ny-u.ny*c.nx),d=1,x=false;u.nx*c.nx-u.ny*-c.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,x=true):f>0&&(d=-1,x=true);let y=f/2,m,p=Math.abs(Math.cos(y)*l/Math.sin(y));p>Math.min(u.len/2,c.len/2)?(p=Math.min(u.len/2,c.len/2),m=Math.abs(p*Math.sin(y)/Math.cos(y))):m=l;let b=a.x+c.nx*p+-c.ny*m*d,v=a.y+c.ny*p+c.nx*m*d,S=Math.atan2(u.ny,u.nx)+Math.PI/2*d,P=Math.atan2(c.ny,c.nx)-Math.PI/2*d;n===0&&i.moveTo(b+Math.cos(S)*m,v+Math.sin(S)*m),i.arc(b,v,m,S,P,x),o=a;}}function cm(i,t,e,r){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,h)=>({x:a.x+(l.x-a.x)*h,y:a.y+(l.y-a.y)*h}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],h=l.radius??e;if(h<=0){a===0?i.moveTo(l.x,l.y):i.lineTo(l.x,l.y);continue}let u=t[a],c=t[(a+2)%n],f=s(u,l),d;if(f<1e-4)d=l;else {let m=Math.min(f/2,h);d=o(l,u,m/f);}let x=s(c,l),y;if(x<1e-4)y=l;else {let m=Math.min(x/2,h);y=o(l,c,m/x);}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(l.x,l.y,y.x,y.y,r);}}var dm=g(()=>{});var Ly,xn,fm=g(()=>{qp();Zp();tm();Xt();em();ce();Xl();sm();Kl();nm();hm();dm();Ly=new st,xn=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new mt,this._graphicsPath2D=t,this.signed=t.checkForHoles;}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return (s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(false);let a=this._currentPoly.points;return gn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return om(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let l=this._currentPoly.points;return lm(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return mn(this._currentPoly.points,l.lastX,l.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return im(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(true),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(true),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data);}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let l=a.shape,h=o?.shape;h&&h.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a;}}}return this}finish(t=false){this.endPoly(t);}rect(t,e,r,s,o){return this.drawShape(new st(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new un(t,e,r),s),this}poly(t,e,r){let s=new li(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,h=[];for(let u=0;u<s;u++){let c=a-u*l;h.push(t+r*Math.cos(c),e+r*Math.sin(c));}return this.poly(h,true,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let l=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let h=-1*Math.PI/2+n,u=Math.PI*2/s,c=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*u+h,x=t+r*Math.cos(d),y=e+r*Math.sin(d),m=d+Math.PI+c,p=d-Math.PI-c,b=x+o*Math.cos(m),v=y+o*Math.sin(m),S=x+o*Math.cos(p),P=y+o*Math.sin(p);f===0?this.moveTo(b,v):this.lineTo(b,v),this.quadraticCurveTo(x,y,S,P,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?cm(this,t,e,s):um(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+r,h=e+s,u=a<0?-a:0,c=Math.abs(a);return this.moveTo(t,e+c).arcTo(t+u,e+u,t+c,e,c).lineTo(l-c,e).arcTo(l-u,e+u,l,e+c,c).lineTo(l,h-c).arcTo(l-u,h-u,t+r-c,h,c).lineTo(t+c,h).arcTo(t+u,h-u,t,h-c,c).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),l=t+r,h=e+s,u=[t+a,e,l-a,e,l,e+a,l,h-a,l-a,h,t+a,h,t,h-a,t,e+a];for(let c=u.length-1;c>=2;c-=2)u[c]===u[c-2]&&u[c-1]===u[c-3]&&u.splice(c-1,2);return this.poly(u,true,n)}ellipse(t,e,r,s,o){return this.drawShape(new cn(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new fn(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new li,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=false){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=true){if(!this._currentPoly&&(this._currentPoly=new li,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty;}this._currentPoly.points.push(r,s);}else this._currentPoly.points.push(0,0);}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data);}this.finish();}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Ly);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function bs(i,t){return i?i.prepend(t):t.clone()}var er,Ql=g(()=>{we();Ut();zt();Kp();fm();er=class i{constructor(t,e=false){this.instructions=[],this.uid=it("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?jp(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new xn(this)),this._dirty&&(this._dirty=false,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=true,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=true,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=true,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=true,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=true,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(rt.shared),l=0,h=0;if(!n||n.action!=="bezierCurveTo")l=a.x,h=a.y;else {l=n.data[2],h=n.data[3];let u=a.x,c=a.y;l=u+(u-l),h=c+(c-h);}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,r,s,o]}),this._dirty=true,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=true,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=true,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=true,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=true,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(rt.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 l=o.x,h=o.y;n=l+(l-n),a=h+(h-a);}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=true,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=true,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=true,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=true,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=true,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=true,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=true,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=true,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=true,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=true,this}star(t,e,r,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=r*2,u=Math.PI*2/h,c=[];for(let f=0;f<h;f++){let d=f%2?o:s,x=f*u+l;c.push(t+d*Math.cos(x),e+d*Math.sin(x));}return this.poly(c,true,a),this}clone(t=false){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()});}return e}clear(){return this.instructions.length=0,this._dirty=true,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,h=0,u=0,c=0,f=0,d=0,x=0,y=0;for(let m=0;m<this.instructions.length;m++){let p=this.instructions[m],b=p.data;switch(p.action){case "moveTo":case "lineTo":l=b[0],h=b[1],b[0]=e*l+s*h+n,b[1]=r*l+o*h+a;break;case "bezierCurveTo":u=b[0],c=b[1],f=b[2],d=b[3],l=b[4],h=b[5],b[0]=e*u+s*c+n,b[1]=r*u+o*c+a,b[2]=e*f+s*d+n,b[3]=r*f+o*d+a,b[4]=e*l+s*h+n,b[5]=r*l+o*h+a;break;case "quadraticCurveTo":u=b[0],c=b[1],l=b[2],h=b[3],b[0]=e*u+s*c+n,b[1]=r*u+o*c+a,b[2]=e*l+s*h+n,b[3]=r*l+o*h+a;break;case "arcToSvg":l=b[5],h=b[6],x=b[0],y=b[1],b[0]=e*x+s*y,b[1]=r*x+o*y,b[5]=e*l+s*h+n,b[6]=r*l+o*h+a;break;case "circle":b[4]=bs(b[3],t);break;case "rect":b[4]=bs(b[4],t);break;case "ellipse":b[8]=bs(b[8],t);break;case "roundRect":b[5]=bs(b[5],t);break;case "addPath":b[0].transform(t);break;case "poly":b[2]=bs(b[2],t);break;default:Z("unknown transform action",p.action);break}}return this._dirty=true,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e];}switch(r.action){case "moveTo":case "lineTo":t.x=r.data[0],t.y=r.data[1];break;case "quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case "bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case "arc":case "arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case "addPath":r.data[0].getLastPoint(t);break}return t}};});function pt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Jl=g(()=>{});function pm(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case "lineargradient":t.defs[n.id]=Ry(n);break;case "radialgradient":t.defs[n.id]=Fy();break;}}}}function Ry(i){let t=pt(i,"x1",0),e=pt(i,"y1",0),r=pt(i,"x2",1),s=pt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Kt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let l=i.children[a],h=pt(l,"offset",0),u=J.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(h,u);}return n}function Fy(i){return Z("[SVG Parser] Radial gradients are not yet supported"),new Kt(0,0,1,0)}var mm=g(()=>{$t();zt();si();Jl();});function th(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var gm=g(()=>{});function eh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in xm){let a=i.getAttribute(n);a&&_m(t,o,n,a.trim());}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[h,u]=l.split(":");xm[h]&&_m(t,o,h,u.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function _m(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=th(r);t.strokeStyle.fill=i.defs[s];}else t.strokeStyle.color=J.shared.setValue(r).toNumber();t.useStroke=true;}break;case "stroke-width":t.strokeStyle.width=Number(r);break;case "fill":if(r!=="none"){if(r.startsWith("url(")){let s=th(r);t.fillStyle.fill=i.defs[s];}else t.fillStyle.color=J.shared.setValue(r).toNumber();t.useFill=true;}break;case "fill-opacity":t.fillStyle.alpha=Number(r);break;case "stroke-opacity":t.strokeStyle.alpha=Number(r);break;case "opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var xm,ym=g(()=>{$t();gm();xm={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 bm(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg");}let e={context:t,defs:{},path:new er};pm(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=eh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&vm(a,e,s,o);}return t}function vm(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=eh(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let l,h,u,c,f,d,x,y,m,p,b,v,S,P,T,C,G;switch(i.nodeName.toLowerCase()){case "path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&Z("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new er(P,true),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":x=pt(i,"cx",0),y=pt(i,"cy",0),m=pt(i,"r",0),t.context.ellipse(x,y,m,m),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "rect":l=pt(i,"x",0),h=pt(i,"y",0),C=pt(i,"width",0),G=pt(i,"height",0),p=pt(i,"rx",0),b=pt(i,"ry",0),p||b?t.context.roundRect(l,h,C,G,p||b):t.context.rect(l,h,C,G),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "ellipse":x=pt(i,"cx",0),y=pt(i,"cy",0),p=pt(i,"rx",0),b=pt(i,"ry",0),t.context.beginPath(),t.context.ellipse(x,y,p,b),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "line":u=pt(i,"x1",0),c=pt(i,"y1",0),f=pt(i,"x2",0),d=pt(i,"y2",0),t.context.beginPath(),t.context.moveTo(u,c),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case "polygon":S=i.getAttribute("points"),v=S.match(/\d+/g).map(E=>parseInt(E,10)),t.context.poly(v,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":S=i.getAttribute("points"),v=S.match(/\d+/g).map(E=>parseInt(E,10)),t.context.poly(v,false),r&&t.context.stroke(r);break;case "g":case "svg":break;default:{Z(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let E=0;E<s.length;E++)vm(s[E],t,e,r);}var Sm=g(()=>{zt();Ql();mm();Jl();ym();});function By(i){return J.isColorLike(i)}function Tm(i){return i instanceof Ve}function wm(i){return i instanceof Kt}function ky(i){return i instanceof D}function Gy(i,t,e){let r=J.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=D.WHITE,{...e,...i}}function Oy(i,t,e){return i.texture=t,{...e,...i}}function Cm(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function Pm(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function Dy(i,t){let e={...t,...i},r=J.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function We(i,t){if(i==null)return null;let e={},r=i;return By(i)?Gy(e,i,t):ky(i)?Oy(e,i,t):Tm(i)?Cm(e,i,t):wm(i)?Pm(e,i,t):r.fill&&Tm(r.fill)?Cm(r,r.fill,t):r.fill&&wm(r.fill)?Pm(r,r.fill,t):Dy(r,t)}function ui(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=We(i,l);return h?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var rh=g(()=>{$t();Rt();si();hn();});var Uy,Mm,ih,Jt,sh=g(()=>{Yt();$t();ut();we();Rt();Ut();yt();ce();Ql();Sm();rh();Uy=new rt,Mm=new F,ih=class Re extends et{constructor(){super(...arguments),this.uid=it("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new er,this._transform=new F,this._fillStyle={...Re.defaultFillStyle},this._strokeStyle={...Re.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new mt,this._boundsDirty=true;}clone(){let t=new Re;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=true,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=We(t,Re.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ui(t,Re.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=We(t,Re.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=We(t,Re.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?J.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new er,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(N(q,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=We(t,Re.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(rt.shared);this._activePath.clear(),this._activePath.moveTo(t,e);}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ui(t,Re.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else {e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,bm(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof F?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof F?(this._transform.append(t),this):(Mm.set(t,e,r,s,o,n),this._transform.append(Mm),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=true,this._boundsDirty=true);}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds);}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform);}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a);}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return false;let e=this.instructions,r=false;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,h=a.shapePath.shapePrimitives;for(let u=0;u<h.length;u++){let c=h[u].shape;if(!l||!c)continue;let f=h[u].transform,d=f?f.applyInverse(t,Uy):t;if(o.action==="fill")r=c.contains(d.x,d.y);else {let y=l;r=c.strokeContains(d.x,d.y,y.width,y.alignment);}let x=n.hole;if(x){let y=x.shapePath?.shapePrimitives;if(y)for(let m=0;m<y.length;m++)y[m].shape.contains(d.x,d.y)&&(r=false);}if(r)return true}}return r}destroy(t=false){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r);}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null;}};ih.defaultFillStyle={color:16777215,alpha:1,texture:D.WHITE,matrix:null,fill:null,textureSpace:"local"};ih.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:D.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Jt=ih;});function Am(i){let t=[],e=0;for(let r=0;r<Em.length;r++){let s=`_${Em[r]}`;t[e++]=i[s];}return e=Im(i._fill,t,e),e=Ny(i._stroke,t,e),e=Vy(i.dropShadow,t,e),e=zy(i.filters,t,e),t.join("-")}function zy(i,t,e){if(!i)return e;for(let r of i)t[e++]=r.uid;return e}function Im(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Ny(i,t,e){return i&&(e=Im(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function Vy(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=J.shared.setValue(i.color).toNumber()),e}var Em,Lm=g(()=>{$t();Em=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function Wy(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=he.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance};}if(t.strokeThickness!==void 0){N(q,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(J.isColorLike(e))r.color=e;else if(e instanceof Kt||e instanceof Ve)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness};}if(Array.isArray(t.fillGradientStops)){N(q,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=he.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Kt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>J.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o);}),i.fill={fill:r};}}var oh,he,vs=g(()=>{Yt();$t();yt();si();hn();sh();rh();Lm();oh=class ci extends et{constructor(t={}){super(),Wy(t);let e={...ci.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r];}this.update();}get align(){return this._align}set align(t){this._align=t,this.update();}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update();}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ci.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ci.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 filters(){return this._filters}set filters(t){this._filters=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({...Jt.defaultFillStyle,...t},()=>{this._fill=We({...this._originalFill},Jt.defaultFillStyle);})),this._fill=We(t===0?"black":t,Jt.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Jt.defaultStrokeStyle,...t},()=>{this._stroke=ui({...this._originalStroke},Jt.defaultStrokeStyle);})),this._stroke=ui(t,Jt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=Am(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=ci.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ci({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,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=false){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r);}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null;}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),true)})}_isFillStyle(t){return (t??null)!==null&&!(J.isColorLike(t)||t instanceof Kt||t instanceof Ve)}};oh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};oh.defaultTextStyle={align:"left",breakWords:false,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:false,whiteSpace:"pre",wordWrap:false,wordWrapWidth:100};he=oh;});function _n(i,t,e,r){let s=Hy;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=kt.getOptimalTexture(s.width,s.height,r,false);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var Hy,nh=g(()=>{zr();ce();Hy=new mt;});var ah,Fe,Ss=g(()=>{fe();zi();ah=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=gt.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return {canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Oe(t),e=Oe(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Fe=new ah;});function Yy(i,t){Mr||(Mr=gt.get().createCanvas(256,128),He=Mr.getContext("2d",{willReadFrequently:true}),He.globalCompositeOperation="copy",He.globalAlpha=1),(Mr.width<i||Mr.height<t)&&(Mr.width=Oe(i),Mr.height=Oe(t));}function Rm(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return false;return true}function Fm(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return false;return true}function Bm(...i){let t=i[0];t.canvas||(t={canvas:i[0],resolution:i[1]});let{canvas:e}=t,r=Math.min(t.resolution??1,1),s=t.width??e.width,o=t.height??e.height,n=t.output;if(Yy(s,o),!He)throw new TypeError("Failed to get canvas 2D context");He.drawImage(e,0,0,s,o,0,0,s*r,o*r);let l=He.getImageData(0,0,s,o).data,h=0,u=0,c=s-1,f=o-1;for(;u<o&&Rm(l,s,u);)++u;if(u===o)return st.EMPTY;for(;Rm(l,s,f);)--f;for(;Fm(l,s,h,u,f);)++h;for(;Fm(l,s,c,u,f);)--c;return ++c,++f,He.globalCompositeOperation="source-over",He.strokeRect(h,u,c-h,f-u),He.globalCompositeOperation="copy",n??(n=new st),n.set(h/r,u/r,(c-h)/r,(f-u)/r),n}var Mr,He,km=g(()=>{fe();zi();Xt();Mr=null,He=null;});function Er(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!$y.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var $y,yn=g(()=>{$y=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var lh,Be,qt,Ts=g(()=>{fe();yn();lh={willReadFrequently:true},Be=class z{static get experimentalLetterSpacingSupported(){let t=z._experimentalLetterSpacingSupported;if(t===void 0){let e=gt.get().getCanvasRenderingContext2D().prototype;t=z._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e;}return t}constructor(t,e,r,s,o,n,a,l,h){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h;}static measureText(t=" ",e,r=z._canvas,s=e.wordWrap){let o=Er(e),n=z.measureFont(o);n.fontSize===0&&(n.fontSize=e.fontSize,n.ascent=e.fontSize);let a=z.__context;a.font=o;let h=(s?z._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),c=0;for(let p=0;p<h.length;p++){let b=z._measureText(h[p],e.letterSpacing,a);u[p]=b,c=Math.max(c,b);}let f=e._stroke?.width||0,d=c+f;e.dropShadow&&(d+=e.dropShadow.distance);let x=e.lineHeight||n.fontSize,y=Math.max(x,n.fontSize+f)+(h.length-1)*(x+e.leading);return e.dropShadow&&(y+=e.dropShadow.distance),new z(t,e,d,y,h,u,x+e.leading,c,n)}static _measureText(t,e,r){let s=false;z.experimentalLetterSpacingSupported&&(z.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=true):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,h=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,h-=e;else {let u=(z.graphemeSegmenter(t).length-1)*e;n+=u,h+=u;}return Math.max(n,h)}static _wordWrap(t,e,r=z._canvas){let s=r.getContext("2d",lh),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=e,c=z._collapseSpaces(u),f=z._collapseNewlines(u),d=!c,x=e.wordWrapWidth+h,y=z._tokenize(t);for(let m=0;m<y.length;m++){let p=y[m];if(z._isNewline(p)){if(!f){a+=z._addLine(n),d=!c,n="",o=0;continue}p=" ";}if(c){let v=z.isBreakingSpace(p),S=z.isBreakingSpace(n[n.length-1]);if(v&&S)continue}let b=z._getFromCache(p,h,l,s);if(b>x)if(n!==""&&(a+=z._addLine(n),n="",o=0),z.canBreakWords(p,e.breakWords)){let v=z.wordWrapSplit(p);for(let S=0;S<v.length;S++){let P=v[S],T=P,C=1;for(;v[S+C];){let E=v[S+C];if(!z.canBreakChars(T,E,p,S,e.breakWords))P+=E;else break;T=E,C++;}S+=C-1;let G=z._getFromCache(P,h,l,s);G+o>x&&(a+=z._addLine(n),d=false,n="",o=0),n+=P,o+=G;}}else {n.length>0&&(a+=z._addLine(n),n="",o=0);let v=m===y.length-1;a+=z._addLine(p,!v),d=false,n="",o=0;}else b+o>x&&(d=false,a+=z._addLine(n),n="",o=0),(n.length>0||!z.isBreakingSpace(p)||d)&&(n+=p,o+=b);}return a+=z._addLine(n,false),a}static _addLine(t,e=true){return t=z._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=z._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return "";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!z.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:z._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:z._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(z.isBreakingSpace(o,n)||z._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o;}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return true}static wordWrapSplit(t){return z.graphemeSegmenter(t)}static measureFont(t){if(z._fonts[t])return z._fonts[t];let e=z._context;e.font=t;let r=e.measureText(z.METRICS_STRING+z.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return z._fonts[t]=s,s}static clearMetrics(t=""){t?delete z._fonts[t]:z._fonts={};}static get _canvas(){if(!z.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",lh)?.measureText)return z.__canvas=e,e;t=gt.get().createCanvas();}catch{t=gt.get().createCanvas();}t.width=t.height=10,z.__canvas=t;}return z.__canvas}static get _context(){return z.__context||(z.__context=z._canvas.getContext("2d",lh)),z.__context}};Be.METRICS_STRING="|\xC9q\xC5";Be.BASELINE_SYMBOL="M";Be.BASELINE_MULTIPLIER=1.4;Be.HEIGHT_MULTIPLIER=2;Be.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>{let e=i.segment(t),r=[],s=0;for(let o of e)r[s++]=o.segment;return r}}return i=>[...i]})();Be.experimentalLetterSpacing=false;Be._fonts={};Be._newlines=[10,13];Be._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];qt=Be;});function di(i,t,e,r=0){if(i.texture===D.WHITE&&!i.fill)return J.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Ve){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(F.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Kt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+r,l=e.height+r);let h,u=false;if(o){let{start:c,end:f}=s;h=t.createLinearGradient(c.x*a,c.y*l,f.x*a,f.y*l),u=Math.abs(f.x-c.x)<Math.abs((f.y-c.y)*.1);}else {let{center:c,innerRadius:f,outerCenter:d,outerRadius:x}=s;h=t.createRadialGradient(c.x*a,c.y*l,f*a,d.x*a,d.y*l,x*a);}if(u&&n&&e){let c=e.lineHeight/l;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+r/2)/l;s.colorStops.forEach(x=>{let y=d+x.offset*c;h.addColorStop(Math.floor(y*Gm)/Gm,J.shared.setValue(x.color).toHex());});}}else s.colorStops.forEach(c=>{h.addColorStop(c.offset,J.shared.setValue(c.color).toHex());});return h}}else {let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(F.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return Z("FillStyle not recognised",i),"red"}var Gm,hh=g(()=>{$t();ut();Rt();zt();si();hn();Gm=1e5;});var Om,uh,bn,Dm=g(()=>{$t();Xt();Ss();km();Ts();yn();hh();Om=new st,uh=class{getCanvasAndContext(t){let{text:e,style:r,resolution:s=1}=t,o=r._getFinalPadding(),n=qt.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,n.width)+o*2)*s),l=Math.ceil(Math.ceil(Math.max(1,n.height)+o*2)*s),h=Fe.getOptimalCanvasAndContext(a,l);this._renderTextToCanvas(e,r,o,s,h);let u=r.trim?Bm({canvas:h.canvas,width:a,height:l,resolution:1,output:Om}):Om.set(0,0,a,l);return {canvasAndContext:h,frame:u}}returnCanvasAndContext(t){Fe.returnCanvasAndContext(t);}_renderTextToCanvas(t,e,r,s,o){let{canvas:n,context:a}=o,l=Er(e),h=qt.measureText(t||" ",e),u=h.lines,c=h.lineHeight,f=h.lineWidths,d=h.maxLineWidth,x=h.fontProperties,y=n.height;if(a.resetTransform(),a.scale(s,s),a.textBaseline=e.textBaseline,e._stroke?.width){let v=e._stroke;a.lineWidth=v.width,a.miterLimit=v.miterLimit,a.lineJoin=v.join,a.lineCap=v.cap;}a.font=l;let m,p,b=e.dropShadow?2:1;for(let v=0;v<b;++v){let S=e.dropShadow&&v===0,P=S?Math.ceil(Math.max(1,y)+r*2):0,T=P*s;if(S){a.fillStyle="black",a.strokeStyle="black";let E=e.dropShadow,L=E.color,R=E.alpha;a.shadowColor=J.shared.setValue(L).setAlpha(R).toRgbaString();let j=E.blur*s,ot=E.distance*s;a.shadowBlur=j,a.shadowOffsetX=Math.cos(E.angle)*ot,a.shadowOffsetY=Math.sin(E.angle)*ot+T;}else {if(a.fillStyle=e._fill?di(e._fill,a,h):null,e._stroke?.width){let E=e._stroke.width*e._stroke.alignment;a.strokeStyle=di(e._stroke,a,h,E);}a.shadowColor="black";}let C=(c-x.fontSize)/2;c-x.fontSize<0&&(C=0);let G=e._stroke?.width??0;for(let E=0;E<u.length;E++)m=G/2,p=G/2+E*c+x.ascent+C,e.align==="right"?m+=d-f[E]:e.align==="center"&&(m+=(d-f[E])/2),e._stroke?.width&&this._drawLetterSpacing(u[E],e,o,m+r,p+r-P,true),e._fill!==void 0&&this._drawLetterSpacing(u[E],e,o,m+r,p+r-P);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,l=e.letterSpacing,h=false;if(qt.experimentalLetterSpacingSupported&&(qt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=true):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||h){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let u=s,c=qt.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let x=0;x<c.length;++x){let y=c[x];n?a.strokeText(y,u,o):a.fillText(y,u,o);let m="";for(let p=x+1;p<c.length;++p)m+=c[p];d=a.measureText(m).width,u+=f-d+l,f=d;}}},bn=new uh;});var ws,Um=g(()=>{U();zr();Ur();yt();vs();nh();Dm();ws=class{constructor(t){this._renderer=t;}getTexture(t,e,r,s){typeof t=="string"&&(N("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof he||(t.style=new he(t.style)),t.textureStyle instanceof ae||(t.textureStyle=new ae(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:o,style:n,textureStyle:a}=t,l=t.resolution??this._renderer.resolution,{frame:h,canvasAndContext:u}=bn.getCanvasAndContext({text:o,style:n,resolution:l}),c=_n(u.canvas,h.width,h.height,l);if(a&&(c.source.style=a),n.trim&&(h.pad(n.padding),c.frame.copyFrom(h),c.updateUvs()),n.filters){let f=this._applyFilters(c,n.filters);return this.returnTexture(c),bn.returnCanvasAndContext(u),f}return this._renderer.texture.initSource(c._source),bn.returnCanvasAndContext(u),c}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",kt.returnTexture(t,true);}renderTextToCanvas(){N("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead");}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,s=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(r,false),s}destroy(){this._renderer=null;}};ws.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"};});var ch=g(()=>{U();Wp();Um();W.add(ws);W.add(_s);});var vn,zm=g(()=>{yt();ka();sh();vn=class i extends Wr{constructor(t){t instanceof Jt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Jt,this._context.on("update",this.onViewUpdate,this),this.didViewUpdate=true,this.allowChildren=false,this.roundPixels=r??false;}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===true||t?.context===true)&&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=false){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){N(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),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){N(q,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){N(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!==Jt.defaultStrokeStyle.width||t.color!==Jt.defaultStrokeStyle.color||t.alpha!==Jt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return N(q,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return N(q,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return N(q,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return N(q,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return N(q,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return N(q,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var Nm,Vm,Wm=g(()=>{Nm={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -408,7 +408,7 @@ fn mainFragment(
408
408
  uniform float uDistance;
409
409
  `,main:`
410
410
  outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
411
- `}};});var Hm,Ym,$m=x(()=>{Hm={name:"msdf-bit",fragment:{header:`
411
+ `}};});var Hm,Ym,$m=g(()=>{Hm={name:"msdf-bit",fragment:{header:`
412
412
  fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
413
413
 
414
414
  // MSDF
@@ -462,16 +462,16 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}};});var dh,fh,Sn,Xm=x(()=>{ut();zo();ul();fl();Yo();ml();as();Qe();Wm();$m();Sn=class extends Le{constructor(t){let e=new Vt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});dh??(dh=Qr({name:"sdf-shader",bits:[No,Wo(t),Nm,Hm,ti]})),fh??(fh=Jr({name:"sdf-shader",bits:[Vo,Ho(t),Vm,Ym,ei]})),super({glProgram:fh,gpuProgram:dh,resources:{localUniforms:e,batchSamplers:$o(t)}});}};});var Tn,jm=x(()=>{Yt();yt();Tn=class extends et{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=true,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100;}get font(){return N(q,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return N(q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return N(q,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return N(q,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return N(q,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=false){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(true)),this.pages=null);}};});var Km,ph,Zm=x(()=>{$t();Xt();Ss();Mo();Rt();Ur();yt();Ts();yn();hh();vs();jm();Km=class qm extends Tn{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._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=false;let e={...qm.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=D.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Er(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??false,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof ae?e.textureStyle:new ae(e.textureStyle)),this.fontMetrics=qt.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize;}ensureCharacters(t){let e=qt.graphemeSegmenter(t).filter(m=>!this._currentChars.includes(m)).filter((m,p,b)=>b.indexOf(m)===p);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,l=this._currentX,h=this._currentY,u=this._currentMaxCharHeight,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,f=this._padding*c,d=false,g=s.width/this.resolution,y=s.height/this.resolution;for(let m=0;m<e.length;m++){let p=e[m],b=qt.measureText(p,a,s,false);b.lineHeight=b.height;let v=b.width*c,S=Math.ceil((a.fontStyle==="italic"?2:1)*v),P=b.height*c,T=S+f*2,C=P+f*2;if(d=false,p!==`
466
- `&&p!=="\r"&&p!==" "&&p!==" "&&(d=true,u=Math.ceil(Math.max(C,u))),l+T>g&&(h+=u,u=C,l=0,h+u>y)){n.update();let E=this._nextPage();s=E.canvasAndContext.canvas,o=E.canvasAndContext.context,n=E.texture.source,l=0,h=0,u=0;}let G=v/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[p]={id:p.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:G,kerning:{}},d){this._drawGlyph(o,b,l+f,h+f,c,a);let E=n.width*c,L=n.height*c,R=new st(l/E*n.width,h/L*n.height,T/E*n.width,C/L*n.height);this.chars[p].texture=new D({source:n,frame:R}),l+=Math.ceil(T);}}n.update(),this._currentX=l,this._currentY=h,this._currentMaxCharHeight=u,this._skipKerning&&this._applyKerning(e,o);}get pageTextures(){return N(q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=r[o];l||(l=r[o]=e.measureText(o).width);let h=r[a];h||(h=r[a]=e.measureText(a).width);let u=e.measureText(o+a).width,c=u-(l+h);c&&(this.chars[o].kerning[a]=c),u=e.measureText(o+a).width,c=u-(l+h),c&&(this.chars[a].kerning[o]=c);}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Fe.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new D({source:new Me({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(s.source.style=this._textureStyle);let o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Er(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=di(s,t)),e._fill&&(t.fillStyle=di(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=J.shared.setValue(n.color).toArray(),l=n.blur*r,h=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*h,t.shadowOffsetY=Math.sin(n.angle)*h;}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;}_drawGlyph(t,e,r,s,o,n){let a=e.text,l=e.fontProperties,u=(n._stroke?.width??0)*o,c=r+u/2,f=s-u/2,d=l.descent*o,g=e.lineHeight*o;n.stroke&&u&&t.strokeText(a,c,f+g-d),n._fill&&t.fillText(a,c,f+g-d);}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Fe.returnCanvasAndContext(e),r.destroy(true);}this.pages=null;}};Km.defaultOptions={textureSize:512,style:new he,mipmap:true};ph=Km;});function wn(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=true,l={width:0,start:0,index:0,positions:[],chars:[]},h=g=>{let y=o.width;for(let m=0;m<l.index;m++){let p=g.positions[m];o.chars.push(g.chars[m]),o.charPositions.push(p+y);}o.width+=g.width,a=false,l.width=0,l.index=0,l.chars.length=0;},u=()=>{let g=o.chars.length-1;if(r){let y=o.chars[g];for(;y===" ";)o.width-=e.chars[y].xAdvance,y=o.chars[--g];}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=true,s.lines.push(o),s.height+=e.lineHeight;},c=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*c,d=t.wordWrapWidth*c;for(let g=0;g<i.length+1;g++){let y,m=g===i.length;m||(y=i[g]);let p=e.chars[y]||e.chars[" "];if(/(?:\s)/.test(y)||y==="\r"||y===`
465
+ `}};});var dh,fh,Sn,Xm=g(()=>{ut();zo();ul();fl();Yo();ml();as();Qe();Wm();$m();Sn=class extends Le{constructor(t){let e=new Vt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});dh??(dh=Qr({name:"sdf-shader",bits:[No,Wo(t),Nm,Hm,ti]})),fh??(fh=Jr({name:"sdf-shader",bits:[Vo,Ho(t),Vm,Ym,ei]})),super({glProgram:fh,gpuProgram:dh,resources:{localUniforms:e,batchSamplers:$o(t)}});}};});var Tn,jm=g(()=>{Yt();yt();Tn=class extends et{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=true,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100;}get font(){return N(q,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return N(q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return N(q,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return N(q,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return N(q,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=false){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(true)),this.pages=null);}};});var Km,ph,Zm=g(()=>{$t();Xt();Ss();Mo();Rt();Ur();yt();Ts();yn();hh();vs();jm();Km=class qm extends Tn{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._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=false;let e={...qm.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=D.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Er(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??false,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof ae?e.textureStyle:new ae(e.textureStyle)),this.fontMetrics=qt.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize;}ensureCharacters(t){let e=qt.graphemeSegmenter(t).filter(m=>!this._currentChars.includes(m)).filter((m,p,b)=>b.indexOf(m)===p);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,l=this._currentX,h=this._currentY,u=this._currentMaxCharHeight,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,f=this._padding*c,d=false,x=s.width/this.resolution,y=s.height/this.resolution;for(let m=0;m<e.length;m++){let p=e[m],b=qt.measureText(p,a,s,false);b.lineHeight=b.height;let v=b.width*c,S=Math.ceil((a.fontStyle==="italic"?2:1)*v),P=b.height*c,T=S+f*2,C=P+f*2;if(d=false,p!==`
466
+ `&&p!=="\r"&&p!==" "&&p!==" "&&(d=true,u=Math.ceil(Math.max(C,u))),l+T>x&&(h+=u,u=C,l=0,h+u>y)){n.update();let E=this._nextPage();s=E.canvasAndContext.canvas,o=E.canvasAndContext.context,n=E.texture.source,l=0,h=0,u=0;}let G=v/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[p]={id:p.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:G,kerning:{}},d){this._drawGlyph(o,b,l+f,h+f,c,a);let E=n.width*c,L=n.height*c,R=new st(l/E*n.width,h/L*n.height,T/E*n.width,C/L*n.height);this.chars[p].texture=new D({source:n,frame:R}),l+=Math.ceil(T);}}n.update(),this._currentX=l,this._currentY=h,this._currentMaxCharHeight=u,this._skipKerning&&this._applyKerning(e,o);}get pageTextures(){return N(q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=r[o];l||(l=r[o]=e.measureText(o).width);let h=r[a];h||(h=r[a]=e.measureText(a).width);let u=e.measureText(o+a).width,c=u-(l+h);c&&(this.chars[o].kerning[a]=c),u=e.measureText(o+a).width,c=u-(l+h),c&&(this.chars[a].kerning[o]=c);}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Fe.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new D({source:new Me({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(s.source.style=this._textureStyle);let o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Er(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=di(s,t)),e._fill&&(t.fillStyle=di(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=J.shared.setValue(n.color).toArray(),l=n.blur*r,h=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*h,t.shadowOffsetY=Math.sin(n.angle)*h;}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;}_drawGlyph(t,e,r,s,o,n){let a=e.text,l=e.fontProperties,u=(n._stroke?.width??0)*o,c=r+u/2,f=s-u/2,d=l.descent*o,x=e.lineHeight*o;n.stroke&&u&&t.strokeText(a,c,f+x-d),n._fill&&t.fillText(a,c,f+x-d);}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Fe.returnCanvasAndContext(e),r.destroy(true);}this.pages=null;}};Km.defaultOptions={textureSize:512,style:new he,mipmap:true};ph=Km;});function wn(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=true,l={width:0,start:0,index:0,positions:[],chars:[]},h=x=>{let y=o.width;for(let m=0;m<l.index;m++){let p=x.positions[m];o.chars.push(x.chars[m]),o.charPositions.push(p+y);}o.width+=x.width,a=false,l.width=0,l.index=0,l.chars.length=0;},u=()=>{let x=o.chars.length-1;if(r){let y=o.chars[x];for(;y===" ";)o.width-=e.chars[y].xAdvance,y=o.chars[--x];}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=true,s.lines.push(o),s.height+=e.lineHeight;},c=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*c,d=t.wordWrapWidth*c;for(let x=0;x<i.length+1;x++){let y,m=x===i.length;m||(y=i[x]);let p=e.chars[y]||e.chars[" "];if(/(?:\s)/.test(y)||y==="\r"||y===`
467
467
  `||m){if(!a&&t.wordWrap&&o.width+l.width-f>d?(u(),h(l),m||o.charPositions.push(0)):(l.start=o.width,h(l),m||o.charPositions.push(0)),y==="\r"||y===`
468
- `)o.width!==0&&u();else if(!m){let P=p.xAdvance+(p.kerning[n]||0)+f;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(y);}}else {let S=p.kerning[n]||0,P=p.xAdvance+S+f;l.positions[l.index++]=l.width+S,l.chars.push(y),l.width+=P;}n=y;}return u(),t.align==="center"?Xy(s):t.align==="right"?jy(s):t.align==="justify"&&Ky(s),s}function Xy(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function jy(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function Ky(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,h=(t-r.width)/a;for(let u=0;u<r.charPositions.length;u++)u===o&&(o=r.spacesIndex[s++],n+=h),r.charPositions[u]+=n;}}var mh=x(()=>{});function Qm(i){if(i==="")return [];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,l=n;a<=l;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 Jm=x(()=>{});var Cn,gh,tg,eg=x(()=>{es();yt();zt();Ts();vs();Zm();mh();Jm();Cn=0,gh=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:false,textureStyle:null};}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=true;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=false;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=false;}if(!vt.has(r)){let n=new ph({style:e,overrideFill:s,overrideSize:true,...this.defaultOptions});Cn++,Cn>50&&Z("BitmapText",`You have dynamically created ${Cn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Cn--,vt.remove(r);}),vt.set(r,n);}let o=vt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=true){let s=this.getFont(t,e),o=qt.graphemeSegmenter(t);return wn(o,e,s,r)}measureText(t,e,r=true){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},N(q,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof he?s:new he(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ph({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false,textureStyle:e.textureStyle}),l=Qm(e.chars);return a.ensureCharacters(l.join("")),vt.set(`${r}-bitmap`,a),a.once("destroy",()=>vt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=vt.get(e);r&&r.destroy();}},tg=new gh;});function rg(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels;}var xh,Cs,ig=x(()=>{es();U();zm();Ts();Xm();eg();mh();xh=class extends vn{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy();}},Cs=class{constructor(t){this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText");}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);rg(t,r),t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t);}updateRenderable(t){let e=this._getGpuBitmapText(t);rg(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=tg.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=new Sn(this._renderer.limits.maxBatchableTextures)));let o=qt.graphemeSegmenter(t.text),n=t._style,a=s.baseLineOffset,l=wn(o,n,s,true),h=0,u=n.padding,c=l.scale,f=l.width,d=l.height+l.offsetY;n._stroke&&(f+=n._stroke.width/c,d+=n._stroke.width/c),r.translate(-t._anchor._x*f-u,-t._anchor._y*d-u).scale(c,c);let g=s.applyFillAsTint?n._fill.color:16777215;for(let y=0;y<l.lines.length;y++){let m=l.lines[y];for(let p=0;p<m.charPositions.length;p++){let b=o[h++],v=s.chars[b];v?.texture&&r.texture(v.texture,g||"black",Math.round(m.charPositions[p]+v.xOffset),Math.round(a+v.yOffset));}a+=s.lineHeight;}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new xh;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),e}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=vt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,h=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+l*l),c=(Math.abs(h)+Math.abs(u))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=c*s.distanceField.range*(1/f);e.customShader.resources.localUniforms.uniforms.uDistance=d;}destroy(){this._renderer=null;}};Cs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"bitmapText"};});var _h=x(()=>{U();ig();W.add(Cs);});var Pn,sg=x(()=>{Wl();Pn=class extends ai{constructor(t){super(),this.generatingTexture=false,this._renderer=t,t.runners.resolutionChange.add(this);}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate();}destroy(){this._renderer.htmlText.returnTexturePromise(this.texturePromise),this.texturePromise=null,this._renderer=null;}};});var Ps,og=x(()=>{U();Rt();Vl();sg();Ps=class{constructor(t){this._renderer=t;}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t).catch(s=>{console.error(s);}),t._didTextUpdate=false,xs(r,t)),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e);}async _updateGpuText(t){t._didTextUpdate=false;let e=this._getGpuText(t);if(e.generatingTexture)return;e.texturePromise&&(this._renderer.htmlText.returnTexturePromise(e.texturePromise),e.texturePromise=null),e.generatingTexture=true,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let r=this._renderer.htmlText.getTexturePromise(t);e.texturePromise=r,e.texture=await r;let s=t.renderGroup||t.parentRenderGroup;s&&(s.structureDidChange=true),e.generatingTexture=false,xs(e,t);}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new Pn(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.texture=D.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null;}};Ps.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"htmlText"};});function ng(){let{userAgent:i}=gt.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var ag=x(()=>{fe();});var lg,hg,fi,yh=x(()=>{lg="http://www.w3.org/2000/svg",hg="http://www.w3.org/1999/xhtml",fi=class{constructor(){this.svgRoot=document.createElementNS(lg,"svg"),this.foreignObject=document.createElementNS(lg,"foreignObject"),this.domElement=document.createElementNS(hg,"div"),this.styleElement=document.createElementNS(hg,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s);}};});function dg(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${J.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[pg(t)]:[],...i.dropShadow?[fg(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return qy(i.tagStyles,s),s.join(" ")}function fg(i){let t=J.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function pg(i){return [`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${J.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${J.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function qy(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)cg[o]?s.push(cg[o](r[o])):ug[o]&&s.push(ug[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`);}}var ug,cg,mg=x(()=>{$t();ug={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"},cg={fill:i=>`color: ${J.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:pg,dropShadow:fg};});var Mn,gg=x(()=>{zt();vs();mg();Mn=class i extends he{constructor(t={}){super(t),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}update(){this._cssStyle=null,super.update();}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides,tagStyles:{...this.tagStyles}})}get cssStyle(){return this._cssStyle||(this._cssStyle=dg(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update());}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update());}set fill(t){typeof t!="string"&&typeof t!="number"&&Z("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t;}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&Z("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t;}};});function xg(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(l){s[l]||(r.push(l),s[l]=true);}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);n&&n.forEach(l=>{let h=l.split(":")[1].trim();a(h);});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;a(h);}return r}var _g=x(()=>{});async function yg(i){let e=await(await gt.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e);})}var bg=x(()=>{fe();});async function bh(i,t){let e=await yg(t);return `@font-face {
468
+ `)o.width!==0&&u();else if(!m){let P=p.xAdvance+(p.kerning[n]||0)+f;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(y);}}else {let S=p.kerning[n]||0,P=p.xAdvance+S+f;l.positions[l.index++]=l.width+S,l.chars.push(y),l.width+=P;}n=y;}return u(),t.align==="center"?Xy(s):t.align==="right"?jy(s):t.align==="justify"&&Ky(s),s}function Xy(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function jy(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function Ky(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,h=(t-r.width)/a;for(let u=0;u<r.charPositions.length;u++)u===o&&(o=r.spacesIndex[s++],n+=h),r.charPositions[u]+=n;}}var mh=g(()=>{});function Qm(i){if(i==="")return [];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,l=n;a<=l;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 Jm=g(()=>{});var Cn,gh,tg,eg=g(()=>{es();yt();zt();Ts();vs();Zm();mh();Jm();Cn=0,gh=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:false,textureStyle:null};}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=true;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=false;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=false;}if(!vt.has(r)){let n=new ph({style:e,overrideFill:s,overrideSize:true,...this.defaultOptions});Cn++,Cn>50&&Z("BitmapText",`You have dynamically created ${Cn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Cn--,vt.remove(r);}),vt.set(r,n);}let o=vt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=true){let s=this.getFont(t,e),o=qt.graphemeSegmenter(t);return wn(o,e,s,r)}measureText(t,e,r=true){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},N(q,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof he?s:new he(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ph({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false,textureStyle:e.textureStyle}),l=Qm(e.chars);return a.ensureCharacters(l.join("")),vt.set(`${r}-bitmap`,a),a.once("destroy",()=>vt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=vt.get(e);r&&r.destroy();}},tg=new gh;});function rg(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels;}var xh,Cs,ig=g(()=>{es();U();zm();Ts();Xm();eg();mh();xh=class extends vn{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy();}},Cs=class{constructor(t){this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText");}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);rg(t,r),t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t);}updateRenderable(t){let e=this._getGpuBitmapText(t);rg(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=tg.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=new Sn(this._renderer.limits.maxBatchableTextures)));let o=qt.graphemeSegmenter(t.text),n=t._style,a=s.baseLineOffset,l=wn(o,n,s,true),h=0,u=n.padding,c=l.scale,f=l.width,d=l.height+l.offsetY;n._stroke&&(f+=n._stroke.width/c,d+=n._stroke.width/c),r.translate(-t._anchor._x*f-u,-t._anchor._y*d-u).scale(c,c);let x=s.applyFillAsTint?n._fill.color:16777215;for(let y=0;y<l.lines.length;y++){let m=l.lines[y];for(let p=0;p<m.charPositions.length;p++){let b=o[h++],v=s.chars[b];v?.texture&&r.texture(v.texture,x||"black",Math.round(m.charPositions[p]+v.xOffset),Math.round(a+v.yOffset));}a+=s.lineHeight;}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new xh;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),e}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=vt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,h=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+l*l),c=(Math.abs(h)+Math.abs(u))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=c*s.distanceField.range*(1/f);e.customShader.resources.localUniforms.uniforms.uDistance=d;}destroy(){this._renderer=null;}};Cs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"bitmapText"};});var _h=g(()=>{U();ig();W.add(Cs);});var Pn,sg=g(()=>{Wl();Pn=class extends ai{constructor(t){super(),this.generatingTexture=false,this._renderer=t,t.runners.resolutionChange.add(this);}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate();}destroy(){this._renderer.htmlText.returnTexturePromise(this.texturePromise),this.texturePromise=null,this._renderer=null;}};});var Ps,og=g(()=>{U();Rt();Vl();sg();Ps=class{constructor(t){this._renderer=t;}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t).catch(s=>{console.error(s);}),t._didTextUpdate=false,xs(r,t)),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e);}async _updateGpuText(t){t._didTextUpdate=false;let e=this._getGpuText(t);if(e.generatingTexture)return;e.texturePromise&&(this._renderer.htmlText.returnTexturePromise(e.texturePromise),e.texturePromise=null),e.generatingTexture=true,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let r=this._renderer.htmlText.getTexturePromise(t);e.texturePromise=r,e.texture=await r;let s=t.renderGroup||t.parentRenderGroup;s&&(s.structureDidChange=true),e.generatingTexture=false,xs(e,t);}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new Pn(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.texture=D.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null;}};Ps.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"htmlText"};});function ng(){let{userAgent:i}=gt.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var ag=g(()=>{fe();});var lg,hg,fi,yh=g(()=>{lg="http://www.w3.org/2000/svg",hg="http://www.w3.org/1999/xhtml",fi=class{constructor(){this.svgRoot=document.createElementNS(lg,"svg"),this.foreignObject=document.createElementNS(lg,"foreignObject"),this.domElement=document.createElementNS(hg,"div"),this.styleElement=document.createElementNS(hg,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s);}};});function dg(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${J.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[pg(t)]:[],...i.dropShadow?[fg(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return qy(i.tagStyles,s),s.join(" ")}function fg(i){let t=J.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function pg(i){return [`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${J.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${J.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function qy(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)cg[o]?s.push(cg[o](r[o])):ug[o]&&s.push(ug[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`);}}var ug,cg,mg=g(()=>{$t();ug={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"},cg={fill:i=>`color: ${J.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:pg,dropShadow:fg};});var Mn,gg=g(()=>{zt();vs();mg();Mn=class i extends he{constructor(t={}){super(t),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}update(){this._cssStyle=null,super.update();}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides,tagStyles:{...this.tagStyles}})}get cssStyle(){return this._cssStyle||(this._cssStyle=dg(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update());}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update());}set fill(t){typeof t!="string"&&typeof t!="number"&&Z("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t;}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&Z("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t;}};});function xg(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(l){s[l]||(r.push(l),s[l]=true);}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);n&&n.forEach(l=>{let h=l.split(":")[1].trim();a(h);});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;a(h);}return r}var _g=g(()=>{});async function yg(i){let e=await(await gt.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e);})}var bg=g(()=>{fe();});async function bh(i,t){let e=await yg(t);return `@font-face {
469
469
  font-family: "${i.fontFamily}";
470
470
  src: url('${e}');
471
471
  font-weight: ${i.fontWeight};
472
472
  font-style: ${i.fontStyle};
473
- }`}var vg=x(()=>{bg();});async function Sg(i,t,e){let r=i.filter(s=>vt.has(`${s}-and-url`)).map((s,o)=>{if(!En.has(s)){let{url:n}=vt.get(`${s}-and-url`);o===0?En.set(s,bh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):En.set(s,bh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n));}return En.get(s)});return (await Promise.all(r)).join(`
474
- `)}var En,Tg=x(()=>{es();vg();En=new Map;});function wg(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var Cg=x(()=>{});function Pg(i,t){let e=Fe.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var Mg=x(()=>{Ss();});function Eg(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r();},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous";})}var Ag=x(()=>{});function Lg(i,t,e,r){r||(r=Ig||(Ig=new fi));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return {width:a.width-l,height:a.height-l}}var Ig,Rg=x(()=>{yh();});var Ms,Fg=x(()=>{U();Ss();zr();ns();ag();zt();pr();nh();yh();gg();_g();Tg();Cg();Mg();Ag();Rg();Ms=class{constructor(t){this._renderer=t,this._createCanvas=t.type===Ie.WEBGPU;}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:s,textureStyle:o}=t,n=wt.get(fi),a=xg(e,r),l=await Sg(a,r,Mn.defaultTextStyle),h=Lg(e,r,l,n),u=Math.ceil(Math.ceil(Math.max(1,h.width)+r.padding*2)*s),c=Math.ceil(Math.ceil(Math.max(1,h.height)+r.padding*2)*s),f=n.image,d=2;f.width=(u|0)+d,f.height=(c|0)+d;let g=wg(e,r,s,l,n);await Eg(f,g,ng()&&a.length>0);let y=f,m;this._createCanvas&&(m=Pg(f,s));let p=_n(m?m.canvas:y,f.width-d,f.height-d,s);return o&&(p.source.style=o),this._createCanvas&&(this._renderer.texture.initSource(p.source),Fe.returnCanvasAndContext(m)),wt.return(n),p}returnTexturePromise(t){t.then(e=>{this._cleanUp(e);}).catch(()=>{Z("HTMLTextSystem: Failed to clean texture");});}_cleanUp(t){kt.returnTexture(t,true),t.source.resource=null,t.source.uploadMethodId="unknown";}destroy(){this._renderer=null;}};Ms.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"htmlText"};});var vh=x(()=>{U();og();Fg();W.add(Ms);W.add(Ps);});var Bg,pi,An=x(()=>{jr();Xr();os();yt();Bg=class kg extends Ae{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(N(q,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...kg.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Ft({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),l=new Ft({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),h=new Ft({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:lt.INDEX|lt.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,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;}};Bg.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};pi=Bg;});var Es,Gg,Og=x(()=>{Es={name:"local-uniform-bit",vertex:{header:`
473
+ }`}var vg=g(()=>{bg();});async function Sg(i,t,e){let r=i.filter(s=>vt.has(`${s}-and-url`)).map((s,o)=>{if(!En.has(s)){let{url:n}=vt.get(`${s}-and-url`);o===0?En.set(s,bh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):En.set(s,bh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n));}return En.get(s)});return (await Promise.all(r)).join(`
474
+ `)}var En,Tg=g(()=>{es();vg();En=new Map;});function wg(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var Cg=g(()=>{});function Pg(i,t){let e=Fe.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var Mg=g(()=>{Ss();});function Eg(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r();},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous";})}var Ag=g(()=>{});function Lg(i,t,e,r){r||(r=Ig||(Ig=new fi));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return {width:a.width-l,height:a.height-l}}var Ig,Rg=g(()=>{yh();});var Ms,Fg=g(()=>{U();Ss();zr();ns();ag();zt();pr();nh();yh();gg();_g();Tg();Cg();Mg();Ag();Rg();Ms=class{constructor(t){this._renderer=t,this._createCanvas=t.type===Ie.WEBGPU;}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:s,textureStyle:o}=t,n=wt.get(fi),a=xg(e,r),l=await Sg(a,r,Mn.defaultTextStyle),h=Lg(e,r,l,n),u=Math.ceil(Math.ceil(Math.max(1,h.width)+r.padding*2)*s),c=Math.ceil(Math.ceil(Math.max(1,h.height)+r.padding*2)*s),f=n.image,d=2;f.width=(u|0)+d,f.height=(c|0)+d;let x=wg(e,r,s,l,n);await Eg(f,x,ng()&&a.length>0);let y=f,m;this._createCanvas&&(m=Pg(f,s));let p=_n(m?m.canvas:y,f.width-d,f.height-d,s);return o&&(p.source.style=o),this._createCanvas&&(this._renderer.texture.initSource(p.source),Fe.returnCanvasAndContext(m)),wt.return(n),p}returnTexturePromise(t){t.then(e=>{this._cleanUp(e);}).catch(()=>{Z("HTMLTextSystem: Failed to clean texture");});}_cleanUp(t){kt.returnTexture(t,true),t.source.resource=null,t.source.uploadMethodId="unknown";}destroy(){this._renderer=null;}};Ms.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"htmlText"};});var vh=g(()=>{U();og();Fg();W.add(Ms);W.add(Ps);});var Bg,pi,An=g(()=>{jr();Xr();os();yt();Bg=class kg extends Ae{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(N(q,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...kg.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Ft({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),l=new Ft({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),h=new Ft({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:lt.INDEX|lt.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,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;}};Bg.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};pi=Bg;});var Es,Gg,Og=g(()=>{Es={name:"local-uniform-bit",vertex:{header:`
475
475
 
476
476
  struct LocalUniforms {
477
477
  uTransformMatrix:mat3x3<f32>,
@@ -501,7 +501,7 @@ fn mainFragment(
501
501
  {
502
502
  gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
503
503
  }
504
- `}};});var Dg,Ug,zg=x(()=>{Dg={name:"tiling-bit",vertex:{header:`
504
+ `}};});var Dg,Ug,zg=g(()=>{Dg={name:"tiling-bit",vertex:{header:`
505
505
  struct TilingUniforms {
506
506
  uMapCoord:mat3x3<f32>,
507
507
  uClampFrame:vec4<f32>,
@@ -566,5 +566,5 @@ 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 Sh,Th,In,Ng=x(()=>{ut();zo();Og();Yo();as();Qe();Rt();zg();In=class extends Le{constructor(){Sh??(Sh=Qr({name:"tiling-sprite-shader",bits:[Es,Dg,ti]})),Th??(Th=Jr({name:"tiling-sprite-shader",bits:[Gg,Ug,ei]}));let t=new Vt({uMapCoord:{value:new F,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 F,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Th,gpuProgram:Sh,resources:{localUniforms:new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:D.EMPTY.source,uSampler:D.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*l/t,r.b*l/e,r.c*h/t,r.d*h/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,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 Ln,Vg=x(()=>{An();Ln=class extends pi{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 Wg(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var Hg=x(()=>{});function Yg(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,l=r.c,h=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+l*d+u,i[e+1]=a*f+h*d+c,e+=t,s++;}}var $g=x(()=>{});function Xg(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=F.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Yg(t,2,0,a);}var jg=x(()=>{ut();$g();});var Rn,wh,As,Kg=x(()=>{U();is();tn();ns();ds();en();An();Ng();Vg();Hg();jg();Rn=new Ln,wh=class{constructor(){this.canBatch=true,this.geometry=new pi({indices:Rn.indices.slice(),positions:Rn.positions.slice(),uvs:Rn.uvs.slice()});}destroy(){this.geometry.destroy(),this.shader?.destroy();}},As=class{constructor(t){this._state=Cr.default2d,this._renderer=t;}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new tr);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new In),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Je(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ne(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Rn,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new wh;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),Xg(t,r.uvs),Wg(t,r.positions);}destroy(){this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Ie.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};As.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"tilingSprite"};});var Ch=x(()=>{U();Kg();W.add(As);});var qg,Qg,Jg=x(()=>{yt();An();qg=class Zg extends pi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(N(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={...Zg.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*l,d*h),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,g=d*this.verticesX+f,y=d*this.verticesX+f+1,m=(d+1)*this.verticesX+f,p=(d+1)*this.verticesX+f+1;o.push(g,y,m,y,p,m);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};qg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Qg=qg;});var tx,rx,ix=x(()=>{Jg();tx=class ex extends Qg{constructor(t={}){t={...ex.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,g=Math.min(c,d),y=l*e,m=h*r;t[0]=t[8]=t[16]=t[24]=-y,t[2]=t[10]=t[18]=t[26]=s*g-y,t[4]=t[12]=t[20]=t[28]=e-o*g-y,t[6]=t[14]=t[22]=t[30]=e-y,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=n*g-m,t[17]=t[19]=t[21]=t[23]=r-a*g-m,t[25]=t[27]=t[29]=t[31]=r-m,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};tx.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};rx=tx;});var Ph,Is,sx=x(()=>{U();en();ix();Ph=class extends tr{constructor(){super(),this.geometry=new rx;}destroy(){this.geometry.destroy();}},Is=class{constructor(t){this._renderer=t;}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new Ph,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null;}};Is.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"nineSliceSprite"};});var Mh=x(()=>{U();sx();W.add(Is);});var Ls,ox=x(()=>{U();Ls=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ls.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"filter"};});function nx(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var ax=x(()=>{});var Zy,Eh,Rs,lx=x(()=>{U();ut();rs();os();Qe();Rt();zr();ns();ce();ax();zt();Zy=new Ae({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])}),Eh=class{constructor(){this.skip=false,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new mt,this.container=null,this.blendRequired=false,this.outputRenderSurface=null,this.outputOffset={x:0,y:0},this.globalFrame={x:0,y:0,width:0,height:0};}},Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Vt({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 le({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=false,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let o=e.renderTarget.renderTarget.colorTexture.source,n=o.resolution,a=o.antialias;if(r.length===0){s.skip=true;return}let l=s.bounds;if(t.renderables?nx(t.renderables,l):t.filterEffect.filterArea?(l.clear(),l.addRect(t.filterEffect.filterArea),l.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,l),t.container){let y=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;y&&l.applyMatrix(y);}if(this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,n,1),s.skip)return;let h=this._getPreviousFilterData(),u=n,c=0,f=0;h&&(c=h.bounds.minX,f=h.bounds.minY,u=h.inputTexture.source._resolution),s.outputOffset.x=l.minX-c,s.outputOffset.y=l.minY-f;let d=s.globalFrame;if(d.x=c*u,d.y=f*u,d.width=o.width*u,d.height=o.height*u,s.backTexture=D.EMPTY,s.blendRequired){e.renderTarget.finishRenderPass();let g=e.renderTarget.getRenderTarget(s.outputRenderSurface);s.backTexture=this.getBackTexture(g,l,h?.bounds);}s.inputTexture=kt.getOptimalTexture(l.width,l.height,s.resolution,s.antialias),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:l});}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=false,r.filters=e;let s=t.source,o=s.resolution,n=s.antialias;if(e.length===0)return r.skip=true,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,n,o,0),r.skip)return t;let l=o,h=0,u=0;r.outputOffset.x=-a.minX,r.outputOffset.y=-a.minY;let c=r.globalFrame;c.x=h*l,c.y=u*l,c.width=s.width*l,c.height=s.height*l,r.outputRenderSurface=kt.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=D.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,true);let d=r.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,false),e.blendRequired&&kt.returnTexture(e.backTexture),kt.returnTexture(e.inputTexture));}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=kt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),h=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:h},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._activeFilterData,a=n.outputRenderSurface,l=this._filterGlobalUniforms,h=l.uniforms,u=h.uOutputFrame,c=h.uInputSize,f=h.uInputPixel,d=h.uInputClamp,g=h.uGlobalFrame,y=h.uOutputTexture;a===r?(u[0]=n.outputOffset.x,u[1]=n.outputOffset.y):(u[0]=0,u[1]=0),u[2]=e.frame.width,u[3]=e.frame.height,c[0]=e.source.width,c[1]=e.source.height,c[2]=1/c[0],c[3]=1/c[1],f[0]=e.source.pixelWidth,f[1]=e.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],d[0]=.5*f[2],d[1]=.5*f[3],d[2]=e.frame.width*c[2]-.5*f[2],d[3]=e.frame.height*c[3]-.5*f[3],g[0]=n.globalFrame.x,g[1]=n.globalFrame.y,g[2]=n.globalFrame.width,g[3]=n.globalFrame.height,r instanceof D&&(r.source.resource=null);let m=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof D?(y[0]=r.frame.width,y[1]=r.frame.height):(y[0]=m.width,y[1]=m.height),y[2]=m.isRoot?-1:1,l.update(),o.renderPipes.uniformBatch){let p=o.renderPipes.uniformBatch.getUboResource(l);this._globalFilterBindGroup.setResource(p,0);}else this._globalFilterBindGroup.setResource(l,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:Zy,shader:t,state:t._state,topology:"triangle-list"}),o.type===Ie.WEBGL&&o.renderTarget.finishRenderPass();}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(F.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}destroy(){}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,o=t.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),o.length===1)o[0].apply(this,r,t.outputRenderSurface,e);else {let n=t.inputTexture,a=kt.getOptimalTexture(s.width,s.height,n.source._resolution,false),l=a,h=0;for(h=0;h<o.length-1;++h){o[h].apply(this,n,l,true);let c=n;n=l,l=c;}o[h].apply(this,n,t.outputRenderSurface,e),kt.returnTexture(a);}}_calculateFilterBounds(t,e,r,s,o){let n=this.renderer,a=t.bounds,l=t.filters,h=1/0,u=0,c=true,f=false,d=false,g=true;for(let y=0;y<l.length;y++){let m=l[y];if(h=Math.min(h,m.resolution==="inherit"?s:m.resolution),u+=m.padding,m.antialias==="off"?c=false:m.antialias==="inherit"&&c&&(c=r),m.clipToViewport||(g=false),!!!(m.compatibleRenderers&n.type)){d=false;break}if(m.blendRequired&&!(n.backBuffer?.useBackBuffer??true)){Z("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),d=false;break}d=m.enabled||d,f||(f=m.blendRequired);}if(!d){t.skip=true;return}if(g&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(h).ceil().scale(1/h).pad((u|0)*o),!a.isPositive){t.skip=true;return}t.antialias=c,t.resolution=h,t.blendRequired=f;}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new Eh),this._filterStackIndex++,t}};Rs.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"filter"};});var Ah=x(()=>{U();ox();lx();W.add(Rs);W.add(Ls);});var Qy={};var hx=x(()=>{Ac();Pa();Dc();zc();To();Ao();Gl();Ol();Nl();ch();_h();vh();Ch();Mh();Ah();});var Jy={};var cx=x(()=>{Pa();To();Ao();Gl();Ol();Nl();ch();_h();vh();Ch();Mh();Ah();});var Cx=$s((zn,wx)=>{(function(i,t){typeof zn=="object"?wx.exports=zn=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(zn,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof Wn=="function")try{r=Wn("crypto");}catch{}var s=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(b){var v;return p.prototype=b,v=new p,p.prototype=null,v}}(),n={},a=n.lib={},l=a.Base=function(){return {extend:function(p){var b=o(this);return p&&b.mixIn(p),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments);}),b.init.prototype=b,b.$super=this,b},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var b in p)p.hasOwnProperty(b)&&(this[b]=p[b]);p.hasOwnProperty("toString")&&(this.toString=p.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),h=a.WordArray=l.extend({init:function(p,b){p=this.words=p||[],b!=e?this.sigBytes=b:this.sigBytes=p.length*4;},toString:function(p){return (p||c).stringify(this)},concat:function(p){var b=this.words,v=p.words,S=this.sigBytes,P=p.sigBytes;if(this.clamp(),S%4)for(var T=0;T<P;T++){var C=v[T>>>2]>>>24-T%4*8&255;b[S+T>>>2]|=C<<24-(S+T)%4*8;}else for(var G=0;G<P;G+=4)b[S+G>>>2]=v[G>>>2];return this.sigBytes+=P,this},clamp:function(){var p=this.words,b=this.sigBytes;p[b>>>2]&=4294967295<<32-b%4*8,p.length=t.ceil(b/4);},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var b=[],v=0;v<p;v+=4)b.push(s());return new h.init(b,p)}}),u=n.enc={},c=u.Hex={stringify:function(p){for(var b=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=b[P>>>2]>>>24-P%4*8&255;S.push((T>>>4).toString(16)),S.push((T&15).toString(16));}return S.join("")},parse:function(p){for(var b=p.length,v=[],S=0;S<b;S+=2)v[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new h.init(v,b/2)}},f=u.Latin1={stringify:function(p){for(var b=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=b[P>>>2]>>>24-P%4*8&255;S.push(String.fromCharCode(T));}return S.join("")},parse:function(p){for(var b=p.length,v=[],S=0;S<b;S++)v[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new h.init(v,b)}},d=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(f.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return f.parse(unescape(encodeURIComponent(p)))}},g=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(p){typeof p=="string"&&(p=d.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes;},_process:function(p){var b,v=this._data,S=v.words,P=v.sigBytes,T=this.blockSize,C=T*4,G=P/C;p?G=t.ceil(G):G=t.max((G|0)-this._minBufferSize,0);var E=G*T,L=t.min(E*4,P);if(E){for(var R=0;R<E;R+=T)this._doProcessBlock(S,R);b=S.splice(0,E),v.sigBytes-=L;}return new h.init(b,L)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});a.Hasher=g.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var b=this._doFinalize();return b},blockSize:512/32,_createHelper:function(p){return function(b,v){return new p.init(v).finalize(b)}},_createHmacHelper:function(p){return function(b,v){return new m.HMAC.init(p,v).finalize(b)}}});var m=n.algo={};return n}(Math);return i});});var Mx=$s((Nn,Px)=>{(function(i,t){typeof Nn=="object"?Px.exports=Nn=t(Cx()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(Nn,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,s=e.Hasher,o=t.algo,n=[],a=o.SHA1=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,h){for(var u=this._hash.words,c=u[0],f=u[1],d=u[2],g=u[3],y=u[4],m=0;m<80;m++){if(m<16)n[m]=l[h+m]|0;else {var p=n[m-3]^n[m-8]^n[m-14]^n[m-16];n[m]=p<<1|p>>>31;}var b=(c<<5|c>>>27)+y+n[m];m<20?b+=(f&d|~f&g)+1518500249:m<40?b+=(f^d^g)+1859775393:m<60?b+=(f&d|f&g|d&g)-1894007588:b+=(f^d^g)-899497514,y=g,g=d,d=f<<30|f>>>2,f=c,c=b;}u[0]=u[0]+c|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+g|0,u[4]=u[4]+y|0;},_doFinalize:function(){var l=this._data,h=l.words,u=this._nDataBytes*8,c=l.sigBytes*8;return h[c>>>5]|=128<<24-c%32,h[(c+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(c+64>>>9<<4)+15]=u,l.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var l=s.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=s._createHelper(a),t.HmacSHA1=s._createHmacHelper(a);}(),i.SHA1});});var Te={};Ux(Te,{DistortionFilter:()=>js,EqualizerFilter:()=>oe,Filter:()=>Tt,MonoFilter:()=>Ks,ReverbFilter:()=>qs,StereoFilter:()=>Zs,StreamFilter:()=>Qs,TelephoneFilter:()=>Js});var $h;function Xh(i){return $h=i,i}function nt(){return $h}var Tt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var js=class extends Tt{constructor(t=0){let e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,nt().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var _t=class{static setParamValue(t,e){if(t.setValueAtTime){let r=nt().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var at=class extends Tt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,l=0,h=0){let u=[],c=[{f:at.F32,type:"lowshelf",gain:i},{f:at.F64,type:"peaking",gain:t},{f:at.F125,type:"peaking",gain:e},{f:at.F250,type:"peaking",gain:r},{f:at.F500,type:"peaking",gain:s},{f:at.F1K,type:"peaking",gain:o},{f:at.F2K,type:"peaking",gain:n},{f:at.F4K,type:"peaking",gain:a},{f:at.F8K,type:"peaking",gain:l},{f:at.F16K,type:"highshelf",gain:h}];nt().useLegacy||(u=c.map(f=>{let d=nt().context.audioContext.createBiquadFilter();return d.type=f.type,_t.setParamValue(d.Q,1),d.frequency.value=f.f,_t.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);_t.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(at.F32,i);}get f32(){return this.getGain(at.F32)}set f64(i){this.setGain(at.F64,i);}get f64(){return this.getGain(at.F64)}set f125(i){this.setGain(at.F125,i);}get f125(){return this.getGain(at.F125)}set f250(i){this.setGain(at.F250,i);}get f250(){return this.getGain(at.F250)}set f500(i){this.setGain(at.F500,i);}get f500(){return this.getGain(at.F500)}set f1k(i){this.setGain(at.F1K,i);}get f1k(){return this.getGain(at.F1K)}set f2k(i){this.setGain(at.F2K,i);}get f2k(){return this.getGain(at.F2K)}set f4k(i){this.setGain(at.F4K,i);}get f4k(){return this.getGain(at.F4K)}set f8k(i){this.setGain(at.F8K,i);}get f8k(){return this.getGain(at.F8K)}set f16k(i){this.setGain(at.F16K,i);}get f16k(){return this.getGain(at.F16K)}reset(){this.bands.forEach(i=>{_t.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},oe=at;oe.F32=32;oe.F64=64;oe.F125=125;oe.F250=250;oe.F500=500;oe.F1K=1e3;oe.F2K=2e3;oe.F4K=4e3;oe.F8K=8e3;oe.F16K=16e3;var Ks=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var qs=class extends Tt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(nt().useLegacy)return;let{audioContext:t}=nt().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let h=0;h<r;h++)a=this._reverse?r-h:h,o[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let l=t.createConvolver();l.buffer=s,this.init(l);}};var Zs=class extends Tt{constructor(t=0){let e,r,s;if(!nt().useLegacy){let{audioContext:o}=nt().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?_t.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Qs=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Js=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",_t.setParamValue(s.frequency,2e3),o.type="lowpass",_t.setParamValue(o.frequency,2e3),n.type="highpass",_t.setParamValue(n.frequency,500),a.type="highpass",_t.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};U();var ux={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(hx(),Qy));}};U();var dx={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(cx(),Jy));}};U();U();Ao();To();Ga();fe();Xa();Hi();Yt();So();W.add(ux,dx);var Fs=class extends et{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var tb=0,Ih=class extends et{constructor(i){super(),this.id=tb++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Ih.PADDING),this._end=Math.min(this._end+Ih.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),Pt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){Pt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){Pt.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Fn=Ih;Fn.PADDING=.1;var Bs=class extends et{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Fn(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let l=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,l);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let l=r.autoPlayStart();t&&t(null,r,l);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let l=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(l)):console.error(l);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ks=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ar=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Lh=["audio/mpeg","audio/ogg"],Ir={};function fx(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;Ar.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ir,r);}fx();var rb=0,Gs=class extends et{constructor(t){super(),this.id=rb++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);_t.setParamValue(this._gain.gain,o*s*r),_t.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:l}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:h,gain:u}=this._media.nodes.cloneBufferSource();this._source=h,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=l,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){Pt.shared.remove(this._updateListener,this),t&&Pt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Lr=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var px=class extends Lr{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(px.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,_t.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Bn=px;Bn.BUFFER_SIZE=0;var Rr=class{init(t){this.parent=t,this._nodes=new Bn(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Gs(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await gt.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var mi=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=nt().useLegacy?new Bs:new Rr;return new mi(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:jt.extname(e).slice(1)})).filter(({ext:e})=>Ir[e]).sort((e,r)=>Ar.indexOf(e.ext)-Ar.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return nt().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ks(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,l)=>{this._preloadQueue.forEach(h=>h()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,l),s(l));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(mi._pool.length>0){let i=mi._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),mi._pool.indexOf(i)<0&&mi._pool.push(i);}},rr=mi;rr._pool=[];var gi=class i extends Lr{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new et,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var kn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new gi),this._htmlAudioContext=new Fs,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return gi.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof rr)return this._sounds[t]=e,e;let r=this._getOptions(e),s=rr.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var mx=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=jt.basename(t,jt.extname(t))),e},gx={extension:w.Asset,detection:{test:async()=>true,add:async i=>[...i,...Ar.filter(t=>Ir[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[w.LoadParser],priority:Hr.High},test(i){let t=jt.extname(i).slice(1);return !!Ir[t]||Lh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>rr.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return nt().add(mx(t),e),e},async unload(i,t){nt().remove(mx(t));}}};W.add(gx);Xh(new kn);({DistortionFilter:Te.DistortionFilter,EqualizerFilter:Te.EqualizerFilter,MonoFilter:Te.MonoFilter,ReverbFilter:Te.ReverbFilter,StereoFilter:Te.StereoFilter,StreamFilter:Te.StreamFilter,TelephoneFilter:Te.TelephoneFilter});var Q={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var k;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(k||(k={}));var Y=class Y{static init(t){Y._getStepCounter=t.getStepCounter,Y._setStepCounter=t.setStepCounter,Y._getCurrentGameStepState=t.getCurrentGameStepState,Y._restoreGameStepState=t.restoreGameStepState,Y._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(Y._onGoNextEnd=t.onGoNextEnd),Y._getVariable=t.getVariable,Y._setVariable=t.setVariable,Y._removeVariable=t.removeVariable,Y._getFlag=t.getFlag,Y._setFlag=t.setFlag,t.onLabelClosing&&(Y._onLabelClosing=t.onLabelClosing),Y._addHistoryItem=t.addHistoryItem,Y._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,Y._getCharacter=t.getCharacter;}static get stepCounter(){return Y._getStepCounter()}static set stepCounter(t){Y._setStepCounter(t);}static get currentGameStepState(){return Y._getCurrentGameStepState()}static get restoreGameStepState(){return Y._restoreGameStepState}static get openedLabels(){return Y._getOpenedLabels()}static get onGoNextEnd(){return Y._onGoNextEnd}static get getVariable(){return Y._getVariable}static get setVariable(){return Y._setVariable}static get removeVariable(){return Y._removeVariable}static get getFlag(){return Y._getFlag}static get setFlag(){return Y._setFlag}static get onLabelClosing(){return Y._onLabelClosing}static get addHistoryItem(){return Y._addHistoryItem}static get currentStepsRunningNumber(){return Y._getCurrentStepsRunningNumber()}static get getCharacter(){return Y._getCharacter}};M(Y,"_getStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_restoreGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getOpenedLabels",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onGoNextEnd",async()=>{}),M(Y,"_getVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_removeVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onLabelClosing",()=>{}),M(Y,"_addHistoryItem",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentStepsRunningNumber",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCharacter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),M(Y,"onEnd"),M(Y,"onError");var H=Y;function ke(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw k.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var xi=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,bx=new Set,Rh=typeof process=="object"&&process?process:{},vx=(i,t,e,r)=>{typeof Rh.emitWarning=="function"?Rh.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Dn=globalThis.AbortController,xx=globalThis.AbortSignal;if(typeof Dn>"u"){xx=class{constructor(){M(this,"onabort");M(this,"_onabort",[]);M(this,"reason");M(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Dn=class{constructor(){M(this,"signal",new xx);t();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Rh.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,vx("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ob=i=>!bx.has(i),ir=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Sx=i=>ir(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?_i:null:null,_i=class extends Array{constructor(t){super(t),this.fill(0);}},yi,Fr=class Fr{constructor(t,e){M(this,"heap");M(this,"length");if(!_(Fr,yi))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Sx(t);if(!e)return [];V(Fr,yi,true);let r=new Fr(t,e);return V(Fr,yi,false),r}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};yi=new WeakMap,tt(Fr,yi,false);var Fh=Fr,_x,yx,me,te,ge,Br,xe,bi,vi,Mt,_e,St,dt,X,Wt,ee,Gt,At,ye,It,be,ve,re,Se,ar,Ht,Si,A,Bh,kr,Ye,Ds,ie,Tx,Gr,Ti,Us,sr,or,kh,Gn,On,ct,Gh,Os,nr,Oh,Dh=class Dh{constructor(t){tt(this,A);tt(this,me);tt(this,te);tt(this,ge);tt(this,Br);tt(this,xe);tt(this,bi);tt(this,vi);M(this,"ttl");M(this,"ttlResolution");M(this,"ttlAutopurge");M(this,"updateAgeOnGet");M(this,"updateAgeOnHas");M(this,"allowStale");M(this,"noDisposeOnSet");M(this,"noUpdateTTL");M(this,"maxEntrySize");M(this,"sizeCalculation");M(this,"noDeleteOnFetchRejection");M(this,"noDeleteOnStaleGet");M(this,"allowStaleOnFetchAbort");M(this,"allowStaleOnFetchRejection");M(this,"ignoreFetchAbort");tt(this,Mt);tt(this,_e);tt(this,St);tt(this,dt);tt(this,X);tt(this,Wt);tt(this,ee);tt(this,Gt);tt(this,At);tt(this,ye);tt(this,It);tt(this,be);tt(this,ve);tt(this,re);tt(this,Se);tt(this,ar);tt(this,Ht);tt(this,Si);tt(this,kr,()=>{});tt(this,Ye,()=>{});tt(this,Ds,()=>{});tt(this,ie,()=>false);tt(this,Gr,t=>{});tt(this,Ti,(t,e,r)=>{});tt(this,Us,(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,_x,"LRUCache");let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:g=0,maxEntrySize:y=0,sizeCalculation:m,fetchMethod:p,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:T,ignoreFetchAbort:C}=t;if(e!==0&&!ir(e))throw new TypeError("max option must be a nonnegative integer");let G=e?Sx(e):Array;if(!G)throw new Error("invalid max value: "+e);if(V(this,me,e),V(this,te,g),this.maxEntrySize=y||_(this,te),this.sizeCalculation=m,this.sizeCalculation){if(!_(this,te)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(V(this,vi,b),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(V(this,bi,p),V(this,ar,!!p),V(this,St,new Map),V(this,dt,new Array(e).fill(void 0)),V(this,X,new Array(e).fill(void 0)),V(this,Wt,new G(e)),V(this,ee,new G(e)),V(this,Gt,0),V(this,At,0),V(this,ye,Fh.create(e)),V(this,Mt,0),V(this,_e,0),typeof h=="function"&&V(this,ge,h),typeof u=="function"&&V(this,Br,u),typeof c=="function"?(V(this,xe,c),V(this,It,[])):(V(this,xe,void 0),V(this,It,void 0)),V(this,Se,!!_(this,ge)),V(this,Si,!!_(this,Br)),V(this,Ht,!!_(this,xe)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(_(this,te)!==0&&!ir(_(this,te)))throw new TypeError("maxSize must be a positive integer if specified");if(!ir(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");B(this,A,Tx).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ir(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ir(this.ttl))throw new TypeError("ttl must be a positive integer if specified");B(this,A,Bh).call(this);}if(_(this,me)===0&&this.ttl===0&&_(this,te)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!_(this,me)&&!_(this,te)){let E="LRU_CACHE_UNBOUNDED";ob(E)&&(bx.add(E),vx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,Dh));}}static unsafeExposeInternals(t){return {starts:_(t,ve),ttls:_(t,re),sizes:_(t,be),keyMap:_(t,St),keyList:_(t,dt),valList:_(t,X),next:_(t,Wt),prev:_(t,ee),get head(){return _(t,Gt)},get tail(){return _(t,At)},free:_(t,ye),isBackgroundFetch:e=>{var r;return B(r=t,A,ct).call(r,e)},backgroundFetch:(e,r,s,o)=>{var n;return B(n=t,A,On).call(n,e,r,s,o)},moveToTail:e=>{var r;return B(r=t,A,Os).call(r,e)},indexes:e=>{var r;return B(r=t,A,sr).call(r,e)},rindexes:e=>{var r;return B(r=t,A,or).call(r,e)},isStale:e=>{var r;return _(r=t,ie).call(r,e)}}}get max(){return _(this,me)}get maxSize(){return _(this,te)}get calculatedSize(){return _(this,_e)}get size(){return _(this,Mt)}get fetchMethod(){return _(this,bi)}get memoMethod(){return _(this,vi)}get dispose(){return _(this,ge)}get onInsert(){return _(this,Br)}get disposeAfter(){return _(this,xe)}getRemainingTTL(t){return _(this,St).has(t)?1/0:0}*entries(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*rentries(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*keys(){for(let t of B(this,A,sr).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*rkeys(){for(let t of B(this,A,or).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*values(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}*rvalues(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}[(yx=Symbol.iterator,_x=Symbol.toStringTag,yx)](){return this.entries()}find(t,e={}){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,_(this,dt)[r],this))return this.get(_(this,dt)[r],e)}}forEach(t,e=this){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}rforEach(t,e=this){for(let r of B(this,A,or).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}purgeStale(){let t=false;for(let e of B(this,A,or).call(this,{allowStale:true}))_(this,ie).call(this,e)&&(B(this,A,nr).call(this,_(this,dt)[e],"expire"),t=true);return t}info(t){let e=_(this,St).get(t);if(e===void 0)return;let r=_(this,X)[e],s=B(this,A,ct).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(_(this,re)&&_(this,ve)){let n=_(this,re)[e],a=_(this,ve)[e];if(n&&a){let l=n-(xi.now()-a);o.ttl=l,o.start=Date.now();}}return _(this,be)&&(o.size=_(this,be)[e]),o}dump(){let t=[];for(let e of B(this,A,sr).call(this,{allowStale:true})){let r=_(this,dt)[e],s=_(this,X)[e],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(_(this,re)&&_(this,ve)){n.ttl=_(this,re)[e];let a=xi.now()-_(this,ve)[e];n.start=Math.floor(Date.now()-a);}_(this,be)&&(n.size=_(this,be)[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=xi.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){var f,d,g,y;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=r,{noUpdateTTL:h=this.noUpdateTTL}=r,u=_(this,Us).call(this,t,e,r.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),B(this,A,nr).call(this,t,"set"),this;let c=_(this,Mt)===0?void 0:_(this,St).get(t);if(c===void 0)c=_(this,Mt)===0?_(this,At):_(this,ye).length!==0?_(this,ye).pop():_(this,Mt)===_(this,me)?B(this,A,Gn).call(this,false):_(this,Mt),_(this,dt)[c]=t,_(this,X)[c]=e,_(this,St).set(t,c),_(this,Wt)[_(this,At)]=c,_(this,ee)[c]=_(this,At),V(this,At,c),Xs(this,Mt)._++,_(this,Ti).call(this,c,u,l),l&&(l.set="add"),h=false,_(this,Si)&&((f=_(this,Br))==null||f.call(this,e,t,"add"));else {B(this,A,Os).call(this,c);let m=_(this,X)[c];if(e!==m){if(_(this,ar)&&B(this,A,ct).call(this,m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=m;p!==void 0&&!n&&(_(this,Se)&&((d=_(this,ge))==null||d.call(this,p,t,"set")),_(this,Ht)&&_(this,It)?.push([p,t,"set"]));}else n||(_(this,Se)&&((g=_(this,ge))==null||g.call(this,m,t,"set")),_(this,Ht)&&_(this,It)?.push([m,t,"set"]));if(_(this,Gr).call(this,c),_(this,Ti).call(this,c,u,l),_(this,X)[c]=e,l){l.set="replace";let p=m&&B(this,A,ct).call(this,m)?m.__staleWhileFetching:m;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");_(this,Si)&&this.onInsert?.(e,t,e===m?"update":"replace");}if(s!==0&&!_(this,re)&&B(this,A,Bh).call(this),_(this,re)&&(h||_(this,Ds).call(this,c,s,o),l&&_(this,Ye).call(this,l,c)),!n&&_(this,Ht)&&_(this,It)){let m=_(this,It),p;for(;p=m?.shift();)(y=_(this,xe))==null||y.call(this,...p);}return this}pop(){var t;try{for(;_(this,Mt);){let e=_(this,X)[_(this,Gt)];if(B(this,A,Gn).call(this,!0),B(this,A,ct).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(_(this,Ht)&&_(this,It)){let e=_(this,It),r;for(;r=e?.shift();)(t=_(this,xe))==null||t.call(this,...r);}}}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=_(this,St).get(t);if(o!==void 0){let n=_(this,X)[o];if(B(this,A,ct).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(_(this,ie).call(this,o))s&&(s.has="stale",_(this,Ye).call(this,s,o));else return r&&_(this,kr).call(this,o),s&&(s.has="hit",_(this,Ye).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=_(this,St).get(t);if(s===void 0||!r&&_(this,ie).call(this,s))return;let o=_(this,X)[s];return B(this,A,ct).call(this,o)?o.__staleWhileFetching:o}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:y,forceRefresh:m=false,status:p,signal:b}=e;if(!_(this,ar))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:p,signal:b},S=_(this,St).get(t);if(S===void 0){p&&(p.fetch="miss");let P=B(this,A,On).call(this,t,S,v,y);return P.__returned=P}else {let P=_(this,X)[S];if(B(this,A,ct).call(this,P)){let L=r&&P.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",L&&(p.returnedStale=true)),L?P.__staleWhileFetching:P.__returned=P}let T=_(this,ie).call(this,S);if(!m&&!T)return p&&(p.fetch="hit"),B(this,A,Os).call(this,S),s&&_(this,kr).call(this,S),p&&_(this,Ye).call(this,p,S),P;let C=B(this,A,On).call(this,t,S,v,y),E=C.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=T?"stale":"refresh",E&&T&&(p.returnedStale=true)),E?C.__staleWhileFetching:C.__returned=C}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=_(this,vi);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=r(t,a,{options:n,context:s});return this.set(t,l,n),l}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=_(this,St).get(t);if(a!==void 0){let l=_(this,X)[a],h=B(this,A,ct).call(this,l);return n&&_(this,Ye).call(this,n,a),_(this,ie).call(this,a)?(n&&(n.get="stale"),h?(n&&r&&l.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?l.__staleWhileFetching:void 0):(o||B(this,A,nr).call(this,t,"expire"),n&&r&&(n.returnedStale=true),r?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(B(this,A,Os).call(this,a),s&&_(this,kr).call(this,a),l))}else n&&(n.get="miss");}delete(t){return B(this,A,nr).call(this,t,"delete")}clear(){return B(this,A,Oh).call(this,"delete")}};me=new WeakMap,te=new WeakMap,ge=new WeakMap,Br=new WeakMap,xe=new WeakMap,bi=new WeakMap,vi=new WeakMap,Mt=new WeakMap,_e=new WeakMap,St=new WeakMap,dt=new WeakMap,X=new WeakMap,Wt=new WeakMap,ee=new WeakMap,Gt=new WeakMap,At=new WeakMap,ye=new WeakMap,It=new WeakMap,be=new WeakMap,ve=new WeakMap,re=new WeakMap,Se=new WeakMap,ar=new WeakMap,Ht=new WeakMap,Si=new WeakMap,A=new WeakSet,Bh=function(){let t=new _i(_(this,me)),e=new _i(_(this,me));V(this,re,t),V(this,ve,e),V(this,Ds,(o,n,a=xi.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let l=setTimeout(()=>{_(this,ie).call(this,o)&&B(this,A,nr).call(this,_(this,dt)[o],"expire");},n+1);l.unref&&l.unref();}}),V(this,kr,o=>{e[o]=t[o]!==0?xi.now():0;}),V(this,Ye,(o,n)=>{if(t[n]){let a=t[n],l=e[n];if(!a||!l)return;o.ttl=a,o.start=l,o.now=r||s();let h=o.now-l;o.remainingTTL=a-h;}});let r=0,s=()=>{let o=xi.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=_(this,St).get(o);if(n===void 0)return 0;let a=t[n],l=e[n];if(!a||!l)return 1/0;let h=(r||s())-l;return a-h},V(this,ie,o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a});},kr=new WeakMap,Ye=new WeakMap,Ds=new WeakMap,ie=new WeakMap,Tx=function(){let t=new _i(_(this,me));V(this,_e,0),V(this,be,t),V(this,Gr,e=>{V(this,_e,_(this,_e)-t[e]),t[e]=0;}),V(this,Us,(e,r,s,o)=>{if(B(this,A,ct).call(this,r))return 0;if(!ir(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!ir(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),V(this,Ti,(e,r,s)=>{if(t[e]=r,_(this,te)){let o=_(this,te)-t[e];for(;_(this,_e)>o;)B(this,A,Gn).call(this,true);}V(this,_e,_(this,_e)+t[e]),s&&(s.entrySize=r,s.totalCalculatedSize=_(this,_e));});},Gr=new WeakMap,Ti=new WeakMap,Us=new WeakMap,sr=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,At);!(!B(this,A,kh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,Gt)));)e=_(this,ee)[e];},or=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,Gt);!(!B(this,A,kh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,At)));)e=_(this,Wt)[e];},kh=function(t){return t!==void 0&&_(this,St).get(_(this,dt)[t])===t},Gn=function(t){var o;let e=_(this,Gt),r=_(this,dt)[e],s=_(this,X)[e];return _(this,ar)&&B(this,A,ct).call(this,s)?s.__abortController.abort(new Error("evicted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((o=_(this,ge))==null||o.call(this,s,r,"evict")),_(this,Ht)&&_(this,It)?.push([s,r,"evict"])),_(this,Gr).call(this,e),t&&(_(this,dt)[e]=void 0,_(this,X)[e]=void 0,_(this,ye).push(e)),_(this,Mt)===1?(V(this,Gt,V(this,At,0)),_(this,ye).length=0):V(this,Gt,_(this,Wt)[e]),_(this,St).delete(r),Xs(this,Mt)._--,e},On=function(t,e,r,s){let o=e===void 0?void 0:_(this,X)[e];if(B(this,A,ct).call(this,o))return o;let n=new Dn,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:r,context:s},h=(y,m=false)=>{let{aborted:p}=n.signal,b=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(p&&!m?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,b&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!b&&!m)return c(n.signal.reason);let v=d;return _(this,X)[e]===d&&(y===void 0?v.__staleWhileFetching?_(this,X)[e]=v.__staleWhileFetching:B(this,A,nr).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,y,l.options))),y},u=y=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=y),c(y)),c=y=>{let{aborted:m}=n.signal,p=m&&r.allowStaleOnFetchAbort,b=p||r.allowStaleOnFetchRejection,v=b||r.noDeleteOnFetchRejection,S=d;if(_(this,X)[e]===d&&(!v||S.__staleWhileFetching===void 0?B(this,A,nr).call(this,t,"fetch"):p||(_(this,X)[e]=S.__staleWhileFetching)),b)return r.status&&S.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),S.__staleWhileFetching;if(S.__returned===S)throw y},f=(y,m)=>{var b;let p=(b=_(this,bi))==null?void 0:b.call(this,t,o,l);p&&p instanceof Promise&&p.then(v=>y(v===void 0?void 0:v),m),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=v=>h(v,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(h,u),g=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,g,{...l.options,status:void 0}),e=_(this,St).get(t)):_(this,X)[e]=g,g},ct=function(t){if(!_(this,ar))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Dn},Gh=function(t,e){_(this,ee)[e]=t,_(this,Wt)[t]=e;},Os=function(t){t!==_(this,At)&&(t===_(this,Gt)?V(this,Gt,_(this,Wt)[t]):B(this,A,Gh).call(this,_(this,ee)[t],_(this,Wt)[t]),B(this,A,Gh).call(this,_(this,At),t),V(this,At,t));},nr=function(t,e){var s,o;let r=false;if(_(this,Mt)!==0){let n=_(this,St).get(t);if(n!==void 0)if(r=true,_(this,Mt)===1)B(this,A,Oh).call(this,e);else {_(this,Gr).call(this,n);let a=_(this,X)[n];if(B(this,A,ct).call(this,a)?a.__abortController.abort(new Error("deleted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((s=_(this,ge))==null||s.call(this,a,t,e)),_(this,Ht)&&_(this,It)?.push([a,t,e])),_(this,St).delete(t),_(this,dt)[n]=void 0,_(this,X)[n]=void 0,n===_(this,At))V(this,At,_(this,ee)[n]);else if(n===_(this,Gt))V(this,Gt,_(this,Wt)[n]);else {let l=_(this,ee)[n];_(this,Wt)[l]=_(this,Wt)[n];let h=_(this,Wt)[n];_(this,ee)[h]=_(this,ee)[n];}Xs(this,Mt)._--,_(this,ye).push(n);}}if(_(this,Ht)&&_(this,It)?.length){let n=_(this,It),a;for(;a=n?.shift();)(o=_(this,xe))==null||o.call(this,...a);}return r},Oh=function(t){var e,r;for(let s of B(this,A,or).call(this,{allowStale:true})){let o=_(this,X)[s];if(B(this,A,ct).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=_(this,dt)[s];_(this,Se)&&((e=_(this,ge))==null||e.call(this,o,n,t)),_(this,Ht)&&_(this,It)?.push([o,n,t]);}}if(_(this,St).clear(),_(this,X).fill(void 0),_(this,dt).fill(void 0),_(this,re)&&_(this,ve)&&(_(this,re).fill(0),_(this,ve).fill(0)),_(this,be)&&_(this,be).fill(0),V(this,Gt,0),V(this,At,0),_(this,ye).length=0,V(this,_e,0),V(this,Mt,0),_(this,Ht)&&_(this,It)){let s=_(this,It),o;for(;o=s?.shift();)(r=_(this,xe))==null||r.call(this,...o);}};var Un=Dh;var wi=class{constructor(t){M(this,"cache");M(this,"map",new Map);this.cache=new Un({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var zs=new wi({cacheSize:10}),Uh;(s=>{function i(o){let n=zs.get(o);if(!n){k.error(`Label "${o}" not found`);return}return n}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}zs.has(o.id)&&k.info(`Label "${o.id}" already exists, it will be overwritten`),zs.set(o.id,o);}s.add=t;function e(){return Array.from(zs.values())}s.values=e;function r(o){return zs.has(o)}s.has=r;})(Uh||(Uh={}));var se=Uh;var Ex=Hn(Mx());var Ci=class{constructor(t,e){M(this,"_id");M(this,"_onStepStart");M(this,"_onLoadingLabel");M(this,"_onStepEnd");this._id=t,this._onStepStart=e?.onStepStart,this._onLoadingLabel=e?.onLoadingLabel,this._onStepEnd=e?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(t,e)=>{if(this._onLoadingLabel&&t===0&&await this._onLoadingLabel(t,e),this._onStepStart)return await this._onStepStart(t,e)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var lr=class extends Ci{constructor(e,r,s){super(e,s);M(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e){if(e<0||e>=this.steps.length)return k.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[e];return (0,Ex.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return k.warn("stepSha not found, setting to ERROR",r),"error"}}};var ab="__close-label-id__";function zh(){return new lr(ab,[],{})}var Pi=class{constructor(t,e,r,s){M(this,"text");M(this,"_label");M(this,"type");M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{type:o="call",oneTime:n=false,onlyHaveNoChoice:a=false,autoSelect:l=false,...h}=s||{};this.text=t,this._label=e,this.type=o,this.oneTime=n,this.onlyHaveNoChoice=a,this.autoSelect=l,this.devProps=h,this.props=r;}get label(){let t=this._label;if(typeof t=="string"){let e=se.get(t);e?t=e:(k.error(`Label ${t} not found, so it will be closed`),t=zh());}return t}};function lb(i,t,e,r){let s=typeof t=="string"?t:t.id;return {...r,label:s,props:e,text:i,type:r?.type||"call"}}var Mi="close";var Ei=class{constructor(t,e){M(this,"text");M(this,"closeCurrentLabel");M(this,"type",Mi);M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{closeCurrentLabel:r=false,oneTime:s=false,onlyHaveNoChoice:o=false,autoSelect:n=false,...a}=e||{};this.text=t,this.closeCurrentLabel=r,this.oneTime=s,this.onlyHaveNoChoice=o,this.autoSelect=n,this.devProps=a;}};function hb(i,t){return {...t,type:Mi,text:i}}var O=class O{constructor(){}static get allOpenedLabels(){return H.getVariable(Q.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(t){H.setVariable(Q.OPENED_LABELS_COUNTER_KEY,t);}static getCurrentStepTimesCounterData(t=""){let e=O.currentLabelStepIndex;if(e===null)return k.error("currentLabelStepIndex is null"),null;let r=`${e}${t}`,s=O.currentLabelId,o=O._currentLabel;if(!s||e===null||!o)return k.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let n=o.getStepSha(e)||"error",a=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return a[s]||(a[s]={}),(!a[s][r]||a[s][r].stepSha1!=n)&&(a[s][r]={stepSha1:n}),a[s][r]}static setCurrentStepTimesCounterData(t="",e){let r=O.currentLabelStepIndex,s=r+t,o=O.currentLabelId;if(!o||r===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let n=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};n[o]||(n[o]={}),n[o][s]=e,H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,n);}static getCurrentStepTimesCounter(t=""){let e=O._stepCounter,r=O.getCurrentStepTimesCounterData(t);if(!r)return k.error("getCurrentStepTimesCounter obj is null"),0;let s=r.stepCounters||r.lastStepIndexs||[];return s.find(n=>n===e)||(s.push(e),delete r.lastStepIndexs,r.stepCounters=s,O.setCurrentStepTimesCounterData(t,r)),s.length}static getRandomNumber(t,e,r={}){let s=r.nestedId||"";if(r.onceOnly||false){let n=O.getCurrentStepTimesCounterData(s);if(!n)return;let a=n.usedRandomNumbers||{},l=Array.from({length:e-t+1},(c,f)=>f+t).filter(c=>!a[`${t}-${e}`]?.includes(c));if(l.length===0)return;let h=Math.floor(Math.random()*l.length),u=l[h];return a[`${t}-${e}`]||(a[`${t}-${e}`]=[]),a[`${t}-${e}`].push(u),n.usedRandomNumbers=a,O.setCurrentStepTimesCounterData(s,n),u}return Math.floor(Math.random()*(e-t+1))+t}static resetCurrentStepTimesCounter(t=""){let e=O.currentLabelStepIndex,r=e+t,s=O.currentLabelId;if(!s||e===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let o=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][r]={stepCounters:[],stepSha1:""},H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return H.getVariable(Q.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(t){H.setVariable(Q.ALL_CHOICES_MADE_KEY,t);}static increaseStepCounter(){O._stepCounter++;}static get openedLabels(){return ke(O._openedLabels)}static set openedLabels(t){O._openedLabels=ke(t);}static get originalOpenedLabels(){return ke(O._originalOpenedLabels)}static set originalOpenedLabels(t){O._originalOpenedLabels=ke(t);}static get _currentLabel(){if(O.currentLabelId)return se.get(O.currentLabelId)}static get currentLabelId(){if(O._openedLabels.length>0)return O._openedLabels[O._openedLabels.length-1].label}static get currentLabelStepIndex(){return O._openedLabels.length>0?O._openedLabels[O._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(t,e){let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;(!s||s<e)&&(r[t]={biggestStep:e,openCount:o},O.allOpenedLabels=r);}static addChoicesMade(t,e,r,s){let o=O.allChoicesMade,n=o.findIndex(a=>a.labelId===t&&a.stepIndex===e&&a.choiceIndex===s&&a.stepSha1===r);n<0?o.push({labelId:t,stepIndex:e,choiceIndex:s,stepSha1:r,madeTimes:1}):o[n].madeTimes++,O.allChoicesMade=o;}static pushNewLabel(t){if(!se.get(t))throw new Error(`[Pixi\u2019VN] Label ${t} not found`);O._openedLabels.push({label:t,currentStepIndex:0});let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;r[t]={biggestStep:s,openCount:o+1},O.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(O._openedLabels.length>0){let t=O._openedLabels[O._openedLabels.length-1];O._openedLabels[O._openedLabels.length-1]={...t,currentStepIndex:t.currentStepIndex+1};}}static set onStepStart(t){O._onStepStart=t;}static get onStepStart(){return async(t,e)=>{let r=[];return O.onLoadingLabel&&t===0&&r.push(O.onLoadingLabel(t,e)),O._onStepStart&&r.push(O._onStepStart(t,e)),await Promise.all(r)}}};M(O,"stepsRunning",0),M(O,"goNextRequests",0),M(O,"choiceMadeTemp"),M(O,"lastHistoryStep",null),M(O,"_stepCounter",0),M(O,"_openedLabels",[]),M(O,"_originalOpenedLabels",[]),M(O,"_onStepStart"),M(O,"onLoadingLabel"),M(O,"onStepEnd");var I=O;var Ns=class{get currentStepTimesCounter(){return I.getCurrentStepTimesCounter()}set currentStepTimesCounter(t){I.resetCurrentStepTimesCounter();}getRandomNumber(t,e,r={}){return I.getRandomNumber(t,e,r)}get stepCounter(){return I._stepCounter}get openedLabels(){return I.openedLabels}get currentLabel(){return I._currentLabel}addStepHistory(t,e={}){let{choiceMade:r,ignoreSameStep:s}=e,o,n,a,l=H.getVariable(Q.LAST_STEP_GLUED)===this.stepCounter;H.getVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY)),H.getVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(n=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY)),H.getVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY));let h=I.openedLabels,u={currentLabel:I.currentLabelId,dialogue:o,choices:n,stepSha1:t,index:this.stepCounter,labelStepIndex:I.currentLabelStepIndex,choiceIndexMade:r,inputValue:a,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:l,openedLabels:h};I.originalOpenedLabels=h,H.addHistoryItem(u,{ignoreSameStep:s}),I.lastHistoryStep=u,I.increaseStepCounter();}closeCurrentLabel(){if(!I.currentLabelId){k.warn("No label to close");return}if(!this.currentLabel){k.error("currentLabel not found");return}let t=I.openedLabels;t.pop(),I.openedLabels=t,H.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;I.openedLabels.length>0;)this.closeCurrentLabel(),H.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(t){let e;typeof t=="string"?e=t:e=t.id;let s=I.allOpenedLabels[e]?.biggestStep||0;if(s){let o=se.get(e);if(o)return o.stepCount<=s}return false}get alreadyCurrentStepMadeChoicesObj(){let t=I.currentLabelStepIndex,e=this.currentLabel;if(t===null||!e)return;let r=e.getStepSha(t);return r||(k.warn("stepSha not found, setting to ERROR"),r="error"),I.allChoicesMade.filter(s=>s.labelId===e?.id&&s.stepIndex===t&&s.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(t=>t.choiceIndex)}get isCurrentStepAlreadyOpened(){let t=I.currentLabelId;if(t){let e=I.allOpenedLabels[t]?.openCount||0;if(I.currentLabelStepIndex&&e>=I.currentLabelStepIndex)return true}return false}getTimesLabelOpened(t){return I.allOpenedLabels[t]?.openCount||0}getTimesChoiceMade(t){return this.alreadyCurrentStepMadeChoicesObj?.find(e=>e.choiceIndex===t)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanGoNext(t){let e=t?.showWarn||false,r=this.choiceMenuOptions;return r&&r.length>0?(e&&k.warn("The player must make a choice"),false):this.isRequiredInput?(e&&k.warn("The player must enter a value"),false):true}get canGoNext(){return I.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(t,e){let r=[];return t.onStepStart&&r.push(t.onStepStart(e,t)),I.onStepStart&&r.push(I.onStepStart(e,t)),await Promise.all(r)}async onStepEnd(t,e){let r=[];return t.onStepEnd&&r.push(t.onStepEnd(e,t)),I.onStepEnd&&r.push(I.onStepEnd(e,t)),await Promise.all(r)}async goNext(t,e={}){let{runNow:r=false}=e;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&I.stepsRunning!==0){I.goNextRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(s){k.error("Error running onStepEnd",s);}return I.stepsRunning===0&&await H.onGoNextEnd(),I.increaseCurrentStepIndex(),await this.runCurrentStep(t,e)}}async runCurrentStep(t,e={}){let{choiceMade:r}=e;if(I.currentLabelId){let s=I.currentLabelStepIndex;if(s===null){k.error("currentLabelStepIndex is null");return}let o=I._currentLabel;if(!o){k.error("currentLabel not found");return}if(o.stepCount>s){try{await this.onStepRun(o,s);}catch(l){k.error("Error running onStepStart",l),this.onStepError&&this.onStepError(l,t);return}let n=o.getStepById(s);if(!n){k.error("step not found");return}let a=o.getStepSha(s);a||(k.warn("stepSha not found, setting to ERROR"),a="error");try{I.stepsRunning++;let l=await n(t,{labelId:o.id}),h=this.choiceMenuOptions;if(h?.length===1&&h[0].autoSelect){let c=h[0];l=await this.selectChoice(c,t);}let u=I.lastHistoryStep;if(r!==void 0&&u){let c=u.stepSha1;c||(k.warn("stepSha not found, setting to ERROR"),c="error"),I.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",r),I.choiceMadeTemp=r;}return I.stepsRunning--,I.stepsRunning===0&&(I.addLabelHistory(o.id,s),this.addStepHistory(a,{...e,choiceMade:I.choiceMadeTemp}),I.choiceMadeTemp=void 0,I.goNextRequests>0)?(I.goNextRequests--,await this.goNext(t)):l}catch(l){I.stepsRunning>0&&I.stepsRunning--,k.error("Error running step",l),this.onStepError&&this.onStepError(l,t);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.goNext(t,e);if(this.openedLabels.length===1)return I.openedLabels=[],this.onGameEnd?await this.onGameEnd(t,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(I.openedLabels=I.originalOpenedLabels,this.onGameEnd)return await this.onGameEnd(t,{labelId:"end"});k.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else k.error("currentLabelId not found");}async callLabel(t,e,r){let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error calling label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async jumpLabel(t,e,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error jumping label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async selectChoice(t,e){this.choiceMenuOptions=void 0;let r=t.type;switch(r){case "call":return await this.callLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "jump":return await this.jumpLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "close":return await this.closeChoiceMenu(t,{...t.props,...e});default:throw k.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(t,e){if(t.type!=="close")throw k.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof t.choiceIndex=="number"&&(r=t.choiceIndex),t.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(e,{choiceMade:r})}get onGameEnd(){return H.onEnd}set onGameEnd(t){H.onEnd=t;}get onStepError(){let t=H.onError;return t?(e,r)=>t("step",e,r):void 0}set onStepError(t){H.onError=(e,r,s)=>t(r,s);}get dialogue(){let t=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(t)return {...t,character:t.character?H.getCharacter(t.character)||t.character:void 0}}set dialogue(t){if(!t){H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof t=="string"||Array.isArray(t))&&(t={text:t}),this.dialogGlue){let e=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(e){let r=[];Array.isArray(e.text)?r=[...e.text]:r=[e.text],Array.isArray(t.text)?r=[...r,...t.text]:r=[...r,t.text],t.text=r,t.character=t.character||e.character;}H.setVariable(Q.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,ke({...t,character:typeof t.character=="string"?t.character:t.character?.id})),H.setVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(e){throw k.error("DialogueInterface cannot contain functions or classes"),e}}get choiceMenuOptions(){let t=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(t){let e=[],r=t.map((o,n)=>({...o,choiceIndex:n})),s=this.alreadyCurrentStepMadeChoices;if(r=r.filter((o,n)=>o.oneTime&&s&&s.includes(n)?false:o.onlyHaveNoChoice?(e.push(o),false):true),r.length>0)return r;if(e.length>0)return [e[0]]}}set choiceMenuOptions(t){if(!t||t.length===0){H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}let e=t.map(r=>r instanceof Ei?{...r.devProps,text:r.text,type:Mi,closeCurrentLabel:r.closeCurrentLabel,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,autoSelect:r.autoSelect,props:r.props}:r instanceof Pi?{...r.devProps,type:r.type,text:r.text,label:r.label.id,autoSelect:r.autoSelect,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,props:r.props}:r);try{H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,ke(e)),H.setVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(r){throw k.error("ChoiceInterface cannot contain functions or classes"),r}}get dialogGlue(){return H.getFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(t){H.setFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,t);}get inputValue(){return H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(t){this.removeInputRequest(),H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,t),H.setVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(t,e){t.isRequired=true,H.setVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY,t),e!==void 0?H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,e):H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){H.removeVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY),H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){I.openedLabels=[],I._stepCounter=0;}export(){return {openedLabels:ke(I.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(t){let e=this.openedLabels.map(async r=>{let s=[],o=se.get(r.label);return o&&(o.onLoadingLabel&&s.push(o.onLoadingLabel(t,o)),I.onLoadingLabel&&s.push(I.onLoadingLabel(t,o))),await Promise.all(s)});return await Promise.all(e)}async restore(t,e){this.clear();try{I.lastHistoryStep=e,t.hasOwnProperty("openedLabels")?(I.openedLabels=t.openedLabels,I.originalOpenedLabels=I.openedLabels):k.warn("Could not import openedLabels data, so will be ignored"),t.hasOwnProperty("stepCounter")?I._stepCounter=t.stepCounter:t.hasOwnProperty("lastStepIndex")?I._stepCounter=t.lastStepIndex:k.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(I.currentLabelStepIndex||0);}catch(r){k.error("Error running onLoadingLabel",r);}}catch(r){k.error("Error importing data",r);}}};function Ax(i,t,e){let r=new lr(i,t,e);return se.add(r),r}var wO=new Ns;
569
+ `}};});var Sh,Th,In,Ng=g(()=>{ut();zo();Og();Yo();as();Qe();Rt();zg();In=class extends Le{constructor(){Sh??(Sh=Qr({name:"tiling-sprite-shader",bits:[Es,Dg,ti]})),Th??(Th=Jr({name:"tiling-sprite-shader",bits:[Gg,Ug,ei]}));let t=new Vt({uMapCoord:{value:new F,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 F,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Th,gpuProgram:Sh,resources:{localUniforms:new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:D.EMPTY.source,uSampler:D.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*l/t,r.b*l/e,r.c*h/t,r.d*h/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,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 Ln,Vg=g(()=>{An();Ln=class extends pi{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 Wg(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var Hg=g(()=>{});function Yg(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,l=r.c,h=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+l*d+u,i[e+1]=a*f+h*d+c,e+=t,s++;}}var $g=g(()=>{});function Xg(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=F.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Yg(t,2,0,a);}var jg=g(()=>{ut();$g();});var Rn,wh,As,Kg=g(()=>{U();is();tn();ns();ds();en();An();Ng();Vg();Hg();jg();Rn=new Ln,wh=class{constructor(){this.canBatch=true,this.geometry=new pi({indices:Rn.indices.slice(),positions:Rn.positions.slice(),uvs:Rn.uvs.slice()});}destroy(){this.geometry.destroy(),this.shader?.destroy();}},As=class{constructor(t){this._state=Cr.default2d,this._renderer=t;}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new tr);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new In),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Je(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ne(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Rn,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new wh;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),Xg(t,r.uvs),Wg(t,r.positions);}destroy(){this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Ie.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};As.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"tilingSprite"};});var Ch=g(()=>{U();Kg();W.add(As);});var qg,Qg,Jg=g(()=>{yt();An();qg=class Zg extends pi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(N(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={...Zg.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*l,d*h),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,x=d*this.verticesX+f,y=d*this.verticesX+f+1,m=(d+1)*this.verticesX+f,p=(d+1)*this.verticesX+f+1;o.push(x,y,m,y,p,m);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};qg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Qg=qg;});var tx,rx,ix=g(()=>{Jg();tx=class ex extends Qg{constructor(t={}){t={...ex.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,x=Math.min(c,d),y=l*e,m=h*r;t[0]=t[8]=t[16]=t[24]=-y,t[2]=t[10]=t[18]=t[26]=s*x-y,t[4]=t[12]=t[20]=t[28]=e-o*x-y,t[6]=t[14]=t[22]=t[30]=e-y,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=n*x-m,t[17]=t[19]=t[21]=t[23]=r-a*x-m,t[25]=t[27]=t[29]=t[31]=r-m,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};tx.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};rx=tx;});var Ph,Is,sx=g(()=>{U();en();ix();Ph=class extends tr{constructor(){super(),this.geometry=new rx;}destroy(){this.geometry.destroy();}},Is=class{constructor(t){this._renderer=t;}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new Ph,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null;}};Is.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"nineSliceSprite"};});var Mh=g(()=>{U();sx();W.add(Is);});var Ls,ox=g(()=>{U();Ls=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ls.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"filter"};});function nx(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var ax=g(()=>{});var Zy,Eh,Rs,lx=g(()=>{U();ut();rs();os();Qe();Rt();zr();ns();ce();ax();zt();Zy=new Ae({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])}),Eh=class{constructor(){this.skip=false,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new mt,this.container=null,this.blendRequired=false,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0};}},Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Vt({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 le({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=false,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let o=e.renderTarget.renderTarget.colorTexture.source,n=o.resolution,a=o.antialias;if(r.length===0){s.skip=true;return}let l=s.bounds;if(this._calculateFilterArea(t,l),this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,n,1),s.skip)return;let h=this._getPreviousFilterData(),u=this._findFilterResolution(n),c=0,f=0;h&&(c=h.bounds.minX,f=h.bounds.minY),this._calculateGlobalFrame(s,c,f,u,o.width,o.height),this._setupFilterTextures(s,l,e,h);}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=false,r.filters=e;let s=t.source,o=s.resolution,n=s.antialias;if(e.length===0)return r.skip=true,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,n,o,0),r.skip)return t;let l=o;this._calculateGlobalFrame(r,0,0,l,s.width,s.height),r.outputRenderSurface=kt.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=D.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,true);let f=r.outputRenderSurface;return f.source.alphaMode="premultiplied-alpha",f}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,false),e.blendRequired&&kt.returnTexture(e.backTexture),kt.returnTexture(e.inputTexture));}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=kt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),h=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:h},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._activeFilterData,l=n.outputRenderSurface===r,h=o.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._findFilterResolution(h),c=0,f=0;if(l){let d=this._findPreviousFilterOffset();c=d.x,f=d.y;}this._updateFilterUniforms(e,r,n,c,f,u,l,s),this._setupBindGroupsAndRender(t,e,o);}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(F.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}destroy(){}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let s=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(s,0);}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:Zy,shader:t,state:t._state,topology:"triangle-list"}),r.type===Ie.WEBGL&&r.renderTarget.finishRenderPass();}_setupFilterTextures(t,e,r,s){if(t.backTexture=D.EMPTY,t.blendRequired){r.renderTarget.finishRenderPass();let o=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(o,e,s?.bounds);}t.inputTexture=kt.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),r.renderTarget.bind(t.inputTexture,true),r.globalUniforms.push({offset:e});}_calculateGlobalFrame(t,e,r,s,o,n){let a=t.globalFrame;a.x=e*s,a.y=r*s,a.width=o*s,a.height=n*s;}_updateFilterUniforms(t,e,r,s,o,n,a,l){let h=this._filterGlobalUniforms.uniforms,u=h.uOutputFrame,c=h.uInputSize,f=h.uInputPixel,d=h.uInputClamp,x=h.uGlobalFrame,y=h.uOutputTexture;a?(u[0]=r.bounds.minX-s,u[1]=r.bounds.minY-o):(u[0]=0,u[1]=0),u[2]=t.frame.width,u[3]=t.frame.height,c[0]=t.source.width,c[1]=t.source.height,c[2]=1/c[0],c[3]=1/c[1],f[0]=t.source.pixelWidth,f[1]=t.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],d[0]=.5*f[2],d[1]=.5*f[3],d[2]=t.frame.width*c[2]-.5*f[2],d[3]=t.frame.height*c[3]-.5*f[3];let m=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=s*n,x[1]=o*n,x[2]=m.source.width*n,x[3]=m.source.height*n,e instanceof D&&(e.source.resource=null);let p=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!l),e instanceof D?(y[0]=e.frame.width,y[1]=e.frame.height):(y[0]=p.width,y[1]=p.height),y[2]=p.isRoot?-1:1,this._filterGlobalUniforms.update();}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let s=this._filterStack[r];if(!s.skip){t=s.bounds.minX,e=s.bounds.minY;break}}return {x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?nx(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;s&&e.applyMatrix(s);}}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,o=t.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),o.length===1)o[0].apply(this,r,t.outputRenderSurface,e);else {let n=t.inputTexture,a=kt.getOptimalTexture(s.width,s.height,n.source._resolution,false),l=a,h=0;for(h=0;h<o.length-1;++h){o[h].apply(this,n,l,true);let c=n;n=l,l=c;}o[h].apply(this,n,t.outputRenderSurface,e),kt.returnTexture(a);}}_calculateFilterBounds(t,e,r,s,o){let n=this.renderer,a=t.bounds,l=t.filters,h=1/0,u=0,c=true,f=false,d=false,x=true;for(let y=0;y<l.length;y++){let m=l[y];if(h=Math.min(h,m.resolution==="inherit"?s:m.resolution),u+=m.padding,m.antialias==="off"?c=false:m.antialias==="inherit"&&c&&(c=r),m.clipToViewport||(x=false),!!!(m.compatibleRenderers&n.type)){d=false;break}if(m.blendRequired&&!(n.backBuffer?.useBackBuffer??true)){Z("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),d=false;break}d=m.enabled||d,f||(f=m.blendRequired);}if(!d){t.skip=true;return}if(x&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(h).ceil().scale(1/h).pad((u|0)*o),!a.isPositive){t.skip=true;return}t.antialias=c,t.resolution=h,t.blendRequired=f;}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new Eh),this._filterStackIndex++,t}};Rs.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"filter"};});var Ah=g(()=>{U();ox();lx();W.add(Rs);W.add(Ls);});var Qy={};var hx=g(()=>{Ac();Pa();Dc();zc();To();Ao();Gl();Ol();Nl();ch();_h();vh();Ch();Mh();Ah();});var Jy={};var cx=g(()=>{Pa();To();Ao();Gl();Ol();Nl();ch();_h();vh();Ch();Mh();Ah();});var Cx=$s((zn,wx)=>{(function(i,t){typeof zn=="object"?wx.exports=zn=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(zn,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof Wn=="function")try{r=Wn("crypto");}catch{}var s=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(b){var v;return p.prototype=b,v=new p,p.prototype=null,v}}(),n={},a=n.lib={},l=a.Base=function(){return {extend:function(p){var b=o(this);return p&&b.mixIn(p),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments);}),b.init.prototype=b,b.$super=this,b},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var b in p)p.hasOwnProperty(b)&&(this[b]=p[b]);p.hasOwnProperty("toString")&&(this.toString=p.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),h=a.WordArray=l.extend({init:function(p,b){p=this.words=p||[],b!=e?this.sigBytes=b:this.sigBytes=p.length*4;},toString:function(p){return (p||c).stringify(this)},concat:function(p){var b=this.words,v=p.words,S=this.sigBytes,P=p.sigBytes;if(this.clamp(),S%4)for(var T=0;T<P;T++){var C=v[T>>>2]>>>24-T%4*8&255;b[S+T>>>2]|=C<<24-(S+T)%4*8;}else for(var G=0;G<P;G+=4)b[S+G>>>2]=v[G>>>2];return this.sigBytes+=P,this},clamp:function(){var p=this.words,b=this.sigBytes;p[b>>>2]&=4294967295<<32-b%4*8,p.length=t.ceil(b/4);},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var b=[],v=0;v<p;v+=4)b.push(s());return new h.init(b,p)}}),u=n.enc={},c=u.Hex={stringify:function(p){for(var b=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=b[P>>>2]>>>24-P%4*8&255;S.push((T>>>4).toString(16)),S.push((T&15).toString(16));}return S.join("")},parse:function(p){for(var b=p.length,v=[],S=0;S<b;S+=2)v[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new h.init(v,b/2)}},f=u.Latin1={stringify:function(p){for(var b=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=b[P>>>2]>>>24-P%4*8&255;S.push(String.fromCharCode(T));}return S.join("")},parse:function(p){for(var b=p.length,v=[],S=0;S<b;S++)v[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new h.init(v,b)}},d=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(f.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return f.parse(unescape(encodeURIComponent(p)))}},x=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(p){typeof p=="string"&&(p=d.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes;},_process:function(p){var b,v=this._data,S=v.words,P=v.sigBytes,T=this.blockSize,C=T*4,G=P/C;p?G=t.ceil(G):G=t.max((G|0)-this._minBufferSize,0);var E=G*T,L=t.min(E*4,P);if(E){for(var R=0;R<E;R+=T)this._doProcessBlock(S,R);b=S.splice(0,E),v.sigBytes-=L;}return new h.init(b,L)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});a.Hasher=x.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var b=this._doFinalize();return b},blockSize:512/32,_createHelper:function(p){return function(b,v){return new p.init(v).finalize(b)}},_createHmacHelper:function(p){return function(b,v){return new m.HMAC.init(p,v).finalize(b)}}});var m=n.algo={};return n}(Math);return i});});var Mx=$s((Nn,Px)=>{(function(i,t){typeof Nn=="object"?Px.exports=Nn=t(Cx()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(Nn,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,s=e.Hasher,o=t.algo,n=[],a=o.SHA1=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,h){for(var u=this._hash.words,c=u[0],f=u[1],d=u[2],x=u[3],y=u[4],m=0;m<80;m++){if(m<16)n[m]=l[h+m]|0;else {var p=n[m-3]^n[m-8]^n[m-14]^n[m-16];n[m]=p<<1|p>>>31;}var b=(c<<5|c>>>27)+y+n[m];m<20?b+=(f&d|~f&x)+1518500249:m<40?b+=(f^d^x)+1859775393:m<60?b+=(f&d|f&x|d&x)-1894007588:b+=(f^d^x)-899497514,y=x,x=d,d=f<<30|f>>>2,f=c,c=b;}u[0]=u[0]+c|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+x|0,u[4]=u[4]+y|0;},_doFinalize:function(){var l=this._data,h=l.words,u=this._nDataBytes*8,c=l.sigBytes*8;return h[c>>>5]|=128<<24-c%32,h[(c+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(c+64>>>9<<4)+15]=u,l.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var l=s.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=s._createHelper(a),t.HmacSHA1=s._createHmacHelper(a);}(),i.SHA1});});var Te={};Ux(Te,{DistortionFilter:()=>js,EqualizerFilter:()=>oe,Filter:()=>Tt,MonoFilter:()=>Ks,ReverbFilter:()=>qs,StereoFilter:()=>Zs,StreamFilter:()=>Qs,TelephoneFilter:()=>Js});var $h;function Xh(i){return $h=i,i}function nt(){return $h}var Tt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var js=class extends Tt{constructor(t=0){let e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,nt().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var _t=class{static setParamValue(t,e){if(t.setValueAtTime){let r=nt().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var at=class extends Tt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,l=0,h=0){let u=[],c=[{f:at.F32,type:"lowshelf",gain:i},{f:at.F64,type:"peaking",gain:t},{f:at.F125,type:"peaking",gain:e},{f:at.F250,type:"peaking",gain:r},{f:at.F500,type:"peaking",gain:s},{f:at.F1K,type:"peaking",gain:o},{f:at.F2K,type:"peaking",gain:n},{f:at.F4K,type:"peaking",gain:a},{f:at.F8K,type:"peaking",gain:l},{f:at.F16K,type:"highshelf",gain:h}];nt().useLegacy||(u=c.map(f=>{let d=nt().context.audioContext.createBiquadFilter();return d.type=f.type,_t.setParamValue(d.Q,1),d.frequency.value=f.f,_t.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);_t.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(at.F32,i);}get f32(){return this.getGain(at.F32)}set f64(i){this.setGain(at.F64,i);}get f64(){return this.getGain(at.F64)}set f125(i){this.setGain(at.F125,i);}get f125(){return this.getGain(at.F125)}set f250(i){this.setGain(at.F250,i);}get f250(){return this.getGain(at.F250)}set f500(i){this.setGain(at.F500,i);}get f500(){return this.getGain(at.F500)}set f1k(i){this.setGain(at.F1K,i);}get f1k(){return this.getGain(at.F1K)}set f2k(i){this.setGain(at.F2K,i);}get f2k(){return this.getGain(at.F2K)}set f4k(i){this.setGain(at.F4K,i);}get f4k(){return this.getGain(at.F4K)}set f8k(i){this.setGain(at.F8K,i);}get f8k(){return this.getGain(at.F8K)}set f16k(i){this.setGain(at.F16K,i);}get f16k(){return this.getGain(at.F16K)}reset(){this.bands.forEach(i=>{_t.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},oe=at;oe.F32=32;oe.F64=64;oe.F125=125;oe.F250=250;oe.F500=500;oe.F1K=1e3;oe.F2K=2e3;oe.F4K=4e3;oe.F8K=8e3;oe.F16K=16e3;var Ks=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var qs=class extends Tt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(nt().useLegacy)return;let{audioContext:t}=nt().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let h=0;h<r;h++)a=this._reverse?r-h:h,o[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let l=t.createConvolver();l.buffer=s,this.init(l);}};var Zs=class extends Tt{constructor(t=0){let e,r,s;if(!nt().useLegacy){let{audioContext:o}=nt().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?_t.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Qs=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Js=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",_t.setParamValue(s.frequency,2e3),o.type="lowpass",_t.setParamValue(o.frequency,2e3),n.type="highpass",_t.setParamValue(n.frequency,500),a.type="highpass",_t.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};U();var ux={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(hx(),Qy));}};U();var dx={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(cx(),Jy));}};U();U();Ao();To();Ga();fe();Xa();Hi();Yt();So();W.add(ux,dx);var Fs=class extends et{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var tb=0,Ih=class extends et{constructor(i){super(),this.id=tb++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Ih.PADDING),this._end=Math.min(this._end+Ih.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),Pt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){Pt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){Pt.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Fn=Ih;Fn.PADDING=.1;var Bs=class extends et{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Fn(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let l=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,l);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let l=r.autoPlayStart();t&&t(null,r,l);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let l=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(l)):console.error(l);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ks=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ar=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Lh=["audio/mpeg","audio/ogg"],Ir={};function fx(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;Ar.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ir,r);}fx();var rb=0,Gs=class extends et{constructor(t){super(),this.id=rb++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);_t.setParamValue(this._gain.gain,o*s*r),_t.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:l}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:h,gain:u}=this._media.nodes.cloneBufferSource();this._source=h,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=l,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){Pt.shared.remove(this._updateListener,this),t&&Pt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Lr=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var px=class extends Lr{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(px.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,_t.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Bn=px;Bn.BUFFER_SIZE=0;var Rr=class{init(t){this.parent=t,this._nodes=new Bn(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Gs(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await gt.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var mi=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=nt().useLegacy?new Bs:new Rr;return new mi(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:jt.extname(e).slice(1)})).filter(({ext:e})=>Ir[e]).sort((e,r)=>Ar.indexOf(e.ext)-Ar.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return nt().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ks(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,l)=>{this._preloadQueue.forEach(h=>h()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,l),s(l));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(mi._pool.length>0){let i=mi._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),mi._pool.indexOf(i)<0&&mi._pool.push(i);}},rr=mi;rr._pool=[];var gi=class i extends Lr{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new et,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var kn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new gi),this._htmlAudioContext=new Fs,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return gi.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof rr)return this._sounds[t]=e,e;let r=this._getOptions(e),s=rr.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var mx=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=jt.basename(t,jt.extname(t))),e},gx={extension:w.Asset,detection:{test:async()=>true,add:async i=>[...i,...Ar.filter(t=>Ir[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[w.LoadParser],priority:Hr.High},test(i){let t=jt.extname(i).slice(1);return !!Ir[t]||Lh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>rr.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return nt().add(mx(t),e),e},async unload(i,t){nt().remove(mx(t));}}};W.add(gx);Xh(new kn);({DistortionFilter:Te.DistortionFilter,EqualizerFilter:Te.EqualizerFilter,MonoFilter:Te.MonoFilter,ReverbFilter:Te.ReverbFilter,StereoFilter:Te.StereoFilter,StreamFilter:Te.StreamFilter,TelephoneFilter:Te.TelephoneFilter});var Q={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var k;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(k||(k={}));var Y=class Y{static init(t){Y._getStepCounter=t.getStepCounter,Y._setStepCounter=t.setStepCounter,Y._getCurrentGameStepState=t.getCurrentGameStepState,Y._restoreGameStepState=t.restoreGameStepState,Y._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(Y._onGoNextEnd=t.onGoNextEnd),Y._getVariable=t.getVariable,Y._setVariable=t.setVariable,Y._removeVariable=t.removeVariable,Y._getFlag=t.getFlag,Y._setFlag=t.setFlag,t.onLabelClosing&&(Y._onLabelClosing=t.onLabelClosing),Y._addHistoryItem=t.addHistoryItem,Y._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,Y._getCharacter=t.getCharacter;}static get stepCounter(){return Y._getStepCounter()}static set stepCounter(t){Y._setStepCounter(t);}static get currentGameStepState(){return Y._getCurrentGameStepState()}static get restoreGameStepState(){return Y._restoreGameStepState}static get openedLabels(){return Y._getOpenedLabels()}static get onGoNextEnd(){return Y._onGoNextEnd}static get getVariable(){return Y._getVariable}static get setVariable(){return Y._setVariable}static get removeVariable(){return Y._removeVariable}static get getFlag(){return Y._getFlag}static get setFlag(){return Y._setFlag}static get onLabelClosing(){return Y._onLabelClosing}static get addHistoryItem(){return Y._addHistoryItem}static get currentStepsRunningNumber(){return Y._getCurrentStepsRunningNumber()}static get getCharacter(){return Y._getCharacter}};M(Y,"_getStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_restoreGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getOpenedLabels",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onGoNextEnd",async()=>{}),M(Y,"_getVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_removeVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onLabelClosing",()=>{}),M(Y,"_addHistoryItem",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentStepsRunningNumber",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCharacter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),M(Y,"onEnd"),M(Y,"onError");var H=Y;function ke(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw k.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var xi=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,bx=new Set,Rh=typeof process=="object"&&process?process:{},vx=(i,t,e,r)=>{typeof Rh.emitWarning=="function"?Rh.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Dn=globalThis.AbortController,xx=globalThis.AbortSignal;if(typeof Dn>"u"){xx=class{constructor(){M(this,"onabort");M(this,"_onabort",[]);M(this,"reason");M(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Dn=class{constructor(){M(this,"signal",new xx);t();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Rh.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,vx("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ob=i=>!bx.has(i),ir=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Sx=i=>ir(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?_i:null:null,_i=class extends Array{constructor(t){super(t),this.fill(0);}},yi,Fr=class Fr{constructor(t,e){M(this,"heap");M(this,"length");if(!_(Fr,yi))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Sx(t);if(!e)return [];V(Fr,yi,true);let r=new Fr(t,e);return V(Fr,yi,false),r}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};yi=new WeakMap,tt(Fr,yi,false);var Fh=Fr,_x,yx,me,te,ge,Br,xe,bi,vi,Mt,_e,St,dt,X,Wt,ee,Gt,At,ye,It,be,ve,re,Se,ar,Ht,Si,A,Bh,kr,Ye,Ds,ie,Tx,Gr,Ti,Us,sr,or,kh,Gn,On,ct,Gh,Os,nr,Oh,Dh=class Dh{constructor(t){tt(this,A);tt(this,me);tt(this,te);tt(this,ge);tt(this,Br);tt(this,xe);tt(this,bi);tt(this,vi);M(this,"ttl");M(this,"ttlResolution");M(this,"ttlAutopurge");M(this,"updateAgeOnGet");M(this,"updateAgeOnHas");M(this,"allowStale");M(this,"noDisposeOnSet");M(this,"noUpdateTTL");M(this,"maxEntrySize");M(this,"sizeCalculation");M(this,"noDeleteOnFetchRejection");M(this,"noDeleteOnStaleGet");M(this,"allowStaleOnFetchAbort");M(this,"allowStaleOnFetchRejection");M(this,"ignoreFetchAbort");tt(this,Mt);tt(this,_e);tt(this,St);tt(this,dt);tt(this,X);tt(this,Wt);tt(this,ee);tt(this,Gt);tt(this,At);tt(this,ye);tt(this,It);tt(this,be);tt(this,ve);tt(this,re);tt(this,Se);tt(this,ar);tt(this,Ht);tt(this,Si);tt(this,kr,()=>{});tt(this,Ye,()=>{});tt(this,Ds,()=>{});tt(this,ie,()=>false);tt(this,Gr,t=>{});tt(this,Ti,(t,e,r)=>{});tt(this,Us,(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,_x,"LRUCache");let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:x=0,maxEntrySize:y=0,sizeCalculation:m,fetchMethod:p,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:T,ignoreFetchAbort:C}=t;if(e!==0&&!ir(e))throw new TypeError("max option must be a nonnegative integer");let G=e?Sx(e):Array;if(!G)throw new Error("invalid max value: "+e);if(V(this,me,e),V(this,te,x),this.maxEntrySize=y||_(this,te),this.sizeCalculation=m,this.sizeCalculation){if(!_(this,te)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(V(this,vi,b),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(V(this,bi,p),V(this,ar,!!p),V(this,St,new Map),V(this,dt,new Array(e).fill(void 0)),V(this,X,new Array(e).fill(void 0)),V(this,Wt,new G(e)),V(this,ee,new G(e)),V(this,Gt,0),V(this,At,0),V(this,ye,Fh.create(e)),V(this,Mt,0),V(this,_e,0),typeof h=="function"&&V(this,ge,h),typeof u=="function"&&V(this,Br,u),typeof c=="function"?(V(this,xe,c),V(this,It,[])):(V(this,xe,void 0),V(this,It,void 0)),V(this,Se,!!_(this,ge)),V(this,Si,!!_(this,Br)),V(this,Ht,!!_(this,xe)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(_(this,te)!==0&&!ir(_(this,te)))throw new TypeError("maxSize must be a positive integer if specified");if(!ir(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");B(this,A,Tx).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ir(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ir(this.ttl))throw new TypeError("ttl must be a positive integer if specified");B(this,A,Bh).call(this);}if(_(this,me)===0&&this.ttl===0&&_(this,te)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!_(this,me)&&!_(this,te)){let E="LRU_CACHE_UNBOUNDED";ob(E)&&(bx.add(E),vx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,Dh));}}static unsafeExposeInternals(t){return {starts:_(t,ve),ttls:_(t,re),sizes:_(t,be),keyMap:_(t,St),keyList:_(t,dt),valList:_(t,X),next:_(t,Wt),prev:_(t,ee),get head(){return _(t,Gt)},get tail(){return _(t,At)},free:_(t,ye),isBackgroundFetch:e=>{var r;return B(r=t,A,ct).call(r,e)},backgroundFetch:(e,r,s,o)=>{var n;return B(n=t,A,On).call(n,e,r,s,o)},moveToTail:e=>{var r;return B(r=t,A,Os).call(r,e)},indexes:e=>{var r;return B(r=t,A,sr).call(r,e)},rindexes:e=>{var r;return B(r=t,A,or).call(r,e)},isStale:e=>{var r;return _(r=t,ie).call(r,e)}}}get max(){return _(this,me)}get maxSize(){return _(this,te)}get calculatedSize(){return _(this,_e)}get size(){return _(this,Mt)}get fetchMethod(){return _(this,bi)}get memoMethod(){return _(this,vi)}get dispose(){return _(this,ge)}get onInsert(){return _(this,Br)}get disposeAfter(){return _(this,xe)}getRemainingTTL(t){return _(this,St).has(t)?1/0:0}*entries(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*rentries(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*keys(){for(let t of B(this,A,sr).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*rkeys(){for(let t of B(this,A,or).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*values(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}*rvalues(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}[(yx=Symbol.iterator,_x=Symbol.toStringTag,yx)](){return this.entries()}find(t,e={}){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,_(this,dt)[r],this))return this.get(_(this,dt)[r],e)}}forEach(t,e=this){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}rforEach(t,e=this){for(let r of B(this,A,or).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}purgeStale(){let t=false;for(let e of B(this,A,or).call(this,{allowStale:true}))_(this,ie).call(this,e)&&(B(this,A,nr).call(this,_(this,dt)[e],"expire"),t=true);return t}info(t){let e=_(this,St).get(t);if(e===void 0)return;let r=_(this,X)[e],s=B(this,A,ct).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(_(this,re)&&_(this,ve)){let n=_(this,re)[e],a=_(this,ve)[e];if(n&&a){let l=n-(xi.now()-a);o.ttl=l,o.start=Date.now();}}return _(this,be)&&(o.size=_(this,be)[e]),o}dump(){let t=[];for(let e of B(this,A,sr).call(this,{allowStale:true})){let r=_(this,dt)[e],s=_(this,X)[e],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(_(this,re)&&_(this,ve)){n.ttl=_(this,re)[e];let a=xi.now()-_(this,ve)[e];n.start=Math.floor(Date.now()-a);}_(this,be)&&(n.size=_(this,be)[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=xi.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){var f,d,x,y;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=r,{noUpdateTTL:h=this.noUpdateTTL}=r,u=_(this,Us).call(this,t,e,r.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),B(this,A,nr).call(this,t,"set"),this;let c=_(this,Mt)===0?void 0:_(this,St).get(t);if(c===void 0)c=_(this,Mt)===0?_(this,At):_(this,ye).length!==0?_(this,ye).pop():_(this,Mt)===_(this,me)?B(this,A,Gn).call(this,false):_(this,Mt),_(this,dt)[c]=t,_(this,X)[c]=e,_(this,St).set(t,c),_(this,Wt)[_(this,At)]=c,_(this,ee)[c]=_(this,At),V(this,At,c),Xs(this,Mt)._++,_(this,Ti).call(this,c,u,l),l&&(l.set="add"),h=false,_(this,Si)&&((f=_(this,Br))==null||f.call(this,e,t,"add"));else {B(this,A,Os).call(this,c);let m=_(this,X)[c];if(e!==m){if(_(this,ar)&&B(this,A,ct).call(this,m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=m;p!==void 0&&!n&&(_(this,Se)&&((d=_(this,ge))==null||d.call(this,p,t,"set")),_(this,Ht)&&_(this,It)?.push([p,t,"set"]));}else n||(_(this,Se)&&((x=_(this,ge))==null||x.call(this,m,t,"set")),_(this,Ht)&&_(this,It)?.push([m,t,"set"]));if(_(this,Gr).call(this,c),_(this,Ti).call(this,c,u,l),_(this,X)[c]=e,l){l.set="replace";let p=m&&B(this,A,ct).call(this,m)?m.__staleWhileFetching:m;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");_(this,Si)&&this.onInsert?.(e,t,e===m?"update":"replace");}if(s!==0&&!_(this,re)&&B(this,A,Bh).call(this),_(this,re)&&(h||_(this,Ds).call(this,c,s,o),l&&_(this,Ye).call(this,l,c)),!n&&_(this,Ht)&&_(this,It)){let m=_(this,It),p;for(;p=m?.shift();)(y=_(this,xe))==null||y.call(this,...p);}return this}pop(){var t;try{for(;_(this,Mt);){let e=_(this,X)[_(this,Gt)];if(B(this,A,Gn).call(this,!0),B(this,A,ct).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(_(this,Ht)&&_(this,It)){let e=_(this,It),r;for(;r=e?.shift();)(t=_(this,xe))==null||t.call(this,...r);}}}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=_(this,St).get(t);if(o!==void 0){let n=_(this,X)[o];if(B(this,A,ct).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(_(this,ie).call(this,o))s&&(s.has="stale",_(this,Ye).call(this,s,o));else return r&&_(this,kr).call(this,o),s&&(s.has="hit",_(this,Ye).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=_(this,St).get(t);if(s===void 0||!r&&_(this,ie).call(this,s))return;let o=_(this,X)[s];return B(this,A,ct).call(this,o)?o.__staleWhileFetching:o}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:y,forceRefresh:m=false,status:p,signal:b}=e;if(!_(this,ar))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:x,ignoreFetchAbort:d,status:p,signal:b},S=_(this,St).get(t);if(S===void 0){p&&(p.fetch="miss");let P=B(this,A,On).call(this,t,S,v,y);return P.__returned=P}else {let P=_(this,X)[S];if(B(this,A,ct).call(this,P)){let L=r&&P.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",L&&(p.returnedStale=true)),L?P.__staleWhileFetching:P.__returned=P}let T=_(this,ie).call(this,S);if(!m&&!T)return p&&(p.fetch="hit"),B(this,A,Os).call(this,S),s&&_(this,kr).call(this,S),p&&_(this,Ye).call(this,p,S),P;let C=B(this,A,On).call(this,t,S,v,y),E=C.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=T?"stale":"refresh",E&&T&&(p.returnedStale=true)),E?C.__staleWhileFetching:C.__returned=C}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=_(this,vi);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=r(t,a,{options:n,context:s});return this.set(t,l,n),l}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=_(this,St).get(t);if(a!==void 0){let l=_(this,X)[a],h=B(this,A,ct).call(this,l);return n&&_(this,Ye).call(this,n,a),_(this,ie).call(this,a)?(n&&(n.get="stale"),h?(n&&r&&l.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?l.__staleWhileFetching:void 0):(o||B(this,A,nr).call(this,t,"expire"),n&&r&&(n.returnedStale=true),r?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(B(this,A,Os).call(this,a),s&&_(this,kr).call(this,a),l))}else n&&(n.get="miss");}delete(t){return B(this,A,nr).call(this,t,"delete")}clear(){return B(this,A,Oh).call(this,"delete")}};me=new WeakMap,te=new WeakMap,ge=new WeakMap,Br=new WeakMap,xe=new WeakMap,bi=new WeakMap,vi=new WeakMap,Mt=new WeakMap,_e=new WeakMap,St=new WeakMap,dt=new WeakMap,X=new WeakMap,Wt=new WeakMap,ee=new WeakMap,Gt=new WeakMap,At=new WeakMap,ye=new WeakMap,It=new WeakMap,be=new WeakMap,ve=new WeakMap,re=new WeakMap,Se=new WeakMap,ar=new WeakMap,Ht=new WeakMap,Si=new WeakMap,A=new WeakSet,Bh=function(){let t=new _i(_(this,me)),e=new _i(_(this,me));V(this,re,t),V(this,ve,e),V(this,Ds,(o,n,a=xi.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let l=setTimeout(()=>{_(this,ie).call(this,o)&&B(this,A,nr).call(this,_(this,dt)[o],"expire");},n+1);l.unref&&l.unref();}}),V(this,kr,o=>{e[o]=t[o]!==0?xi.now():0;}),V(this,Ye,(o,n)=>{if(t[n]){let a=t[n],l=e[n];if(!a||!l)return;o.ttl=a,o.start=l,o.now=r||s();let h=o.now-l;o.remainingTTL=a-h;}});let r=0,s=()=>{let o=xi.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=_(this,St).get(o);if(n===void 0)return 0;let a=t[n],l=e[n];if(!a||!l)return 1/0;let h=(r||s())-l;return a-h},V(this,ie,o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a});},kr=new WeakMap,Ye=new WeakMap,Ds=new WeakMap,ie=new WeakMap,Tx=function(){let t=new _i(_(this,me));V(this,_e,0),V(this,be,t),V(this,Gr,e=>{V(this,_e,_(this,_e)-t[e]),t[e]=0;}),V(this,Us,(e,r,s,o)=>{if(B(this,A,ct).call(this,r))return 0;if(!ir(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!ir(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),V(this,Ti,(e,r,s)=>{if(t[e]=r,_(this,te)){let o=_(this,te)-t[e];for(;_(this,_e)>o;)B(this,A,Gn).call(this,true);}V(this,_e,_(this,_e)+t[e]),s&&(s.entrySize=r,s.totalCalculatedSize=_(this,_e));});},Gr=new WeakMap,Ti=new WeakMap,Us=new WeakMap,sr=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,At);!(!B(this,A,kh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,Gt)));)e=_(this,ee)[e];},or=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,Gt);!(!B(this,A,kh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,At)));)e=_(this,Wt)[e];},kh=function(t){return t!==void 0&&_(this,St).get(_(this,dt)[t])===t},Gn=function(t){var o;let e=_(this,Gt),r=_(this,dt)[e],s=_(this,X)[e];return _(this,ar)&&B(this,A,ct).call(this,s)?s.__abortController.abort(new Error("evicted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((o=_(this,ge))==null||o.call(this,s,r,"evict")),_(this,Ht)&&_(this,It)?.push([s,r,"evict"])),_(this,Gr).call(this,e),t&&(_(this,dt)[e]=void 0,_(this,X)[e]=void 0,_(this,ye).push(e)),_(this,Mt)===1?(V(this,Gt,V(this,At,0)),_(this,ye).length=0):V(this,Gt,_(this,Wt)[e]),_(this,St).delete(r),Xs(this,Mt)._--,e},On=function(t,e,r,s){let o=e===void 0?void 0:_(this,X)[e];if(B(this,A,ct).call(this,o))return o;let n=new Dn,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:r,context:s},h=(y,m=false)=>{let{aborted:p}=n.signal,b=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(p&&!m?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,b&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!b&&!m)return c(n.signal.reason);let v=d;return _(this,X)[e]===d&&(y===void 0?v.__staleWhileFetching?_(this,X)[e]=v.__staleWhileFetching:B(this,A,nr).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,y,l.options))),y},u=y=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=y),c(y)),c=y=>{let{aborted:m}=n.signal,p=m&&r.allowStaleOnFetchAbort,b=p||r.allowStaleOnFetchRejection,v=b||r.noDeleteOnFetchRejection,S=d;if(_(this,X)[e]===d&&(!v||S.__staleWhileFetching===void 0?B(this,A,nr).call(this,t,"fetch"):p||(_(this,X)[e]=S.__staleWhileFetching)),b)return r.status&&S.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),S.__staleWhileFetching;if(S.__returned===S)throw y},f=(y,m)=>{var b;let p=(b=_(this,bi))==null?void 0:b.call(this,t,o,l);p&&p instanceof Promise&&p.then(v=>y(v===void 0?void 0:v),m),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=v=>h(v,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(h,u),x=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,x,{...l.options,status:void 0}),e=_(this,St).get(t)):_(this,X)[e]=x,x},ct=function(t){if(!_(this,ar))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Dn},Gh=function(t,e){_(this,ee)[e]=t,_(this,Wt)[t]=e;},Os=function(t){t!==_(this,At)&&(t===_(this,Gt)?V(this,Gt,_(this,Wt)[t]):B(this,A,Gh).call(this,_(this,ee)[t],_(this,Wt)[t]),B(this,A,Gh).call(this,_(this,At),t),V(this,At,t));},nr=function(t,e){var s,o;let r=false;if(_(this,Mt)!==0){let n=_(this,St).get(t);if(n!==void 0)if(r=true,_(this,Mt)===1)B(this,A,Oh).call(this,e);else {_(this,Gr).call(this,n);let a=_(this,X)[n];if(B(this,A,ct).call(this,a)?a.__abortController.abort(new Error("deleted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((s=_(this,ge))==null||s.call(this,a,t,e)),_(this,Ht)&&_(this,It)?.push([a,t,e])),_(this,St).delete(t),_(this,dt)[n]=void 0,_(this,X)[n]=void 0,n===_(this,At))V(this,At,_(this,ee)[n]);else if(n===_(this,Gt))V(this,Gt,_(this,Wt)[n]);else {let l=_(this,ee)[n];_(this,Wt)[l]=_(this,Wt)[n];let h=_(this,Wt)[n];_(this,ee)[h]=_(this,ee)[n];}Xs(this,Mt)._--,_(this,ye).push(n);}}if(_(this,Ht)&&_(this,It)?.length){let n=_(this,It),a;for(;a=n?.shift();)(o=_(this,xe))==null||o.call(this,...a);}return r},Oh=function(t){var e,r;for(let s of B(this,A,or).call(this,{allowStale:true})){let o=_(this,X)[s];if(B(this,A,ct).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=_(this,dt)[s];_(this,Se)&&((e=_(this,ge))==null||e.call(this,o,n,t)),_(this,Ht)&&_(this,It)?.push([o,n,t]);}}if(_(this,St).clear(),_(this,X).fill(void 0),_(this,dt).fill(void 0),_(this,re)&&_(this,ve)&&(_(this,re).fill(0),_(this,ve).fill(0)),_(this,be)&&_(this,be).fill(0),V(this,Gt,0),V(this,At,0),_(this,ye).length=0,V(this,_e,0),V(this,Mt,0),_(this,Ht)&&_(this,It)){let s=_(this,It),o;for(;o=s?.shift();)(r=_(this,xe))==null||r.call(this,...o);}};var Un=Dh;var wi=class{constructor(t){M(this,"cache");M(this,"map",new Map);this.cache=new Un({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var zs=new wi({cacheSize:10}),Uh;(s=>{function i(o){let n=zs.get(o);if(!n){k.error(`Label "${o}" not found`);return}return n}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}zs.has(o.id)&&k.info(`Label "${o.id}" already exists, it will be overwritten`),zs.set(o.id,o);}s.add=t;function e(){return Array.from(zs.values())}s.values=e;function r(o){return zs.has(o)}s.has=r;})(Uh||(Uh={}));var se=Uh;var Ex=Hn(Mx());var Ci=class{constructor(t,e){M(this,"_id");M(this,"_onStepStart");M(this,"_onLoadingLabel");M(this,"_onStepEnd");this._id=t,this._onStepStart=e?.onStepStart,this._onLoadingLabel=e?.onLoadingLabel,this._onStepEnd=e?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(t,e)=>{if(this._onLoadingLabel&&t===0&&await this._onLoadingLabel(t,e),this._onStepStart)return await this._onStepStart(t,e)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var lr=class extends Ci{constructor(e,r,s){super(e,s);M(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e){if(e<0||e>=this.steps.length)return k.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[e];return (0,Ex.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return k.warn("stepSha not found, setting to ERROR",r),"error"}}};var ab="__close-label-id__";function zh(){return new lr(ab,[],{})}var Pi=class{constructor(t,e,r,s){M(this,"text");M(this,"_label");M(this,"type");M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{type:o="call",oneTime:n=false,onlyHaveNoChoice:a=false,autoSelect:l=false,...h}=s||{};this.text=t,this._label=e,this.type=o,this.oneTime=n,this.onlyHaveNoChoice=a,this.autoSelect=l,this.devProps=h,this.props=r;}get label(){let t=this._label;if(typeof t=="string"){let e=se.get(t);e?t=e:(k.error(`Label ${t} not found, so it will be closed`),t=zh());}return t}};function lb(i,t,e,r){let s=typeof t=="string"?t:t.id;return {...r,label:s,props:e,text:i,type:r?.type||"call"}}var Mi="close";var Ei=class{constructor(t,e){M(this,"text");M(this,"closeCurrentLabel");M(this,"type",Mi);M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{closeCurrentLabel:r=false,oneTime:s=false,onlyHaveNoChoice:o=false,autoSelect:n=false,...a}=e||{};this.text=t,this.closeCurrentLabel=r,this.oneTime=s,this.onlyHaveNoChoice=o,this.autoSelect=n,this.devProps=a;}};function hb(i,t){return {...t,type:Mi,text:i}}var O=class O{constructor(){}static get allOpenedLabels(){return H.getVariable(Q.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(t){H.setVariable(Q.OPENED_LABELS_COUNTER_KEY,t);}static getCurrentStepTimesCounterData(t=""){let e=O.currentLabelStepIndex;if(e===null)return k.error("currentLabelStepIndex is null"),null;let r=`${e}${t}`,s=O.currentLabelId,o=O._currentLabel;if(!s||e===null||!o)return k.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let n=o.getStepSha(e)||"error",a=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return a[s]||(a[s]={}),(!a[s][r]||a[s][r].stepSha1!=n)&&(a[s][r]={stepSha1:n}),a[s][r]}static setCurrentStepTimesCounterData(t="",e){let r=O.currentLabelStepIndex,s=r+t,o=O.currentLabelId;if(!o||r===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let n=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};n[o]||(n[o]={}),n[o][s]=e,H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,n);}static getCurrentStepTimesCounter(t=""){let e=O._stepCounter,r=O.getCurrentStepTimesCounterData(t);if(!r)return k.error("getCurrentStepTimesCounter obj is null"),0;let s=r.stepCounters||r.lastStepIndexs||[];return s.find(n=>n===e)||(s.push(e),delete r.lastStepIndexs,r.stepCounters=s,O.setCurrentStepTimesCounterData(t,r)),s.length}static getRandomNumber(t,e,r={}){let s=r.nestedId||"";if(r.onceOnly||false){let n=O.getCurrentStepTimesCounterData(s);if(!n)return;let a=n.usedRandomNumbers||{},l=Array.from({length:e-t+1},(c,f)=>f+t).filter(c=>!a[`${t}-${e}`]?.includes(c));if(l.length===0)return;let h=Math.floor(Math.random()*l.length),u=l[h];return a[`${t}-${e}`]||(a[`${t}-${e}`]=[]),a[`${t}-${e}`].push(u),n.usedRandomNumbers=a,O.setCurrentStepTimesCounterData(s,n),u}return Math.floor(Math.random()*(e-t+1))+t}static resetCurrentStepTimesCounter(t=""){let e=O.currentLabelStepIndex,r=e+t,s=O.currentLabelId;if(!s||e===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let o=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][r]={stepCounters:[],stepSha1:""},H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return H.getVariable(Q.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(t){H.setVariable(Q.ALL_CHOICES_MADE_KEY,t);}static increaseStepCounter(){O._stepCounter++;}static get openedLabels(){return ke(O._openedLabels)}static set openedLabels(t){O._openedLabels=ke(t);}static get originalOpenedLabels(){return ke(O._originalOpenedLabels)}static set originalOpenedLabels(t){O._originalOpenedLabels=ke(t);}static get _currentLabel(){if(O.currentLabelId)return se.get(O.currentLabelId)}static get currentLabelId(){if(O._openedLabels.length>0)return O._openedLabels[O._openedLabels.length-1].label}static get currentLabelStepIndex(){return O._openedLabels.length>0?O._openedLabels[O._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(t,e){let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;(!s||s<e)&&(r[t]={biggestStep:e,openCount:o},O.allOpenedLabels=r);}static addChoicesMade(t,e,r,s){let o=O.allChoicesMade,n=o.findIndex(a=>a.labelId===t&&a.stepIndex===e&&a.choiceIndex===s&&a.stepSha1===r);n<0?o.push({labelId:t,stepIndex:e,choiceIndex:s,stepSha1:r,madeTimes:1}):o[n].madeTimes++,O.allChoicesMade=o;}static pushNewLabel(t){if(!se.get(t))throw new Error(`[Pixi\u2019VN] Label ${t} not found`);O._openedLabels.push({label:t,currentStepIndex:0});let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;r[t]={biggestStep:s,openCount:o+1},O.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(O._openedLabels.length>0){let t=O._openedLabels[O._openedLabels.length-1];O._openedLabels[O._openedLabels.length-1]={...t,currentStepIndex:t.currentStepIndex+1};}}static set onStepStart(t){O._onStepStart=t;}static get onStepStart(){return async(t,e)=>{let r=[];return O.onLoadingLabel&&t===0&&r.push(O.onLoadingLabel(t,e)),O._onStepStart&&r.push(O._onStepStart(t,e)),await Promise.all(r)}}};M(O,"stepsRunning",0),M(O,"goNextRequests",0),M(O,"choiceMadeTemp"),M(O,"lastHistoryStep",null),M(O,"_stepCounter",0),M(O,"_openedLabels",[]),M(O,"_originalOpenedLabels",[]),M(O,"_onStepStart"),M(O,"onLoadingLabel"),M(O,"onStepEnd");var I=O;var Ns=class{get currentStepTimesCounter(){return I.getCurrentStepTimesCounter()}set currentStepTimesCounter(t){I.resetCurrentStepTimesCounter();}getRandomNumber(t,e,r={}){return I.getRandomNumber(t,e,r)}get stepCounter(){return I._stepCounter}get openedLabels(){return I.openedLabels}get currentLabel(){return I._currentLabel}addStepHistory(t,e={}){let{choiceMade:r,ignoreSameStep:s}=e,o,n,a,l=H.getVariable(Q.LAST_STEP_GLUED)===this.stepCounter;H.getVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY)),H.getVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(n=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY)),H.getVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY));let h=I.openedLabels,u={currentLabel:I.currentLabelId,dialogue:o,choices:n,stepSha1:t,index:this.stepCounter,labelStepIndex:I.currentLabelStepIndex,choiceIndexMade:r,inputValue:a,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:l,openedLabels:h};I.originalOpenedLabels=h,H.addHistoryItem(u,{ignoreSameStep:s}),I.lastHistoryStep=u,I.increaseStepCounter();}closeCurrentLabel(){if(!I.currentLabelId){k.warn("No label to close");return}if(!this.currentLabel){k.error("currentLabel not found");return}let t=I.openedLabels;t.pop(),I.openedLabels=t,H.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;I.openedLabels.length>0;)this.closeCurrentLabel(),H.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(t){let e;typeof t=="string"?e=t:e=t.id;let s=I.allOpenedLabels[e]?.biggestStep||0;if(s){let o=se.get(e);if(o)return o.stepCount<=s}return false}get alreadyCurrentStepMadeChoicesObj(){let t=I.currentLabelStepIndex,e=this.currentLabel;if(t===null||!e)return;let r=e.getStepSha(t);return r||(k.warn("stepSha not found, setting to ERROR"),r="error"),I.allChoicesMade.filter(s=>s.labelId===e?.id&&s.stepIndex===t&&s.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(t=>t.choiceIndex)}get isCurrentStepAlreadyOpened(){let t=I.currentLabelId;if(t){let e=I.allOpenedLabels[t]?.openCount||0;if(I.currentLabelStepIndex&&e>=I.currentLabelStepIndex)return true}return false}getTimesLabelOpened(t){return I.allOpenedLabels[t]?.openCount||0}getTimesChoiceMade(t){return this.alreadyCurrentStepMadeChoicesObj?.find(e=>e.choiceIndex===t)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanGoNext(t){let e=t?.showWarn||false,r=this.choiceMenuOptions;return r&&r.length>0?(e&&k.warn("The player must make a choice"),false):this.isRequiredInput?(e&&k.warn("The player must enter a value"),false):true}get canGoNext(){return I.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(t,e){let r=[];return t.onStepStart&&r.push(t.onStepStart(e,t)),I.onStepStart&&r.push(I.onStepStart(e,t)),await Promise.all(r)}async onStepEnd(t,e){let r=[];return t.onStepEnd&&r.push(t.onStepEnd(e,t)),I.onStepEnd&&r.push(I.onStepEnd(e,t)),await Promise.all(r)}async goNext(t,e={}){let{runNow:r=false}=e;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&I.stepsRunning!==0){I.goNextRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(s){k.error("Error running onStepEnd",s);}return I.stepsRunning===0&&await H.onGoNextEnd(),I.increaseCurrentStepIndex(),await this.runCurrentStep(t,e)}}async runCurrentStep(t,e={}){let{choiceMade:r}=e;if(I.currentLabelId){let s=I.currentLabelStepIndex;if(s===null){k.error("currentLabelStepIndex is null");return}let o=I._currentLabel;if(!o){k.error("currentLabel not found");return}if(o.stepCount>s){try{await this.onStepRun(o,s);}catch(l){k.error("Error running onStepStart",l),this.onStepError&&this.onStepError(l,t);return}let n=o.getStepById(s);if(!n){k.error("step not found");return}let a=o.getStepSha(s);a||(k.warn("stepSha not found, setting to ERROR"),a="error");try{I.stepsRunning++;let l=await n(t,{labelId:o.id}),h=this.choiceMenuOptions;if(h?.length===1&&h[0].autoSelect){let c=h[0];l=await this.selectChoice(c,t);}let u=I.lastHistoryStep;if(r!==void 0&&u){let c=u.stepSha1;c||(k.warn("stepSha not found, setting to ERROR"),c="error"),I.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",r),I.choiceMadeTemp=r;}return I.stepsRunning--,I.stepsRunning===0&&(I.addLabelHistory(o.id,s),this.addStepHistory(a,{...e,choiceMade:I.choiceMadeTemp}),I.choiceMadeTemp=void 0,I.goNextRequests>0)?(I.goNextRequests--,await this.goNext(t)):l}catch(l){I.stepsRunning>0&&I.stepsRunning--,k.error("Error running step",l),this.onStepError&&this.onStepError(l,t);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.goNext(t,e);if(this.openedLabels.length===1)return I.openedLabels=[],this.onGameEnd?await this.onGameEnd(t,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(I.openedLabels=I.originalOpenedLabels,this.onGameEnd)return await this.onGameEnd(t,{labelId:"end"});k.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else k.error("currentLabelId not found");}async callLabel(t,e,r){let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error calling label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async jumpLabel(t,e,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error jumping label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async selectChoice(t,e){this.choiceMenuOptions=void 0;let r=t.type;switch(r){case "call":return await this.callLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "jump":return await this.jumpLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "close":return await this.closeChoiceMenu(t,{...t.props,...e});default:throw k.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(t,e){if(t.type!=="close")throw k.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof t.choiceIndex=="number"&&(r=t.choiceIndex),t.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(e,{choiceMade:r})}get onGameEnd(){return H.onEnd}set onGameEnd(t){H.onEnd=t;}get onStepError(){let t=H.onError;return t?(e,r)=>t("step",e,r):void 0}set onStepError(t){H.onError=(e,r,s)=>t(r,s);}get dialogue(){let t=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(t)return {...t,character:t.character?H.getCharacter(t.character)||t.character:void 0}}set dialogue(t){if(!t){H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof t=="string"||Array.isArray(t))&&(t={text:t}),this.dialogGlue){let e=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(e){let r=[];Array.isArray(e.text)?r=[...e.text]:r=[e.text],Array.isArray(t.text)?r=[...r,...t.text]:r=[...r,t.text],t.text=r,t.character=t.character||e.character;}H.setVariable(Q.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,ke({...t,character:typeof t.character=="string"?t.character:t.character?.id})),H.setVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(e){throw k.error("DialogueInterface cannot contain functions or classes"),e}}get choiceMenuOptions(){let t=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(t){let e=[],r=t.map((o,n)=>({...o,choiceIndex:n})),s=this.alreadyCurrentStepMadeChoices;if(r=r.filter((o,n)=>o.oneTime&&s&&s.includes(n)?false:o.onlyHaveNoChoice?(e.push(o),false):true),r.length>0)return r;if(e.length>0)return [e[0]]}}set choiceMenuOptions(t){if(!t||t.length===0){H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}let e=t.map(r=>r instanceof Ei?{...r.devProps,text:r.text,type:Mi,closeCurrentLabel:r.closeCurrentLabel,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,autoSelect:r.autoSelect,props:r.props}:r instanceof Pi?{...r.devProps,type:r.type,text:r.text,label:r.label.id,autoSelect:r.autoSelect,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,props:r.props}:r);try{H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,ke(e)),H.setVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(r){throw k.error("ChoiceInterface cannot contain functions or classes"),r}}get dialogGlue(){return H.getFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(t){H.setFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,t);}get inputValue(){return H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(t){this.removeInputRequest(),H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,t),H.setVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(t,e){t.isRequired=true,H.setVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY,t),e!==void 0?H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,e):H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){H.removeVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY),H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){I.openedLabels=[],I._stepCounter=0;}export(){return {openedLabels:ke(I.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(t){let e=this.openedLabels.map(async r=>{let s=[],o=se.get(r.label);return o&&(o.onLoadingLabel&&s.push(o.onLoadingLabel(t,o)),I.onLoadingLabel&&s.push(I.onLoadingLabel(t,o))),await Promise.all(s)});return await Promise.all(e)}async restore(t,e){this.clear();try{I.lastHistoryStep=e,t.hasOwnProperty("openedLabels")?(I.openedLabels=t.openedLabels,I.originalOpenedLabels=I.openedLabels):k.warn("Could not import openedLabels data, so will be ignored"),t.hasOwnProperty("stepCounter")?I._stepCounter=t.stepCounter:t.hasOwnProperty("lastStepIndex")?I._stepCounter=t.lastStepIndex:k.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(I.currentLabelStepIndex||0);}catch(r){k.error("Error running onLoadingLabel",r);}}catch(r){k.error("Error importing data",r);}}};function Ax(i,t,e){let r=new lr(i,t,e);return se.add(r),r}var wO=new Ns;
570
570
  export{Pi as ChoiceMenuOption,Ei as ChoiceMenuOptionClose,Mi as Close,lr as Label,Ci as LabelAbstract,I as NarrationManagerStatic,se as RegisteredLabels,wO as narration,lb as newChoiceOption,hb as newCloseChoiceOption,Ax as newLabel};