route-graphics 1.1.3 → 1.1.4

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 bB=Object.create;var Af=Object.defineProperty;var vB=Object.getOwnPropertyDescriptor;var TB=Object.getOwnPropertyNames;var SB=Object.getPrototypeOf,wB=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var J=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),o_=(r,t)=>{for(var e in t)Af(r,e,{get:t[e],enumerable:!0})},EB=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of TB(t))!wB.call(r,s)&&s!==e&&Af(r,s,{get:()=>t[s],enumerable:!(i=vB(t,s))||i.enumerable});return r};var Ki=(r,t,e)=>(e=r!=null?bB(SB(r)):{},EB(t||!r||!r.__esModule?Af(e,"default",{value:r,enumerable:!0}):e,r));var T,Pf,Oh,H,F=x(()=>{"use strict";T=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(T||{}),Pf=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Oh=(r,t)=>Pf(r).priority??t,H={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Pf).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Pf).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Oh(n.value,e)-Oh(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Oh(o,e)-Oh(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var a_=J((VD,Cf)=>{"use strict";var PB=Object.prototype.hasOwnProperty,Ie="~";function In(){}Object.create&&(In.prototype=Object.create(null),new In().__proto__||(Ie=!1));function CB(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function n_(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new CB(e,i||r,s),n=Ie?Ie+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Lh(r,t){--r._eventsCount===0?r._events=new In:delete r._events[t]}function Ee(){this._events=new In,this._eventsCount=0}Ee.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)PB.call(e,i)&&t.push(Ie?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ee.prototype.listeners=function(t){var e=Ie?Ie+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Ee.prototype.listenerCount=function(t){var e=Ie?Ie+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Ee.prototype.emit=function(t,e,i,s,o,n){var a=Ie?Ie+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Ee.prototype.on=function(t,e,i){return n_(this,t,e,i,!1)};Ee.prototype.once=function(t,e,i){return n_(this,t,e,i,!0)};Ee.prototype.removeListener=function(t,e,i,s){var o=Ie?Ie+t:t;if(!this._events[o])return this;if(!e)return Lh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Lh(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Lh(this,o)}return this};Ee.prototype.removeAllListeners=function(t){var e;return t?(e=Ie?Ie+t:t,this._events[e]&&Lh(this,e)):(this._events=new In,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Ie;Ee.EventEmitter=Ee;typeof Cf<"u"&&(Cf.exports=Ee)});var l_,It,Ae=x(()=>{l_=Ki(a_(),1),It=l_.default});var RB,Jr,ge,nr,g_,h_,Rf,MB,Dh,x_,y_,c_,u_,d_,Bn,IB,BB,FB,kB,Bf,f_,UB,Mf,If,p_,Ff,qe,m_,Nh,kf=x(()=>{RB={grad:.9,turn:360,rad:360/(2*Math.PI)},Jr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ge=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},nr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},g_=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},h_=function(r){return{r:nr(r.r,0,255),g:nr(r.g,0,255),b:nr(r.b,0,255),a:nr(r.a)}},Rf=function(r){return{r:ge(r.r),g:ge(r.g),b:ge(r.b),a:ge(r.a,3)}},MB=/^#([0-9a-f]{3,8})$/i,Dh=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},x_=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},y_=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),h=o%6;return{r:255*[i,a,n,n,l,i][h],g:255*[l,i,i,a,n,n][h],b:255*[n,n,l,i,i,a][h],a:s}},c_=function(r){return{h:g_(r.h),s:nr(r.s,0,100),l:nr(r.l,0,100),a:nr(r.a)}},u_=function(r){return{h:ge(r.h),s:ge(r.s),l:ge(r.l),a:ge(r.a,3)}},d_=function(r){return y_((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Bn=function(r){return{h:(t=x_(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},IB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,BB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,FB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bf={string:[[function(r){var t=MB.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ge(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ge(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=FB.exec(r)||kB.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:h_({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=IB.exec(r)||BB.exec(r);if(!t)return null;var e,i,s=c_({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(RB[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return d_(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Jr(t)&&Jr(e)&&Jr(i)?h_({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(e)||!Jr(i))return null;var n=c_({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return d_(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(e)||!Jr(i))return null;var n=function(a){return{h:g_(a.h),s:nr(a.s,0,100),v:nr(a.v,0,100),a:nr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return y_(n)},"hsv"]]},f_=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},UB=function(r){return typeof r=="string"?f_(r.trim(),Bf.string):typeof r=="object"&&r!==null?f_(r,Bf.object):[null,void 0]},Mf=function(r,t){var e=Bn(r);return{h:e.h,s:nr(e.s+100*t,0,100),l:e.l,a:e.a}},If=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},p_=function(r,t){var e=Bn(r);return{h:e.h,s:e.s,l:nr(e.l+100*t,0,100),a:e.a}},Ff=function(){function r(t){this.parsed=UB(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ge(If(this.rgba),2)},r.prototype.isDark=function(){return If(this.rgba)<.5},r.prototype.isLight=function(){return If(this.rgba)>=.5},r.prototype.toHex=function(){return t=Rf(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?Dh(ge(255*o)):"","#"+Dh(e)+Dh(i)+Dh(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return Rf(this.rgba)},r.prototype.toRgbString=function(){return t=Rf(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return u_(Bn(this.rgba))},r.prototype.toHslString=function(){return t=u_(Bn(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=x_(this.rgba),{h:ge(t.h),s:ge(t.s),v:ge(t.v),a:ge(t.a,3)};var t},r.prototype.invert=function(){return qe({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),qe(Mf(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),qe(Mf(this.rgba,-t))},r.prototype.grayscale=function(){return qe(Mf(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),qe(p_(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),qe(p_(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?qe({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ge(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Bn(this.rgba);return typeof t=="number"?qe({h:t,s:e.s,l:e.l,a:e.a}):ge(e.h)},r.prototype.isEqual=function(t){return this.toHex()===qe(t).toHex()},r}(),qe=function(r){return r instanceof Ff?r:new Ff(r)},m_=[],Nh=function(r){r.forEach(function(t){m_.indexOf(t)<0&&(t(Ff,Bf),m_.push(t))})}});function Hh(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var p in e){var g=(a=c,l=o[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g<u&&(u=g,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var Uf=x(()=>{});var Xs,ot,ve=x(()=>{kf();Uf();Nh([Hh]);Xs=class Fn{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 Fn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=Fn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Fn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=qe(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Fn||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}};Xs.shared=new Xs;Xs._temp=new Xs;Xs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;ot=Xs});var __,b_=x(()=>{"use strict";__={cullArea:null,cullable:!1,cullableChildren:!0}});var v_,T_,S_,Gf=x(()=>{"use strict";v_=Math.PI*2,T_=180/Math.PI,S_=Math.PI/180});var dt,Of,ar=x(()=>{"use strict";dt=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Of.x=0,Of.y=0,Of}},Of=new dt});var G,GB,OB,mt=x(()=>{Gf();ar();G=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new dt;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new dt;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(i*n+o*-s),c=t.x,u=t.y;return e.x=n*h*c+-o*h*u+(l*o-a*n)*h,e.y=i*h*u+-s*h*c+(-l*i+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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,d=e.d;return this.a=i*h+s*u,this.b=i*c+s*d,this.c=o*h+n*u,this.d=o*c+n*d,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*d+e.ty,this}setTransform(t,e,i,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-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(v_-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+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return OB.identity()}static get shared(){return GB.identity()}},GB=new G,OB=new G});var Te,Vh=x(()=>{"use strict";Te=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function ut(r="default"){return Lf[r]===void 0&&(Lf[r]=-1),++Lf[r]}var Lf,Se=x(()=>{"use strict";Lf={default:-1}});function j(r,t,e=3){if(w_[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var vB=Object.create;var Pf=Object.defineProperty;var TB=Object.getOwnPropertyDescriptor;var SB=Object.getOwnPropertyNames;var wB=Object.getPrototypeOf,EB=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var J=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),n_=(r,t)=>{for(var e in t)Pf(r,e,{get:t[e],enumerable:!0})},AB=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of SB(t))!EB.call(r,s)&&s!==e&&Pf(r,s,{get:()=>t[s],enumerable:!(i=TB(t,s))||i.enumerable});return r};var Zi=(r,t,e)=>(e=r!=null?vB(wB(r)):{},AB(t||!r||!r.__esModule?Pf(e,"default",{value:r,enumerable:!0}):e,r));var T,Cf,Oh,H,F=x(()=>{"use strict";T=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(T||{}),Cf=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Oh=(r,t)=>Cf(r).priority??t,H={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Cf).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Cf).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Oh(n.value,e)-Oh(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Oh(o,e)-Oh(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var l_=J((zD,Rf)=>{"use strict";var CB=Object.prototype.hasOwnProperty,Ie="~";function In(){}Object.create&&(In.prototype=Object.create(null),new In().__proto__||(Ie=!1));function RB(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function a_(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new RB(e,i||r,s),n=Ie?Ie+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Lh(r,t){--r._eventsCount===0?r._events=new In:delete r._events[t]}function Ee(){this._events=new In,this._eventsCount=0}Ee.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)CB.call(e,i)&&t.push(Ie?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ee.prototype.listeners=function(t){var e=Ie?Ie+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Ee.prototype.listenerCount=function(t){var e=Ie?Ie+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Ee.prototype.emit=function(t,e,i,s,o,n){var a=Ie?Ie+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Ee.prototype.on=function(t,e,i){return a_(this,t,e,i,!1)};Ee.prototype.once=function(t,e,i){return a_(this,t,e,i,!0)};Ee.prototype.removeListener=function(t,e,i,s){var o=Ie?Ie+t:t;if(!this._events[o])return this;if(!e)return Lh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Lh(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Lh(this,o)}return this};Ee.prototype.removeAllListeners=function(t){var e;return t?(e=Ie?Ie+t:t,this._events[e]&&Lh(this,e)):(this._events=new In,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Ie;Ee.EventEmitter=Ee;typeof Rf<"u"&&(Rf.exports=Ee)});var h_,It,Ae=x(()=>{h_=Zi(l_(),1),It=h_.default});var MB,Jr,ge,nr,x_,c_,Mf,IB,Dh,y_,__,u_,d_,f_,Bn,BB,FB,kB,UB,Ff,p_,GB,If,Bf,m_,kf,qe,g_,Nh,Uf=x(()=>{MB={grad:.9,turn:360,rad:360/(2*Math.PI)},Jr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ge=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},nr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},x_=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},c_=function(r){return{r:nr(r.r,0,255),g:nr(r.g,0,255),b:nr(r.b,0,255),a:nr(r.a)}},Mf=function(r){return{r:ge(r.r),g:ge(r.g),b:ge(r.b),a:ge(r.a,3)}},IB=/^#([0-9a-f]{3,8})$/i,Dh=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},y_=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},__=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),h=o%6;return{r:255*[i,a,n,n,l,i][h],g:255*[l,i,i,a,n,n][h],b:255*[n,n,l,i,i,a][h],a:s}},u_=function(r){return{h:x_(r.h),s:nr(r.s,0,100),l:nr(r.l,0,100),a:nr(r.a)}},d_=function(r){return{h:ge(r.h),s:ge(r.s),l:ge(r.l),a:ge(r.a,3)}},f_=function(r){return __((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Bn=function(r){return{h:(t=y_(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},BB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,FB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,UB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ff={string:[[function(r){var t=IB.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ge(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ge(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=kB.exec(r)||UB.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:c_({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=BB.exec(r)||FB.exec(r);if(!t)return null;var e,i,s=u_({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(MB[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return f_(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Jr(t)&&Jr(e)&&Jr(i)?c_({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(e)||!Jr(i))return null;var n=u_({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return f_(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(e)||!Jr(i))return null;var n=function(a){return{h:x_(a.h),s:nr(a.s,0,100),v:nr(a.v,0,100),a:nr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return __(n)},"hsv"]]},p_=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},GB=function(r){return typeof r=="string"?p_(r.trim(),Ff.string):typeof r=="object"&&r!==null?p_(r,Ff.object):[null,void 0]},If=function(r,t){var e=Bn(r);return{h:e.h,s:nr(e.s+100*t,0,100),l:e.l,a:e.a}},Bf=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},m_=function(r,t){var e=Bn(r);return{h:e.h,s:e.s,l:nr(e.l+100*t,0,100),a:e.a}},kf=function(){function r(t){this.parsed=GB(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ge(Bf(this.rgba),2)},r.prototype.isDark=function(){return Bf(this.rgba)<.5},r.prototype.isLight=function(){return Bf(this.rgba)>=.5},r.prototype.toHex=function(){return t=Mf(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?Dh(ge(255*o)):"","#"+Dh(e)+Dh(i)+Dh(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return Mf(this.rgba)},r.prototype.toRgbString=function(){return t=Mf(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return d_(Bn(this.rgba))},r.prototype.toHslString=function(){return t=d_(Bn(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=y_(this.rgba),{h:ge(t.h),s:ge(t.s),v:ge(t.v),a:ge(t.a,3)};var t},r.prototype.invert=function(){return qe({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),qe(If(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),qe(If(this.rgba,-t))},r.prototype.grayscale=function(){return qe(If(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),qe(m_(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),qe(m_(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?qe({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ge(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Bn(this.rgba);return typeof t=="number"?qe({h:t,s:e.s,l:e.l,a:e.a}):ge(e.h)},r.prototype.isEqual=function(t){return this.toHex()===qe(t).toHex()},r}(),qe=function(r){return r instanceof kf?r:new kf(r)},g_=[],Nh=function(r){r.forEach(function(t){g_.indexOf(t)<0&&(t(kf,Ff),g_.push(t))})}});function Hh(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=c,l=o[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var Gf=x(()=>{});var Xs,ot,ve=x(()=>{Uf();Gf();Nh([Hh]);Xs=class Fn{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 Fn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=Fn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Fn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=qe(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Fn||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}};Xs.shared=new Xs;Xs._temp=new Xs;Xs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;ot=Xs});var b_,v_=x(()=>{"use strict";b_={cullArea:null,cullable:!1,cullableChildren:!0}});var T_,S_,w_,Of=x(()=>{"use strict";T_=Math.PI*2,S_=180/Math.PI,w_=Math.PI/180});var dt,Lf,ar=x(()=>{"use strict";dt=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Lf.x=0,Lf.y=0,Lf}},Lf=new dt});var G,OB,LB,mt=x(()=>{Of();ar();G=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new dt;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new dt;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(i*n+o*-s),c=t.x,u=t.y;return e.x=n*h*c+-o*h*u+(l*o-a*n)*h,e.y=i*h*u+-s*h*c+(-l*i+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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,d=e.d;return this.a=i*h+s*u,this.b=i*c+s*d,this.c=o*h+n*u,this.d=o*c+n*d,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*d+e.ty,this}setTransform(t,e,i,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-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(T_-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+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return LB.identity()}static get shared(){return OB.identity()}},OB=new G,LB=new G});var Te,Vh=x(()=>{"use strict";Te=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function ut(r="default"){return Df[r]===void 0&&(Df[r]=-1),++Df[r]}var Df,Se=x(()=>{"use strict";Df={default:-1}});function j(r,t,e=3){if(E_[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
2
  Deprecated since v${r}`):(i=i.split(`
3
3
  `).splice(e).join(`
4
4
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
5
5
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${r}`),console.warn(i))),w_[t]=!0}var w_,rt,E_,Wt=x(()=>{"use strict";w_={},rt="8.0.0",E_="8.3.4"});var Zi,Df=x(()=>{"use strict";Zi=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var Nf,it,Be=x(()=>{Df();Nf=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Zi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},it=new Nf});var A_,P_=x(()=>{Wt();A_={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){j("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Wh(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var Hf=x(()=>{"use strict"});var C_,R_=x(()=>{Hf();Wt();C_={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Wh(this.children,r,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||j(rt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var M_,I_=x(()=>{"use strict";M_={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ti,zh=x(()=>{"use strict";ti=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 Vf,$h,B_=x(()=>{F();Be();Vf=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let i=this._tests[e];if(i.test(t))return it.get(i.maskClass,t)}return t}returnMaskEffect(t){it.return(t)}},$h=new Vf;H.handleByList(T.MaskEffect,$h._effectClasses)});var F_,k_=x(()=>{zh();B_();F_={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),$h.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=$h.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new ti);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ti),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var U_,G_=x(()=>{Wt();U_={label:null,get name(){return j(rt,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){j(rt,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var Xh,tt,he=x(()=>{ar();Xh=[new dt,new dt,new dt,new dt],tt=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,h=i*(1-s),c=i-h,u=a-h,d=a+o+h,f=l-h,p=l+n+h,g=a+c,m=a+o-c,_=l+c,b=l+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>g&&t<m&&e>_&&e<b)}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Xh[0].set(t.left,t.top),l=Xh[1].set(t.left,t.bottom),h=Xh[2].set(t.right,t.top),c=Xh[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,g=d*s+f*o,m=d*i+f*n,_=d*s+f*n;if(Math.max(p,g,m,_)<=d*a.x+f*a.y||Math.min(p,g,m,_)>=d*c.x+f*c.y)return!1;let b=u*(a.y-h.y),y=u*(h.x-a.x),w=b*i+y*o,E=b*s+y*o,v=b*i+y*n,S=b*s+y*n;return!(Math.max(w,E,v,S)<=b*a.x+y*a.y||Math.min(w,E,v,S)>=b*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var O_,At,Ve=x(()=>{mt();he();O_=new G,At=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=O_,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new tt);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=O_,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,g=this.maxY,m=n*t+l*e+c,_=a*t+h*e+u;m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),m=n*i+l*e+c,_=a*i+h*e+u,m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),m=n*t+l*s+c,_=a*t+h*s+u,m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),m=n*i+l*s+c,_=a*i+h*s+u,m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:h,tx:c,ty:u}=t,d=n*e+l*i+c,f=a*e+h*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+c,f=a*s+h*i+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+l*o+c,f=a*e+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+c,f=a*s+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let g=e;g<i;g+=2){let m=t[g],_=t[g+1],b=h*m+u*_+f,y=c*m+d*_+p;o=b<o?b:o,n=y<n?y:n,a=b>a?b:a,l=y>l?y: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 ie,Ke,Qi=x(()=>{mt();Df();Ve();ie=new Zi(G),Ke=new Zi(At)});var LB,L_,D_=x(()=>{mt();Ve();Qi();LB=new G,L_={getFastGlobalBounds(r,t){t||(t=new At),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ke.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(r,i,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(LB).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ke.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ke.return(i))}}});function js(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=ie.get().identity(),i=jh(r,s)):i=G.IDENTITY,N_(r,e,i,t),s&&ie.return(s),e.isValid||e.set(0,0,0,0),e}function N_(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ie.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ke.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)N_(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,G.IDENTITY),Ke.return(t)}i||ie.return(s)}function jh(r,t){let e=r.parent;return e&&(jh(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var kn=x(()=>{mt();Qi()});function Yh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=i*n/255|0,c=s*a/255|0;return(l<<16)+(h<<8)+c}var Wf=x(()=>{"use strict"});function Ys(r,t){return r===H_?t:t===H_?r:Yh(r,t)}var H_,zf=x(()=>{Wf();H_=16777215});function Un(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var V_,W_=x(()=>{kn();Qi();zf();V_={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=jh(this,ie.get().identity());return r.appendFrom(this.localTransform,e),ie.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Un(this.renderGroup.worldColor):this.parentRenderGroup?Un(Ys(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Ys(t,e.localColor),e=e.parent;return Un(t)}}});function V(...r){$f!==z_&&($f++,$f===z_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var $f,z_,Pt=x(()=>{"use strict";$f=0,z_=500});function qs(r,t,e){return t.clear(),e||(e=G.IDENTITY),$_(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function $_(r,t,e,i,s){let o;if(s)o=ie.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ie.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ke.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let h=0;h<l.length;h++)$_(l[h],t,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,i);n.addBounds(t,G.IDENTITY),Ke.return(t)}ie.return(o)}var qh=x(()=>{mt();Qi()});function Xf(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&Xf(s,t)}return t.didChange}var X_=x(()=>{"use strict"});var DB,j_,Y_=x(()=>{mt();Ve();kn();qh();X_();DB=new G,j_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new At});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Xf(this,r),r.didChange&&qs(this,r.localBounds,DB),r.localBounds},getBounds(r,t){return js(this,r,t||new At)}}});var q_,K_=x(()=>{"use strict";q_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function NB(r,t){return r._zIndex-t._zIndex}var Z_,Q_=x(()=>{"use strict";Z_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(NB))}}});var J_,tb=x(()=>{ar();Qi();J_={getGlobalPosition(r=new dt,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ie.get(),e);return t=i.apply(r,t),ie.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ie.get(),i);return e=s.applyInverse(r,e),ie.return(s),e}}});var Ks,jf=x(()=>{Se();Ks=class{constructor(){this.uid=ut("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 ei(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Yf(r){return!(r&r-1)&&!!r}var Gn=x(()=>{"use strict"});function Kh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var qf=x(()=>{"use strict"});function HB(r){let t=eb[r];return t===void 0&&(eb[r]=ut("resource")),t}var eb,rb,Zh,Kf=x(()=>{Ae();Se();Wt();eb=Object.create(null);rb=class ib extends It{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...ib.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){j(rt,"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=HB(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};rb.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Zh=rb});var sb,wt,We=x(()=>{Ae();Gn();qf();Se();Kf();sb=class ob extends It{constructor(t={}){super(),this.options=t,this.uid=ut("textureSource"),this._resourceType="textureSource",this._resourceId=ut("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...ob.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 Zh(Kh(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ut("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=ut("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Yf(this.pixelWidth)&&Yf(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};sb.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};wt=sb});function VB(){for(let r=0;r<16;r++){let t=[];Zf.push(t);for(let e=0;e<16;e++){let i=Qh(Ji[r]*Ji[e]+es[r]*ts[e]),s=Qh(ts[r]*Ji[e]+rs[r]*ts[e]),o=Qh(Ji[r]*es[e]+es[r]*rs[e]),n=Qh(ts[r]*es[e]+rs[r]*rs[e]);for(let a=0;a<16;a++)if(Ji[a]===i&&ts[a]===s&&es[a]===o&&rs[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new G;t.set(Ji[r],ts[r],es[r],rs[r],0,0),nb.push(t)}}var Ji,ts,es,rs,Zf,nb,Qh,Dt,ab=x(()=>{mt();Ji=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ts=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],es=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],rs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Zf=[],nb=[],Qh=Math.sign;VB();Dt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Ji[r],uY:r=>ts[r],vX:r=>es[r],vY:r=>rs[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Zf[r][t],sub:(r,t)=>Zf[r][Dt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Dt.S:Dt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Dt.E:Dt.W:t>0?r>0?Dt.SE:Dt.SW:r>0?Dt.NE:Dt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=nb[Dt.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var Qf,lb=x(()=>{"use strict";Qf=()=>{}});var is,Jf=x(()=>{F();We();is=class extends wt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};is.extension=T.TextureSource});var hb,Zs,tp=x(()=>{mt();hb=new G,Zs=class{constructor(t,e){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let i=t.orig,s=t.trim;s&&(hb.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(hb));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,!0}}});var I,Tt=x(()=>{Ae();ab();he();Se();Wt();lb();Jf();We();tp();I=class extends It{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=ut("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new tt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new wt,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=h||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Zs(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,h=this.rotate;if(h){let c=a/2,u=l/2,d=o+c,f=n+u;h=Dt.add(h,Dt.NW),t.x0=d+c*Dt.uX(h),t.y0=f+u*Dt.uY(h),h=Dt.add(h,2),t.x1=d+c*Dt.uX(h),t.y1=f+u*Dt.uY(h),h=Dt.add(h,2),t.x2=d+c*Dt.uX(h),t.y2=f+u*Dt.uY(h),h=Dt.add(h,2),t.x3=d+c*Dt.uX(h),t.y3=f+u*Dt.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=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return j(rt,"Texture.baseTexture is now Texture.source"),this._source}};I.EMPTY=new I({label:"EMPTY",source:new wt({label:"EMPTY"})});I.EMPTY.destroy=Qf;I.WHITE=new I({source:new is({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});I.WHITE.destroy=Qf});var WB,ep,zt,Si=x(()=>{Gn();We();Tt();WB=0,ep=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new wt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new I({source:s,label:`texturePool_${WB++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ei(o),n=ei(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=i,l.source.width=o/i,l.source.height=n/i,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=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},zt=new ep});var Jh,cb=x(()=>{mt();jf();Si();Jh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Ks,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(zt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),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 G),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 ub(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var db=x(()=>{"use strict"});var rp,ip,sp,Qs,On,ss,nt,br=x(()=>{Ae();ve();b_();F();mt();Gf();Vh();Se();Wt();Be();P_();R_();I_();k_();G_();D_();W_();Y_();K_();Q_();tb();cb();db();rp=new Te(null),ip=new Te(null),sp=new Te(null,1,1),Qs=1,On=2,ss=4,nt=class r extends It{constructor(t={}){super(),this.uid=ut("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Te(this,0,0),this._scale=sp,this._pivot=ip,this._skew=rp,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=[],ub(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){j("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),H.mixin(r,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||j(rt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=it.get(Jh,this),this.groupTransform=G.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),it.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 G),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*T_}set angle(t){this.rotation=t*S_}get pivot(){return this._pivot===ip&&(this._pivot=new Te(this,0,0)),this._pivot}set pivot(t){this._pivot===ip&&(this._pivot=new Te(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===rp&&(this._skew=new Te(this,0,0)),this._skew}set skew(t){this._skew===rp&&(this._skew=new Te(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===sp&&(this._scale=new Te(this,1,1)),this._scale}set scale(t){this._scale===sp&&(this._scale=new Te(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,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|=Qs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=ot.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Qs,this._onUpdate())}get tint(){return Un(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=On,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ss,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ss,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|=ss,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};H.mixin(nt,C_,L_,J_,q_,j_,F_,U_,Z_,__,A_,V_,M_)});var wi,tc=x(()=>{ar();wi=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function zB(r){return function(t){return t.test(r)}}function Ei(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=zB(e),o={apple:{phone:s(op)&&!s(ri),ipod:s(fb),tablet:!s(op)&&(s(pb)||Sb(t))&&!s(ri),universal:s(mb),device:(s(op)||s(fb)||s(pb)||s(mb)||Sb(t))&&!s(ri)},amazon:{phone:s(Js),tablet:!s(Js)&&s(ec),device:s(Js)||s(ec)},android:{phone:!s(ri)&&s(Js)||!s(ri)&&s(np),tablet:!s(ri)&&!s(Js)&&!s(np)&&(s(ec)||s(gb)),device:!s(ri)&&(s(Js)||s(ec)||s(np)||s(gb))||s(/\bokhttp\b/i)},windows:{phone:s(ri),tablet:s(xb),device:s(ri)||s(xb)},other:{blackberry:s(yb),blackberry10:s(_b),opera:s(bb),firefox:s(Tb),chrome:s(vb),device:s(yb)||s(_b)||s(bb)||s(Tb)||s(vb)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var op,fb,pb,mb,np,gb,Js,ec,ri,xb,yb,_b,bb,vb,Tb,Sb,ap=x(()=>{op=/iPhone/i,fb=/iPod/i,pb=/iPad/i,mb=/\biOS-universal(?:.+)Mac\b/i,np=/\bAndroid(?:.+)Mobile\b/i,gb=/Android/i,Js=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ec=/Silk/i,ri=/Windows Phone/i,xb=/\bWindows(?:.+)ARM\b/i,yb=/BlackBerry/i,_b=/BB10/i,bb=/Opera Mini/i,vb=/\b(CriOS|Chrome)(?:.+)Mobile/i,Tb=/Mobile(?:.+)Firefox\b/i,Sb=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var lp=x(()=>{ap();ap()});var $B,wb,Eb=x(()=>{lp();$B=Ei.default??Ei,wb=$B(globalThis.navigator)});var XB,rc,jB,YB,Ab,Pb,qB,KB,ZB,hp,Rb,Mb=x(()=>{tc();F();Eb();Hf();XB=9,rc=100,jB=0,YB=0,Ab=2,Pb=1,qB=-1e3,KB=-1e3,ZB=2,hp=class Cb{constructor(t,e=wb){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${Pb}px`,t.style.height=`${Pb}px`,t.style.position="absolute",t.style.top=`${qB}px`,t.style.left=`${KB}px`,t.style.zIndex=ZB.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${rc}px`,this._div.style.height=`${rc}px`,this._div.style.position="absolute",this._div.style.top=`${jB}px`,this._div.style.left=`${YB}px`,this._div.style.zIndex=Ab.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...Cb.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Wh(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i<this._children.length;i++){let s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,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:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
6
+ Deprecated since v${r}`),console.warn(i))),E_[t]=!0}var E_,rt,A_,Wt=x(()=>{"use strict";E_={},rt="8.0.0",A_="8.3.4"});var Qi,Nf=x(()=>{"use strict";Qi=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 Hf,it,Be=x(()=>{Nf();Hf=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 Qi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},it=new Hf});var P_,C_=x(()=>{Wt();P_={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){j("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Wh(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var Vf=x(()=>{"use strict"});var R_,M_=x(()=>{Vf();Wt();R_={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Wh(this.children,r,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||j(rt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var I_,B_=x(()=>{"use strict";I_={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ti,zh=x(()=>{"use strict";ti=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 Wf,$h,F_=x(()=>{F();Be();Wf=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let i=this._tests[e];if(i.test(t))return it.get(i.maskClass,t)}return t}returnMaskEffect(t){it.return(t)}},$h=new Wf;H.handleByList(T.MaskEffect,$h._effectClasses)});var k_,U_=x(()=>{zh();F_();k_={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),$h.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=$h.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new ti);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ti),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var G_,O_=x(()=>{Wt();G_={label:null,get name(){return j(rt,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){j(rt,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var Xh,tt,he=x(()=>{ar();Xh=[new dt,new dt,new dt,new dt],tt=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,h=i*(1-s),c=i-h,u=a-h,d=a+o+h,f=l-h,p=l+n+h,m=a+c,g=a+o-c,_=l+c,b=l+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<g&&e>_&&e<b)}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Xh[0].set(t.left,t.top),l=Xh[1].set(t.left,t.bottom),h=Xh[2].set(t.right,t.top),c=Xh[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*c.x+f*c.y)return!1;let b=u*(a.y-h.y),y=u*(h.x-a.x),w=b*i+y*o,E=b*s+y*o,v=b*i+y*n,S=b*s+y*n;return!(Math.max(w,E,v,S)<=b*a.x+y*a.y||Math.min(w,E,v,S)>=b*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var L_,At,Ve=x(()=>{mt();he();L_=new G,At=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=L_,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new tt);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=L_,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=n*t+l*e+c,_=a*t+h*e+u;g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*i+l*e+c,_=a*i+h*e+u,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*t+l*s+c,_=a*t+h*s+u,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),g=n*i+l*s+c,_=a*i+h*s+u,g<d&&(d=g),_<f&&(f=_),g>p&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:h,tx:c,ty:u}=t,d=n*e+l*i+c,f=a*e+h*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+c,f=a*s+h*i+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+l*o+c,f=a*e+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+c,f=a*s+h*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=e;m<i;m+=2){let g=t[m],_=t[m+1],b=h*g+u*_+f,y=c*g+d*_+p;o=b<o?b:o,n=y<n?y:n,a=b>a?b:a,l=y>l?y: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 ie,Ke,Ji=x(()=>{mt();Nf();Ve();ie=new Qi(G),Ke=new Qi(At)});var DB,D_,N_=x(()=>{mt();Ve();Ji();DB=new G,D_={getFastGlobalBounds(r,t){t||(t=new At),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ke.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(r,i,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(DB).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ke.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ke.return(i))}}});function js(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=ie.get().identity(),i=jh(r,s)):i=G.IDENTITY,H_(r,e,i,t),s&&ie.return(s),e.isValid||e.set(0,0,0,0),e}function H_(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ie.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ke.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)H_(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,G.IDENTITY),Ke.return(t)}i||ie.return(s)}function jh(r,t){let e=r.parent;return e&&(jh(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var kn=x(()=>{mt();Ji()});function Yh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=i*n/255|0,c=s*a/255|0;return(l<<16)+(h<<8)+c}var zf=x(()=>{"use strict"});function Ys(r,t){return r===V_?t:t===V_?r:Yh(r,t)}var V_,$f=x(()=>{zf();V_=16777215});function Un(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var W_,z_=x(()=>{kn();Ji();$f();W_={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=jh(this,ie.get().identity());return r.appendFrom(this.localTransform,e),ie.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Un(this.renderGroup.worldColor):this.parentRenderGroup?Un(Ys(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Ys(t,e.localColor),e=e.parent;return Un(t)}}});function V(...r){Xf!==$_&&(Xf++,Xf===$_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Xf,$_,Pt=x(()=>{"use strict";Xf=0,$_=500});function qs(r,t,e){return t.clear(),e||(e=G.IDENTITY),X_(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function X_(r,t,e,i,s){let o;if(s)o=ie.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ie.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ke.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let h=0;h<l.length;h++)X_(l[h],t,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,i);n.addBounds(t,G.IDENTITY),Ke.return(t)}ie.return(o)}var qh=x(()=>{mt();Ji()});function jf(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&jf(s,t)}return t.didChange}var j_=x(()=>{"use strict"});var NB,Y_,q_=x(()=>{mt();Ve();kn();qh();j_();NB=new G,Y_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new At});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),jf(this,r),r.didChange&&qs(this,r.localBounds,NB),r.localBounds},getBounds(r,t){return js(this,r,t||new At)}}});var K_,Z_=x(()=>{"use strict";K_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function HB(r,t){return r._zIndex-t._zIndex}var Q_,J_=x(()=>{"use strict";Q_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(HB))}}});var tb,eb=x(()=>{ar();Ji();tb={getGlobalPosition(r=new dt,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ie.get(),e);return t=i.apply(r,t),ie.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ie.get(),i);return e=s.applyInverse(r,e),ie.return(s),e}}});var Ks,Yf=x(()=>{Se();Ks=class{constructor(){this.uid=ut("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 ei(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function qf(r){return!(r&r-1)&&!!r}var Gn=x(()=>{"use strict"});function Kh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Kf=x(()=>{"use strict"});function VB(r){let t=rb[r];return t===void 0&&(rb[r]=ut("resource")),t}var rb,ib,Zh,Zf=x(()=>{Ae();Se();Wt();rb=Object.create(null);ib=class sb extends It{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...sb.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){j(rt,"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=VB(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};ib.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Zh=ib});var ob,wt,We=x(()=>{Ae();Gn();Kf();Se();Zf();ob=class nb extends It{constructor(t={}){super(),this.options=t,this.uid=ut("textureSource"),this._resourceType="textureSource",this._resourceId=ut("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...nb.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 Zh(Kh(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ut("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=ut("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=qf(this.pixelWidth)&&qf(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};ob.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};wt=ob});function WB(){for(let r=0;r<16;r++){let t=[];Qf.push(t);for(let e=0;e<16;e++){let i=Qh(ts[r]*ts[e]+rs[r]*es[e]),s=Qh(es[r]*ts[e]+is[r]*es[e]),o=Qh(ts[r]*rs[e]+rs[r]*is[e]),n=Qh(es[r]*rs[e]+is[r]*is[e]);for(let a=0;a<16;a++)if(ts[a]===i&&es[a]===s&&rs[a]===o&&is[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new G;t.set(ts[r],es[r],rs[r],is[r],0,0),ab.push(t)}}var ts,es,rs,is,Qf,ab,Qh,Dt,lb=x(()=>{mt();ts=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],es=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],rs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],is=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Qf=[],ab=[],Qh=Math.sign;WB();Dt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>ts[r],uY:r=>es[r],vX:r=>rs[r],vY:r=>is[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Qf[r][t],sub:(r,t)=>Qf[r][Dt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Dt.S:Dt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Dt.E:Dt.W:t>0?r>0?Dt.SE:Dt.SW:r>0?Dt.NE:Dt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=ab[Dt.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var Jf,hb=x(()=>{"use strict";Jf=()=>{}});var ss,tp=x(()=>{F();We();ss=class extends wt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};ss.extension=T.TextureSource});var cb,Zs,ep=x(()=>{mt();cb=new G,Zs=class{constructor(t,e){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let i=t.orig,s=t.trim;s&&(cb.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(cb));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,!0}}});var I,Tt=x(()=>{Ae();lb();he();Se();Wt();hb();tp();We();ep();I=class extends It{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=ut("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new tt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new wt,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=h||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Zs(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,h=this.rotate;if(h){let c=a/2,u=l/2,d=o+c,f=n+u;h=Dt.add(h,Dt.NW),t.x0=d+c*Dt.uX(h),t.y0=f+u*Dt.uY(h),h=Dt.add(h,2),t.x1=d+c*Dt.uX(h),t.y1=f+u*Dt.uY(h),h=Dt.add(h,2),t.x2=d+c*Dt.uX(h),t.y2=f+u*Dt.uY(h),h=Dt.add(h,2),t.x3=d+c*Dt.uX(h),t.y3=f+u*Dt.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=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return j(rt,"Texture.baseTexture is now Texture.source"),this._source}};I.EMPTY=new I({label:"EMPTY",source:new wt({label:"EMPTY"})});I.EMPTY.destroy=Jf;I.WHITE=new I({source:new ss({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});I.WHITE.destroy=Jf});var zB,rp,zt,Si=x(()=>{Gn();We();Tt();zB=0,rp=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new wt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new I({source:s,label:`texturePool_${zB++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ei(o),n=ei(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=i,l.source.width=o/i,l.source.height=n/i,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=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},zt=new rp});var Jh,ub=x(()=>{mt();Yf();Si();Jh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Ks,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(zt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),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 G),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 db(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var fb=x(()=>{"use strict"});var ip,sp,op,Qs,On,os,nt,br=x(()=>{Ae();ve();v_();F();mt();Of();Vh();Se();Wt();Be();C_();M_();B_();U_();O_();N_();z_();q_();Z_();J_();eb();ub();fb();ip=new Te(null),sp=new Te(null),op=new Te(null,1,1),Qs=1,On=2,os=4,nt=class r extends It{constructor(t={}){super(),this.uid=ut("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Te(this,0,0),this._scale=op,this._pivot=sp,this._skew=ip,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=[],db(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){j("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),H.mixin(r,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||j(rt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=it.get(Jh,this),this.groupTransform=G.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),it.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 G),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*S_}set angle(t){this.rotation=t*w_}get pivot(){return this._pivot===sp&&(this._pivot=new Te(this,0,0)),this._pivot}set pivot(t){this._pivot===sp&&(this._pivot=new Te(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ip&&(this._skew=new Te(this,0,0)),this._skew}set skew(t){this._skew===ip&&(this._skew=new Te(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===op&&(this._scale=new Te(this,1,1)),this._scale}set scale(t){this._scale===op&&(this._scale=new Te(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,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|=Qs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=ot.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Qs,this._onUpdate())}get tint(){return Un(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=On,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=os,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=os,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|=os,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};H.mixin(nt,R_,D_,tb,K_,Y_,k_,G_,Q_,b_,P_,W_,I_)});var wi,tc=x(()=>{ar();wi=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function $B(r){return function(t){return t.test(r)}}function Ei(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=$B(e),o={apple:{phone:s(np)&&!s(ri),ipod:s(pb),tablet:!s(np)&&(s(mb)||wb(t))&&!s(ri),universal:s(gb),device:(s(np)||s(pb)||s(mb)||s(gb)||wb(t))&&!s(ri)},amazon:{phone:s(Js),tablet:!s(Js)&&s(ec),device:s(Js)||s(ec)},android:{phone:!s(ri)&&s(Js)||!s(ri)&&s(ap),tablet:!s(ri)&&!s(Js)&&!s(ap)&&(s(ec)||s(xb)),device:!s(ri)&&(s(Js)||s(ec)||s(ap)||s(xb))||s(/\bokhttp\b/i)},windows:{phone:s(ri),tablet:s(yb),device:s(ri)||s(yb)},other:{blackberry:s(_b),blackberry10:s(bb),opera:s(vb),firefox:s(Sb),chrome:s(Tb),device:s(_b)||s(bb)||s(vb)||s(Sb)||s(Tb)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var np,pb,mb,gb,ap,xb,Js,ec,ri,yb,_b,bb,vb,Tb,Sb,wb,lp=x(()=>{np=/iPhone/i,pb=/iPod/i,mb=/iPad/i,gb=/\biOS-universal(?:.+)Mac\b/i,ap=/\bAndroid(?:.+)Mobile\b/i,xb=/Android/i,Js=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ec=/Silk/i,ri=/Windows Phone/i,yb=/\bWindows(?:.+)ARM\b/i,_b=/BlackBerry/i,bb=/BB10/i,vb=/Opera Mini/i,Tb=/\b(CriOS|Chrome)(?:.+)Mobile/i,Sb=/Mobile(?:.+)Firefox\b/i,wb=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var hp=x(()=>{lp();lp()});var XB,Eb,Ab=x(()=>{hp();XB=Ei.default??Ei,Eb=XB(globalThis.navigator)});var jB,rc,YB,qB,Pb,Cb,KB,ZB,QB,cp,Mb,Ib=x(()=>{tc();F();Ab();Vf();jB=9,rc=100,YB=0,qB=0,Pb=2,Cb=1,KB=-1e3,ZB=-1e3,QB=2,cp=class Rb{constructor(t,e=Eb){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${Cb}px`,t.style.height=`${Cb}px`,t.style.position="absolute",t.style.top=`${KB}px`,t.style.left=`${ZB}px`,t.style.zIndex=QB.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${rc}px`,this._div.style.height=`${rc}px`,this._div.style.position="absolute",this._div.style.top=`${YB}px`,this._div.style.left=`${qB}px`,this._div.style.zIndex=Pb.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...Rb.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Wh(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i<this._children.length;i++){let s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,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:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
7
7
  color: transparent;
8
8
  pointer-events: none;
9
9
  padding: 0;
@@ -16,9 +16,9 @@ Deprecated since v${r}`),console.warn(i))),w_[t]=!0}var w_,rt,E_,Wt=x(()=>{"use
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=`${rc}px`,e.style.height=`${rc}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Ab.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new wi(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==XB||!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()}};hp.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"accessibility"};hp.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Rb=hp});var Ib,Bb=x(()=>{"use strict";Ib={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var Fb=x(()=>{F();br();Mb();Bb();H.add(Rb);H.mixin(nt,Ib)});var Ln,kb=x(()=>{F();Ln=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Ln.extension=T.Application});var Ir,Dn=x(()=>{"use strict";Ir=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Ir||{})});var to,Ub=x(()=>{"use strict";to=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var Gb,ce,eo=x(()=>{Dn();Ub();Gb=class Ze{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new to(null,null,1/0),this.deltaMS=1/Ze.targetFPMS,this.elapsedMS=1/Ze.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Ir.NORMAL){return this._addListener(new to(t,e,i))}addOnce(t,e,i=Ir.NORMAL){return this._addListener(new to(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ze.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Ze.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ze._shared){let t=Ze._shared=new Ze;t.autoStart=!0,t._protected=!0}return Ze._shared}static get system(){if(!Ze._system){let t=Ze._system=new Ze;t.autoStart=!0,t._protected=!0}return Ze._system}};Gb.targetFPMS=.06;ce=Gb});var Nn,Ob=x(()=>{F();Dn();eo();Nn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ir.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ce.shared:new ce,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nn.extension=T.Application});var cp=x(()=>{F();kb();Ob();H.add(Ln);H.add(Nn)});var up,Br,dp=x(()=>{Dn();eo();up=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(ce.system.add(this._tickerUpdate,this,Ir.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ce.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Br=new up});var ii,ic=x(()=>{ar();tc();ii=class extends wi{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,l,h,c,u,d,f,p,g){throw new Error("Method not implemented.")}}});var Fe,fp=x(()=>{ic();Fe=class extends ii{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Fr,pp=x(()=>{ic();Fr=class extends ii{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Fr.DOM_DELTA_PIXEL=0;Fr.DOM_DELTA_LINE=1;Fr.DOM_DELTA_PAGE=2});var QB,JB,Hn,sc,Lb=x(()=>{Ae();ar();Pt();dp();ic();fp();pp();QB=2048,JB=new dt,Hn=new dt,sc=class{constructor(t){this.dispatch=new It,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else V(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Br.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,JB.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i<QB&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Br.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,o,n||o(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let 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,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Br.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,h=i;for(let c=l.length-1;c>=0;c--){let u=l[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,h,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Hn),!t.hitArea.contains(Hn.x,Hn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let s=t.effects[i];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Hn),t.containsPoint(Hn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let i=`on${e}`;t.currentTarget[i]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(h)}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let 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(i)}mapPointerUpOutside(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Fr)){V("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let s=this.allocateEvent(Fe);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Fr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(Fe);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Fe&&e instanceof Fe&&(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 ii&&e instanceof ii&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,o=i.length;s<o&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}});var tF,eF,gp,oc,xp=x(()=>{F();Lb();dp();fp();pp();tF=1,eF={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},gp=class mp{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new sc(null),Br.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Fe(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...mp.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,mp._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){let o=e[i],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Br.pointerMoved();let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Br.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Br.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Br.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,i){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches[i];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=tF),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=eF[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}};gp.extension={name:"events",type:[T.WebGLSystem,T.CanvasSystem,T.WebGPUSystem],priority:-1};gp.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};oc=gp});var Db,Nb=x(()=>{xp();tc();Db={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??oc.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,n)}),o?l.once(r,a,n):l.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof wi))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var Hb=x(()=>{F();br();xp();Nb();H.add(oc);H.mixin(nt,Db)});var Vn,Vb=x(()=>{F();Vn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let i=0;i<t.length;i++){let s=t[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(i,1),i--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,l=s.width*a.x,h=s.height*a.y;o.style.transformOrigin=`${l}px ${h}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-l}, ${n.ty-h})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};Vn.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"dom"}});var Ai,nc=x(()=>{Ve();br();Ai=class extends nt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new At(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let h=0;h<l;h++)a[h].collectRenderables(t,e,i)}}});var Wb=x(()=>{F();Vb();H.add(Vn)});var ke,Pi=x(()=>{"use strict";ke=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ke||{})});var zb,$b=x(()=>{"use strict";zb={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var Xb,Y,Ft=x(()=>{$b();Xb=zb,Y={get(){return Xb},set(r){Xb=r}}});function vr(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Wn(r){return r.split("?")[0].split("#")[0]}function rF(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function iF(r,t,e){return r.replace(new RegExp(rF(t),"g"),e)}function sF(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a<r.length)n=r.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ue,os=x(()=>{Ft();ue={toPosix(r){return iF(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){vr(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(vr(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Wn(this.toPosix(t??Y.get().getBaseUrl())),s=Wn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ue.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(vr(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=sF(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return vr(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){let i=r[e];if(vr(i),i.length>0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(vr(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){vr(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){vr(r),t&&vr(t),r=Wn(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){vr(r),r=Wn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){vr(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Wn(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,l=-1,h=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}l===-1&&(h=!1,l=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||l===-1||u===0||u===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,l)):(t.name=r.slice(a,n),t.base=r.slice(a,l)),t.ext=r.slice(n,l)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ue,zn=x(()=>{"use strict";Ue=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function jb(r,t,e,i,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?jb(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function Yb(r){let t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),jb(r,s,0,e,i)}else i.push(r);return i}var qb=x(()=>{"use strict"});var ns,ac=x(()=>{"use strict";ns=r=>!Array.isArray(r)});function oF(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Qe,ro=x(()=>{Pt();os();zn();qb();ac();Qe=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Ue(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&V("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let i=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);i.push(h),l=[a,h]}else{let h=a.map(c=>this._createBundleAssetId(t,c));i.push(...h),l=[...a,...h]}this.add({...o,alias:l,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&V(`[Resolver] already has key: ${o} overwriting`)},Ue(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,c=Ue(n).map(f=>typeof f=="string"?Yb(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(p=>{let g={};if(typeof p!="object"){g.src=p;for(let m=0;m<this._parsers.length;m++){let _=this._parsers[m];if(_.test(p)){g=_.parse(p);break}}}else a=p.data??a,l=p.format??l,h=p.loadParser??h,g={...g,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:l,loadParser:h}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=ns(t);t=Ue(t);let i={};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}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=ns(t);t=Ue(t);let i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(c=>c[a]?c[a]===l:!1);h.length&&(o=h)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ue.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??oF(t.src),t}};Qe.RETINA_PREFIX=/@([0-9\.]+)x/});var $n,yp=x(()=>{"use strict";$n=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var Kb,Ci,_p=x(()=>{he();Tt();Kb=class Xn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof I?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Xn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=Xn.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new tt(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?a=new tt(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 tt(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new tt(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new I({source:this.textureSource,frame:a,orig:c,trim: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 i=0;i<t[e].length;i++){let s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Xn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Xn.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Kb.BATCH_SIZE=1e3;Ci=Kb});function Zb(r,t,e){let i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=ue.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=Zb([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var nF,Qb,Jb=x(()=>{Pi();ro();yp();F();Tt();os();_p();nF=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Qb={extension:T.Asset,cache:{test:r=>r instanceof Ci,getCacheableAssets:(r,t)=>Zb(r,t,!1)},resolver:{extension:{type:T.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&nF.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Qe.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:T.LoadParser,priority:ke.Normal,name:"spritesheetLoader"},async testParse(r,t){return ue.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=ue.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof I)a=i;else{let c=$n(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let l=new Ci(a.source,r);await l.parse();let h=r?.meta?.related_multi_packs;if(Array.isArray(h)){let c=[];for(let d of h){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=$n(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);l.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var lc=x(()=>{F();Jb();H.add(Qb)});function hc(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var bp=x(()=>{"use strict"});var kt,jn=x(()=>{Vh();Tt();bp();Wt();nc();kt=class r extends Ai{constructor(t=I.EMPTY){t instanceof I&&(t={texture:t});let{texture:e=I.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Te({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof I?new r(t):new r(I.from(t,e))}set texture(t){t||(t=I.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return hc(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return j("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function cc(r,t,e){let i=aF;r.measurable=!0,js(r,e,i),t.addBoundsMask(i),r.measurable=!1}var aF,vp=x(()=>{Ve();kn();aF=new At});function uc(r,t,e){let i=Ke.get();r.measurable=!0;let s=ie.get().identity(),o=tv(r,e,s);qs(r,i,o),r.measurable=!1,t.addBoundsMask(i),ie.return(s),Ke.return(i)}function tv(r,t,e){return r?(r!==t&&(tv(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(V("Mask bounds, renderable is not inside the root container"),e)}var Tp=x(()=>{qh();Qi();Pt()});var Yn,ev=x(()=>{F();jn();vp();Tp();Yn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof kt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||cc(this.mask,t,e)}addLocalBounds(t,e){uc(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof kt}};Yn.extension=T.MaskEffect});var qn,rv=x(()=>{F();qn=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"}};qn.extension=T.MaskEffect});var Kn,iv=x(()=>{F();br();vp();Tp();Kn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){cc(this.mask,t,e)}addLocalBounds(t,e){uc(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof nt}};Kn.extension=T.MaskEffect});var Pe,io=x(()=>{Ft();F();We();Pe=class extends wt{constructor(t){t.resource||(t.resource=Y.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Pe.extension=T.TextureSource});var ze,so=x(()=>{Ft();F();Pt();We();ze=class extends wt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=Y.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,V("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};ze.extension=T.TextureSource});async function dc(){return Sp??(Sp=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Sp}var Sp,wp=x(()=>{"use strict"});var fc,oo,Ep=x(()=>{F();eo();wp();We();fc=class sv extends wt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...sv.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=ce.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await dc(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ce.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ce.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ce.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};fc.extension=T.TextureSource;fc.defaultOptions={...wt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};fc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};oo=fc});var Ap,St,Ri=x(()=>{Pt();zn();Ap=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||V(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Ue(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(l=>{o.set(l,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.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&&V("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(t){if(!this._cacheMap.has(t)){V(`[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}},St=new Ap});function ov(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<Pp.length;s++){let o=Pp[s];if(o.test(e))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function nv(r={},t=!1){let e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&St.has(i))return St.get(i);let o=new I({source:ov(s)});return o.on("destroy",()=>{St.has(i)&&St.remove(i)}),t||St.set(i,o),o}function av(r,t=!1){return typeof r=="string"?St.get(r):r instanceof wt?new I({source:r}):nv(r,t)}var Pp,Cp=x(()=>{Ri();F();We();Tt();Pp=[];H.handleByList(T.TextureSource,Pp);I.from=av;wt.from=ov});var pc=x(()=>{F();ev();rv();iv();Jf();io();so();Ep();Cp();H.add(Yn,qn,Kn,oo,ze,Pe,is)});var xe,Mi=x(()=>{"use strict";xe=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function gc(){return(!mc||mc?.isContextLost())&&(mc=Y.get().createCanvas().getContext("webgl",{})),mc}var mc,Rp=x(()=>{Ft()});function hF(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
20
- else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function lv(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let i=lF.replace(/%forloop%/gi,hF(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}var lF,hv=x(()=>{"use strict";lF=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `)});function lr(){if(no)return no;let r=gc();return no=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),no=lv(no,r),r.getExtension("WEBGL_lose_context")?.loseContext(),no}var no,as=x(()=>{Rp();hv();no=null});function ao(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return cv[e]||cF(r,t,e)}function cF(r,t,e){let i={},s=0;Mp||(Mp=lr());for(let n=0;n<Mp;n++){let a=n<t?r[n]:I.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new xe(i);return cv[e]=o,o}var cv,Mp,xc=x(()=>{Mi();Tt();as();cv={};Mp=0});var kr,Ip=x(()=>{"use strict";kr=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Zn(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var Bp=x(()=>{"use strict"});var uv,Gt,ls=x(()=>{"use strict";uv={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Gt=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Gt||{})});function si(r,t){return t.alphaMode==="no-premultiply-alpha"&&uv[r]||r}var Qn=x(()=>{ls()});var yc,dv=x(()=>{"use strict";yc=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 fv(){return kp>0?mv[--kp]:new Fp}function pv(r){mv[kp++]=r}var Fp,mv,kp,Jn,gv,xv,yv=x(()=>{Se();Ip();Bp();Qn();as();dv();Fp=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new yc,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},mv=[],kp=0;Jn=0,gv=class _c{constructor(t={}){this.uid=ut("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],_c.defaultOptions.maxTextures=_c.defaultOptions.maxTextures??lr(),t={..._c.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new kr(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)pv(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let i=fv(),s=i.textures;s.clear();let o=e[this.elementStart],n=si(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let m=e[g];e[g]=null;let b=m.texture._source,y=si(m.blendMode,b),w=n!==y||a!==m.topology;if(b._batchTick===Jn&&!w){m._textureId=b._textureBindLocation,u+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=i;continue}b._batchTick=Jn,(s.count>=p||w)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=y,a=m.topology,i=fv(),s=i.textures,s.clear(),++Jn),m._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,m._batch=i,u+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++Jn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,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=i,++Jn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),i=new kr(e);Zn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Zn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[i++]=s+o[h+a]-l}destroy(){for(let t=0;t<this.batches.length;t++)pv(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}};gv.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};xv=gv});var ht,oi=x(()=>{"use strict";ht=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(ht||{})});var Yt,Ii=x(()=>{Ae();Se();oi();Yt=class extends It{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=ut("buffer"),this._resourceType="buffer",this._resourceId=ut("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ht.STATIC)}set static(t){t?this.descriptor.usage|=ht.STATIC:this.descriptor.usage&=~ht.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ut("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Up(r,t){if(!(r instanceof Yt)){let e=t?ht.INDEX:ht.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=ht.INDEX|ht.COPY_DST):(r=new Float32Array(r),e=ht.VERTEX|ht.COPY_DST)),r=new Yt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}var _v=x(()=>{Ii();oi()});function bv(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||2*4)/h;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>l&&(l=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var vv=x(()=>{"use strict"});function uF(r){return(r instanceof Yt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Up(r.buffer,!1),r}var hr,lo=x(()=>{Ae();Ve();Se();Ii();_v();vv();hr=class extends It{constructor(t={}){super(),this.uid=ut("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new At,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let i=uF(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=Up(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,bv(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var dF,fF,bc,Tv=x(()=>{Ii();oi();lo();dF=new Float32Array(1),fF=new Uint32Array(1),bc=class extends hr{constructor(){let e=new Yt({data:dF,label:"attribute-batch-buffer",usage:ht.VERTEX|ht.COPY_DST,shrinkToFit:!1}),i=new Yt({data:fF,label:"index-batch-buffer",usage:ht.INDEX|ht.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function ni(r,t){let e=Sv[r];return e===void 0&&(Gp[t]===void 0&&(Gp[t]=1),Sv[r]=e=Gp[t]++),e}var Gp,Sv,ta=x(()=>{"use strict";Gp=Object.create(null),Sv=Object.create(null)});function wv(){if(!vc){vc="mediump";let r=gc();r&&r.getShaderPrecisionFormat&&(vc=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return vc}var vc,Ev=x(()=>{Rp()});function Av(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${rc}px`,e.style.height=`${rc}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Pb.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new wi(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==jB||!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()}};cp.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"accessibility"};cp.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Mb=cp});var Bb,Fb=x(()=>{"use strict";Bb={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var kb=x(()=>{F();br();Ib();Fb();H.add(Mb);H.mixin(nt,Bb)});var Ln,Ub=x(()=>{F();Ln=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Ln.extension=T.Application});var Ir,Dn=x(()=>{"use strict";Ir=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Ir||{})});var to,Gb=x(()=>{"use strict";to=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var Ob,ce,eo=x(()=>{Dn();Gb();Ob=class Ze{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new to(null,null,1/0),this.deltaMS=1/Ze.targetFPMS,this.elapsedMS=1/Ze.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Ir.NORMAL){return this._addListener(new to(t,e,i))}addOnce(t,e,i=Ir.NORMAL){return this._addListener(new to(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ze.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Ze.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ze._shared){let t=Ze._shared=new Ze;t.autoStart=!0,t._protected=!0}return Ze._shared}static get system(){if(!Ze._system){let t=Ze._system=new Ze;t.autoStart=!0,t._protected=!0}return Ze._system}};Ob.targetFPMS=.06;ce=Ob});var Nn,Lb=x(()=>{F();Dn();eo();Nn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ir.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ce.shared:new ce,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nn.extension=T.Application});var up=x(()=>{F();Ub();Lb();H.add(Ln);H.add(Nn)});var dp,Br,fp=x(()=>{Dn();eo();dp=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(ce.system.add(this._tickerUpdate,this,Ir.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ce.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Br=new dp});var ii,ic=x(()=>{ar();tc();ii=class extends wi{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,l,h,c,u,d,f,p,m){throw new Error("Method not implemented.")}}});var Fe,pp=x(()=>{ic();Fe=class extends ii{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Fr,mp=x(()=>{ic();Fr=class extends ii{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Fr.DOM_DELTA_PIXEL=0;Fr.DOM_DELTA_LINE=1;Fr.DOM_DELTA_PAGE=2});var JB,tF,Hn,sc,Db=x(()=>{Ae();ar();Pt();fp();ic();pp();mp();JB=2048,tF=new dt,Hn=new dt,sc=class{constructor(t){this.dispatch=new It,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else V(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Br.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,tF.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i<JB&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Br.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,o,n||o(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let 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,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Br.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,h=i;for(let c=l.length-1;c>=0;c--){let u=l[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,h,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Hn),!t.hitArea.contains(Hn.x,Hn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let s=t.effects[i];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Hn),t.containsPoint(Hn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let i=`on${e}`;t.currentTarget[i]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(h)}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let 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(i)}mapPointerUpOutside(t){if(!(t instanceof Fe)){V("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Fr)){V("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let s=this.allocateEvent(Fe);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Fr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(Fe);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Fe&&e instanceof Fe&&(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 ii&&e instanceof ii&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,o=i.length;s<o&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}});var eF,rF,xp,oc,yp=x(()=>{F();Db();fp();pp();mp();eF=1,rF={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},xp=class gp{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new sc(null),Br.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Fe(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...gp.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,gp._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){let o=e[i],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Br.pointerMoved();let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Br.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Br.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Br.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,i){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches[i];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=eF),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=rF[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}};xp.extension={name:"events",type:[T.WebGLSystem,T.CanvasSystem,T.WebGPUSystem],priority:-1};xp.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};oc=xp});var Nb,Hb=x(()=>{yp();tc();Nb={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??oc.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,n)}),o?l.once(r,a,n):l.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof wi))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var Vb=x(()=>{F();br();yp();Hb();H.add(oc);H.mixin(nt,Nb)});var Vn,Wb=x(()=>{F();Vn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let i=0;i<t.length;i++){let s=t[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(i,1),i--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,l=s.width*a.x,h=s.height*a.y;o.style.transformOrigin=`${l}px ${h}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-l}, ${n.ty-h})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};Vn.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"dom"}});var Ai,nc=x(()=>{Ve();br();Ai=class extends nt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new At(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let h=0;h<l;h++)a[h].collectRenderables(t,e,i)}}});var zb=x(()=>{F();Wb();H.add(Vn)});var ke,Pi=x(()=>{"use strict";ke=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ke||{})});var $b,Xb=x(()=>{"use strict";$b={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var jb,Y,Ft=x(()=>{Xb();jb=$b,Y={get(){return jb},set(r){jb=r}}});function vr(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Wn(r){return r.split("?")[0].split("#")[0]}function iF(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sF(r,t,e){return r.replace(new RegExp(iF(t),"g"),e)}function oF(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a<r.length)n=r.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ue,ns=x(()=>{Ft();ue={toPosix(r){return sF(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){vr(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(vr(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Wn(this.toPosix(t??Y.get().getBaseUrl())),s=Wn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ue.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(vr(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=oF(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return vr(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){let i=r[e];if(vr(i),i.length>0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(vr(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){vr(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){vr(r),t&&vr(t),r=Wn(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){vr(r),r=Wn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){vr(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Wn(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,l=-1,h=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}l===-1&&(h=!1,l=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||l===-1||u===0||u===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,l)):(t.name=r.slice(a,n),t.base=r.slice(a,l)),t.ext=r.slice(n,l)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ue,zn=x(()=>{"use strict";Ue=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function Yb(r,t,e,i,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Yb(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function qb(r){let t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Yb(r,s,0,e,i)}else i.push(r);return i}var Kb=x(()=>{"use strict"});var as,ac=x(()=>{"use strict";as=r=>!Array.isArray(r)});function nF(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Qe,ro=x(()=>{Pt();ns();zn();Kb();ac();Qe=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Ue(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&V("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let i=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);i.push(h),l=[a,h]}else{let h=a.map(c=>this._createBundleAssetId(t,c));i.push(...h),l=[...a,...h]}this.add({...o,alias:l,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&V(`[Resolver] already has key: ${o} overwriting`)},Ue(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,c=Ue(n).map(f=>typeof f=="string"?qb(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g<this._parsers.length;g++){let _=this._parsers[g];if(_.test(p)){m=_.parse(p);break}}}else a=p.data??a,l=p.format??l,h=p.loadParser??h,m={...m,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:l,loadParser:h}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=as(t);t=Ue(t);let i={};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}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=as(t);t=Ue(t);let i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(c=>c[a]?c[a]===l:!1);h.length&&(o=h)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ue.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??nF(t.src),t}};Qe.RETINA_PREFIX=/@([0-9\.]+)x/});var $n,_p=x(()=>{"use strict";$n=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var Zb,Ci,bp=x(()=>{he();Tt();Zb=class Xn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof I?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Xn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=Xn.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new tt(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?a=new tt(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 tt(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new tt(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new I({source:this.textureSource,frame:a,orig:c,trim: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 i=0;i<t[e].length;i++){let s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Xn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Xn.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Zb.BATCH_SIZE=1e3;Ci=Zb});function Qb(r,t,e){let i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=ue.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=Qb([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var aF,Jb,tv=x(()=>{Pi();ro();_p();F();Tt();ns();bp();aF=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Jb={extension:T.Asset,cache:{test:r=>r instanceof Ci,getCacheableAssets:(r,t)=>Qb(r,t,!1)},resolver:{extension:{type:T.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&aF.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Qe.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:T.LoadParser,priority:ke.Normal,name:"spritesheetLoader"},async testParse(r,t){return ue.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=ue.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof I)a=i;else{let c=$n(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let l=new Ci(a.source,r);await l.parse();let h=r?.meta?.related_multi_packs;if(Array.isArray(h)){let c=[];for(let d of h){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=$n(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);l.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var lc=x(()=>{F();tv();H.add(Jb)});function hc(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var vp=x(()=>{"use strict"});var kt,jn=x(()=>{Vh();Tt();vp();Wt();nc();kt=class r extends Ai{constructor(t=I.EMPTY){t instanceof I&&(t={texture:t});let{texture:e=I.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Te({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof I?new r(t):new r(I.from(t,e))}set texture(t){t||(t=I.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return hc(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return j("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function cc(r,t,e){let i=lF;r.measurable=!0,js(r,e,i),t.addBoundsMask(i),r.measurable=!1}var lF,Tp=x(()=>{Ve();kn();lF=new At});function uc(r,t,e){let i=Ke.get();r.measurable=!0;let s=ie.get().identity(),o=ev(r,e,s);qs(r,i,o),r.measurable=!1,t.addBoundsMask(i),ie.return(s),Ke.return(i)}function ev(r,t,e){return r?(r!==t&&(ev(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(V("Mask bounds, renderable is not inside the root container"),e)}var Sp=x(()=>{qh();Ji();Pt()});var Yn,rv=x(()=>{F();jn();Tp();Sp();Yn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof kt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||cc(this.mask,t,e)}addLocalBounds(t,e){uc(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof kt}};Yn.extension=T.MaskEffect});var qn,iv=x(()=>{F();qn=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"}};qn.extension=T.MaskEffect});var Kn,sv=x(()=>{F();br();Tp();Sp();Kn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){cc(this.mask,t,e)}addLocalBounds(t,e){uc(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof nt}};Kn.extension=T.MaskEffect});var Pe,io=x(()=>{Ft();F();We();Pe=class extends wt{constructor(t){t.resource||(t.resource=Y.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Pe.extension=T.TextureSource});var ze,so=x(()=>{Ft();F();Pt();We();ze=class extends wt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=Y.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,V("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};ze.extension=T.TextureSource});async function dc(){return wp??(wp=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),wp}var wp,Ep=x(()=>{"use strict"});var fc,oo,Ap=x(()=>{F();eo();Ep();We();fc=class ov extends wt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ov.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=ce.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await dc(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ce.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ce.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ce.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};fc.extension=T.TextureSource;fc.defaultOptions={...wt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};fc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};oo=fc});var Pp,St,Ri=x(()=>{Pt();zn();Pp=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||V(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Ue(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(l=>{o.set(l,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.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&&V("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(t){if(!this._cacheMap.has(t)){V(`[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}},St=new Pp});function nv(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<Cp.length;s++){let o=Cp[s];if(o.test(e))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function av(r={},t=!1){let e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&St.has(i))return St.get(i);let o=new I({source:nv(s)});return o.on("destroy",()=>{St.has(i)&&St.remove(i)}),t||St.set(i,o),o}function lv(r,t=!1){return typeof r=="string"?St.get(r):r instanceof wt?new I({source:r}):av(r,t)}var Cp,Rp=x(()=>{Ri();F();We();Tt();Cp=[];H.handleByList(T.TextureSource,Cp);I.from=lv;wt.from=nv});var pc=x(()=>{F();rv();iv();sv();tp();io();so();Ap();Rp();H.add(Yn,qn,Kn,oo,ze,Pe,ss)});var xe,Mi=x(()=>{"use strict";xe=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function gc(){return(!mc||mc?.isContextLost())&&(mc=Y.get().createCanvas().getContext("webgl",{})),mc}var mc,Mp=x(()=>{Ft()});function cF(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
20
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function hv(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let i=hF.replace(/%forloop%/gi,cF(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}var hF,cv=x(()=>{"use strict";hF=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
+ `)});function lr(){if(no)return no;let r=gc();return no=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),no=hv(no,r),r.getExtension("WEBGL_lose_context")?.loseContext(),no}var no,ls=x(()=>{Mp();cv();no=null});function ao(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return uv[e]||uF(r,t,e)}function uF(r,t,e){let i={},s=0;Ip||(Ip=lr());for(let n=0;n<Ip;n++){let a=n<t?r[n]:I.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new xe(i);return uv[e]=o,o}var uv,Ip,xc=x(()=>{Mi();Tt();ls();uv={};Ip=0});var kr,Bp=x(()=>{"use strict";kr=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Zn(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var Fp=x(()=>{"use strict"});var dv,Gt,hs=x(()=>{"use strict";dv={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Gt=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Gt||{})});function si(r,t){return t.alphaMode==="no-premultiply-alpha"&&dv[r]||r}var Qn=x(()=>{hs()});var yc,fv=x(()=>{"use strict";yc=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 pv(){return Up>0?gv[--Up]:new kp}function mv(r){gv[Up++]=r}var kp,gv,Up,Jn,xv,yv,_v=x(()=>{Se();Bp();Fp();Qn();ls();fv();kp=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new yc,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},gv=[],Up=0;Jn=0,xv=class _c{constructor(t={}){this.uid=ut("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],_c.defaultOptions.maxTextures=_c.defaultOptions.maxTextures??lr(),t={..._c.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new kr(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)mv(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let i=pv(),s=i.textures;s.clear();let o=e[this.elementStart],n=si(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let g=e[m];e[m]=null;let b=g.texture._source,y=si(g.blendMode,b),w=n!==y||a!==g.topology;if(b._batchTick===Jn&&!w){g._textureId=b._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,l,h,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,l,h,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=i;continue}b._batchTick=Jn,(s.count>=p||w)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=y,a=g.topology,i=pv(),s=i.textures,s.clear(),++Jn),g._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,g._batch=i,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,l,h,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,l,h,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++Jn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,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=i,++Jn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),i=new kr(e);Zn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Zn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[i++]=s+o[h+a]-l}destroy(){for(let t=0;t<this.batches.length;t++)mv(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}};xv.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};yv=xv});var ht,oi=x(()=>{"use strict";ht=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(ht||{})});var Yt,Ii=x(()=>{Ae();Se();oi();Yt=class extends It{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=ut("buffer"),this._resourceType="buffer",this._resourceId=ut("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ht.STATIC)}set static(t){t?this.descriptor.usage|=ht.STATIC:this.descriptor.usage&=~ht.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ut("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Gp(r,t){if(!(r instanceof Yt)){let e=t?ht.INDEX:ht.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=ht.INDEX|ht.COPY_DST):(r=new Float32Array(r),e=ht.VERTEX|ht.COPY_DST)),r=new Yt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}var bv=x(()=>{Ii();oi()});function vv(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||2*4)/h;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>l&&(l=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var Tv=x(()=>{"use strict"});function dF(r){return(r instanceof Yt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Gp(r.buffer,!1),r}var hr,lo=x(()=>{Ae();Ve();Se();Ii();bv();Tv();hr=class extends It{constructor(t={}){super(),this.uid=ut("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new At,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let i=dF(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=Gp(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,vv(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var fF,pF,bc,Sv=x(()=>{Ii();oi();lo();fF=new Float32Array(1),pF=new Uint32Array(1),bc=class extends hr{constructor(){let e=new Yt({data:fF,label:"attribute-batch-buffer",usage:ht.VERTEX|ht.COPY_DST,shrinkToFit:!1}),i=new Yt({data:pF,label:"index-batch-buffer",usage:ht.INDEX|ht.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function ni(r,t){let e=wv[r];return e===void 0&&(Op[t]===void 0&&(Op[t]=1),wv[r]=e=Op[t]++),e}var Op,wv,ta=x(()=>{"use strict";Op=Object.create(null),wv=Object.create(null)});function Ev(){if(!vc){vc="mediump";let r=gc();r&&r.getShaderPrecisionFormat&&(vc=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return vc}var vc,Av=x(()=>{Mp()});function Pv(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -33,27 +33,27 @@ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function lv(r,t){if(r===0)th
33
33
  #define out varying
34
34
  #endif
35
35
  ${r}
36
- `}var Pv=x(()=>{"use strict"});function Cv(r,t,e){let i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float;
37
- ${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Rv=x(()=>{"use strict"});function Mv(r,t){return t?`#version 300 es
38
- ${r}`:r}var Iv=x(()=>{"use strict"});function Bv(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let i=e?pF:mF;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
39
- ${r}`}var pF,mF,Fv=x(()=>{"use strict";pF={},mF={}});function kv(r,t){return t?r.replace("#version 300 es",""):r}var Uv=x(()=>{"use strict"});var Op,Lp,Gv,cr,hs=x(()=>{ta();Ev();Pv();Rv();Iv();Fv();Uv();Op={stripVersion:kv,ensurePrecision:Cv,addProgramDefines:Av,setProgramName:Bv,insertVersion:Mv},Lp=Object.create(null),Gv=class Dp{constructor(t){t={...Dp.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:wv()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Op).forEach(n=>{let a=i[n];s=Op[n](s,a,!0),o=Op[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=ni(`${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 Lp[e]||(Lp[e]=new Dp(t)),Lp[e]}};Gv.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};cr=Gv});function $e(r){return Ov[r]??Ov.float32}var Ov,cs=x(()=>{"use strict";Ov={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Lv({source:r,entryPoint:t}){let e={},i=r.indexOf(`fn ${t}`);if(i!==-1){let s=r.indexOf("->",i);if(s!==-1){let o=r.substring(i,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=gF[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:$e(l).stride,offset:0,instance:!1,start:0}}}}return e}var gF,Dv=x(()=>{cs();gF={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 Tc(r){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@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=r.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(i)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!h)return{groups:[],structs:[]};let c=r.match(n)?.map(u=>{let d=u.match(l)[1],f=u.match(a).reduce((p,g)=>{let[m,_]=g.split(":");return p[m.trim()]=_.trim(),p},{});return f?{name:d,members:f}:null}).filter(({name:u})=>h.some(d=>d.type===u))??[];return{groups:h,structs:c}}var Nv=x(()=>{"use strict"});var ho,Hv=x(()=>{"use strict";ho=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(ho||{})});function Vv({groups:r}){let t=[];for(let e=0;e<r.length;e++){let i=r[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:ho.VERTEX|ho.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:ho.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"&&t[i.group].push({binding:i.binding,visibility:ho.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Wv=x(()=>{Hv()});function zv({groups:r}){let t=[];for(let e=0;e<r.length;e++){let i=r[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}var $v=x(()=>{"use strict"});function Xv(r,t){let e=new Set,i=new Set,s=[...r.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...r.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:o}}var jv=x(()=>{"use strict"});var Np,ur,co=x(()=>{ta();Dv();Nv();Wv();$v();jv();Np=Object.create(null),ur=class r{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:i,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=i,e.source===i.source){let a=Tc(e.source);this.structsAndGroups=a}else{let a=Tc(i.source),l=Tc(e.source);this.structsAndGroups=Xv(a,l)}this.layout=s??zv(this.structsAndGroups),this.gpuLayout=o??Vv(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,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ni(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Lv(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 Np[e]||(Np[e]=new r(t)),Np[e]}}});function Hp(r,t,e){if(r)for(let i in r){let s=i.toLocaleLowerCase(),o=t[s];if(o){let n=r[i];i==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else V(`${i} placement hook does not exist in shader`)}}var Yv=x(()=>{Pt()});function Vp(r){let t={};return(r.match(xF)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var xF,qv=x(()=>{"use strict";xF=/\{\{(.*?)\}\}/g});function Kv(r,t){let e,i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function Wp(r,t,e=!1){let i=[];Kv(t,i),r.forEach(a=>{a.header&&Kv(a.header,i)});let s=i;e&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(`
36
+ `}var Cv=x(()=>{"use strict"});function Rv(r,t,e){let i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float;
37
+ ${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Mv=x(()=>{"use strict"});function Iv(r,t){return t?`#version 300 es
38
+ ${r}`:r}var Bv=x(()=>{"use strict"});function Fv(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let i=e?mF:gF;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
39
+ ${r}`}var mF,gF,kv=x(()=>{"use strict";mF={},gF={}});function Uv(r,t){return t?r.replace("#version 300 es",""):r}var Gv=x(()=>{"use strict"});var Lp,Dp,Ov,cr,cs=x(()=>{ta();Av();Cv();Mv();Bv();kv();Gv();Lp={stripVersion:Uv,ensurePrecision:Rv,addProgramDefines:Pv,setProgramName:Fv,insertVersion:Iv},Dp=Object.create(null),Ov=class Np{constructor(t){t={...Np.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Ev()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Lp).forEach(n=>{let a=i[n];s=Lp[n](s,a,!0),o=Lp[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=ni(`${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 Dp[e]||(Dp[e]=new Np(t)),Dp[e]}};Ov.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};cr=Ov});function $e(r){return Lv[r]??Lv.float32}var Lv,us=x(()=>{"use strict";Lv={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Dv({source:r,entryPoint:t}){let e={},i=r.indexOf(`fn ${t}`);if(i!==-1){let s=r.indexOf("->",i);if(s!==-1){let o=r.substring(i,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=xF[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:$e(l).stride,offset:0,instance:!1,start:0}}}}return e}var xF,Nv=x(()=>{us();xF={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 Tc(r){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@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=r.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(i)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!h)return{groups:[],structs:[]};let c=r.match(n)?.map(u=>{let d=u.match(l)[1],f=u.match(a).reduce((p,m)=>{let[g,_]=m.split(":");return p[g.trim()]=_.trim(),p},{});return f?{name:d,members:f}:null}).filter(({name:u})=>h.some(d=>d.type===u))??[];return{groups:h,structs:c}}var Hv=x(()=>{"use strict"});var ho,Vv=x(()=>{"use strict";ho=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(ho||{})});function Wv({groups:r}){let t=[];for(let e=0;e<r.length;e++){let i=r[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:ho.VERTEX|ho.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:ho.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"&&t[i.group].push({binding:i.binding,visibility:ho.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var zv=x(()=>{Vv()});function $v({groups:r}){let t=[];for(let e=0;e<r.length;e++){let i=r[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}var Xv=x(()=>{"use strict"});function jv(r,t){let e=new Set,i=new Set,s=[...r.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...r.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:o}}var Yv=x(()=>{"use strict"});var Hp,ur,co=x(()=>{ta();Nv();Hv();zv();Xv();Yv();Hp=Object.create(null),ur=class r{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:i,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=i,e.source===i.source){let a=Tc(e.source);this.structsAndGroups=a}else{let a=Tc(i.source),l=Tc(e.source);this.structsAndGroups=jv(a,l)}this.layout=s??$v(this.structsAndGroups),this.gpuLayout=o??Wv(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,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ni(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Dv(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 Hp[e]||(Hp[e]=new r(t)),Hp[e]}}});function Vp(r,t,e){if(r)for(let i in r){let s=i.toLocaleLowerCase(),o=t[s];if(o){let n=r[i];i==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else V(`${i} placement hook does not exist in shader`)}}var qv=x(()=>{Pt()});function Wp(r){let t={};return(r.match(yF)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var yF,Kv=x(()=>{"use strict";yF=/\{\{(.*?)\}\}/g});function Zv(r,t){let e,i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function zp(r,t,e=!1){let i=[];Zv(t,i),r.forEach(a=>{a.header&&Zv(a.header,i)});let s=i;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 Zv=x(()=>{"use strict"});function Qv(r,t){let e,i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function yF(r){let e=/\b(\w+)\s*:/g.exec(r);return e?e[1]:""}function _F(r){let t=/@.*?\s+/g;return r.replace(t,"")}function Jv(r,t){let e=[];Qv(t,e),r.forEach(l=>{l.header&&Qv(l.header,e)});let i=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
43
- `),o=e.sort().map(l=>` var ${_F(l)};`).join(`
42
+ `),n}var Qv=x(()=>{"use strict"});function Jv(r,t){let e,i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function _F(r){let e=/\b(\w+)\s*:/g.exec(r);return e?e[1]:""}function bF(r){let t=/@.*?\s+/g;return r.replace(t,"")}function t0(r,t){let e=[];Jv(t,e),r.forEach(l=>{l.header&&Jv(l.header,e)});let i=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
43
+ `),o=e.sort().map(l=>` var ${bF(l)};`).join(`
44
44
  `),n=`return VSOutput(
45
- ${e.sort().map(l=>` ${yF(l)}`).join(`,
45
+ ${e.sort().map(l=>` ${_F(l)}`).join(`,
46
46
  `)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
47
47
  ${s}
48
48
  `),a=a.replace("{{start}}",`
49
49
  ${o}
50
50
  `),a=a.replace("{{return}}",`
51
51
  ${n}
52
- `),a}var t0=x(()=>{"use strict"});function zp(r,t){let e=r;for(let i in t){let s=t[i];s.join(`
52
+ `),a}var e0=x(()=>{"use strict"});function $p(r,t){let e=r;for(let i in t){let s=t[i];s.join(`
53
53
  `).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
54
54
  ${s.join(`
55
55
  `)}
56
- //----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}var e0=x(()=>{"use strict"});function r0({template:r,bits:t}){let e=s0(r,t);if(Bi[e])return Bi[e];let{vertex:i,fragment:s}=vF(r,t);return Bi[e]=o0(i,s,t),Bi[e]}function i0({template:r,bits:t}){let e=s0(r,t);return Bi[e]||(Bi[e]=o0(r.vertex,r.fragment,t)),Bi[e]}function vF(r,t){let e=t.map(n=>n.vertex).filter(n=>!!n),i=t.map(n=>n.fragment).filter(n=>!!n),s=Wp(e,r.vertex,!0);s=Jv(e,s);let o=Wp(i,r.fragment,!0);return{vertex:s,fragment:o}}function s0(r,t){return t.map(e=>($p.has(e)||$p.set(e,bF++),$p.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function o0(r,t,e){let i=Vp(r),s=Vp(t);return e.forEach(o=>{Hp(o.vertex,i,o.name),Hp(o.fragment,s,o.name)}),{vertex:zp(r,i),fragment:zp(t,s)}}var Bi,$p,bF,n0=x(()=>{Yv();qv();Zv();t0();e0();Bi=Object.create(null),$p=new Map,bF=0});var a0,l0,h0,c0,u0=x(()=>{"use strict";a0=`
56
+ //----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}var r0=x(()=>{"use strict"});function i0({template:r,bits:t}){let e=o0(r,t);if(Bi[e])return Bi[e];let{vertex:i,fragment:s}=TF(r,t);return Bi[e]=n0(i,s,t),Bi[e]}function s0({template:r,bits:t}){let e=o0(r,t);return Bi[e]||(Bi[e]=n0(r.vertex,r.fragment,t)),Bi[e]}function TF(r,t){let e=t.map(n=>n.vertex).filter(n=>!!n),i=t.map(n=>n.fragment).filter(n=>!!n),s=zp(e,r.vertex,!0);s=t0(e,s);let o=zp(i,r.fragment,!0);return{vertex:s,fragment:o}}function o0(r,t){return t.map(e=>(Xp.has(e)||Xp.set(e,vF++),Xp.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function n0(r,t,e){let i=Wp(r),s=Wp(t);return e.forEach(o=>{Vp(o.vertex,i,o.name),Vp(o.fragment,s,o.name)}),{vertex:$p(r,i),fragment:$p(t,s)}}var Bi,Xp,vF,a0=x(()=>{qv();Kv();Qv();e0();r0();Bi=Object.create(null),Xp=new Map,vF=0});var l0,h0,c0,u0,d0=x(()=>{"use strict";l0=`
57
57
  @in aPosition: vec2<f32>;
58
58
  @in aUV: vec2<f32>;
59
59
 
@@ -97,7 +97,7 @@ ${s.join(`
97
97
 
98
98
  {{return}}
99
99
  };
100
- `,l0=`
100
+ `,h0=`
101
101
  @in vUV : vec2<f32>;
102
102
  @in vColor : vec4<f32>;
103
103
 
@@ -120,7 +120,7 @@ ${s.join(`
120
120
 
121
121
  return finalColor;
122
122
  };
123
- `,h0=`
123
+ `,c0=`
124
124
  in vec2 aPosition;
125
125
  in vec2 aUV;
126
126
 
@@ -156,7 +156,7 @@ ${s.join(`
156
156
 
157
157
  {{end}}
158
158
  }
159
- `,c0=`
159
+ `,u0=`
160
160
 
161
161
  in vec4 vColor;
162
162
  in vec2 vUV;
@@ -177,7 +177,7 @@ ${s.join(`
177
177
 
178
178
  {{end}}
179
179
  }
180
- `});var d0,f0,p0=x(()=>{"use strict";d0={name:"global-uniforms-bit",vertex:{header:`
180
+ `});var f0,p0,m0=x(()=>{"use strict";f0={name:"global-uniforms-bit",vertex:{header:`
181
181
  struct GlobalUniforms {
182
182
  uProjectionMatrix:mat3x3<f32>,
183
183
  uWorldTransformMatrix:mat3x3<f32>,
@@ -186,12 +186,12 @@ ${s.join(`
186
186
  }
187
187
 
188
188
  @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
189
- `}},f0={name:"global-uniforms-bit",vertex:{header:`
189
+ `}},p0={name:"global-uniforms-bit",vertex:{header:`
190
190
  uniform mat3 uProjectionMatrix;
191
191
  uniform mat3 uWorldTransformMatrix;
192
192
  uniform vec4 uWorldColorAlpha;
193
193
  uniform vec2 uResolution;
194
- `}}});function Ur({bits:r,name:t}){let e=r0({template:{fragment:l0,vertex:a0},bits:[d0,...r]});return ur.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Gr({bits:r,name:t}){return new cr({name:t,...i0({template:{vertex:h0,fragment:c0},bits:[f0,...r]})})}var Fi=x(()=>{hs();co();n0();u0();p0()});var uo,fo,ea=x(()=>{"use strict";uo={name:"color-bit",vertex:{header:`
194
+ `}}});function Ur({bits:r,name:t}){let e=i0({template:{fragment:h0,vertex:l0},bits:[f0,...r]});return ur.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Gr({bits:r,name:t}){return new cr({name:t,...s0({template:{vertex:c0,fragment:u0},bits:[p0,...r]})})}var Fi=x(()=>{cs();co();a0();d0();m0()});var uo,fo,ea=x(()=>{"use strict";uo={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);
@@ -199,9 +199,9 @@ ${s.join(`
199
199
  in vec4 aColor;
200
200
  `,main:`
201
201
  vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
202
- `}}});function TF(r){let t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i<r;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(`
203
- `)}function SF(r){let t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
204
- `)}function po(r){return Xp[r]||(Xp[r]={name:"texture-batch-bit",vertex:{header:`
202
+ `}}});function SF(r){let t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i<r;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(`
203
+ `)}function wF(r){let t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
204
+ `)}function po(r){return jp[r]||(jp[r]={name:"texture-batch-bit",vertex:{header:`
205
205
  @in aTextureIdAndRound: vec2<u32>;
206
206
  @out @interpolate(flat) vTextureId : u32;
207
207
  `,main:`
@@ -214,14 +214,14 @@ ${s.join(`
214
214
  `},fragment:{header:`
215
215
  @in @interpolate(flat) vTextureId: u32;
216
216
 
217
- ${TF(r)}
217
+ ${SF(r)}
218
218
  `,main:`
219
219
  var uvDx = dpdx(vUV);
220
220
  var uvDy = dpdy(vUV);
221
221
 
222
- ${SF(r)}
223
- `}}),Xp[r]}function wF(r){let t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
224
- `)}function mo(r){return jp[r]||(jp[r]={name:"texture-batch-bit",vertex:{header:`
222
+ ${wF(r)}
223
+ `}}),jp[r]}function EF(r){let t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
224
+ `)}function mo(r){return Yp[r]||(Yp[r]={name:"texture-batch-bit",vertex:{header:`
225
225
  in vec2 aTextureIdAndRound;
226
226
  out float vTextureId;
227
227
 
@@ -239,8 +239,8 @@ ${s.join(`
239
239
 
240
240
  `,main:`
241
241
 
242
- ${wF(r)}
243
- `}}),jp[r]}var Xp,jp,ra=x(()=>{"use strict";Xp={};jp={}});var Or,Lr,ki=x(()=>{"use strict";Or={name:"round-pixels-bit",vertex:{header:`
242
+ ${EF(r)}
243
+ `}}),Yp[r]}var jp,Yp,ra=x(()=>{"use strict";jp={};Yp={}});var Or,Lr,ki=x(()=>{"use strict";Or={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 Yp,m0,g0=x(()=>{"use strict";Yp=["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>"],m0=Yp.reduce((r,t)=>(r[t]=!0,r),{})});function x0(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var y0=x(()=>{"use strict"});var _0,Ct,Ge=x(()=>{Se();ta();g0();y0();_0=class b0{constructor(t,e){this._touched=0,this.uid=ut("uniform"),this._resourceType="uniformGroup",this._resourceId=ut("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...b0.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!m0[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Yp.join(", ")}`);o.value??(o.value=x0(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ni(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};_0.defaultOptions={ubo:!1,isStatic:!1};Ct=_0});function go(r){let t=v0[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=v0[r]=new Ct({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var v0,Sc=x(()=>{Ge();v0={}});var se,Dr=x(()=>{"use strict";se=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(se||{})});var qt,Tr=x(()=>{Ae();Se();hs();Mi();co();Dr();Ge();qt=class r extends It{constructor(t){super(),this.uid=ut("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=se.WEBGPU),i&&(n|=se.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 c in a[h]){let u=a[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let c in o)l[c]||(s[99]||(s[99]=new xe,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new Ct(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new xe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new xe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=ur.from(e)),i&&(n=cr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var wc,T0=x(()=>{Fi();ea();ra();ki();Sc();Tr();wc=class extends qt{constructor(t){let e=Gr({name:"batch",bits:[fo,mo(t),Lr]}),i=Ur({name:"batch",bits:[uo,po(t),Or]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:go(t)}})}}});var S0,w0,ia,qp=x(()=>{F();yv();Tv();T0();S0=null,w0=class E0 extends xv{constructor(){super(...arguments),this.geometry=new bc,this.shader=S0||(S0=new wc(this.maxTextures)),this.name=E0.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:g}=t,m=t.color,_=t.attributeOffset,b=_+t.attributeSize;for(let y=_;y<b;y++){let w=y*2,E=p[w],v=p[w+1];e[s++]=l*E+c*v+d,e[s++]=u*v+h*E+f,e[s++]=g[w],e[s++]=g[w+1],i[s++]=m,i[s++]=n}}packQuadAttributes(t,e,i,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,g=p.maxX,m=p.minX,_=p.maxY,b=p.minY,y=n.uvs,w=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=l*m+c*b+d,e[s+1]=u*b+h*m+f,e[s+2]=y.x0,e[s+3]=y.y0,i[s+4]=w,i[s+5]=E,e[s+6]=l*g+c*b+d,e[s+7]=u*b+h*g+f,e[s+8]=y.x1,e[s+9]=y.y1,i[s+10]=w,i[s+11]=E,e[s+12]=l*g+c*_+d,e[s+13]=u*_+h*g+f,e[s+14]=y.x2,e[s+15]=y.y2,i[s+16]=w,i[s+17]=E,e[s+18]=l*m+c*_+d,e[s+19]=u*_+h*m+f,e[s+20]=y.x3,e[s+21]=y.y3,i[s+22]=w,i[s+23]=E}};w0.extension={type:[T.Batcher],name:"default"};ia=w0});function A0(r,t,e,i,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<n;){let g=r[e],m=r[e+1];i[s]=h*g+u*m+f,i[s+1]=c*g+d*m+p,s+=o,e+=t,l++}}function P0(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var C0=x(()=>{"use strict"});function Kp(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],p=r[u+1];r[u]=o*f+a*p+h,r[u+1]=n*f+l*p+c,u+=i}}var R0=x(()=>{"use strict"});var EF,us,Zp=x(()=>{mt();Wf();EF=new G,us=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Yh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||EF}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var xo,M0,I0,B0=x(()=>{F();xo={extension:{type:T.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let w=r;e=w.x,i=w.y,n=a=w.radius,s=o=0}else if(r.type==="ellipse"){let w=r;e=w.x,i=w.y,n=w.halfWidth,a=w.halfHeight,s=o=0}else{let w=r,E=w.width/2,v=w.height/2;e=w.x+E,i=w.y+v,n=a=Math.max(0,Math.min(w.radius,Math.min(E,v))),s=E-n,o=v-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=l*4+(s?2:0)+2,d=u,f=h,p=s+n,g=o,m=e+p,_=e-p,b=i+g;if(t[c++]=m,t[c++]=b,t[--u]=b,t[--u]=_,o){let w=i-g;t[d++]=_,t[d++]=w,t[--f]=w,t[--f]=m}for(let w=1;w<l;w++){let E=Math.PI/2*(w/l),v=s+Math.cos(E)*n,S=o+Math.sin(E)*a,P=e+v,R=e-v,A=i+S,C=i-S;t[c++]=P,t[c++]=A,t[--u]=A,t[--u]=R,t[d++]=R,t[d++]=C,t[--f]=C,t[--f]=P}p=s,g=o+a,m=e+p,_=e-p,b=i+g;let y=i-g;return t[c++]=m,t[c++]=b,t[--f]=y,t[--f]=m,s&&(t[c++]=_,t[c++]=b,t[--f]=y,t[--f]=_),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let c=0;c<r.length;c+=2)n+=r[c],a+=r[c+1];n/=r.length/2,a/=r.length/2;let l=i;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let c=0;c<r.length;c+=2)t[l*e]=r[c],t[l*e+1]=r[c+1],c>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1}},M0={...xo,extension:{...xo.extension,name:"ellipse"}},I0={...xo,extension:{...xo.extension,name:"roundedRectangle"}}});function F0(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var k0=x(()=>{"use strict"});function U0(r,t,e,i,s,o,n,a){let l=r-e*s,h=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let p=l+d,g=h+f,m=c+d,_=u+f;return a.push(p,g),a.push(m,_),2}function ds(r,t,e,i,s,o,n,a){let l=e-r,h=i-t,c=Math.atan2(l,h),u=Math.atan2(s-r,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),g=Math.sqrt(l*l+h*h),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,_=f/m;if(d+=_,a){n.push(r,t),n.push(e,i);for(let b=1,y=d;b<m;b++,y+=_)n.push(r,t),n.push(r+Math.sin(y)*g,t+Math.cos(y)*g);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let b=1,y=d;b<m;b++,y+=_)n.push(r+Math.sin(y)*g,t+Math.cos(y)*g),n.push(r,t);n.push(s,o),n.push(r,t)}return m*2}function G0(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let L=F0(r);e&&(L*=-1),l=(l-.5)*L+.5}let h=new dt(r[0],r[1]),c=new dt(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(h.x-c.x)<n&&Math.abs(h.y-c.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));let L=(h.x+c.x)*.5,z=(c.y+h.y)*.5;r.unshift(L,z),r.push(L,z)}let f=s,p=r.length/2,g=r.length,m=f.length/2,_=a.width/2,b=_*_,y=a.miterLimit*a.miterLimit,w=r[0],E=r[1],v=r[2],S=r[3],P=0,R=0,A=-(E-S),C=w-v,M=0,B=0,k=Math.sqrt(A*A+C*C);A/=k,C/=k,A*=_,C*=_;let U=l,O=(1-U)*2,$=U*2;u||(a.cap==="round"?g+=ds(w-A*(O-$)*.5,E-C*(O-$)*.5,w-A*O,E-C*O,w+A*$,E+C*$,f,!0)+2:a.cap==="square"&&(g+=U0(w,E,A,C,O,$,!0,f))),f.push(w-A*O,E-C*O),f.push(w+A*$,E+C*$);for(let L=1;L<p-1;++L){w=r[(L-1)*2],E=r[(L-1)*2+1],v=r[L*2],S=r[L*2+1],P=r[(L+1)*2],R=r[(L+1)*2+1],A=-(E-S),C=w-v,k=Math.sqrt(A*A+C*C),A/=k,C/=k,A*=_,C*=_,M=-(S-R),B=v-P,k=Math.sqrt(M*M+B*B),M/=k,B/=k,M*=_,B*=_;let z=v-w,st=E-S,Q=v-P,bt=R-S,Bt=z*Q+st*bt,Mt=st*Q-bt*z,jt=Mt<0;if(Math.abs(Mt)<.001*Math.abs(Bt)){f.push(v-A*O,S-C*O),f.push(v+A*$,S+C*$),Bt>=0&&(a.join==="round"?g+=ds(v,S,v-A*O,S-C*O,v-M*O,S-B*O,f,!1)+4:g+=2,f.push(v-M*$,S-B*$),f.push(v+M*O,S+B*O));continue}let Zt=(-A+w)*(-C+S)-(-A+v)*(-C+E),xt=(-M+P)*(-B+S)-(-M+v)*(-B+R),ct=(z*xt-Q*Zt)/Mt,vt=(bt*Zt-st*xt)/Mt,Ot=(ct-v)*(ct-v)+(vt-S)*(vt-S),ee=v+(ct-v)*O,re=S+(vt-S)*O,He=v-(ct-v)*$,qi=S-(vt-S)*$,yB=Math.min(z*z+st*st,Q*Q+bt*bt),s_=jt?O:$,_B=yB+s_*s_*b;Ot<=_B?a.join==="bevel"||Ot/b>y?(jt?(f.push(ee,re),f.push(v+A*$,S+C*$),f.push(ee,re),f.push(v+M*$,S+B*$)):(f.push(v-A*O,S-C*O),f.push(He,qi),f.push(v-M*O,S-B*O),f.push(He,qi)),g+=2):a.join==="round"?jt?(f.push(ee,re),f.push(v+A*$,S+C*$),g+=ds(v,S,v+A*$,S+C*$,v+M*$,S+B*$,f,!0)+4,f.push(ee,re),f.push(v+M*$,S+B*$)):(f.push(v-A*O,S-C*O),f.push(He,qi),g+=ds(v,S,v-A*O,S-C*O,v-M*O,S-B*O,f,!1)+4,f.push(v-M*O,S-B*O),f.push(He,qi)):(f.push(ee,re),f.push(He,qi)):(f.push(v-A*O,S-C*O),f.push(v+A*$,S+C*$),a.join==="round"?jt?g+=ds(v,S,v+A*$,S+C*$,v+M*$,S+B*$,f,!0)+2:g+=ds(v,S,v-A*O,S-C*O,v-M*O,S-B*O,f,!1)+2:a.join==="miter"&&Ot/b<=y&&(jt?(f.push(He,qi),f.push(He,qi)):(f.push(ee,re),f.push(ee,re)),g+=2),f.push(v-M*O,S-B*O),f.push(v+M*$,S+B*$),g+=2)}w=r[(p-2)*2],E=r[(p-2)*2+1],v=r[(p-1)*2],S=r[(p-1)*2+1],A=-(E-S),C=w-v,k=Math.sqrt(A*A+C*C),A/=k,C/=k,A*=_,C*=_,f.push(v-A*O,S-C*O),f.push(v+A*$,S+C*$),u||(a.cap==="round"?g+=ds(v-A*(O-$)*.5,S-C*(O-$)*.5,v-A*O,S-C*O,v+A*$,S+C*$,f,!1)+2:a.cap==="square"&&(g+=U0(v,S,A,C,O,$,!1,f)));let N=1e-4*1e-4;for(let L=m;L<g+m-2;++L)w=f[L*2],E=f[L*2+1],v=f[(L+1)*2],S=f[(L+1)*2+1],P=f[(L+2)*2],R=f[(L+2)*2+1],!(Math.abs(w*(S-R)+v*(R-E)+P*(E-S))<N)&&o.push(L,L+1,L+2)}var O0=x(()=>{ar();k0()});function L0(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,c=e,u=r.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);h&&i.push(d+u-1,d)}var D0=x(()=>{});var Rc=J((Y5,em)=>{"use strict";em.exports=Pc;em.exports.default=Pc;function Pc(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=H0(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,h,c,u,d,f;if(i&&(o=BF(r,t,o,e)),r.length>80*e){a=h=r[0],l=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+1],u<a&&(a=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return sa(o,n,e,a,l,f,0),n}function H0(r,t,e,i,s){var o,n;if(s===tm(r,t,e,i)>0)for(o=t;o<e;o+=i)n=N0(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=N0(o,r[o],r[o+1],n);return n&&Cc(n,n.next)&&(na(n),n=n.next),n}function fs(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Cc(e,e.next)||$t(e.prev,e,e.next)===0)){if(na(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function sa(r,t,e,i,s,o,n){if(r){!n&&o&&OF(r,i,s,o);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,o?RF(r,i,s,o):CF(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),na(r),r=h.next,a=h.next;continue}if(r=h,r===a){n?n===1?(r=MF(fs(r),t,e),sa(r,t,e,i,s,o,2)):n===2&&IF(r,t,e,i,s,o):sa(fs(r),t,e,i,s,o,1);break}}}}function CF(r){var t=r.prev,e=r,i=r.next;if($t(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,h=i.y,c=s<o?s<n?s:n:o<n?o:n,u=a<l?a<h?a:h:l<h?l:h,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>h?a:h:l>h?l:h,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&yo(s,a,o,l,n,h,p.x,p.y)&&$t(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function RF(r,t,e,i){var s=r.prev,o=r,n=r.next;if($t(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,h=n.x,c=s.y,u=o.y,d=n.y,f=a<l?a<h?a:h:l<h?l:h,p=c<u?c<d?c:d:u<d?u:d,g=a>l?a>h?a:h:l>h?l:h,m=c>u?c>d?c:d:u>d?u:d,_=Qp(f,p,t,e,i),b=Qp(g,m,t,e,i),y=r.prevZ,w=r.nextZ;y&&y.z>=_&&w&&w.z<=b;){if(y.x>=f&&y.x<=g&&y.y>=p&&y.y<=m&&y!==s&&y!==n&&yo(a,c,l,u,h,d,y.x,y.y)&&$t(y.prev,y,y.next)>=0||(y=y.prevZ,w.x>=f&&w.x<=g&&w.y>=p&&w.y<=m&&w!==s&&w!==n&&yo(a,c,l,u,h,d,w.x,w.y)&&$t(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=g&&y.y>=p&&y.y<=m&&y!==s&&y!==n&&yo(a,c,l,u,h,d,y.x,y.y)&&$t(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;w&&w.z<=b;){if(w.x>=f&&w.x<=g&&w.y>=p&&w.y<=m&&w!==s&&w!==n&&yo(a,c,l,u,h,d,w.x,w.y)&&$t(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function MF(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!Cc(s,o)&&V0(s,i,i.next,o)&&oa(s,o)&&oa(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),na(i),na(i.next),i=r=o),i=i.next}while(i!==r);return fs(i)}function IF(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&NF(n,a)){var l=W0(n,a);n=fs(n,n.next),l=fs(l,l.next),sa(n,t,e,i,s,o,0),sa(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function BF(r,t,e,i){var s=[],o,n,a,l,h;for(o=0,n=t.length;o<n;o++)a=t[o]*i,l=o<n-1?t[o+1]*i:r.length,h=H0(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(DF(h));for(s.sort(FF),o=0;o<s.length;o++)e=kF(s[o],e);return e}function FF(r,t){return r.x-t.x}function kF(r,t){var e=UF(r,t);if(!e)return t;var i=W0(e,r);return fs(i,i.next),fs(e,e.next)}function UF(r,t){var e=t,i=r.x,s=r.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))return n}e=e.next}while(e!==t);if(!n)return null;var l=n,h=n.x,c=n.y,u=1/0,d;e=n;do i>=e.x&&e.x>=h&&i!==e.x&&yo(s<c?i:o,s,h,c,s<c?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),oa(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&GF(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function GF(r,t){return $t(r.prev,r,t.prev)<0&&$t(t.next,r,r.next)<0}function OF(r,t,e,i){var s=r;do s.z===0&&(s.z=Qp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,LF(s)}function LF(r){var t,e,i,s,o,n,a,l,h=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<h&&(a++,i=i.nextZ,!!i);t++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,h*=2}while(n>1);return r}function Qp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function DF(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function yo(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function NF(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!HF(r,t)&&(oa(r,t)&&oa(t,r)&&VF(r,t)&&($t(r.prev,r,t.prev)||$t(r,t.prev,t))||Cc(r,t)&&$t(r.prev,r,r.next)>0&&$t(t.prev,t,t.next)>0)}function $t(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cc(r,t){return r.x===t.x&&r.y===t.y}function V0(r,t,e,i){var s=Ac($t(r,t,e)),o=Ac($t(r,t,i)),n=Ac($t(e,i,r)),a=Ac($t(e,i,t));return!!(s!==o&&n!==a||s===0&&Ec(r,e,t)||o===0&&Ec(r,i,t)||n===0&&Ec(e,r,i)||a===0&&Ec(e,t,i))}function Ec(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ac(r){return r>0?1:r<0?-1:0}function HF(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&V0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function oa(r,t){return $t(r.prev,r,r.next)<0?$t(r,t,r.next)>=0&&$t(r,r.prev,t)>=0:$t(r,t,r.prev)<0||$t(r,r.next,t)<0}function VF(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function W0(r,t){var e=new Jp(r.i,r.x,r.y),i=new Jp(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function N0(r,t,e,i){var s=new Jp(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function na(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Jp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Pc.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(tm(r,0,o,e));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,c=a<l-1?t[a+1]*e:r.length;n-=Math.abs(tm(r,h,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function tm(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}Pc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function Mc(r,t,e,i,s,o,n){let a=(0,z0.default)(r,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*i;for(let h=0;h<r.length;h+=2)e[l]=r[h],e[l+1]=r[h+1],l+=i}var z0,rm=x(()=>{z0=Ki(Rc(),1)});var WF,$0,X0=x(()=>{F();rm();WF=[],$0={extension:{type:T.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){Mc(r,WF,t,e,i,s,o)}}});var j0,Y0=x(()=>{F();j0={extension:{type:T.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var q0,K0=x(()=>{F();q0={extension:{type:T.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function Q0(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function J0(r,t){let e=Y.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function zF(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&(j("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??Xe.defaultLinearOptions.textureSize}),t}var Z0,sm,Xe,_o=x(()=>{ve();Ft();mt();so();Tt();Se();Wt();qf();Z0=[{offset:0,color:"white"},{offset:1,color:"black"}],sm=class im{constructor(...t){this.uid=ut("fillGradient"),this.type="linear",this.colorStops=[];let e=zF(t);e={...e.type==="radial"?im.defaultRadialOptions:im.defaultLinearOptions,...Kh(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:ot.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let m=t;t=i,i=m,o*=-1}if(n<0){let m=e;e=s,s=m,n*=-1}}let l=this.colorStops.length?this.colorStops:Z0,h=this._textureSize,{canvas:c,context:u}=J0(h,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Q0(d,l),u.fillStyle=d,u.fillRect(0,0,h,1),this.texture=new I({source:new ze({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),g=new G;g.scale(f/h,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(h,h),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Z0,e=this._textureSize,{canvas:i,context:s}=J0(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=a-c,d=l-c,f=e/(c*2),p=(o-u)*f,g=(n-d)*f,m=s.createRadialGradient(p,g,h*f,(a-u)*f,(l-d)*f,c*f);Q0(m,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=m,s.translate(p,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-g),s.fillRect(0,0,e,e),this.texture=new I({source:new ze({resource:i,addressMode:this._wrapMode})});let _=new G;_.scale(1/f,1/f),_.translate(u,d),this.textureSpace==="local"&&_.scale(e,e),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};sm.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};sm.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Xe=sm});function tT(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(XF);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,c=1/n.height,u=-a*h,d=-l*c,f=s.a,p=s.b,g=s.c,m=s.d;s.a*=h,s.b*=h,s.c*=c,s.d*=c,s.tx=u*f+d*g+s.tx,s.ty=u*p+d*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 Xe)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append($F.copyFrom(i).invert()),s}var $F,XF,eT=x(()=>{mt();he();_o();$F=new G,XF=new tt});function iT(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")qF(o.data,i,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&&rT(h.shapePath,l,!0,i,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),rT(a,l,n,i,e)}}}function qF(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,l=[],h=Ic.rectangle,c=jF,u=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;let d=r.transform;h.build(c,l),d&&Kp(l,d),h.triangulate(l,i,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=it.get(us);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=u,p.geometryData=e,t.push(p)}function rT(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=Ic[l.type],g="triangle-list";if(p.build(l,f),h&&Kp(f,h),e){let y=l.closePath??!0,w=t;w.pixelLine?(L0(f,y,o,a),g="line-list"):G0(f,w,!1,y,o,a)}else if(c){let y=[],w=f.slice();KF(c).forEach(v=>{y.push(w.length/2),w.push(...v)}),Mc(w,y,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let m=n.length/2,_=t.texture;if(_!==I.WHITE){let y=tT(YF,t,l,h);A0(o,2,d,n,m,2,o.length/2-d,y)}else P0(n,m,2,o.length/2-d);let b=it.get(us);b.indexOffset=u,b.indexSize=a.length-u,b.attributeOffset=d,b.attributeSize=o.length/2-d,b.baseColor=t.color,b.alpha=t.alpha,b.texture=_,b.geometryData=s,b.topology=g,i.push(b)})}function KF(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];Ic[i.type].build(i,s),t.push(s)}return t}var Ic,jF,YF,sT=x(()=>{F();mt();he();C0();R0();Tt();Be();Zp();B0();O0();D0();X0();Y0();K0();eT();rm();Ic={};H.handleByMap(T.ShapeBuilder,Ic);H.add(j0,$0,q0,xo,M0,I0);jF=new tt,YF=new G});var om,nm,lm,bo,Bc=x(()=>{F();xc();qp();jf();Wt();Be();sT();om=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},nm=class{constructor(){this.batcher=new ia,this.instructions=new Ks}init(){this.instructions.reset()}get geometry(){return j(E_,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},lm=class am{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){am.defaultOptions.bezierSmoothness=t?.bezierSmoothness??am.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),iT(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=it.get(nm),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<i.length;c++){let u=i[c];a.add(u)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let h=a.batches;for(let c=0;c<h.length;c++){let u=h[c];u.bindGroup=ao(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new om;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]&&(it.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{it.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};lm.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"graphicsContext"};lm.defaultOptions={bezierSmoothness:.5};bo=lm});var ZF,hm,cm,um,dm,fm,pm,mm,Qt,Sr=x(()=>{"use strict";ZF={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},hm=0,cm=1,um=2,dm=3,fm=4,pm=5,mm=class oT{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<hm)}set blend(t){!!(this.data&1<<hm)!==t&&(this.data^=1<<hm)}get offsets(){return!!(this.data&1<<cm)}set offsets(t){!!(this.data&1<<cm)!==t&&(this.data^=1<<cm)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<um)}set culling(t){!!(this.data&1<<um)!==t&&(this.data^=1<<um)}get depthTest(){return!!(this.data&1<<dm)}set depthTest(t){!!(this.data&1<<dm)!==t&&(this.data^=1<<dm)}get depthMask(){return!!(this.data&1<<pm)}set depthMask(t){!!(this.data&1<<pm)!==t&&(this.data^=1<<pm)}get clockwiseFrontFace(){return!!(this.data&1<<fm)}set clockwiseFrontFace(t){!!(this.data&1<<fm)!==t&&(this.data^=1<<fm)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=ZF[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 oT;return t.depthTest=!1,t.blend=!0,t}};mm.default2d=mm.for2d();Qt=mm});function Nr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var vo=x(()=>{"use strict"});var aa,nT=x(()=>{F();Sr();Be();vo();Zp();aa=class{constructor(t,e){this.state=Qt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let s=e[i];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=it.get(us);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{it.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};aa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"graphics"}});var gm=x(()=>{F();Bc();nT();H.add(aa);H.add(bo)});var Ui,Fc=x(()=>{"use strict";Ui=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var la,aT=x(()=>{F();mt();Mi();Ge();Qn();Be();vo();Fc();la=class{constructor(t,e){this.localUniforms=new Ct({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new xe({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(it.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=si(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Nr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=it.get(Ui);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&it.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};la.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"mesh"}});var xm=x(()=>{F();aT();H.add(la)});var kc,lT=x(()=>{"use strict";kc=class{execute(t,e){let i=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let 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 ym(r,t=null){let e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var hT=x(()=>{"use strict"});function uT(r){return{dynamicUpdate:cT(r,!0),staticUpdate:cT(r,!1)}}function cT(r,t){let e=[];e.push(`
253
+ `}}});var qp,g0,x0=x(()=>{"use strict";qp=["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>"],g0=qp.reduce((r,t)=>(r[t]=!0,r),{})});function y0(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var _0=x(()=>{"use strict"});var b0,Ct,Ge=x(()=>{Se();ta();x0();_0();b0=class v0{constructor(t,e){this._touched=0,this.uid=ut("uniform"),this._resourceType="uniformGroup",this._resourceId=ut("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...v0.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!g0[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${qp.join(", ")}`);o.value??(o.value=y0(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ni(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};b0.defaultOptions={ubo:!1,isStatic:!1};Ct=b0});function go(r){let t=T0[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=T0[r]=new Ct({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var T0,Sc=x(()=>{Ge();T0={}});var se,Dr=x(()=>{"use strict";se=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(se||{})});var qt,Tr=x(()=>{Ae();Se();cs();Mi();co();Dr();Ge();qt=class r extends It{constructor(t){super(),this.uid=ut("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=se.WEBGPU),i&&(n|=se.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 c in a[h]){let u=a[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let c in o)l[c]||(s[99]||(s[99]=new xe,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new Ct(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new xe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new xe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=ur.from(e)),i&&(n=cr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var wc,S0=x(()=>{Fi();ea();ra();ki();Sc();Tr();wc=class extends qt{constructor(t){let e=Gr({name:"batch",bits:[fo,mo(t),Lr]}),i=Ur({name:"batch",bits:[uo,po(t),Or]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:go(t)}})}}});var w0,E0,ia,Kp=x(()=>{F();_v();Sv();S0();w0=null,E0=class A0 extends yv{constructor(){super(...arguments),this.geometry=new bc,this.shader=w0||(w0=new wc(this.maxTextures)),this.name=A0.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=t,g=t.color,_=t.attributeOffset,b=_+t.attributeSize;for(let y=_;y<b;y++){let w=y*2,E=p[w],v=p[w+1];e[s++]=l*E+c*v+d,e[s++]=u*v+h*E+f,e[s++]=m[w],e[s++]=m[w+1],i[s++]=g,i[s++]=n}}packQuadAttributes(t,e,i,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,m=p.maxX,g=p.minX,_=p.maxY,b=p.minY,y=n.uvs,w=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=l*g+c*b+d,e[s+1]=u*b+h*g+f,e[s+2]=y.x0,e[s+3]=y.y0,i[s+4]=w,i[s+5]=E,e[s+6]=l*m+c*b+d,e[s+7]=u*b+h*m+f,e[s+8]=y.x1,e[s+9]=y.y1,i[s+10]=w,i[s+11]=E,e[s+12]=l*m+c*_+d,e[s+13]=u*_+h*m+f,e[s+14]=y.x2,e[s+15]=y.y2,i[s+16]=w,i[s+17]=E,e[s+18]=l*g+c*_+d,e[s+19]=u*_+h*g+f,e[s+20]=y.x3,e[s+21]=y.y3,i[s+22]=w,i[s+23]=E}};E0.extension={type:[T.Batcher],name:"default"};ia=E0});function P0(r,t,e,i,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<n;){let m=r[e],g=r[e+1];i[s]=h*m+u*g+f,i[s+1]=c*m+d*g+p,s+=o,e+=t,l++}}function C0(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var R0=x(()=>{"use strict"});function Zp(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],p=r[u+1];r[u]=o*f+a*p+h,r[u+1]=n*f+l*p+c,u+=i}}var M0=x(()=>{"use strict"});var AF,ds,Qp=x(()=>{mt();zf();AF=new G,ds=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Yh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||AF}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var xo,I0,B0,F0=x(()=>{F();xo={extension:{type:T.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let w=r;e=w.x,i=w.y,n=a=w.radius,s=o=0}else if(r.type==="ellipse"){let w=r;e=w.x,i=w.y,n=w.halfWidth,a=w.halfHeight,s=o=0}else{let w=r,E=w.width/2,v=w.height/2;e=w.x+E,i=w.y+v,n=a=Math.max(0,Math.min(w.radius,Math.min(E,v))),s=E-n,o=v-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=l*4+(s?2:0)+2,d=u,f=h,p=s+n,m=o,g=e+p,_=e-p,b=i+m;if(t[c++]=g,t[c++]=b,t[--u]=b,t[--u]=_,o){let w=i-m;t[d++]=_,t[d++]=w,t[--f]=w,t[--f]=g}for(let w=1;w<l;w++){let E=Math.PI/2*(w/l),v=s+Math.cos(E)*n,S=o+Math.sin(E)*a,P=e+v,R=e-v,A=i+S,C=i-S;t[c++]=P,t[c++]=A,t[--u]=A,t[--u]=R,t[d++]=R,t[d++]=C,t[--f]=C,t[--f]=P}p=s,m=o+a,g=e+p,_=e-p,b=i+m;let y=i-m;return t[c++]=g,t[c++]=b,t[--f]=y,t[--f]=g,s&&(t[c++]=_,t[c++]=b,t[--f]=y,t[--f]=_),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let c=0;c<r.length;c+=2)n+=r[c],a+=r[c+1];n/=r.length/2,a/=r.length/2;let l=i;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let c=0;c<r.length;c+=2)t[l*e]=r[c],t[l*e+1]=r[c+1],c>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1}},I0={...xo,extension:{...xo.extension,name:"ellipse"}},B0={...xo,extension:{...xo.extension,name:"roundedRectangle"}}});function k0(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var U0=x(()=>{"use strict"});function G0(r,t,e,i,s,o,n,a){let l=r-e*s,h=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let p=l+d,m=h+f,g=c+d,_=u+f;return a.push(p,m),a.push(g,_),2}function fs(r,t,e,i,s,o,n,a){let l=e-r,h=i-t,c=Math.atan2(l,h),u=Math.atan2(s-r,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),m=Math.sqrt(l*l+h*h),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,a){n.push(r,t),n.push(e,i);for(let b=1,y=d;b<g;b++,y+=_)n.push(r,t),n.push(r+Math.sin(y)*m,t+Math.cos(y)*m);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let b=1,y=d;b<g;b++,y+=_)n.push(r+Math.sin(y)*m,t+Math.cos(y)*m),n.push(r,t);n.push(s,o),n.push(r,t)}return g*2}function O0(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let L=k0(r);e&&(L*=-1),l=(l-.5)*L+.5}let h=new dt(r[0],r[1]),c=new dt(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(h.x-c.x)<n&&Math.abs(h.y-c.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));let L=(h.x+c.x)*.5,z=(c.y+h.y)*.5;r.unshift(L,z),r.push(L,z)}let f=s,p=r.length/2,m=r.length,g=f.length/2,_=a.width/2,b=_*_,y=a.miterLimit*a.miterLimit,w=r[0],E=r[1],v=r[2],S=r[3],P=0,R=0,A=-(E-S),C=w-v,M=0,B=0,k=Math.sqrt(A*A+C*C);A/=k,C/=k,A*=_,C*=_;let U=l,O=(1-U)*2,$=U*2;u||(a.cap==="round"?m+=fs(w-A*(O-$)*.5,E-C*(O-$)*.5,w-A*O,E-C*O,w+A*$,E+C*$,f,!0)+2:a.cap==="square"&&(m+=G0(w,E,A,C,O,$,!0,f))),f.push(w-A*O,E-C*O),f.push(w+A*$,E+C*$);for(let L=1;L<p-1;++L){w=r[(L-1)*2],E=r[(L-1)*2+1],v=r[L*2],S=r[L*2+1],P=r[(L+1)*2],R=r[(L+1)*2+1],A=-(E-S),C=w-v,k=Math.sqrt(A*A+C*C),A/=k,C/=k,A*=_,C*=_,M=-(S-R),B=v-P,k=Math.sqrt(M*M+B*B),M/=k,B/=k,M*=_,B*=_;let z=v-w,st=E-S,Q=v-P,bt=R-S,Bt=z*Q+st*bt,Mt=st*Q-bt*z,jt=Mt<0;if(Math.abs(Mt)<.001*Math.abs(Bt)){f.push(v-A*O,S-C*O),f.push(v+A*$,S+C*$),Bt>=0&&(a.join==="round"?m+=fs(v,S,v-A*O,S-C*O,v-M*O,S-B*O,f,!1)+4:m+=2,f.push(v-M*$,S-B*$),f.push(v+M*O,S+B*O));continue}let Zt=(-A+w)*(-C+S)-(-A+v)*(-C+E),xt=(-M+P)*(-B+S)-(-M+v)*(-B+R),ct=(z*xt-Q*Zt)/Mt,vt=(bt*Zt-st*xt)/Mt,Ot=(ct-v)*(ct-v)+(vt-S)*(vt-S),ee=v+(ct-v)*O,re=S+(vt-S)*O,He=v-(ct-v)*$,Ki=S-(vt-S)*$,_B=Math.min(z*z+st*st,Q*Q+bt*bt),o_=jt?O:$,bB=_B+o_*o_*b;Ot<=bB?a.join==="bevel"||Ot/b>y?(jt?(f.push(ee,re),f.push(v+A*$,S+C*$),f.push(ee,re),f.push(v+M*$,S+B*$)):(f.push(v-A*O,S-C*O),f.push(He,Ki),f.push(v-M*O,S-B*O),f.push(He,Ki)),m+=2):a.join==="round"?jt?(f.push(ee,re),f.push(v+A*$,S+C*$),m+=fs(v,S,v+A*$,S+C*$,v+M*$,S+B*$,f,!0)+4,f.push(ee,re),f.push(v+M*$,S+B*$)):(f.push(v-A*O,S-C*O),f.push(He,Ki),m+=fs(v,S,v-A*O,S-C*O,v-M*O,S-B*O,f,!1)+4,f.push(v-M*O,S-B*O),f.push(He,Ki)):(f.push(ee,re),f.push(He,Ki)):(f.push(v-A*O,S-C*O),f.push(v+A*$,S+C*$),a.join==="round"?jt?m+=fs(v,S,v+A*$,S+C*$,v+M*$,S+B*$,f,!0)+2:m+=fs(v,S,v-A*O,S-C*O,v-M*O,S-B*O,f,!1)+2:a.join==="miter"&&Ot/b<=y&&(jt?(f.push(He,Ki),f.push(He,Ki)):(f.push(ee,re),f.push(ee,re)),m+=2),f.push(v-M*O,S-B*O),f.push(v+M*$,S+B*$),m+=2)}w=r[(p-2)*2],E=r[(p-2)*2+1],v=r[(p-1)*2],S=r[(p-1)*2+1],A=-(E-S),C=w-v,k=Math.sqrt(A*A+C*C),A/=k,C/=k,A*=_,C*=_,f.push(v-A*O,S-C*O),f.push(v+A*$,S+C*$),u||(a.cap==="round"?m+=fs(v-A*(O-$)*.5,S-C*(O-$)*.5,v-A*O,S-C*O,v+A*$,S+C*$,f,!1)+2:a.cap==="square"&&(m+=G0(v,S,A,C,O,$,!1,f)));let N=1e-4*1e-4;for(let L=g;L<m+g-2;++L)w=f[L*2],E=f[L*2+1],v=f[(L+1)*2],S=f[(L+1)*2+1],P=f[(L+2)*2],R=f[(L+2)*2+1],!(Math.abs(w*(S-R)+v*(R-E)+P*(E-S))<N)&&o.push(L,L+1,L+2)}var L0=x(()=>{ar();U0()});function D0(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,c=e,u=r.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);h&&i.push(d+u-1,d)}var N0=x(()=>{});var Rc=J((K5,rm)=>{"use strict";rm.exports=Pc;rm.exports.default=Pc;function Pc(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=V0(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,h,c,u,d,f;if(i&&(o=FF(r,t,o,e)),r.length>80*e){a=h=r[0],l=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+1],u<a&&(a=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return sa(o,n,e,a,l,f,0),n}function V0(r,t,e,i,s){var o,n;if(s===em(r,t,e,i)>0)for(o=t;o<e;o+=i)n=H0(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=H0(o,r[o],r[o+1],n);return n&&Cc(n,n.next)&&(na(n),n=n.next),n}function ps(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Cc(e,e.next)||$t(e.prev,e,e.next)===0)){if(na(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function sa(r,t,e,i,s,o,n){if(r){!n&&o&&LF(r,i,s,o);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,o?MF(r,i,s,o):RF(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),na(r),r=h.next,a=h.next;continue}if(r=h,r===a){n?n===1?(r=IF(ps(r),t,e),sa(r,t,e,i,s,o,2)):n===2&&BF(r,t,e,i,s,o):sa(ps(r),t,e,i,s,o,1);break}}}}function RF(r){var t=r.prev,e=r,i=r.next;if($t(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,h=i.y,c=s<o?s<n?s:n:o<n?o:n,u=a<l?a<h?a:h:l<h?l:h,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>h?a:h:l>h?l:h,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&yo(s,a,o,l,n,h,p.x,p.y)&&$t(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function MF(r,t,e,i){var s=r.prev,o=r,n=r.next;if($t(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,h=n.x,c=s.y,u=o.y,d=n.y,f=a<l?a<h?a:h:l<h?l:h,p=c<u?c<d?c:d:u<d?u:d,m=a>l?a>h?a:h:l>h?l:h,g=c>u?c>d?c:d:u>d?u:d,_=Jp(f,p,t,e,i),b=Jp(m,g,t,e,i),y=r.prevZ,w=r.nextZ;y&&y.z>=_&&w&&w.z<=b;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==s&&y!==n&&yo(a,c,l,u,h,d,y.x,y.y)&&$t(y.prev,y,y.next)>=0||(y=y.prevZ,w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==s&&w!==n&&yo(a,c,l,u,h,d,w.x,w.y)&&$t(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==s&&y!==n&&yo(a,c,l,u,h,d,y.x,y.y)&&$t(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;w&&w.z<=b;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==s&&w!==n&&yo(a,c,l,u,h,d,w.x,w.y)&&$t(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function IF(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!Cc(s,o)&&W0(s,i,i.next,o)&&oa(s,o)&&oa(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),na(i),na(i.next),i=r=o),i=i.next}while(i!==r);return ps(i)}function BF(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&HF(n,a)){var l=z0(n,a);n=ps(n,n.next),l=ps(l,l.next),sa(n,t,e,i,s,o,0),sa(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function FF(r,t,e,i){var s=[],o,n,a,l,h;for(o=0,n=t.length;o<n;o++)a=t[o]*i,l=o<n-1?t[o+1]*i:r.length,h=V0(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(NF(h));for(s.sort(kF),o=0;o<s.length;o++)e=UF(s[o],e);return e}function kF(r,t){return r.x-t.x}function UF(r,t){var e=GF(r,t);if(!e)return t;var i=z0(e,r);return ps(i,i.next),ps(e,e.next)}function GF(r,t){var e=t,i=r.x,s=r.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))return n}e=e.next}while(e!==t);if(!n)return null;var l=n,h=n.x,c=n.y,u=1/0,d;e=n;do i>=e.x&&e.x>=h&&i!==e.x&&yo(s<c?i:o,s,h,c,s<c?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),oa(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&OF(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function OF(r,t){return $t(r.prev,r,t.prev)<0&&$t(t.next,r,r.next)<0}function LF(r,t,e,i){var s=r;do s.z===0&&(s.z=Jp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,DF(s)}function DF(r){var t,e,i,s,o,n,a,l,h=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<h&&(a++,i=i.nextZ,!!i);t++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,h*=2}while(n>1);return r}function Jp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function NF(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function yo(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function HF(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!VF(r,t)&&(oa(r,t)&&oa(t,r)&&WF(r,t)&&($t(r.prev,r,t.prev)||$t(r,t.prev,t))||Cc(r,t)&&$t(r.prev,r,r.next)>0&&$t(t.prev,t,t.next)>0)}function $t(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cc(r,t){return r.x===t.x&&r.y===t.y}function W0(r,t,e,i){var s=Ac($t(r,t,e)),o=Ac($t(r,t,i)),n=Ac($t(e,i,r)),a=Ac($t(e,i,t));return!!(s!==o&&n!==a||s===0&&Ec(r,e,t)||o===0&&Ec(r,i,t)||n===0&&Ec(e,r,i)||a===0&&Ec(e,t,i))}function Ec(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ac(r){return r>0?1:r<0?-1:0}function VF(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&W0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function oa(r,t){return $t(r.prev,r,r.next)<0?$t(r,t,r.next)>=0&&$t(r,r.prev,t)>=0:$t(r,t,r.prev)<0||$t(r,r.next,t)<0}function WF(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function z0(r,t){var e=new tm(r.i,r.x,r.y),i=new tm(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function H0(r,t,e,i){var s=new tm(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function na(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function tm(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Pc.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(em(r,0,o,e));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,c=a<l-1?t[a+1]*e:r.length;n-=Math.abs(em(r,h,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function em(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}Pc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function Mc(r,t,e,i,s,o,n){let a=(0,$0.default)(r,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*i;for(let h=0;h<r.length;h+=2)e[l]=r[h],e[l+1]=r[h+1],l+=i}var $0,im=x(()=>{$0=Zi(Rc(),1)});var zF,X0,j0=x(()=>{F();im();zF=[],X0={extension:{type:T.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){Mc(r,zF,t,e,i,s,o)}}});var Y0,q0=x(()=>{F();Y0={extension:{type:T.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var K0,Z0=x(()=>{F();K0={extension:{type:T.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function J0(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function tT(r,t){let e=Y.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function $F(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&(j("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??Xe.defaultLinearOptions.textureSize}),t}var Q0,om,Xe,_o=x(()=>{ve();Ft();mt();so();Tt();Se();Wt();Kf();Q0=[{offset:0,color:"white"},{offset:1,color:"black"}],om=class sm{constructor(...t){this.uid=ut("fillGradient"),this.type="linear",this.colorStops=[];let e=$F(t);e={...e.type==="radial"?sm.defaultRadialOptions:sm.defaultLinearOptions,...Kh(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:ot.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=i,i=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let l=this.colorStops.length?this.colorStops:Q0,h=this._textureSize,{canvas:c,context:u}=tT(h,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);J0(d,l),u.fillStyle=d,u.fillRect(0,0,h,1),this.texture=new I({source:new ze({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new G;m.scale(f/h,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(h,h),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Q0,e=this._textureSize,{canvas:i,context:s}=tT(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=a-c,d=l-c,f=e/(c*2),p=(o-u)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,h*f,(a-u)*f,(l-d)*f,c*f);J0(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new I({source:new ze({resource:i,addressMode:this._wrapMode})});let _=new G;_.scale(1/f,1/f),_.translate(u,d),this.textureSpace==="local"&&_.scale(e,e),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};om.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};om.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Xe=om});function eT(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(jF);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,c=1/n.height,u=-a*h,d=-l*c,f=s.a,p=s.b,m=s.c,g=s.d;s.a*=h,s.b*=h,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*g+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Xe)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(XF.copyFrom(i).invert()),s}var XF,jF,rT=x(()=>{mt();he();_o();XF=new G,jF=new tt});function sT(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")KF(o.data,i,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&&iT(h.shapePath,l,!0,i,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),iT(a,l,n,i,e)}}}function KF(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,l=[],h=Ic.rectangle,c=YF,u=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;let d=r.transform;h.build(c,l),d&&Zp(l,d),h.triangulate(l,i,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=it.get(ds);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=u,p.geometryData=e,t.push(p)}function iT(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=Ic[l.type],m="triangle-list";if(p.build(l,f),h&&Zp(f,h),e){let y=l.closePath??!0,w=t;w.pixelLine?(D0(f,y,o,a),m="line-list"):O0(f,w,!1,y,o,a)}else if(c){let y=[],w=f.slice();ZF(c).forEach(v=>{y.push(w.length/2),w.push(...v)}),Mc(w,y,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let g=n.length/2,_=t.texture;if(_!==I.WHITE){let y=eT(qF,t,l,h);P0(o,2,d,n,g,2,o.length/2-d,y)}else C0(n,g,2,o.length/2-d);let b=it.get(ds);b.indexOffset=u,b.indexSize=a.length-u,b.attributeOffset=d,b.attributeSize=o.length/2-d,b.baseColor=t.color,b.alpha=t.alpha,b.texture=_,b.geometryData=s,b.topology=m,i.push(b)})}function ZF(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];Ic[i.type].build(i,s),t.push(s)}return t}var Ic,YF,qF,oT=x(()=>{F();mt();he();R0();M0();Tt();Be();Qp();F0();L0();N0();j0();q0();Z0();rT();im();Ic={};H.handleByMap(T.ShapeBuilder,Ic);H.add(Y0,X0,K0,xo,I0,B0);YF=new tt,qF=new G});var nm,am,hm,bo,Bc=x(()=>{F();xc();Kp();Yf();Wt();Be();oT();nm=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},am=class{constructor(){this.batcher=new ia,this.instructions=new Ks}init(){this.instructions.reset()}get geometry(){return j(A_,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},hm=class lm{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){lm.defaultOptions.bezierSmoothness=t?.bezierSmoothness??lm.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),sT(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=it.get(am),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<i.length;c++){let u=i[c];a.add(u)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let h=a.batches;for(let c=0;c<h.length;c++){let u=h[c];u.bindGroup=ao(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new nm;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]&&(it.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{it.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};hm.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"graphicsContext"};hm.defaultOptions={bezierSmoothness:.5};bo=hm});var QF,cm,um,dm,fm,pm,mm,gm,Qt,Sr=x(()=>{"use strict";QF={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},cm=0,um=1,dm=2,fm=3,pm=4,mm=5,gm=class nT{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<cm)}set blend(t){!!(this.data&1<<cm)!==t&&(this.data^=1<<cm)}get offsets(){return!!(this.data&1<<um)}set offsets(t){!!(this.data&1<<um)!==t&&(this.data^=1<<um)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<dm)}set culling(t){!!(this.data&1<<dm)!==t&&(this.data^=1<<dm)}get depthTest(){return!!(this.data&1<<fm)}set depthTest(t){!!(this.data&1<<fm)!==t&&(this.data^=1<<fm)}get depthMask(){return!!(this.data&1<<mm)}set depthMask(t){!!(this.data&1<<mm)!==t&&(this.data^=1<<mm)}get clockwiseFrontFace(){return!!(this.data&1<<pm)}set clockwiseFrontFace(t){!!(this.data&1<<pm)!==t&&(this.data^=1<<pm)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=QF[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 nT;return t.depthTest=!1,t.blend=!0,t}};gm.default2d=gm.for2d();Qt=gm});function Nr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var vo=x(()=>{"use strict"});var aa,aT=x(()=>{F();Sr();Be();vo();Qp();aa=class{constructor(t,e){this.state=Qt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let s=e[i];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=it.get(ds);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{it.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};aa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"graphics"}});var xm=x(()=>{F();Bc();aT();H.add(aa);H.add(bo)});var Ui,Fc=x(()=>{"use strict";Ui=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var la,lT=x(()=>{F();mt();Mi();Ge();Qn();Be();vo();Fc();la=class{constructor(t,e){this.localUniforms=new Ct({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new xe({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(it.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=si(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Nr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=it.get(Ui);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&it.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};la.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"mesh"}});var ym=x(()=>{F();lT();H.add(la)});var kc,hT=x(()=>{"use strict";kc=class{execute(t,e){let i=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let 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 _m(r,t=null){let e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var cT=x(()=>{"use strict"});function dT(r){return{dynamicUpdate:uT(r,!0),staticUpdate:uT(r,!1)}}function uT(r,t){let e=[];e.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -264,7 +264,7 @@ ${s.join(`
264
264
  `),e.unshift(`
265
265
  var stride = ${i};
266
266
  `);let s=e.join(`
267
- `);return new Function("ps","f32v","u32v",s)}var dT=x(()=>{cs()});function QF(r){let t=[];for(let e in r){let i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var Uc,fT=x(()=>{Ii();oi();lo();cs();Ip();hT();dT();Uc=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,i=t.properties,s=0,o=0;for(let c in i){let u=i[c],d=$e(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new kr(e*4*s),this.dynamicAttributeBuffer=new kr(e*4*o),this.indexBuffer=ym(e);let n=new hr,a=0,l=0;this._staticBuffer=new Yt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ht.VERTEX|ht.COPY_DST}),this._dynamicBuffer=new Yt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ht.VERTEX|ht.COPY_DST});for(let c in i){let u=i[c],d=$e(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:u.format}),l+=d.size)}n.addIndex(this.indexBuffer);let h=this.getParticleUpdate(i);this._dynamicUpload=h.dynamicUpdate,this._staticUpload=h.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=QF(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return uT(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new kr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new kr(this._size*this._dynamicStride*4*4),this.indexBuffer=ym(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var pT,mT=x(()=>{pT=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var fT=x(()=>{us()});function JF(r){let t=[];for(let e in r){let i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var Uc,pT=x(()=>{Ii();oi();lo();us();Bp();cT();fT();Uc=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,i=t.properties,s=0,o=0;for(let c in i){let u=i[c],d=$e(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new kr(e*4*s),this.dynamicAttributeBuffer=new kr(e*4*o),this.indexBuffer=_m(e);let n=new hr,a=0,l=0;this._staticBuffer=new Yt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ht.VERTEX|ht.COPY_DST}),this._dynamicBuffer=new Yt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ht.VERTEX|ht.COPY_DST});for(let c in i){let u=i[c],d=$e(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:u.format}),l+=d.size)}n.addIndex(this.indexBuffer);let h=this.getParticleUpdate(i);this._dynamicUpload=h.dynamicUpdate,this._staticUpload=h.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=JF(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return dT(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new kr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new kr(this._size*this._dynamicStride*4*4),this.indexBuffer=_m(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var mT,gT=x(()=>{mT=`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 gT,xT=x(()=>{gT=`attribute vec2 aVertex;
275
+ }`});var xT,yT=x(()=>{xT=`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 _m,yT=x(()=>{_m=`
314
+ `});var bm,_T=x(()=>{bm=`
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 Gc,_T=x(()=>{ve();mt();hs();co();Tr();Tt();Kf();mT();xT();yT();Gc=class extends qt{constructor(){let t=cr.from({vertex:gT,fragment:pT}),e=ur.from({fragment:{source:_m,entryPoint:"mainFragment"},vertex:{source:_m,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new Zh({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new ot(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var To,bm=x(()=>{mt();Ge();Qn();Sr();vo();fT();_T();To=class{constructor(t,e){this.state=Qt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ct({uTranslationMatrix:{value:new G,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 Gc,this.state=Qt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Uc({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=si(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var ha,bT=x(()=>{F();lT();bm();ha=class extends To{constructor(t){super(t,new kc)}};ha.extension={type:[T.WebGLPipes],name:"particle"}});var Oc,vT=x(()=>{"use strict";Oc=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var ca,TT=x(()=>{F();vT();bm();ca=class extends To{constructor(t){super(t,new Oc)}};ca.extension={type:[T.WebGPUPipes],name:"particle"}});var vm=x(()=>{F();bT();TT();H.add(ha);H.add(ca)});var Hr,ua=x(()=>{"use strict";Hr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function da(r,t){let{texture:e,bounds:i}=r;hc(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Tm=x(()=>{bp()});var fa,ST=x(()=>{F();Be();ua();Tm();fa=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),it.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,da(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:it.get(Hr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};fa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"}});var Sm,je,So=x(()=>{Ft();Gn();Sm=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=Y.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ei(t),e=ei(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},je=new Sm});function wT(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function ET(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function AT(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,l=0,h=e-1,c=i-1;for(;l<i&&wT(n,e,l);)++l;if(l===i)return tt.EMPTY;for(;wT(n,e,c);)--c;for(;ET(n,e,a,l,c);)++a;for(;ET(n,e,h,l,c);)--h;return++h,++c,new tt(a/t,l/t,(h-a)/t,(c-l)/t)}var PT=x(()=>{he()});var CT,ai,Lc=x(()=>{mt();Se();CT={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ai=class{constructor(t,e){this.uid=ut("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=CT[e].addressModeU,t.source.style.addressModeV=CT[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 MT=J((y8,RT)=>{RT.exports=t2;var wm={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},JF=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function t2(r){var t=[];return r.replace(JF,function(e,i,s){var o=i.toLowerCase();for(s=r2(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==wm[o])return s.unshift(i),t.push(s);if(s.length<wm[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,wm[o])))}}),t}var e2=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function r2(r){var t=r.match(e2);return t?t.map(Number):[]}});function BT(r,t){let e=(0,IT.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],h=l[0],c=l;switch(h){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:V(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var IT,FT=x(()=>{IT=Ki(MT(),1);Pt()});var Dc,kT=x(()=>{he();Dc=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new tt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Nc,UT=x(()=>{he();Nc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,h=o-l,c=n-l,u=o+a,d=n+a,f=t-this.x,p=e-this.y,g=f*f/(h*h)+p*p/(c*c),m=f*f/(u*u)+p*p/(d*d);return g>1&&m<=1}getBounds(t){return t||(t=new tt),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function GT(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,h=o-i,c=n*l+a*h,u=l*l+h*h,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=i):d>1?(f=s,p=o):(f=e+d*l,p=i+d*h);let g=r-f,m=t-p;return g*g+m*m}var OT=x(()=>{"use strict"});var i2,s2,wo,LT=x(()=>{OT();he();wo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],l=e[(s+3)%i];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(i2),i=t.getBounds(s2);if(!e.containsRect(i))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;c<h;c+=2){let u=l[c],d=l[c+1],f=l[(c+2)%l.length],p=l[(c+3)%l.length],g=GT(t,e,u,d,f,p),m=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(g<=(m<0?a:n))return!0}return!1}getBounds(t){t||(t=new tt);let e=this.points,i=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],c=e[a+1];i=h<i?h:i,s=h>s?h:s,o=c<o?c:o,n=c>n?c:n}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Hc,Vc,DT=x(()=>{he();Hc=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},Vc=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new tt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,c=i*(1-s),u=i-c,d=o+h,f=n+h,p=a-h*2,g=l-h*2,m=o+a,_=n+l;return(t>=o-c&&t<=o+u||t>=m-u&&t<=m+c)&&e>=f&&e<=f+g||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&Hc(t,e,d,f,h,u,c)||t>m-h&&e<f&&Hc(t,e,m-h,f,h,u,c)||t>m-h&&e>_-h&&Hc(t,e,m-h,_-h,h,u,c)||t<d&&e>_-h&&Hc(t,e,d,_-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function zc(r,t,e,i,s,o,n,a,l,h){let u=Math.min(.99,Math.max(0,h??bo.defaultOptions.bezierSmoothness)),d=(n2-u)/1;return d*=d,a2(t,e,i,s,o,n,a,l,r,d),r}function a2(r,t,e,i,s,o,n,a,l,h){Am(r,t,e,i,s,o,n,a,l,h,0),l.push(n,a)}function Am(r,t,e,i,s,o,n,a,l,h,c){if(c>o2)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,p=(e+s)/2,g=(i+o)/2,m=(s+n)/2,_=(o+a)/2,b=(d+p)/2,y=(f+g)/2,w=(p+m)/2,E=(g+_)/2,v=(b+w)/2,S=(y+E)/2;if(c>0){let P=n-r,R=a-t,A=Math.abs((e-n)*R-(i-a)*P),C=Math.abs((s-n)*R-(o-a)*P),M,B;if(A>Wc&&C>Wc){if((A+C)*(A+C)<=h*(P*P+R*R)){if(Eo<Em){l.push(v,S);return}let k=Math.atan2(o-i,s-e);if(M=Math.abs(k-Math.atan2(i-t,e-r)),B=Math.abs(Math.atan2(a-o,n-s)-k),M>=u&&(M=2*u-M),B>=u&&(B=2*u-B),M+B<Eo){l.push(v,S);return}if(ps!==0){if(M>ps){l.push(e,i);return}if(B>ps){l.push(s,o);return}}}}else if(A>Wc){if(A*A<=h*(P*P+R*R)){if(Eo<Em){l.push(v,S);return}if(M=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),M>=u&&(M=2*u-M),M<Eo){l.push(e,i),l.push(s,o);return}if(ps!==0&&M>ps){l.push(e,i);return}}}else if(C>Wc){if(C*C<=h*(P*P+R*R)){if(Eo<Em){l.push(v,S);return}if(M=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),M>=u&&(M=2*u-M),M<Eo){l.push(e,i),l.push(s,o);return}if(ps!==0&&M>ps){l.push(s,o);return}}}else if(P=v-(r+n)/2,R=S-(t+a)/2,P*P+R*R<=h){l.push(v,S);return}}Am(r,t,d,f,b,y,v,S,l,h,c+1),Am(v,S,w,E,m,_,n,a,l,h,c+1)}var o2,Wc,n2,Em,Eo,ps,Pm=x(()=>{Bc();o2=8,Wc=11920929e-14,n2=1,Em=.01,Eo=0,ps=0});function HT(r,t,e,i,s,o,n,a){let h=Math.min(.99,Math.max(0,a??bo.defaultOptions.bezierSmoothness)),c=(c2-h)/1;return c*=c,d2(t,e,i,s,o,n,r,c),r}function d2(r,t,e,i,s,o,n,a){Cm(n,r,t,e,i,s,o,a,0),n.push(s,o)}function Cm(r,t,e,i,s,o,n,a,l){if(l>l2)return;let h=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,p=(c+d)/2,g=(u+f)/2,m=o-t,_=n-e,b=Math.abs((i-o)*_-(s-n)*m);if(b>h2){if(b*b<=a*(m*m+_*_)){if(NT<u2){r.push(p,g);return}let y=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(y>=h&&(y=2*h-y),y<NT){r.push(p,g);return}}}else if(m=p-(t+o)/2,_=g-(e+n)/2,m*m+_*_<=a){r.push(p,g);return}Cm(r,t,e,c,u,p,g,a,l+1),Cm(r,p,g,d,f,o,n,a,l+1)}var l2,h2,c2,u2,NT,VT=x(()=>{Bc();l2=8,h2=11920929e-14,c2=1,u2=.01,NT=0});function $c(r,t,e,i,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(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,c=s;h*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*i,g=e+f*i;r.push(p,g),c+=h}}var Rm=x(()=>{"use strict"});function WT(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,h=n-t,c=s-e,u=i-t,d=Math.abs(l*u-h*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+h*h,p=c*c+u*u,g=l*c+h*u,m=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,b=m*g/f,y=_*g/p,w=m*u+_*h,E=m*c+_*l,v=h*(_+b),S=l*(_+b),P=u*(m+y),R=c*(m+y),A=Math.atan2(S-E,v-w),C=Math.atan2(R-E,P-w);$c(r,w+t,E+e,o,A,C,h*c>u*l)}var zT=x(()=>{Rm()});function f2(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function XT(r,t,e,i,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let c=Math.sin(a*pa/360),u=Math.cos(a*pa/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),p2(t,e,i,s,o,n,l,h,c,u,d,f,Mm);let{ang1:g,ang2:m}=Mm,{centerX:_,centerY:b}=Mm,y=Math.abs(m)/(pa/4);Math.abs(1-y)<1e-7&&(y=1);let w=Math.max(Math.ceil(y),1);m/=w;let E=r[r.length-2],v=r[r.length-1],S={x:0,y:0};for(let P=0;P<w;P++){let R=f2(g,m),{x:A,y:C}=Im(R[0],o,n,u,c,_,b,S),{x:M,y:B}=Im(R[1],o,n,u,c,_,b,S),{x:k,y:U}=Im(R[2],o,n,u,c,_,b,S);zc(r,E,v,A,C,M,B,k,U),E=k,v=U,g+=m}}var pa,Mm,Im,$T,p2,jT=x(()=>{Pm();pa=Math.PI*2,Mm={centerX:0,centerY:0,ang1:0,ang2:0},Im=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let h=s*r-o*t,c=o*r+s*t;return l.x=h+n,l.y=c+a,l};$T=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},p2=(r,t,e,i,s,o,n,a,l,h,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),g=Math.pow(c,2),m=Math.pow(u,2),_=f*p-f*m-p*g;_<0&&(_=0),_/=f*m+p*g,_=Math.sqrt(_)*(n===a?-1:1);let b=_*s/o*u,y=_*-o/s*c,w=h*b-l*y+(r+e)/2,E=l*b+h*y+(t+i)/2,v=(c-b)/s,S=(u-y)/o,P=(-c-b)/s,R=(-u-y)/o,A=$T(1,0,v,S),C=$T(v,S,P,R);a===0&&C>0&&(C-=pa),a===1&&C<0&&(C+=pa),d.centerX=w,d.centerY=E,d.ang1=A,d.ang2=C}});function YT(r,t,e){let i=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,c=Math.sqrt(l*l+h*h),u=l/c,d=h/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let h=t[(n+1)%t.length],c=i(a,o),u=i(a,h);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let g=d/2,m,_=Math.abs(Math.cos(g)*l/Math.sin(g));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),m=Math.abs(_*Math.sin(g)/Math.cos(g))):m=l;let b=a.x+u.nx*_+-u.ny*m*f,y=a.y+u.ny*_+u.nx*m*f,w=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(b+Math.cos(w)*m,y+Math.sin(w)*m),r.arc(b,y,m,w,E,p),o=a}}function qT(r,t,e,i){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?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,l),f;if(d<1e-4)f=l;else{let m=Math.min(d/2,h);f=o(l,c,m/d)}let p=s(u,l),g;if(p<1e-4)g=l;else{let m=Math.min(p/2,h);g=o(l,u,m/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,g.x,g.y,i)}}var KT=x(()=>{"use strict"});var m2,Xc,ZT=x(()=>{kT();UT();LT();he();DT();Ve();Pm();VT();Rm();zT();jT();KT();m2=new tt,Xc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new At,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return $c(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return WT(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return XT(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return zc(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return HT(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,h=o?.shape;h&&h.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new tt(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new Dc(t,e,i),s),this}poly(t,e,i){let s=new wo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,h=[];for(let c=0;c<s;c++){let u=a-c*l;h.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(h,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let h=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+h,p=t+i*Math.cos(f),g=e+i*Math.sin(f),m=f+Math.PI+u,_=f-Math.PI-u,b=p+o*Math.cos(m),y=g+o*Math.sin(m),w=p+o*Math.cos(_),E=g+o*Math.sin(_);d===0?this.moveTo(b,y):this.lineTo(b,y),this.quadraticCurveTo(p,g,w,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?qT(this,t,e,s):YT(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+i,h=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(l-u,e).arcTo(l-c,e+c,l,e+u,u).lineTo(l,h-u).arcTo(l-c,h-c,t+i-u,h,u).lineTo(t+u,h).arcTo(t+c,h-c,t,h-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),l=t+i,h=e+s,c=[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 u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,i,s,o){return this.drawShape(new Nc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Vc(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new wo,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new wo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds(m2);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function ma(r,t){return r?r.prepend(t):t.clone()}var Gi,Bm=x(()=>{ar();Se();Pt();FT();ZT();Gi=class r{constructor(t,e=!1){this.instructions=[],this.uid=ut("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?BT(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Xc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(dt.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 c=a.x,u=a.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(dt.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,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=i*2,c=Math.PI*2/h,u=[];for(let d=0;d<h;d++){let f=d%2?o:s,p=d*c+l;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,h=0,c=0,u=0,d=0,f=0,p=0,g=0;for(let m=0;m<this.instructions.length;m++){let _=this.instructions[m],b=_.data;switch(_.action){case"moveTo":case"lineTo":l=b[0],h=b[1],b[0]=e*l+s*h+n,b[1]=i*l+o*h+a;break;case"bezierCurveTo":c=b[0],u=b[1],d=b[2],f=b[3],l=b[4],h=b[5],b[0]=e*c+s*u+n,b[1]=i*c+o*u+a,b[2]=e*d+s*f+n,b[3]=i*d+o*f+a,b[4]=e*l+s*h+n,b[5]=i*l+o*h+a;break;case"quadraticCurveTo":c=b[0],u=b[1],l=b[2],h=b[3],b[0]=e*c+s*u+n,b[1]=i*c+o*u+a,b[2]=e*l+s*h+n,b[3]=i*l+o*h+a;break;case"arcToSvg":l=b[5],h=b[6],p=b[0],g=b[1],b[0]=e*p+s*g,b[1]=i*p+o*g,b[5]=e*l+s*h+n,b[6]=i*l+o*h+a;break;case"circle":b[4]=ma(b[3],t);break;case"rect":b[4]=ma(b[4],t);break;case"ellipse":b[8]=ma(b[8],t);break;case"roundRect":b[5]=ma(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=ma(b[2],t);break;default:V("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Nt(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var Fm=x(()=>{"use strict"});function QT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=g2(n);break;case"radialgradient":t.defs[n.id]=x2(n);break;default:break}}}}function g2(r){let t=Nt(r,"x1",0),e=Nt(r,"y1",0),i=Nt(r,"x2",1),s=Nt(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new Xe(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],h=Nt(l,"offset",0),c=ot.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(h,c)}return n}function x2(r){return V("[SVG Parser] Radial gradients are not yet supported"),new Xe(0,0,1,0)}var JT=x(()=>{ve();Pt();_o();Fm()});function km(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var tS=x(()=>{"use strict"});function Um(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in eS){let a=r.getAttribute(n);a&&rS(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,c]=l.split(":");eS[h]&&rS(t,o,h,c.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function rS(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=km(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=ot.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=km(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=ot.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var eS,iS=x(()=>{ve();tS();eS={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 sS(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Gi};QT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Um(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&oS(a,e,s,o)}return t}function oS(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Um(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let l,h,c,u,d,f,p,g,m,_,b,y,w,E,v,S,P;switch(r.nodeName.toLowerCase()){case"path":E=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&V("SVG Evenodd fill rule not supported, your svg may render incorrectly"),v=new Gi(E,!0),t.context.path(v),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":p=Nt(r,"cx",0),g=Nt(r,"cy",0),m=Nt(r,"r",0),t.context.ellipse(p,g,m,m),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Nt(r,"x",0),h=Nt(r,"y",0),S=Nt(r,"width",0),P=Nt(r,"height",0),_=Nt(r,"rx",0),b=Nt(r,"ry",0),_||b?t.context.roundRect(l,h,S,P,_||b):t.context.rect(l,h,S,P),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Nt(r,"cx",0),g=Nt(r,"cy",0),_=Nt(r,"rx",0),b=Nt(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,_,b),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Nt(r,"x1",0),u=Nt(r,"y1",0),d=Nt(r,"x2",0),f=Nt(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":w=r.getAttribute("points"),y=w.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(y,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=r.getAttribute("points"),y=w.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(y,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{V(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<s.length;R++)oS(s[R],t,e,i)}var nS=x(()=>{Pt();Bm();JT();Fm();iS()});function y2(r){return ot.isColorLike(r)}function aS(r){return r instanceof ai}function lS(r){return r instanceof Xe}function _2(r){return r instanceof I}function b2(r,t,e){let i=ot.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=I.WHITE,{...e,...r}}function v2(r,t,e){return r.texture=t,{...e,...r}}function hS(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function cS(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function T2(r,t){let e={...t,...r},i=ot.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function li(r,t){if(r==null)return null;let e={},i=r;return y2(r)?b2(e,r,t):_2(r)?v2(e,r,t):aS(r)?hS(e,r,t):lS(r)?cS(e,r,t):i.fill&&aS(i.fill)?hS(i,i.fill,t):i.fill&&lS(i.fill)?cS(i,i.fill,t):T2(i,t)}function Ao(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=li(r,l);return h?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var Gm=x(()=>{ve();Tt();_o();Lc()});var S2,uS,Om,Oe,jc=x(()=>{Ae();ve();mt();ar();Tt();Se();Wt();Ve();Bm();nS();Gm();S2=new dt,uS=new G,Om=class Vr extends It{constructor(){super(...arguments),this.uid=ut("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Gi,this._transform=new G,this._fillStyle={...Vr.defaultFillStyle},this._strokeStyle={...Vr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new At,this._boundsDirty=!0}clone(){let t=new Vr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=li(t,Vr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ao(t,Vr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=li(t,Vr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=li(t,Vr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?ot.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Gi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(j(rt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=li(t,Vr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(dt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Ao(t,Vr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,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*i+l.c*s+l.tx,l.b*i+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,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,sS(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof G?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof G?(this._transform.append(t),this):(uS.set(t,e,i,s,o,n),this._transform.append(uS),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),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!1;let e=this.instructions,i=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,h=a.shapePath.shapePrimitives;for(let c=0;c<h.length;c++){let u=h[c].shape;if(!l||!u)continue;let d=h[c].transform,f=d?d.applyInverse(t,S2):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let g=l;i=u.strokeContains(f.x,f.y,g.width,g.alignment)}let p=n.hole;if(p){let g=p.shapePath?.shapePrimitives;if(g)for(let m=0;m<g.length;m++)g[m].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Om.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};Om.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Oe=Om});function Yc(r){let t=[],e=0;for(let i=0;i<dS.length;i++){let s=`_${dS[i]}`;t[e++]=r[s]}return e=fS(r._fill,t,e),e=w2(r._stroke,t,e),e=E2(r.dropShadow,t,e),t.join("-")}function fS(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function w2(r,t,e){return r&&(e=fS(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function E2(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=ot.shared.setValue(r.color).toNumber()),e}var dS,Lm=x(()=>{ve();dS=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function A2(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Ht.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){j(rt,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(ot.isColorLike(e))i.color=e;else if(e instanceof Xe||e instanceof ai)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){j(rt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Ht.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new Xe({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>ot.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Dm,Ht,ms=x(()=>{Ae();ve();Wt();_o();Lc();jc();Gm();Lm();Dm=class Po extends It{constructor(t={}){super(),A2(t);let e={...Po.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Po.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Po.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Oe.defaultFillStyle,...t},()=>{this._fill=li({...this._originalFill},Oe.defaultFillStyle)})),this._fill=li(t===0?"black":t,Oe.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Oe.defaultStrokeStyle,...t},()=>{this._stroke=Ao({...this._originalStroke},Oe.defaultStrokeStyle)})),this._stroke=Ao(t,Oe.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Yc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Po.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Po({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(ot.isColorLike(t)||t instanceof Xe||t instanceof ai)}};Dm.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Dm.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Ht=Dm});function qc(r,t,e,i){let s=P2;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=zt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var P2,Nm=x(()=>{Si();Ve();P2=new At});function gs(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!C2.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var C2,Kc=x(()=>{"use strict";C2=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Hm,wr,Jt,ga=x(()=>{Ft();Kc();Hm={willReadFrequently:!0},wr=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){let e=Y.get().getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",e,i=q._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=gs(e),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=q.__context;l.font=n;let c=(s?q._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let b=0;b<c.length;b++){let y=q._measureText(c[b],e.letterSpacing,l);u[b]=y,d=Math.max(d,y)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,m=Math.max(g,a.fontSize+f)+(c.length-1)*(g+e.leading);return e.dropShadow&&(m+=e.dropShadow.distance),new q(t,e,p,m,c,u,g+e.leading,d,a)}static _measureText(t,e,i){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,h=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,h-=e;else{let c=(q.graphemeSegmenter(t).length-1)*e;n+=c,h+=c}return Math.max(n,h)}static _wordWrap(t,e,i=q._canvas){let s=i.getContext("2d",Hm),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=q._collapseSpaces(c),d=q._collapseNewlines(c),f=!u,p=e.wordWrapWidth+h,g=q._tokenize(t);for(let m=0;m<g.length;m++){let _=g[m];if(q._isNewline(_)){if(!d){a+=q._addLine(n),f=!u,n="",o=0;continue}_=" "}if(u){let y=q.isBreakingSpace(_),w=q.isBreakingSpace(n[n.length-1]);if(y&&w)continue}let b=q._getFromCache(_,h,l,s);if(b>p)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,e.breakWords)){let y=q.wordWrapSplit(_);for(let w=0;w<y.length;w++){let E=y[w],v=E,S=1;for(;y[w+S];){let R=y[w+S];if(!q.canBreakChars(v,R,_,w,e.breakWords))E+=R;else break;v=R,S++}w+=S-1;let P=q._getFromCache(E,h,l,s);P+o>p&&(a+=q._addLine(n),f=!1,n="",o=0),n+=E,o+=P}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let y=m===g.length-1;a+=q._addLine(_,!y),f=!1,n="",o=0}else b+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=b)}return a+=q._addLine(n,!1),a}static _addLine(t,e=!0){return t=q._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=q._measureText(t,e,s)+e,i[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let i=t[e];if(!q.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(q.isBreakingSpace(o,n)||q._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];let e=q._context;e.font=t;let i=e.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return q._fonts[t]=s,s}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){if(!q.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Hm)?.measureText)return q.__canvas=e,e;t=Y.get().createCanvas()}catch{t=Y.get().createCanvas()}t.width=t.height=10,q.__canvas=t}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",Hm)),q.__context}};wr.METRICS_STRING="|\xC9q\xC5";wr.BASELINE_SYMBOL="M";wr.BASELINE_MULTIPLIER=1.4;wr.HEIGHT_MULTIPLIER=2;wr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();wr.experimentalLetterSpacing=!1;wr._fonts={};wr._newlines=[10,13];wr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];wr._measurementCache={};Jt=wr});function Co(r,t,e,i=0){if(r.texture===I.WHITE&&!r.fill)return ot.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ai){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof Xe){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let h,c=!1;if(o){let{start:u,end:d}=s;h=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;h=t.createRadialGradient(u.x*a,u.y*l,d*a,f.x*a,f.y*l,p*a)}if(c&&n&&e){let u=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let g=f+p.offset*u;h.addColorStop(Math.floor(g*pS)/pS,ot.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{h.addColorStop(u.offset,ot.shared.setValue(u.color).toHex())});return h}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(G.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return V("FillStyle not recognised",r),"red"}var pS,Vm=x(()=>{ve();mt();Tt();Pt();_o();Lc();pS=1e5});var xa,mS=x(()=>{ve();F();Gn();So();Si();PT();Wt();ms();Nm();ga();Kc();Vm();xa=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=Jt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ei(o),n=ei(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(j("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Ht||(t.style=new Ht(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),je.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Jt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=je.getOptimalCanvasAndContext(n,a),{canvas:h}=l;this.renderTextToCanvas(e,i,s,l);let c=qc(h,n,a,s);if(i.trim){let u=AT(h,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",zt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(je.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=gs(e),l=Jt.measureText(t||" ",e),h=l.lines,c=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let b=e._stroke;n.lineWidth=b.width,n.miterLimit=b.miterLimit,n.lineJoin=b.join,n.lineCap=b.cap}n.font=a;let g,m,_=e.dropShadow?2:1;for(let b=0;b<_;++b){let y=e.dropShadow&&b===0,w=y?Math.ceil(Math.max(1,p)+e.padding*2):0,E=w*i;if(y){n.fillStyle="black",n.strokeStyle="black";let P=e.dropShadow,R=P.color,A=P.alpha;n.shadowColor=ot.shared.setValue(R).setAlpha(A).toRgbaString();let C=P.blur*i,M=P.distance*i;n.shadowBlur=C,n.shadowOffsetX=Math.cos(P.angle)*M,n.shadowOffsetY=Math.sin(P.angle)*M+E}else{if(n.fillStyle=e._fill?Co(e._fill,n,l):null,e._stroke?.width){let P=e._stroke.width*e._stroke.alignment;n.strokeStyle=Co(e._stroke,n,l,P)}n.shadowColor="black"}let v=(c-f.fontSize)/2;c-f.fontSize<0&&(v=0);let S=e._stroke?.width??0;for(let P=0;P<h.length;P++)g=S/2,m=S/2+P*c+f.ascent+v,e.align==="right"?g+=d-u[P]:e.align==="center"&&(g+=(d-u[P])/2),e._stroke?.width&&this._drawLetterSpacing(h[P],e,s,g+e.padding,m+e.padding-w,!0),e._fill!==void 0&&this._drawLetterSpacing(h[P],e,s,g+e.padding,m+e.padding-w)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,l=e.letterSpacing,h=!1;if(Jt.experimentalLetterSpacingSupported&&(Jt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||h){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Jt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let g=u[p];n?a.strokeText(g,c,o):a.fillText(g,c,o);let m="";for(let _=p+1;_<u.length;++_)m+=u[_];f=a.measureText(m).width,c+=d-f+l,d=f}}destroy(){this._activeTextures=null}};xa.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"canvasText"}});var Wm=x(()=>{F();ST();mS();H.add(xa);H.add(fa)});var de,zm=x(()=>{Wt();nc();jc();de=class r extends Ai{constructor(t){t instanceof Oe&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Oe,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){j(rt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){j(rt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){j(rt,"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!==Oe.defaultStrokeStyle.width||t.color!==Oe.defaultStrokeStyle.color||t.alpha!==Oe.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return j(rt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return j(rt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return j(rt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return j(rt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return j(rt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return j(rt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var gS,xS,yS=x(()=>{"use strict";gS={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var Gc,bT=x(()=>{ve();mt();cs();co();Tr();Tt();Zf();gT();yT();_T();Gc=class extends qt{constructor(){let t=cr.from({vertex:xT,fragment:mT}),e=ur.from({fragment:{source:bm,entryPoint:"mainFragment"},vertex:{source:bm,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new Zh({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new ot(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var To,vm=x(()=>{mt();Ge();Qn();Sr();vo();pT();bT();To=class{constructor(t,e){this.state=Qt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ct({uTranslationMatrix:{value:new G,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 Gc,this.state=Qt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Uc({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=si(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var ha,vT=x(()=>{F();hT();vm();ha=class extends To{constructor(t){super(t,new kc)}};ha.extension={type:[T.WebGLPipes],name:"particle"}});var Oc,TT=x(()=>{"use strict";Oc=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var ca,ST=x(()=>{F();TT();vm();ca=class extends To{constructor(t){super(t,new Oc)}};ca.extension={type:[T.WebGPUPipes],name:"particle"}});var Tm=x(()=>{F();vT();ST();H.add(ha);H.add(ca)});var Hr,ua=x(()=>{"use strict";Hr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function da(r,t){let{texture:e,bounds:i}=r;hc(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Sm=x(()=>{vp()});var fa,wT=x(()=>{F();Be();ua();Sm();fa=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),it.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,da(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:it.get(Hr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};fa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"}});var wm,je,So=x(()=>{Ft();Gn();wm=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=Y.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ei(t),e=ei(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},je=new wm});function ET(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function AT(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function PT(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,l=0,h=e-1,c=i-1;for(;l<i&&ET(n,e,l);)++l;if(l===i)return tt.EMPTY;for(;ET(n,e,c);)--c;for(;AT(n,e,a,l,c);)++a;for(;AT(n,e,h,l,c);)--h;return++h,++c,new tt(a/t,l/t,(h-a)/t,(c-l)/t)}var CT=x(()=>{he()});var RT,ai,Lc=x(()=>{mt();Se();RT={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ai=class{constructor(t,e){this.uid=ut("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=RT[e].addressModeU,t.source.style.addressModeV=RT[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 IT=J((b8,MT)=>{MT.exports=e2;var Em={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t2=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function e2(r){var t=[];return r.replace(t2,function(e,i,s){var o=i.toLowerCase();for(s=i2(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Em[o])return s.unshift(i),t.push(s);if(s.length<Em[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,Em[o])))}}),t}var r2=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function i2(r){var t=r.match(r2);return t?t.map(Number):[]}});function FT(r,t){let e=(0,BT.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],h=l[0],c=l;switch(h){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:V(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var BT,kT=x(()=>{BT=Zi(IT(),1);Pt()});var Dc,UT=x(()=>{he();Dc=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new tt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Nc,GT=x(()=>{he();Nc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,h=o-l,c=n-l,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(h*h)+p*p/(c*c),g=f*f/(u*u)+p*p/(d*d);return m>1&&g<=1}getBounds(t){return t||(t=new tt),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function OT(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,h=o-i,c=n*l+a*h,u=l*l+h*h,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=i):d>1?(f=s,p=o):(f=e+d*l,p=i+d*h);let m=r-f,g=t-p;return m*m+g*g}var LT=x(()=>{"use strict"});var s2,o2,wo,DT=x(()=>{LT();he();wo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],l=e[(s+3)%i];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(s2),i=t.getBounds(o2);if(!e.containsRect(i))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;c<h;c+=2){let u=l[c],d=l[c+1],f=l[(c+2)%l.length],p=l[(c+3)%l.length],m=OT(t,e,u,d,f,p),g=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new tt);let e=this.points,i=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],c=e[a+1];i=h<i?h:i,s=h>s?h:s,o=c<o?c:o,n=c>n?c:n}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Hc,Vc,NT=x(()=>{he();Hc=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},Vc=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new tt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,c=i*(1-s),u=i-c,d=o+h,f=n+h,p=a-h*2,m=l-h*2,g=o+a,_=n+l;return(t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&Hc(t,e,d,f,h,u,c)||t>g-h&&e<f&&Hc(t,e,g-h,f,h,u,c)||t>g-h&&e>_-h&&Hc(t,e,g-h,_-h,h,u,c)||t<d&&e>_-h&&Hc(t,e,d,_-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function zc(r,t,e,i,s,o,n,a,l,h){let u=Math.min(.99,Math.max(0,h??bo.defaultOptions.bezierSmoothness)),d=(a2-u)/1;return d*=d,l2(t,e,i,s,o,n,a,l,r,d),r}function l2(r,t,e,i,s,o,n,a,l,h){Pm(r,t,e,i,s,o,n,a,l,h,0),l.push(n,a)}function Pm(r,t,e,i,s,o,n,a,l,h,c){if(c>n2)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,p=(e+s)/2,m=(i+o)/2,g=(s+n)/2,_=(o+a)/2,b=(d+p)/2,y=(f+m)/2,w=(p+g)/2,E=(m+_)/2,v=(b+w)/2,S=(y+E)/2;if(c>0){let P=n-r,R=a-t,A=Math.abs((e-n)*R-(i-a)*P),C=Math.abs((s-n)*R-(o-a)*P),M,B;if(A>Wc&&C>Wc){if((A+C)*(A+C)<=h*(P*P+R*R)){if(Eo<Am){l.push(v,S);return}let k=Math.atan2(o-i,s-e);if(M=Math.abs(k-Math.atan2(i-t,e-r)),B=Math.abs(Math.atan2(a-o,n-s)-k),M>=u&&(M=2*u-M),B>=u&&(B=2*u-B),M+B<Eo){l.push(v,S);return}if(ms!==0){if(M>ms){l.push(e,i);return}if(B>ms){l.push(s,o);return}}}}else if(A>Wc){if(A*A<=h*(P*P+R*R)){if(Eo<Am){l.push(v,S);return}if(M=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),M>=u&&(M=2*u-M),M<Eo){l.push(e,i),l.push(s,o);return}if(ms!==0&&M>ms){l.push(e,i);return}}}else if(C>Wc){if(C*C<=h*(P*P+R*R)){if(Eo<Am){l.push(v,S);return}if(M=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),M>=u&&(M=2*u-M),M<Eo){l.push(e,i),l.push(s,o);return}if(ms!==0&&M>ms){l.push(s,o);return}}}else if(P=v-(r+n)/2,R=S-(t+a)/2,P*P+R*R<=h){l.push(v,S);return}}Pm(r,t,d,f,b,y,v,S,l,h,c+1),Pm(v,S,w,E,g,_,n,a,l,h,c+1)}var n2,Wc,a2,Am,Eo,ms,Cm=x(()=>{Bc();n2=8,Wc=11920929e-14,a2=1,Am=.01,Eo=0,ms=0});function VT(r,t,e,i,s,o,n,a){let h=Math.min(.99,Math.max(0,a??bo.defaultOptions.bezierSmoothness)),c=(u2-h)/1;return c*=c,f2(t,e,i,s,o,n,r,c),r}function f2(r,t,e,i,s,o,n,a){Rm(n,r,t,e,i,s,o,a,0),n.push(s,o)}function Rm(r,t,e,i,s,o,n,a,l){if(l>h2)return;let h=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,p=(c+d)/2,m=(u+f)/2,g=o-t,_=n-e,b=Math.abs((i-o)*_-(s-n)*g);if(b>c2){if(b*b<=a*(g*g+_*_)){if(HT<d2){r.push(p,m);return}let y=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(y>=h&&(y=2*h-y),y<HT){r.push(p,m);return}}}else if(g=p-(t+o)/2,_=m-(e+n)/2,g*g+_*_<=a){r.push(p,m);return}Rm(r,t,e,c,u,p,m,a,l+1),Rm(r,p,m,d,f,o,n,a,l+1)}var h2,c2,u2,d2,HT,WT=x(()=>{Bc();h2=8,c2=11920929e-14,u2=1,d2=.01,HT=0});function $c(r,t,e,i,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(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,c=s;h*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*i,m=e+f*i;r.push(p,m),c+=h}}var Mm=x(()=>{"use strict"});function zT(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,h=n-t,c=s-e,u=i-t,d=Math.abs(l*u-h*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+h*h,p=c*c+u*u,m=l*c+h*u,g=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,b=g*m/f,y=_*m/p,w=g*u+_*h,E=g*c+_*l,v=h*(_+b),S=l*(_+b),P=u*(g+y),R=c*(g+y),A=Math.atan2(S-E,v-w),C=Math.atan2(R-E,P-w);$c(r,w+t,E+e,o,A,C,h*c>u*l)}var $T=x(()=>{Mm()});function p2(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function jT(r,t,e,i,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let c=Math.sin(a*pa/360),u=Math.cos(a*pa/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),m2(t,e,i,s,o,n,l,h,c,u,d,f,Im);let{ang1:m,ang2:g}=Im,{centerX:_,centerY:b}=Im,y=Math.abs(g)/(pa/4);Math.abs(1-y)<1e-7&&(y=1);let w=Math.max(Math.ceil(y),1);g/=w;let E=r[r.length-2],v=r[r.length-1],S={x:0,y:0};for(let P=0;P<w;P++){let R=p2(m,g),{x:A,y:C}=Bm(R[0],o,n,u,c,_,b,S),{x:M,y:B}=Bm(R[1],o,n,u,c,_,b,S),{x:k,y:U}=Bm(R[2],o,n,u,c,_,b,S);zc(r,E,v,A,C,M,B,k,U),E=k,v=U,m+=g}}var pa,Im,Bm,XT,m2,YT=x(()=>{Cm();pa=Math.PI*2,Im={centerX:0,centerY:0,ang1:0,ang2:0},Bm=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let h=s*r-o*t,c=o*r+s*t;return l.x=h+n,l.y=c+a,l};XT=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},m2=(r,t,e,i,s,o,n,a,l,h,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(c,2),g=Math.pow(u,2),_=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(n===a?-1:1);let b=_*s/o*u,y=_*-o/s*c,w=h*b-l*y+(r+e)/2,E=l*b+h*y+(t+i)/2,v=(c-b)/s,S=(u-y)/o,P=(-c-b)/s,R=(-u-y)/o,A=XT(1,0,v,S),C=XT(v,S,P,R);a===0&&C>0&&(C-=pa),a===1&&C<0&&(C+=pa),d.centerX=w,d.centerY=E,d.ang1=A,d.ang2=C}});function qT(r,t,e){let i=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,c=Math.sqrt(l*l+h*h),u=l/c,d=h/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let h=t[(n+1)%t.length],c=i(a,o),u=i(a,h);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let m=d/2,g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;let b=a.x+u.nx*_+-u.ny*g*f,y=a.y+u.ny*_+u.nx*g*f,w=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(b+Math.cos(w)*g,y+Math.sin(w)*g),r.arc(b,y,g,w,E,p),o=a}}function KT(r,t,e,i){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?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,l),f;if(d<1e-4)f=l;else{let g=Math.min(d/2,h);f=o(l,c,g/d)}let p=s(u,l),m;if(p<1e-4)m=l;else{let g=Math.min(p/2,h);m=o(l,u,g/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var ZT=x(()=>{"use strict"});var g2,Xc,QT=x(()=>{UT();GT();DT();he();NT();Ve();Cm();WT();Mm();$T();YT();ZT();g2=new tt,Xc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new At,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return $c(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return zT(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return jT(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return zc(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return VT(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,h=o?.shape;h&&h.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new tt(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new Dc(t,e,i),s),this}poly(t,e,i){let s=new wo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,h=[];for(let c=0;c<s;c++){let u=a-c*l;h.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(h,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let h=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+h,p=t+i*Math.cos(f),m=e+i*Math.sin(f),g=f+Math.PI+u,_=f-Math.PI-u,b=p+o*Math.cos(g),y=m+o*Math.sin(g),w=p+o*Math.cos(_),E=m+o*Math.sin(_);d===0?this.moveTo(b,y):this.lineTo(b,y),this.quadraticCurveTo(p,m,w,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?KT(this,t,e,s):qT(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+i,h=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(l-u,e).arcTo(l-c,e+c,l,e+u,u).lineTo(l,h-u).arcTo(l-c,h-c,t+i-u,h,u).lineTo(t+u,h).arcTo(t+c,h-c,t,h-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),l=t+i,h=e+s,c=[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 u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,i,s,o){return this.drawShape(new Nc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Vc(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new wo,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new wo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds(g2);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function ma(r,t){return r?r.prepend(t):t.clone()}var Gi,Fm=x(()=>{ar();Se();Pt();kT();QT();Gi=class r{constructor(t,e=!1){this.instructions=[],this.uid=ut("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?FT(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Xc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(dt.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 c=a.x,u=a.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(dt.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,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=i*2,c=Math.PI*2/h,u=[];for(let d=0;d<h;d++){let f=d%2?o:s,p=d*c+l;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,h=0,c=0,u=0,d=0,f=0,p=0,m=0;for(let g=0;g<this.instructions.length;g++){let _=this.instructions[g],b=_.data;switch(_.action){case"moveTo":case"lineTo":l=b[0],h=b[1],b[0]=e*l+s*h+n,b[1]=i*l+o*h+a;break;case"bezierCurveTo":c=b[0],u=b[1],d=b[2],f=b[3],l=b[4],h=b[5],b[0]=e*c+s*u+n,b[1]=i*c+o*u+a,b[2]=e*d+s*f+n,b[3]=i*d+o*f+a,b[4]=e*l+s*h+n,b[5]=i*l+o*h+a;break;case"quadraticCurveTo":c=b[0],u=b[1],l=b[2],h=b[3],b[0]=e*c+s*u+n,b[1]=i*c+o*u+a,b[2]=e*l+s*h+n,b[3]=i*l+o*h+a;break;case"arcToSvg":l=b[5],h=b[6],p=b[0],m=b[1],b[0]=e*p+s*m,b[1]=i*p+o*m,b[5]=e*l+s*h+n,b[6]=i*l+o*h+a;break;case"circle":b[4]=ma(b[3],t);break;case"rect":b[4]=ma(b[4],t);break;case"ellipse":b[8]=ma(b[8],t);break;case"roundRect":b[5]=ma(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=ma(b[2],t);break;default:V("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Nt(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var km=x(()=>{"use strict"});function JT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=x2(n);break;case"radialgradient":t.defs[n.id]=y2(n);break;default:break}}}}function x2(r){let t=Nt(r,"x1",0),e=Nt(r,"y1",0),i=Nt(r,"x2",1),s=Nt(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new Xe(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],h=Nt(l,"offset",0),c=ot.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(h,c)}return n}function y2(r){return V("[SVG Parser] Radial gradients are not yet supported"),new Xe(0,0,1,0)}var tS=x(()=>{ve();Pt();_o();km()});function Um(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var eS=x(()=>{"use strict"});function Gm(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in rS){let a=r.getAttribute(n);a&&iS(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,c]=l.split(":");rS[h]&&iS(t,o,h,c.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function iS(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Um(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=ot.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=Um(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=ot.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var rS,sS=x(()=>{ve();eS();rS={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 oS(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Gi};JT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Gm(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&nS(a,e,s,o)}return t}function nS(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Gm(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let l,h,c,u,d,f,p,m,g,_,b,y,w,E,v,S,P;switch(r.nodeName.toLowerCase()){case"path":E=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&V("SVG Evenodd fill rule not supported, your svg may render incorrectly"),v=new Gi(E,!0),t.context.path(v),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":p=Nt(r,"cx",0),m=Nt(r,"cy",0),g=Nt(r,"r",0),t.context.ellipse(p,m,g,g),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Nt(r,"x",0),h=Nt(r,"y",0),S=Nt(r,"width",0),P=Nt(r,"height",0),_=Nt(r,"rx",0),b=Nt(r,"ry",0),_||b?t.context.roundRect(l,h,S,P,_||b):t.context.rect(l,h,S,P),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Nt(r,"cx",0),m=Nt(r,"cy",0),_=Nt(r,"rx",0),b=Nt(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,_,b),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Nt(r,"x1",0),u=Nt(r,"y1",0),d=Nt(r,"x2",0),f=Nt(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":w=r.getAttribute("points"),y=w.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(y,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=r.getAttribute("points"),y=w.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(y,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{V(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<s.length;R++)nS(s[R],t,e,i)}var aS=x(()=>{Pt();Fm();tS();km();sS()});function _2(r){return ot.isColorLike(r)}function lS(r){return r instanceof ai}function hS(r){return r instanceof Xe}function b2(r){return r instanceof I}function v2(r,t,e){let i=ot.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=I.WHITE,{...e,...r}}function T2(r,t,e){return r.texture=t,{...e,...r}}function cS(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function uS(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function S2(r,t){let e={...t,...r},i=ot.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function li(r,t){if(r==null)return null;let e={},i=r;return _2(r)?v2(e,r,t):b2(r)?T2(e,r,t):lS(r)?cS(e,r,t):hS(r)?uS(e,r,t):i.fill&&lS(i.fill)?cS(i,i.fill,t):i.fill&&hS(i.fill)?uS(i,i.fill,t):S2(i,t)}function Ao(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=li(r,l);return h?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var Om=x(()=>{ve();Tt();_o();Lc()});var w2,dS,Lm,Oe,jc=x(()=>{Ae();ve();mt();ar();Tt();Se();Wt();Ve();Fm();aS();Om();w2=new dt,dS=new G,Lm=class Vr extends It{constructor(){super(...arguments),this.uid=ut("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Gi,this._transform=new G,this._fillStyle={...Vr.defaultFillStyle},this._strokeStyle={...Vr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new At,this._boundsDirty=!0}clone(){let t=new Vr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=li(t,Vr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ao(t,Vr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=li(t,Vr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=li(t,Vr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?ot.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Gi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(j(rt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=li(t,Vr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(dt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Ao(t,Vr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,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*i+l.c*s+l.tx,l.b*i+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,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,oS(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof G?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof G?(this._transform.append(t),this):(dS.set(t,e,i,s,o,n),this._transform.append(dS),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),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!1;let e=this.instructions,i=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,h=a.shapePath.shapePrimitives;for(let c=0;c<h.length;c++){let u=h[c].shape;if(!l||!u)continue;let d=h[c].transform,f=d?d.applyInverse(t,w2):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let m=l;i=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let g=0;g<m.length;g++)m[g].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Lm.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};Lm.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Oe=Lm});function Yc(r){let t=[],e=0;for(let i=0;i<fS.length;i++){let s=`_${fS[i]}`;t[e++]=r[s]}return e=pS(r._fill,t,e),e=E2(r._stroke,t,e),e=A2(r.dropShadow,t,e),t.join("-")}function pS(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function E2(r,t,e){return r&&(e=pS(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function A2(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=ot.shared.setValue(r.color).toNumber()),e}var fS,Dm=x(()=>{ve();fS=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function P2(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Ht.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){j(rt,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(ot.isColorLike(e))i.color=e;else if(e instanceof Xe||e instanceof ai)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){j(rt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Ht.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new Xe({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>ot.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Nm,Ht,gs=x(()=>{Ae();ve();Wt();_o();Lc();jc();Om();Dm();Nm=class Po extends It{constructor(t={}){super(),P2(t);let e={...Po.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Po.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Po.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Oe.defaultFillStyle,...t},()=>{this._fill=li({...this._originalFill},Oe.defaultFillStyle)})),this._fill=li(t===0?"black":t,Oe.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Oe.defaultStrokeStyle,...t},()=>{this._stroke=Ao({...this._originalStroke},Oe.defaultStrokeStyle)})),this._stroke=Ao(t,Oe.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Yc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Po.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Po({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(ot.isColorLike(t)||t instanceof Xe||t instanceof ai)}};Nm.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Nm.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Ht=Nm});function qc(r,t,e,i){let s=C2;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=zt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var C2,Hm=x(()=>{Si();Ve();C2=new At});function xs(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!R2.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var R2,Kc=x(()=>{"use strict";R2=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Vm,wr,Jt,ga=x(()=>{Ft();Kc();Vm={willReadFrequently:!0},wr=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){let e=Y.get().getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",e,i=q._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=xs(e),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=q.__context;l.font=n;let c=(s?q._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let b=0;b<c.length;b++){let y=q._measureText(c[b],e.letterSpacing,l);u[b]=y,d=Math.max(d,y)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new q(t,e,p,g,c,u,m+e.leading,d,a)}static _measureText(t,e,i){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,h=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,h-=e;else{let c=(q.graphemeSegmenter(t).length-1)*e;n+=c,h+=c}return Math.max(n,h)}static _wordWrap(t,e,i=q._canvas){let s=i.getContext("2d",Vm),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=q._collapseSpaces(c),d=q._collapseNewlines(c),f=!u,p=e.wordWrapWidth+h,m=q._tokenize(t);for(let g=0;g<m.length;g++){let _=m[g];if(q._isNewline(_)){if(!d){a+=q._addLine(n),f=!u,n="",o=0;continue}_=" "}if(u){let y=q.isBreakingSpace(_),w=q.isBreakingSpace(n[n.length-1]);if(y&&w)continue}let b=q._getFromCache(_,h,l,s);if(b>p)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,e.breakWords)){let y=q.wordWrapSplit(_);for(let w=0;w<y.length;w++){let E=y[w],v=E,S=1;for(;y[w+S];){let R=y[w+S];if(!q.canBreakChars(v,R,_,w,e.breakWords))E+=R;else break;v=R,S++}w+=S-1;let P=q._getFromCache(E,h,l,s);P+o>p&&(a+=q._addLine(n),f=!1,n="",o=0),n+=E,o+=P}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let y=g===m.length-1;a+=q._addLine(_,!y),f=!1,n="",o=0}else b+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=b)}return a+=q._addLine(n,!1),a}static _addLine(t,e=!0){return t=q._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=q._measureText(t,e,s)+e,i[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let i=t[e];if(!q.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(q.isBreakingSpace(o,n)||q._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];let e=q._context;e.font=t;let i=e.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return q._fonts[t]=s,s}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){if(!q.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Vm)?.measureText)return q.__canvas=e,e;t=Y.get().createCanvas()}catch{t=Y.get().createCanvas()}t.width=t.height=10,q.__canvas=t}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",Vm)),q.__context}};wr.METRICS_STRING="|\xC9q\xC5";wr.BASELINE_SYMBOL="M";wr.BASELINE_MULTIPLIER=1.4;wr.HEIGHT_MULTIPLIER=2;wr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();wr.experimentalLetterSpacing=!1;wr._fonts={};wr._newlines=[10,13];wr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];wr._measurementCache={};Jt=wr});function Co(r,t,e,i=0){if(r.texture===I.WHITE&&!r.fill)return ot.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ai){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof Xe){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let h,c=!1;if(o){let{start:u,end:d}=s;h=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;h=t.createRadialGradient(u.x*a,u.y*l,d*a,f.x*a,f.y*l,p*a)}if(c&&n&&e){let u=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let m=f+p.offset*u;h.addColorStop(Math.floor(m*mS)/mS,ot.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{h.addColorStop(u.offset,ot.shared.setValue(u.color).toHex())});return h}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(G.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return V("FillStyle not recognised",r),"red"}var mS,Wm=x(()=>{ve();mt();Tt();Pt();_o();Lc();mS=1e5});var xa,gS=x(()=>{ve();F();Gn();So();Si();CT();Wt();gs();Hm();ga();Kc();Wm();xa=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=Jt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ei(o),n=ei(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(j("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Ht||(t.style=new Ht(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),je.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Jt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=je.getOptimalCanvasAndContext(n,a),{canvas:h}=l;this.renderTextToCanvas(e,i,s,l);let c=qc(h,n,a,s);if(i.trim){let u=PT(h,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",zt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(je.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=xs(e),l=Jt.measureText(t||" ",e),h=l.lines,c=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let b=e._stroke;n.lineWidth=b.width,n.miterLimit=b.miterLimit,n.lineJoin=b.join,n.lineCap=b.cap}n.font=a;let m,g,_=e.dropShadow?2:1;for(let b=0;b<_;++b){let y=e.dropShadow&&b===0,w=y?Math.ceil(Math.max(1,p)+e.padding*2):0,E=w*i;if(y){n.fillStyle="black",n.strokeStyle="black";let P=e.dropShadow,R=P.color,A=P.alpha;n.shadowColor=ot.shared.setValue(R).setAlpha(A).toRgbaString();let C=P.blur*i,M=P.distance*i;n.shadowBlur=C,n.shadowOffsetX=Math.cos(P.angle)*M,n.shadowOffsetY=Math.sin(P.angle)*M+E}else{if(n.fillStyle=e._fill?Co(e._fill,n,l):null,e._stroke?.width){let P=e._stroke.width*e._stroke.alignment;n.strokeStyle=Co(e._stroke,n,l,P)}n.shadowColor="black"}let v=(c-f.fontSize)/2;c-f.fontSize<0&&(v=0);let S=e._stroke?.width??0;for(let P=0;P<h.length;P++)m=S/2,g=S/2+P*c+f.ascent+v,e.align==="right"?m+=d-u[P]:e.align==="center"&&(m+=(d-u[P])/2),e._stroke?.width&&this._drawLetterSpacing(h[P],e,s,m+e.padding,g+e.padding-w,!0),e._fill!==void 0&&this._drawLetterSpacing(h[P],e,s,m+e.padding,g+e.padding-w)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,l=e.letterSpacing,h=!1;if(Jt.experimentalLetterSpacingSupported&&(Jt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||h){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Jt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,c,o):a.fillText(m,c,o);let g="";for(let _=p+1;_<u.length;++_)g+=u[_];f=a.measureText(g).width,c+=d-f+l,d=f}}destroy(){this._activeTextures=null}};xa.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"canvasText"}});var zm=x(()=>{F();wT();gS();H.add(xa);H.add(fa)});var de,$m=x(()=>{Wt();nc();jc();de=class r extends Ai{constructor(t){t instanceof Oe&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Oe,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){j(rt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){j(rt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){j(rt,"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!==Oe.defaultStrokeStyle.width||t.color!==Oe.defaultStrokeStyle.color||t.alpha!==Oe.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return j(rt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return j(rt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return j(rt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return j(rt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return j(rt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return j(rt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var xS,yS,_S=x(()=>{"use strict";xS={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -392,7 +392,7 @@ fn mainFragment(
392
392
  @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
393
393
  `,main:`
394
394
  outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
395
- `}},xS={name:"local-uniform-msdf-bit",vertex:{header:`
395
+ `}},yS={name:"local-uniform-msdf-bit",vertex:{header:`
396
396
  uniform mat3 uTransformMatrix;
397
397
  uniform vec4 uColor;
398
398
  uniform float uRound;
@@ -408,7 +408,7 @@ fn mainFragment(
408
408
  uniform float uDistance;
409
409
  `,main:`
410
410
  outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
411
- `}}});var _S,bS,vS=x(()=>{"use strict";_S={name:"msdf-bit",fragment:{header:`
411
+ `}}});var bS,vS,TS=x(()=>{"use strict";bS={name:"msdf-bit",fragment:{header:`
412
412
  fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
413
413
 
414
414
  // MSDF
@@ -435,7 +435,7 @@ fn mainFragment(
435
435
  return coverage;
436
436
 
437
437
  }
438
- `}},bS={name:"msdf-bit",fragment:{header:`
438
+ `}},vS={name:"msdf-bit",fragment:{header:`
439
439
  float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
440
440
 
441
441
  // MSDF
@@ -462,16 +462,16 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}}});var $m,Xm,Zc,TS=x(()=>{mt();as();Fi();ea();ra();ki();Sc();Tr();Ge();yS();vS();Zc=class extends qt{constructor(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=lr();$m??($m=Ur({name:"sdf-shader",bits:[uo,po(e),gS,_S,Or]})),Xm??(Xm=Gr({name:"sdf-shader",bits:[fo,mo(e),xS,bS,Lr]})),super({glProgram:Xm,gpuProgram:$m,resources:{localUniforms:t,batchSamplers:go(e)}})}}});var Ro,jm=x(()=>{Ae();Wt();Ro=class extends It{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return j(rt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return j(rt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return j(rt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return j(rt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return j(rt,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function Qc(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,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 Ym=x(()=>{"use strict"});var SS,qm,ES=x(()=>{ve();he();So();so();Tt();Wt();ga();Kc();Vm();ms();jm();Ym();SS=class wS extends Ro{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={...wS.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=I.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=gs(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=Jt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=Qc(t).filter(m=>!this._currentChars.includes(m)).filter((m,_,b)=>b.indexOf(m)===_);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,h=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,p=s.width/this.resolution,g=s.height/this.resolution;for(let m=0;m<e.length;m++){let _=e[m],b=Jt.measureText(_,a,s,!1);b.lineHeight=b.height;let y=b.width*c,w=Math.ceil((a.fontStyle==="italic"?2:1)*y),E=b.height*c,v=w+u*2,S=E+u*2;if(f=!1,_!==`
466
- `&&_!=="\r"&&_!==" "&&_!==" "&&(f=!0,d=Math.ceil(Math.max(S,d))),l+v>p&&(h+=d,d=S,l=0,h+d>g)){n.update();let R=this._nextPage();s=R.canvasAndContext.canvas,o=R.canvasAndContext.context,n=R.texture.source,h=0}let P=y/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:P,kerning:{}},f){this._drawGlyph(o,b,l+u,h+u,c,a);let R=n.width*c,A=n.height*c,C=new tt(l/R*n.width,h/A*n.height,v/R*n.width,S/A*n.height);this.chars[_].texture=new I({source:n,frame:C}),l+=Math.ceil(v)}}n.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return j(rt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=i[o];l||(l=i[o]=e.measureText(o).width);let h=i[a];h||(h=i[a]=e.measureText(a).width);let c=e.measureText(o+a).width,u=c-(l+h);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(l+h),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=je.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new I({source:new ze({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=gs(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=Co(s,t)),e._fill&&(t.fillStyle=Co(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=ot.shared.setValue(n.color).toArray(),l=n.blur*i,h=n.distance*i;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,i,s,o,n){let a=e.text,l=e.fontProperties,c=(n._stroke?.width??0)*o,u=i+c/2,d=s-c/2,f=l.descent*o,p=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:i}=this.pages[t];je.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};SS.defaultOptions={textureSize:512,style:new Ht,mipmap:!0};qm=SS});function Jc(r,t,e,i){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},h=p=>{let g=o.width;for(let m=0;m<l.index;m++){let _=p.positions[m];o.chars.push(p.chars[m]),o.charPositions.push(_+g)}o.width+=p.width,a=!1,l.width=0,l.index=0,l.chars.length=0},c=()=>{let p=o.chars.length-1;if(i){let g=o.chars[p];for(;g===" ";)o.width-=e.chars[g].xAdvance,g=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;p<r.length+1;p++){let g,m=p===r.length;m||(g=r[p]);let _=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
467
- `||m){if(!a&&t.wordWrap&&o.width+l.width-d>f?(c(),h(l),m||o.charPositions.push(0)):(l.start=o.width,h(l),m||o.charPositions.push(0)),g==="\r"||g===`
468
- `)o.width!==0&&c();else if(!m){let E=_.xAdvance+(_.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let w=_.kerning[n]||0,E=_.xAdvance+w+d;l.positions[l.index++]=l.width+w,l.chars.push(g),l.width+=E}n=g}return c(),t.align==="center"?R2(s):t.align==="right"?M2(s):t.align==="justify"&&I2(s),s}function R2(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function M2(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function I2(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,h=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===o&&(o=i.spacesIndex[s++],n+=h),i.charPositions[c]+=n}}var Km=x(()=>{"use strict"});var tu,Zm,ya,Qm=x(()=>{Ri();Wt();Pt();ms();ES();Km();Ym();tu=0,Zm=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!St.has(i)){let n=new qm({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});tu++,tu>50&&V("BitmapText",`You have dynamically created ${tu} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{tu--,St.remove(i)}),St.set(i,n)}let o=St.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return Jc([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},j(rt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Ht?s:new Ht(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new qm({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),l=Qc(e.chars);return a.ensureCharacters(l.join("")),St.set(`${i}-bitmap`,a),a.once("destroy",()=>St.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=St.get(e);i&&i.destroy()}},ya=new Zm});function AS(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var _a,PS=x(()=>{Ri();F();Be();zm();TS();Qm();Km();_a=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);AS(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(it.return(e.customShader),e.customShader=null),it.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);AS(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ya.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=it.get(Zc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,l=Jc(o,n,s,!0),h=0,c=n.padding,u=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<l.lines.length;g++){let m=l.lines[g];for(let _=0;_<m.charPositions.length;_++){let b=o[h++],y=s.chars[b];y?.texture&&i.texture(y.texture,p||"black",Math.round(m.charPositions[_]+y.xOffset),Math.round(a+y.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=it.get(de);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,s=St.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,h=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+l*l),u=(Math.abs(h)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};_a.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"bitmapText"}});var Jm=x(()=>{F();PS();H.add(_a)});var ba,CS=x(()=>{F();Tt();Be();ua();Tm();ba=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),it.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,da(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),da(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:I.EMPTY,currentKey:"--",batchableSprite:it.get(Hr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=I.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"htmlText"}});function RS(){let{userAgent:r}=Y.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var MS=x(()=>{Ft()});var IS,BS,Mo,tg=x(()=>{"use strict";IS="http://www.w3.org/2000/svg",BS="http://www.w3.org/1999/xhtml",Mo=class{constructor(){this.svgRoot=document.createElementNS(IS,"svg"),this.foreignObject=document.createElementNS(IS,"foreignObject"),this.domElement=document.createElementNS(BS,"div"),this.styleElement=document.createElementNS(BS,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function US(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${ot.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[OS(t)]:[],...r.dropShadow?[GS(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return B2(r.tagStyles,s),s.join(" ")}function GS(r){let t=ot.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function OS(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${ot.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${ot.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function B2(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)kS[o]?s.push(kS[o](i[o])):FS[o]&&s.push(FS[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var FS,kS,LS=x(()=>{ve();FS={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"},kS={fill:r=>`color: ${ot.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:OS,dropShadow:GS}});var eu,DS=x(()=>{Pt();ms();Lm();LS();eu=class r extends Ht{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Yc(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=US(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&V("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&V("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function NS(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}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 i}var HS=x(()=>{"use strict"});async function VS(r){let e=await(await Y.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var WS=x(()=>{Ft()});async function eg(r,t){let e=await VS(t);return`@font-face {
465
+ `}}});var Xm,jm,Zc,SS=x(()=>{mt();ls();Fi();ea();ra();ki();Sc();Tr();Ge();_S();TS();Zc=class extends qt{constructor(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=lr();Xm??(Xm=Ur({name:"sdf-shader",bits:[uo,po(e),xS,bS,Or]})),jm??(jm=Gr({name:"sdf-shader",bits:[fo,mo(e),yS,vS,Lr]})),super({glProgram:jm,gpuProgram:Xm,resources:{localUniforms:t,batchSamplers:go(e)}})}}});var Ro,Ym=x(()=>{Ae();Wt();Ro=class extends It{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return j(rt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return j(rt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return j(rt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return j(rt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return j(rt,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function Qc(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,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 qm=x(()=>{"use strict"});var wS,Km,AS=x(()=>{ve();he();So();so();Tt();Wt();ga();Kc();Wm();gs();Ym();qm();wS=class ES extends Ro{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={...ES.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=I.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=xs(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=Jt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=Qc(t).filter(g=>!this._currentChars.includes(g)).filter((g,_,b)=>b.indexOf(g)===_);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,h=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let g=0;g<e.length;g++){let _=e[g],b=Jt.measureText(_,a,s,!1);b.lineHeight=b.height;let y=b.width*c,w=Math.ceil((a.fontStyle==="italic"?2:1)*y),E=b.height*c,v=w+u*2,S=E+u*2;if(f=!1,_!==`
466
+ `&&_!=="\r"&&_!==" "&&_!==" "&&(f=!0,d=Math.ceil(Math.max(S,d))),l+v>p&&(h+=d,d=S,l=0,h+d>m)){n.update();let R=this._nextPage();s=R.canvasAndContext.canvas,o=R.canvasAndContext.context,n=R.texture.source,h=0}let P=y/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:P,kerning:{}},f){this._drawGlyph(o,b,l+u,h+u,c,a);let R=n.width*c,A=n.height*c,C=new tt(l/R*n.width,h/A*n.height,v/R*n.width,S/A*n.height);this.chars[_].texture=new I({source:n,frame:C}),l+=Math.ceil(v)}}n.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return j(rt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=i[o];l||(l=i[o]=e.measureText(o).width);let h=i[a];h||(h=i[a]=e.measureText(a).width);let c=e.measureText(o+a).width,u=c-(l+h);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(l+h),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=je.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new I({source:new ze({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=xs(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=Co(s,t)),e._fill&&(t.fillStyle=Co(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=ot.shared.setValue(n.color).toArray(),l=n.blur*i,h=n.distance*i;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,i,s,o,n){let a=e.text,l=e.fontProperties,c=(n._stroke?.width??0)*o,u=i+c/2,d=s-c/2,f=l.descent*o,p=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:i}=this.pages[t];je.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};wS.defaultOptions={textureSize:512,style:new Ht,mipmap:!0};Km=wS});function Jc(r,t,e,i){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},h=p=>{let m=o.width;for(let g=0;g<l.index;g++){let _=p.positions[g];o.chars.push(p.chars[g]),o.charPositions.push(_+m)}o.width+=p.width,a=!1,l.width=0,l.index=0,l.chars.length=0},c=()=>{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;p<r.length+1;p++){let m,g=p===r.length;g||(m=r[p]);let _=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
467
+ `||g){if(!a&&t.wordWrap&&o.width+l.width-d>f?(c(),h(l),g||o.charPositions.push(0)):(l.start=o.width,h(l),g||o.charPositions.push(0)),m==="\r"||m===`
468
+ `)o.width!==0&&c();else if(!g){let E=_.xAdvance+(_.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let w=_.kerning[n]||0,E=_.xAdvance+w+d;l.positions[l.index++]=l.width+w,l.chars.push(m),l.width+=E}n=m}return c(),t.align==="center"?M2(s):t.align==="right"?I2(s):t.align==="justify"&&B2(s),s}function M2(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function I2(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function B2(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,h=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===o&&(o=i.spacesIndex[s++],n+=h),i.charPositions[c]+=n}}var Zm=x(()=>{"use strict"});var tu,Qm,ya,Jm=x(()=>{Ri();Wt();Pt();gs();AS();Zm();qm();tu=0,Qm=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!St.has(i)){let n=new Km({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});tu++,tu>50&&V("BitmapText",`You have dynamically created ${tu} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{tu--,St.remove(i)}),St.set(i,n)}let o=St.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return Jc([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},j(rt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Ht?s:new Ht(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Km({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),l=Qc(e.chars);return a.ensureCharacters(l.join("")),St.set(`${i}-bitmap`,a),a.once("destroy",()=>St.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=St.get(e);i&&i.destroy()}},ya=new Qm});function PS(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var _a,CS=x(()=>{Ri();F();Be();$m();SS();Jm();Zm();_a=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);PS(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(it.return(e.customShader),e.customShader=null),it.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);PS(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ya.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=it.get(Zc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,l=Jc(o,n,s,!0),h=0,c=n.padding,u=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<l.lines.length;m++){let g=l.lines[m];for(let _=0;_<g.charPositions.length;_++){let b=o[h++],y=s.chars[b];y?.texture&&i.texture(y.texture,p||"black",Math.round(g.charPositions[_]+y.xOffset),Math.round(a+y.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=it.get(de);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,s=St.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,h=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+l*l),u=(Math.abs(h)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};_a.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"bitmapText"}});var tg=x(()=>{F();CS();H.add(_a)});var ba,RS=x(()=>{F();Tt();Be();ua();Sm();ba=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),it.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,da(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),da(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:I.EMPTY,currentKey:"--",batchableSprite:it.get(Hr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=I.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"htmlText"}});function MS(){let{userAgent:r}=Y.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var IS=x(()=>{Ft()});var BS,FS,Mo,eg=x(()=>{"use strict";BS="http://www.w3.org/2000/svg",FS="http://www.w3.org/1999/xhtml",Mo=class{constructor(){this.svgRoot=document.createElementNS(BS,"svg"),this.foreignObject=document.createElementNS(BS,"foreignObject"),this.domElement=document.createElementNS(FS,"div"),this.styleElement=document.createElementNS(FS,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function GS(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${ot.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[LS(t)]:[],...r.dropShadow?[OS(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return F2(r.tagStyles,s),s.join(" ")}function OS(r){let t=ot.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function LS(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${ot.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${ot.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function F2(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)US[o]?s.push(US[o](i[o])):kS[o]&&s.push(kS[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var kS,US,DS=x(()=>{ve();kS={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"},US={fill:r=>`color: ${ot.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:LS,dropShadow:OS}});var eu,NS=x(()=>{Pt();gs();Dm();DS();eu=class r extends Ht{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Yc(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=GS(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&V("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&V("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function HS(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}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 i}var VS=x(()=>{"use strict"});async function WS(r){let e=await(await Y.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var zS=x(()=>{Ft()});async function rg(r,t){let e=await WS(t);return`@font-face {
469
469
  font-family: "${r.fontFamily}";
470
470
  src: url('${e}');
471
471
  font-weight: ${r.fontWeight};
472
472
  font-style: ${r.fontStyle};
473
- }`}var zS=x(()=>{WS()});async function $S(r,t,e){let i=r.filter(s=>St.has(`${s}-and-url`)).map((s,o)=>{if(!ru.has(s)){let{url:n}=St.get(`${s}-and-url`);o===0?ru.set(s,eg({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):ru.set(s,eg({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return ru.get(s)});return(await Promise.all(i)).join(`
474
- `)}var ru,XS=x(()=>{Ri();zS();ru=new Map});function jS(r,t,e,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var YS=x(()=>{"use strict"});function qS(r,t){let e=je.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}var KS=x(()=>{So()});function ZS(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}var QS=x(()=>{"use strict"});function tw(r,t,e,i){i||(i=JS||(JS=new Mo));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return{width:a.width-l,height:a.height-l}}var JS,ew=x(()=>{tg()});var Io,rw=x(()=>{F();So();Si();Dr();MS();Pt();Be();Nm();tg();DS();HS();XS();YS();KS();QS();ew();Io=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===se.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,i){let s=it.get(Mo),o=NS(t,i),n=await $S(o,i,eu.defaultTextStyle),a=tw(t,i,n,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),h=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,u=2;c.width=(l|0)+u,c.height=(h|0)+u;let d=jS(t,i,e,n,s);await ZS(c,d,RS()&&o.length>0);let f=c,p;this._createCanvas&&(p=qS(c,e));let g=qc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),je.returnCanvasAndContext(p)),it.return(s),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{V("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){zt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};Io.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"htmlText"};Io.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var rg=x(()=>{F();CS();rw();H.add(Io);H.add(ba)});var iw,Bo,iu=x(()=>{Ii();oi();lo();Wt();iw=class sw extends hr{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(j(rt,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...sw.defaultOptions,...e};let i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(i.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Yt({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:ht.VERTEX|ht.COPY_DST}),l=new Yt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ht.VERTEX|ht.COPY_DST}),h=new Yt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:ht.INDEX|ht.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}};iw.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Bo=iw});var xs,ow,Fo,ko=x(()=>{"use strict";xs={name:"local-uniform-bit",vertex:{header:`
473
+ }`}var $S=x(()=>{zS()});async function XS(r,t,e){let i=r.filter(s=>St.has(`${s}-and-url`)).map((s,o)=>{if(!ru.has(s)){let{url:n}=St.get(`${s}-and-url`);o===0?ru.set(s,rg({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):ru.set(s,rg({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return ru.get(s)});return(await Promise.all(i)).join(`
474
+ `)}var ru,jS=x(()=>{Ri();$S();ru=new Map});function YS(r,t,e,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var qS=x(()=>{"use strict"});function KS(r,t){let e=je.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}var ZS=x(()=>{So()});function QS(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}var JS=x(()=>{"use strict"});function ew(r,t,e,i){i||(i=tw||(tw=new Mo));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return{width:a.width-l,height:a.height-l}}var tw,rw=x(()=>{eg()});var Io,iw=x(()=>{F();So();Si();Dr();IS();Pt();Be();Hm();eg();NS();VS();jS();qS();ZS();JS();rw();Io=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===se.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,i){let s=it.get(Mo),o=HS(t,i),n=await XS(o,i,eu.defaultTextStyle),a=ew(t,i,n,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),h=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,u=2;c.width=(l|0)+u,c.height=(h|0)+u;let d=YS(t,i,e,n,s);await QS(c,d,MS()&&o.length>0);let f=c,p;this._createCanvas&&(p=KS(c,e));let m=qc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(m.source),je.returnCanvasAndContext(p)),it.return(s),m}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{V("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){zt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};Io.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"htmlText"};Io.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var ig=x(()=>{F();RS();iw();H.add(Io);H.add(ba)});var sw,Bo,iu=x(()=>{Ii();oi();lo();Wt();sw=class ow extends hr{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(j(rt,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...ow.defaultOptions,...e};let i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(i.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Yt({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:ht.VERTEX|ht.COPY_DST}),l=new Yt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ht.VERTEX|ht.COPY_DST}),h=new Yt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:ht.INDEX|ht.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}};sw.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Bo=sw});var ys,nw,Fo,ko=x(()=>{"use strict";ys={name:"local-uniform-bit",vertex:{header:`
475
475
 
476
476
  struct LocalUniforms {
477
477
  uTransformMatrix:mat3x3<f32>,
@@ -488,7 +488,7 @@ fn mainFragment(
488
488
  {
489
489
  vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
490
490
  }
491
- `}},ow={...xs,vertex:{...xs.vertex,header:xs.vertex.header.replace("group(1)","group(2)")}},Fo={name:"local-uniform-bit",vertex:{header:`
491
+ `}},nw={...ys,vertex:{...ys.vertex,header:ys.vertex.header.replace("group(1)","group(2)")}},Fo={name:"local-uniform-bit",vertex:{header:`
492
492
 
493
493
  uniform mat3 uTransformMatrix;
494
494
  uniform vec4 uColor;
@@ -501,7 +501,7 @@ fn mainFragment(
501
501
  {
502
502
  gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
503
503
  }
504
- `}}});var nw,aw,lw=x(()=>{"use strict";nw={name:"tiling-bit",vertex:{header:`
504
+ `}}});var aw,lw,hw=x(()=>{"use strict";aw={name:"tiling-bit",vertex:{header:`
505
505
  struct TilingUniforms {
506
506
  uMapCoord:mat3x3<f32>,
507
507
  uClampFrame:vec4<f32>,
@@ -544,7 +544,7 @@ fn mainFragment(
544
544
  }
545
545
 
546
546
  outColor = textureSampleBias(uTexture, uSampler, coord, bias);
547
- `}},aw={name:"tiling-bit",vertex:{header:`
547
+ `}},lw={name:"tiling-bit",vertex:{header:`
548
548
  uniform mat3 uTextureTransform;
549
549
  uniform vec4 uSizeAnchor;
550
550
 
@@ -566,7 +566,7 @@ fn mainFragment(
566
566
 
567
567
  outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
568
568
 
569
- `}}});var ig,sg,su,hw=x(()=>{mt();Fi();ko();ki();Tr();Ge();Tt();lw();su=class extends qt{constructor(){ig??(ig=Ur({name:"tiling-sprite-shader",bits:[xs,nw,Or]})),sg??(sg=Gr({name:"tiling-sprite-shader",bits:[Fo,aw,Lr]}));let t=new Ct({uMapCoord:{value:new G,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 G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:sg,gpuProgram:ig,resources:{localUniforms:new Ct({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:I.EMPTY.source,uSampler:I.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*h/t,i.d*h/e,i.tx/t,i.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var ou,cw=x(()=>{iu();ou=class extends Bo{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 uw(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var dw=x(()=>{"use strict"});function fw(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,h=i.d,c=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+l*f+c,r[e+1]=a*d+h*f+u,e+=t,s++}}var pw=x(()=>{"use strict"});function mw(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),fw(t,2,0,a)}var gw=x(()=>{mt();pw()});var nu,va,xw=x(()=>{F();Qn();Sr();Dr();vo();Fc();iu();hw();cw();dw();gw();nu=new ou,va=class{constructor(t){this._state=Qt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ui);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new su),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=si(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:nu,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Bo({indices:nu.indices,positions:nu.positions.slice(),uvs:nu.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),mw(t,i.uvs),uw(t,i.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=!0;return this._renderer.type===se.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};va.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"}});var og=x(()=>{F();xw();H.add(va)});var yw,bw,vw=x(()=>{Wt();iu();yw=class _w extends Bo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(j(rt,"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={..._w.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;i.push(d*l,f*h),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,p=f*this.verticesX+d,g=f*this.verticesX+d+1,m=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(p,g,m,g,_,m)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};yw.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};bw=yw});var Tw,ww,Ew=x(()=>{vw();Tw=class Sw extends bw{constructor(t={}){t={...Sw.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=i>d?1:i/d,p=Math.min(u,f),g=l*e,m=h*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*p-g,t[4]=t[12]=t[20]=t[28]=e-o*p-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=n*p-m,t[17]=t[19]=t[21]=t[23]=i-a*p-m,t[25]=t[27]=t[29]=t[31]=i-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,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};Tw.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};ww=Tw});var Ta,Aw=x(()=>{F();Be();Fc();Ew();Ta=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];it.return(e.geometry),it.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=it.get(Ui);return e.geometry=it.get(ww),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};Ta.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"}});var ng=x(()=>{F();Aw();H.add(Ta)});var Sa,Pw=x(()=>{F();Sa=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Sa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"}});function Cw(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var Rw=x(()=>{"use strict"});var F2,wa,Mw=x(()=>{F();mt();ar();Mi();lo();Ge();Tt();Si();Dr();Ve();Rw();Pt();F2=new hr({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])}),wa=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Ct({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 xe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?Cw(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,h=!0,c=!1,u=!1,d=!0;for(let f=0;f<i.length;f++){let p=i[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),l+=p.padding,p.antialias==="off"?h=!1:p.antialias==="inherit"&&h&&(h=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){V("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(l|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=zt.getOptimalTexture(o.width,o.height,a,h),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=I.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),zt.returnTexture(i);else{let a=e.inputTexture,l=zt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),h=0;for(h=0;h<n.length-1;++h){n[h].apply(this,a,l,!0);let u=a;a=l,l=u}n[h].apply(this,a,e.previousRenderSurface,!1),zt.returnTexture(a),zt.returnTexture(l)}e.blendRequired&&zt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=zt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let 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,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=dt.shared,c=n.previousRenderSurface===i,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,g=p.uOutputFrame,m=p.uInputSize,_=p.uInputPixel,b=p.uInputClamp,y=p.uGlobalFrame,w=p.uOutputTexture;if(c){let S=this._filterStackIndex;for(;S>0;){S--;let P=this._filterStack[this._filterStackIndex-1];if(!P.skip){l.x=P.bounds.minX,l.y=P.bounds.minY;break}}g[0]=a.minX-l.x,g[1]=a.minY-l.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,m[0]=e.source.width,m[1]=e.source.height,m[2]=1/m[0],m[3]=1/m[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],b[0]=.5*_[2],b[1]=.5*_[3],b[2]=e.frame.width*m[2]-.5*_[2],b[3]=e.frame.height*m[3]-.5*_[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;y[0]=l.x*u,y[1]=l.y*u,y[2]=E.source.width*u,y[3]=E.source.height*u;let v=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof I?(w[0]=i.frame.width,w[1]=i.frame.height):(w[0]=v.width,w[1]=v.height),w[2]=v.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let S=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(S,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:F2,shader:t,state:t._state,topology:"triangle-list"}),o.type===se.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new At,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(G.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}};wa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"}});var ag=x(()=>{F();Pw();Mw();H.add(wa);H.add(Sa)});var k2={};var Iw=x(()=>{Fb();cp();Hb();Wb();lc();pc();gm();xm();vm();Wm();Jm();rg();og();ng();ag()});var U2={};var Fw=x(()=>{cp();lc();pc();gm();xm();vm();Wm();Jm();rg();og();ng();ag()});var Uw,Gw,Ow=x(()=>{hs();co();Tr();Sr();Uw=class lg extends qt{constructor(t){t={...lg.defaultOptions,...t},super(t),this.enabled=!0,this._state=Qt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=ur.from(e)),i&&(n=cr.from(i)),new lg({gpuProgram:o,glProgram:n,...s})}};Uw.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};Gw=Uw});async function Lw(r){if(!r)for(let t=0;t<hg.length;t++){let e=hg[t];if(e.value.test()){await e.value.load();return}}}var hg,Dw=x(()=>{F();hg=[];H.handleByNamedList(T.Environment,hg)});function au(){if(typeof Ea=="boolean")return Ea;try{Ea=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ea=!1}return Ea}var Ea,cg=x(()=>{"use strict"});var ye,Uo=x(()=>{"use strict";ye=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(ye||{})});var Go,ug=x(()=>{"use strict";Go=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:h,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var G2,Nw,Oi,Aa=x(()=>{ve();Dw();br();cg();Wt();Uo();ug();Ae();G2=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Nw=class Hw extends It{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...G2,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Lw(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...Hw.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof nt&&(i={container:i},e&&(j(rt,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:ot.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ye.ALL);let{clear:i,clearColor:s,target:o}=t;ot.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,ot.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Go(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!au())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};Nw.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Oi=Nw});var Pa,zw=x(()=>{F();mt();as();xc();Fi();ea();ra();ko();ki();Tr();Ge();Pa=class{init(){let t=new Ct({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Ur({name:"graphics",bits:[uo,po(lr()),ow,Or]});this.shader=new qt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),h=o.encoder;h.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;h.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);h.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p<l.instructionSize;p++){let g=d[p];if(g.topology!==f&&(f=g.topology,h.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let m=g.textures;g.bindGroup=ao(m.textures,m.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}h.setBindGroup(1,g.bindGroup,s.gpuProgram),h.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};Pa.extension={type:[T.WebGPUPipesAdaptor],name:"graphics"}});var $w,Xw,dg=x(()=>{"use strict";$w={name:"texture-bit",vertex:{header:`
569
+ `}}});var sg,og,su,cw=x(()=>{mt();Fi();ko();ki();Tr();Ge();Tt();hw();su=class extends qt{constructor(){sg??(sg=Ur({name:"tiling-sprite-shader",bits:[ys,aw,Or]})),og??(og=Gr({name:"tiling-sprite-shader",bits:[Fo,lw,Lr]}));let t=new Ct({uMapCoord:{value:new G,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 G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:og,gpuProgram:sg,resources:{localUniforms:new Ct({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:I.EMPTY.source,uSampler:I.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*h/t,i.d*h/e,i.tx/t,i.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var ou,uw=x(()=>{iu();ou=class extends Bo{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 dw(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var fw=x(()=>{"use strict"});function pw(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,h=i.d,c=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+l*f+c,r[e+1]=a*d+h*f+u,e+=t,s++}}var mw=x(()=>{"use strict"});function gw(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),pw(t,2,0,a)}var xw=x(()=>{mt();mw()});var nu,va,yw=x(()=>{F();Qn();Sr();Dr();vo();Fc();iu();cw();uw();fw();xw();nu=new ou,va=class{constructor(t){this._state=Qt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ui);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new su),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Nr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=si(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:nu,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Bo({indices:nu.indices,positions:nu.positions.slice(),uvs:nu.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),gw(t,i.uvs),dw(t,i.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=!0;return this._renderer.type===se.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};va.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"}});var ng=x(()=>{F();yw();H.add(va)});var _w,vw,Tw=x(()=>{Wt();iu();_w=class bw extends Bo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(j(rt,"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={...bw.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;i.push(d*l,f*h),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,p=f*this.verticesX+d,m=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,_,g)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};_w.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};vw=_w});var Sw,Ew,Aw=x(()=>{Tw();Sw=class ww extends vw{constructor(t={}){t={...ww.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=i>d?1:i/d,p=Math.min(u,f),m=l*e,g=h*i;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*p-g,t[17]=t[19]=t[21]=t[23]=i-a*p-g,t[25]=t[27]=t[29]=t[31]=i-g,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};Sw.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Ew=Sw});var Ta,Pw=x(()=>{F();Be();Fc();Aw();Ta=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];it.return(e.geometry),it.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=it.get(Ui);return e.geometry=it.get(Ew),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};Ta.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"}});var ag=x(()=>{F();Pw();H.add(Ta)});var Sa,Cw=x(()=>{F();Sa=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Sa.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"}});function Rw(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var Mw=x(()=>{"use strict"});var k2,wa,Iw=x(()=>{F();mt();ar();Mi();lo();Ge();Tt();Si();Dr();Ve();Mw();Pt();k2=new hr({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])}),wa=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Ct({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 xe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?Rw(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,h=!0,c=!1,u=!1,d=!0;for(let f=0;f<i.length;f++){let p=i[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),l+=p.padding,p.antialias==="off"?h=!1:p.antialias==="inherit"&&h&&(h=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){V("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(l|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=zt.getOptimalTexture(o.width,o.height,a,h),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=I.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),zt.returnTexture(i);else{let a=e.inputTexture,l=zt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),h=0;for(h=0;h<n.length-1;++h){n[h].apply(this,a,l,!0);let u=a;a=l,l=u}n[h].apply(this,a,e.previousRenderSurface,!1),zt.returnTexture(a),zt.returnTexture(l)}e.blendRequired&&zt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=zt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let 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,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=dt.shared,c=n.previousRenderSurface===i,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,g=p.uInputSize,_=p.uInputPixel,b=p.uInputClamp,y=p.uGlobalFrame,w=p.uOutputTexture;if(c){let S=this._filterStackIndex;for(;S>0;){S--;let P=this._filterStack[this._filterStackIndex-1];if(!P.skip){l.x=P.bounds.minX,l.y=P.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],b[0]=.5*_[2],b[1]=.5*_[3],b[2]=e.frame.width*g[2]-.5*_[2],b[3]=e.frame.height*g[3]-.5*_[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;y[0]=l.x*u,y[1]=l.y*u,y[2]=E.source.width*u,y[3]=E.source.height*u;let v=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof I?(w[0]=i.frame.width,w[1]=i.frame.height):(w[0]=v.width,w[1]=v.height),w[2]=v.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let S=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(S,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:k2,shader:t,state:t._state,topology:"triangle-list"}),o.type===se.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new At,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(G.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}};wa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"}});var lg=x(()=>{F();Cw();Iw();H.add(wa);H.add(Sa)});var U2={};var Bw=x(()=>{kb();up();Vb();zb();lc();pc();xm();ym();Tm();zm();tg();ig();ng();ag();lg()});var G2={};var kw=x(()=>{up();lc();pc();xm();ym();Tm();zm();tg();ig();ng();ag();lg()});var Gw,Ow,Lw=x(()=>{cs();co();Tr();Sr();Gw=class hg extends qt{constructor(t){t={...hg.defaultOptions,...t},super(t),this.enabled=!0,this._state=Qt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=ur.from(e)),i&&(n=cr.from(i)),new hg({gpuProgram:o,glProgram:n,...s})}};Gw.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};Ow=Gw});async function Dw(r){if(!r)for(let t=0;t<cg.length;t++){let e=cg[t];if(e.value.test()){await e.value.load();return}}}var cg,Nw=x(()=>{F();cg=[];H.handleByNamedList(T.Environment,cg)});function au(){if(typeof Ea=="boolean")return Ea;try{Ea=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ea=!1}return Ea}var Ea,ug=x(()=>{"use strict"});var ye,Uo=x(()=>{"use strict";ye=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(ye||{})});var Go,dg=x(()=>{"use strict";Go=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:h,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var O2,Hw,Oi,Aa=x(()=>{ve();Nw();br();ug();Wt();Uo();dg();Ae();O2=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Hw=class Vw extends It{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...O2,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Dw(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...Vw.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof nt&&(i={container:i},e&&(j(rt,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:ot.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ye.ALL);let{clear:i,clearColor:s,target:o}=t;ot.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,ot.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Go(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!au())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};Hw.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Oi=Hw});var Pa,$w=x(()=>{F();mt();ls();xc();Fi();ea();ra();ko();ki();Tr();Ge();Pa=class{init(){let t=new Ct({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Ur({name:"graphics",bits:[uo,po(lr()),nw,Or]});this.shader=new qt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),h=o.encoder;h.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;h.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);h.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p<l.instructionSize;p++){let m=d[p];if(m.topology!==f&&(f=m.topology,h.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let g=m.textures;m.bindGroup=ao(g.textures,g.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}h.setBindGroup(1,m.bindGroup,s.gpuProgram),h.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};Pa.extension={type:[T.WebGPUPipesAdaptor],name:"graphics"}});var Xw,jw,fg=x(()=>{"use strict";Xw={name:"texture-bit",vertex:{header:`
570
570
 
571
571
  struct TextureUniforms {
572
572
  uTextureMatrix:mat3x3<f32>,
@@ -582,7 +582,7 @@ fn mainFragment(
582
582
 
583
583
  `,main:`
584
584
  outColor = textureSample(uTexture, uSampler, vUV);
585
- `}},Xw={name:"texture-bit",vertex:{header:`
585
+ `}},jw={name:"texture-bit",vertex:{header:`
586
586
  uniform mat3 uTextureMatrix;
587
587
  `,main:`
588
588
  uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
@@ -592,7 +592,7 @@ fn mainFragment(
592
592
 
593
593
  `,main:`
594
594
  outColor = texture(uTexture, vUV);
595
- `}}});var Ca,jw=x(()=>{F();mt();Fi();ko();ki();dg();Tr();Tt();Pt();Ca=class{init(){let t=Ur({name:"mesh",bits:[xs,$w,Or]});this._shader=new qt({gpuProgram:t,resources:{uTexture:I.EMPTY._source,uSampler:I.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){V("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Ca.extension={type:[T.WebGPUPipesAdaptor],name:"mesh"}});var cu,Ra,Yw=x(()=>{F();Sr();xc();cu=Qt.for2d(),Ra=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=e,o.setGeometry(e,n),cu.blendMode="normal",s.pipeline.getPipeline(e,n,cu);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=ao(l.textures,l.count)}cu.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,cu,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Ra.extension={type:[T.WebGPUPipesAdaptor],name:"batch"}});var Ma,qw=x(()=>{F();Ma=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Ma.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"customRender"}});function Ia(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=i[s];t[o.renderPipeId].execute(o)}}var fg=x(()=>{"use strict"});var O2,Ba,Kw=x(()=>{F();mt();Be();ua();fg();O2=new G,Ba=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(it.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=it.get(Hr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=O2.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Ia(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Ia(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"renderGroup"}});function Fa(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}var pg=x(()=>{"use strict"});function mg(r,t=!1){D2(r);let e=r.childrenToUpdate,i=r.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,l=n.index;for(let h=0;h<l;h++){let c=a[h];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===o&&Jw(c,i,0)}Fa(a,l),n.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)mg(r.renderGroupChildren[s],t)}function D2(r){let t=r.root,e;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Ys(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Jw(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&Zw&&Qw(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&Zw&&Qw(r,L2,e)),!r.renderGroup){let o=r.children,n=o.length;for(let h=0;h<n;h++)Jw(o[h],t,e);let a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function Qw(r,t,e){if(e&Qs){r.groupColor=Ys(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&On&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&ss&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var L2,Zw,tE=x(()=>{br();pg();zf();L2=new nt,Zw=ss|Qs|On});function eE(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var rE=x(()=>{"use strict"});var N2,ka,iE=x(()=>{F();mt();Si();Ve();pg();fg();tE();rE();N2=new G,ka=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=N2;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ia(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&zt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=zt.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new At),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(zt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?Fa(t.childrenRenderablesToUpdate.list,0):eE(t,i),mg(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:i}=t.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Fa(e,i)}_buildInstructions(t,e){let i=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};ka.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"renderGroup"}});var Ua,sE=x(()=>{F();Be();ua();Ua=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];it.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=it.get(Hr);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)it.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ua.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"sprite"}});var Oo,gg=x(()=>{Ae();Oo="8.9.2"});var Ga,Oa,xg=x(()=>{F();gg();Ga=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Oo)}static destroy(){}};Ga.extension=T.Application;Oa=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Oo)}destroy(){this._renderer=null}};Oa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"initHook",priority:-10}});var yg,_g,nE=x(()=>{F();Sr();qp();yg=class oE{constructor(t,e){this.state=Qt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new ia)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=oE.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let i in e){let s=e[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};yg.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"batch"};yg._availableBatchers=Object.create(null);_g=yg;H.handleByMap(T.Batcher,_g._availableBatchers);H.add(ia)});var aE,lE=x(()=>{aE=`in vec2 vMaskCoord;
595
+ `}}});var Ca,Yw=x(()=>{F();mt();Fi();ko();ki();fg();Tr();Tt();Pt();Ca=class{init(){let t=Ur({name:"mesh",bits:[ys,Xw,Or]});this._shader=new qt({gpuProgram:t,resources:{uTexture:I.EMPTY._source,uSampler:I.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){V("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Ca.extension={type:[T.WebGPUPipesAdaptor],name:"mesh"}});var cu,Ra,qw=x(()=>{F();Sr();xc();cu=Qt.for2d(),Ra=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=e,o.setGeometry(e,n),cu.blendMode="normal",s.pipeline.getPipeline(e,n,cu);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=ao(l.textures,l.count)}cu.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,cu,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Ra.extension={type:[T.WebGPUPipesAdaptor],name:"batch"}});var Ma,Kw=x(()=>{F();Ma=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Ma.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"customRender"}});function Ia(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=i[s];t[o.renderPipeId].execute(o)}}var pg=x(()=>{"use strict"});var L2,Ba,Zw=x(()=>{F();mt();Be();ua();pg();L2=new G,Ba=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(it.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=it.get(Hr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=L2.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Ia(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Ia(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ba.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"renderGroup"}});function Fa(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}var mg=x(()=>{"use strict"});function gg(r,t=!1){N2(r);let e=r.childrenToUpdate,i=r.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,l=n.index;for(let h=0;h<l;h++){let c=a[h];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===o&&tE(c,i,0)}Fa(a,l),n.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)gg(r.renderGroupChildren[s],t)}function N2(r){let t=r.root,e;if(r.renderGroupParent){let i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Ys(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function tE(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&Qw&&Jw(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&Qw&&Jw(r,D2,e)),!r.renderGroup){let o=r.children,n=o.length;for(let h=0;h<n;h++)tE(o[h],t,e);let a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function Jw(r,t,e){if(e&Qs){r.groupColor=Ys(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&On&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&os&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var D2,Qw,eE=x(()=>{br();mg();$f();D2=new nt,Qw=os|Qs|On});function rE(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o<i;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return r.structureDidChange=s,s}var iE=x(()=>{"use strict"});var H2,ka,sE=x(()=>{F();mt();Si();Ve();mg();pg();eE();iE();H2=new G,ka=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=H2;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ia(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&zt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=zt.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new At),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(zt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?Fa(t.childrenRenderablesToUpdate.list,0):rE(t,i),gg(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:i}=t.childrenRenderablesToUpdate;for(let s=0;s<i;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Fa(e,i)}_buildInstructions(t,e){let i=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};ka.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"renderGroup"}});var Ua,oE=x(()=>{F();Be();ua();Ua=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];it.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=it.get(Hr);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)it.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ua.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"sprite"}});var Oo,xg=x(()=>{Ae();Oo="8.9.2"});var Ga,Oa,yg=x(()=>{F();xg();Ga=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Oo)}static destroy(){}};Ga.extension=T.Application;Oa=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Oo)}destroy(){this._renderer=null}};Oa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"initHook",priority:-10}});var _g,bg,aE=x(()=>{F();Sr();Kp();_g=class nE{constructor(t,e){this.state=Qt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new ia)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=nE.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let i in e){let s=e[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};_g.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"batch"};_g._availableBatchers=Object.create(null);bg=_g;H.handleByMap(T.Batcher,bg._availableBatchers);H.add(ia)});var lE,hE=x(()=>{lE=`in vec2 vMaskCoord;
596
596
  in vec2 vTextureCoord;
597
597
 
598
598
  uniform sampler2D uTexture;
@@ -626,7 +626,7 @@ void main(void)
626
626
 
627
627
  finalColor = original * a;
628
628
  }
629
- `});var hE,cE=x(()=>{hE=`in vec2 aPosition;
629
+ `});var cE,uE=x(()=>{cE=`in vec2 aPosition;
630
630
 
631
631
  out vec2 vTextureCoord;
632
632
  out vec2 vMaskCoord;
@@ -663,7 +663,7 @@ void main(void)
663
663
  vTextureCoord = filterTextureCoord(aPosition);
664
664
  vMaskCoord = getFilterCoord(aPosition);
665
665
  }
666
- `});var bg,uE=x(()=>{bg=`struct GlobalFilterUniforms {
666
+ `});var vg,dE=x(()=>{vg=`struct GlobalFilterUniforms {
667
667
  uInputSize:vec4<f32>,
668
668
  uInputPixel:vec4<f32>,
669
669
  uInputClamp:vec4<f32>,
@@ -761,9 +761,9 @@ fn mainFragment(
761
761
 
762
762
  return source * a;
763
763
  }
764
- `});var uu,dE=x(()=>{mt();hs();co();Ge();tp();Ow();lE();cE();uE();uu=class extends Gw{constructor(t){let{sprite:e,...i}=t,s=new Zs(e.texture),o=new Ct({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=ur.from({vertex:{source:bg,entryPoint:"mainVertex"},fragment:{source:bg,entryPoint:"mainFragment"}}),a=cr.from({vertex:hE,fragment:aE,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var H2,vg,La,fE=x(()=>{F();zh();dE();Ve();kn();jn();Be();Tt();Si();Dr();H2=new At,vg=class extends ti{constructor(){super(),this.filters=[new uu({sprite:new kt(I.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},La=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=it.get(vg);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=js(t.mask.mask,!0,H2);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=zt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===se.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();i&&zt.returnTexture(s.filterTexture),it.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};La.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"alphaMask"}});var Da,pE=x(()=>{F();Da=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Da.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"colorMask"}});var Na,mE=x(()=>{F();Uo();ls();Na=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let h=i.instructionSize-l.instructionsStart-1;l.instructionsLength=h;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Gt.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(Gt.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Gt.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Gt.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,ye.STENCIL),i.stencil.setStencilMode(Gt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(Gt.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Gt.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Na.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"stencilMask"}});var Tg,xE,yE=x(()=>{ve();F();Tg=class gE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ot(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...gE.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Tg.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"background",priority:0};Tg.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};xE=Tg});var Ha,Va,_E=x(()=>{F();zh();Pt();Ha={};H.handle(T.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ha[r.name]=r.ref},r=>{delete Ha[r.name]});Va=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Ha[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!Ha[e]){V(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new ti,i.filters=[new Ha[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Va.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"blendMode"}});var Sg,wg,vE,TE=x(()=>{F();br();Tt();Sg={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},wg=class bE{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof nt||t instanceof I?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,bE.defaultImageOptions);let{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},Sg[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Sg[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Sg[e],quality:i});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer;if(e instanceof I)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof I?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof nt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof I?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};wg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"extract"};wg.defaultImageOptions={format:"png",quality:1};vE=wg});var hi,Eg=x(()=>{We();Tt();hi=class r extends I{static create(t){return new r({source:new wt(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var V2,W2,z2,Wa,SE=x(()=>{ve();F();mt();he();Ve();qh();br();Eg();V2=new tt,W2=new At,z2=[0,0,0,0],Wa=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof nt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:ot.shared.setValue(o).toArray():o=z2;let n=t.frame?.copyTo(V2)||qs(s,W2).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=hi.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:i}),l=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};Wa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGenerator"}});var za,wE=x(()=>{F();mt();ar();vo();Mi();Dr();Ge();za=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new G,worldColor:4294967295,offset:new dt},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},h=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(h);let c=h.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Nr(l.worldColor,c.uWorldColorAlpha,0),h.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(h,!1):(u=this._bindGroupPool.pop()||new xe,this._activeBindGroups.push(u),u.setResource(h,0)),l.bindGroup=u,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===se.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new Ct({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};za.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"globalUniforms"}});var $2,$a,EE=x(()=>{F();eo();$2=1,$a=class{constructor(){this._tasks=[],this._offset=0}init(){ce.system.add(this._update,this)}repeat(t,e,i=!0){let s=$2++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let i=this._tasks[e];if(t-i.offset-i.last>=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){ce.system.remove(this._update,this),this._tasks.length=0}};$a.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"scheduler",priority:0}});function PE(r){if(!AE){if(Y.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Oo} (${r}) http://www.pixijs.com/
764
+ `});var uu,fE=x(()=>{mt();cs();co();Ge();ep();Lw();hE();uE();dE();uu=class extends Ow{constructor(t){let{sprite:e,...i}=t,s=new Zs(e.texture),o=new Ct({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=ur.from({vertex:{source:vg,entryPoint:"mainVertex"},fragment:{source:vg,entryPoint:"mainFragment"}}),a=cr.from({vertex:cE,fragment:lE,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var V2,Tg,La,pE=x(()=>{F();zh();fE();Ve();kn();jn();Be();Tt();Si();Dr();V2=new At,Tg=class extends ti{constructor(){super(),this.filters=[new uu({sprite:new kt(I.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},La=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=it.get(Tg);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=js(t.mask.mask,!0,V2);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=zt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===se.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();i&&zt.returnTexture(s.filterTexture),it.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};La.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"alphaMask"}});var Da,mE=x(()=>{F();Da=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Da.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"colorMask"}});var Na,gE=x(()=>{F();Uo();hs();Na=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let h=i.instructionSize-l.instructionsStart-1;l.instructionsLength=h;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[n.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let i=this._renderer,s=i.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Gt.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?i.stencil.setStencilMode(Gt.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Gt.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Gt.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,ye.STENCIL),i.stencil.setStencilMode(Gt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?i.stencil.setStencilMode(Gt.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Gt.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Na.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"stencilMask"}});var Sg,yE,_E=x(()=>{ve();F();Sg=class xE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ot(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...xE.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Sg.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"background",priority:0};Sg.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};yE=Sg});var Ha,Va,bE=x(()=>{F();zh();Pt();Ha={};H.handle(T.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ha[r.name]=r.ref},r=>{delete Ha[r.name]});Va=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Ha[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!Ha[e]){V(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new ti,i.filters=[new Ha[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Va.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"blendMode"}});var wg,Eg,TE,SE=x(()=>{F();br();Tt();wg={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Eg=class vE{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof nt||t instanceof I?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,vE.defaultImageOptions);let{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},wg[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(wg[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:wg[e],quality:i});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer;if(e instanceof I)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof I?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof nt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof I?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Eg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"extract"};Eg.defaultImageOptions={format:"png",quality:1};TE=Eg});var hi,Ag=x(()=>{We();Tt();hi=class r extends I{static create(t){return new r({source:new wt(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var W2,z2,$2,Wa,wE=x(()=>{ve();F();mt();he();Ve();qh();br();Ag();W2=new tt,z2=new At,$2=[0,0,0,0],Wa=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof nt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:ot.shared.setValue(o).toArray():o=$2;let n=t.frame?.copyTo(W2)||qs(s,z2).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=hi.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:i}),l=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};Wa.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGenerator"}});var za,EE=x(()=>{F();mt();ar();vo();Mi();Dr();Ge();za=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new G,worldColor:4294967295,offset:new dt},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},h=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(h);let c=h.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Nr(l.worldColor,c.uWorldColorAlpha,0),h.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(h,!1):(u=this._bindGroupPool.pop()||new xe,this._activeBindGroups.push(u),u.setResource(h,0)),l.bindGroup=u,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===se.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new Ct({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};za.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"globalUniforms"}});var X2,$a,AE=x(()=>{F();eo();X2=1,$a=class{constructor(){this._tasks=[],this._offset=0}init(){ce.system.add(this._update,this)}repeat(t,e,i=!0){let s=X2++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let i=this._tasks[e];if(t-i.offset-i.last>=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){ce.system.remove(this._update,this),this._tasks.length=0}};$a.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"scheduler",priority:0}});function CE(r){if(!PE){if(Y.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Oo} (${r}) http://www.pixijs.com/
765
765
 
766
- `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Oo} - ${r} - http://www.pixijs.com/`);AE=!0}}var AE,CE=x(()=>{Ft();gg();AE=!1});var Lo,RE=x(()=>{F();CE();Dr();Lo=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===se.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),PE(e)}}};Lo.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"hello",priority:-2};Lo.defaultOptions={hello:!1}});function ME(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function IE(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var BE=x(()=>{"use strict"});var X2,Ag,kE,UE=x(()=>{F();BE();X2=0,Ag=class FE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...FE.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=ME(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)IE(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=X2++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,l=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===l&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let h=i;a&&(a.structureDidChange=!0),h[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};Ag.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"renderableGC",priority:0};Ag.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};kE=Ag});var Pg,OE,LE=x(()=>{F();Pg=class GE{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...GE.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Pg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGC"};Pg.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};OE=Pg});var DE,Xa,Cg=x(()=>{Se();We();Tt();DE=class NE{constructor(t={}){if(this.uid=ut("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...NE.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new wt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof I||t.depthStencilTexture instanceof wt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new wt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};DE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Xa=DE});function ys(r,t){if(!ja.has(r)){let e=new I({source:new Pe({resource:r,...t})}),i=()=>{ja.get(r)===e&&ja.delete(r)};e.once("destroy",i),e.source.once("destroy",i),ja.set(r,e)}return ja.get(r)}var ja,du=x(()=>{io();Tt();ja=new Map});var Rg,VE,WE=x(()=>{Ft();F();he();Wt();Cg();du();Rg=class HE{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...HE.defaultOptions,...t},t.view&&(j(rt,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new tt(0,0,t.width,t.height),this.canvas=t.canvas||Y.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ys(this.canvas,t),this.renderTarget=new Xa({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Rg.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"view",priority:0};Rg.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};VE=Rg});var fu,pu,Mg=x(()=>{qw();Kw();iE();sE();xg();nE();fE();pE();mE();yE();_E();TE();SE();wE();EE();RE();UE();LE();WE();fu=[xE,za,Lo,VE,ka,OE,Wa,vE,Oa,kE,$a],pu=[Va,_g,Ua,Ba,La,Na,Da,Ma]});var Ya,zE=x(()=>{F();Ya=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let l=a.shader.getProgramData(e).bindGroups[i],h=s.createBindGroup({layout:l,entries:n});return this._hash[t._key]=h,h}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};Ya.extension={type:[T.WebGPUSystem],name:"bindGroup"}});var qa,$E=x(()=>{F();Bp();qa=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Zn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};qa.extension={type:[T.WebGPUSystem],name:"buffer"}});var Ka,XE=x(()=>{F();Ka=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Ka.extension={type:[T.WebGPUSystem],name:"colorMask"}});var Do,jE=x(()=>{Ft();F();Do=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await Y.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Do.extension={type:[T.WebGPUSystem],name:"device"};Do.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Za,YE=x(()=>{F();Za=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:h}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,h),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,l??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),l??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,i={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Za.extension={type:[T.WebGPUSystem],name:"encoder",priority:1}});var Qa,qE=x(()=>{F();ls();Qa=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Gt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Qa.extension={type:[T.WebGPUSystem],name:"stencil"}});var No,Ig=x(()=>{cg();Ii();oi();No=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!au())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(e.layout.size/4),usage:ht.UNIFORM|ht.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(s.layout.size/4),usage:ht.UNIFORM|ht.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function KE(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i<t.length;i++){let s=t[i],o=Ja[s.data.type].size,n=Ja[s.data.type].align;if(!Ja[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Ja,Bg=x(()=>{"use strict";Ja={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var ci,Fg=x(()=>{"use strict";ci=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
766
+ `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Oo} - ${r} - http://www.pixijs.com/`);PE=!0}}var PE,RE=x(()=>{Ft();xg();PE=!1});var Lo,ME=x(()=>{F();RE();Dr();Lo=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===se.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),CE(e)}}};Lo.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"hello",priority:-2};Lo.defaultOptions={hello:!1}});function IE(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function BE(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var FE=x(()=>{"use strict"});var j2,Pg,UE,GE=x(()=>{F();FE();j2=0,Pg=class kE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...kE.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=IE(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)BE(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=j2++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,l=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===l&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let h=i;a&&(a.structureDidChange=!0),h[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};Pg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"renderableGC",priority:0};Pg.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};UE=Pg});var Cg,LE,DE=x(()=>{F();Cg=class OE{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...OE.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Cg.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"textureGC"};Cg.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};LE=Cg});var NE,Xa,Rg=x(()=>{Se();We();Tt();NE=class HE{constructor(t={}){if(this.uid=ut("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...HE.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new wt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof I||t.depthStencilTexture instanceof wt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new wt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};NE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Xa=NE});function _s(r,t){if(!ja.has(r)){let e=new I({source:new Pe({resource:r,...t})}),i=()=>{ja.get(r)===e&&ja.delete(r)};e.once("destroy",i),e.source.once("destroy",i),ja.set(r,e)}return ja.get(r)}var ja,du=x(()=>{io();Tt();ja=new Map});var Mg,WE,zE=x(()=>{Ft();F();he();Wt();Rg();du();Mg=class VE{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...VE.defaultOptions,...t},t.view&&(j(rt,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new tt(0,0,t.width,t.height),this.canvas=t.canvas||Y.get().createCanvas(),this.antialias=!!t.antialias,this.texture=_s(this.canvas,t),this.renderTarget=new Xa({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Mg.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"view",priority:0};Mg.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};WE=Mg});var fu,pu,Ig=x(()=>{Kw();Zw();sE();oE();yg();aE();pE();mE();gE();_E();bE();SE();wE();EE();AE();ME();GE();DE();zE();fu=[yE,za,Lo,WE,ka,LE,Wa,TE,Oa,UE,$a],pu=[Va,bg,Ua,Ba,La,Na,Da,Ma]});var Ya,$E=x(()=>{F();Ya=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let l=a.shader.getProgramData(e).bindGroups[i],h=s.createBindGroup({layout:l,entries:n});return this._hash[t._key]=h,h}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};Ya.extension={type:[T.WebGPUSystem],name:"bindGroup"}});var qa,XE=x(()=>{F();Fp();qa=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Zn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};qa.extension={type:[T.WebGPUSystem],name:"buffer"}});var Ka,jE=x(()=>{F();Ka=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Ka.extension={type:[T.WebGPUSystem],name:"colorMask"}});var Do,YE=x(()=>{Ft();F();Do=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await Y.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Do.extension={type:[T.WebGPUSystem],name:"device"};Do.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Za,qE=x(()=>{F();Za=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:h}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,h),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,l??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),l??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,i={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Za.extension={type:[T.WebGPUSystem],name:"encoder",priority:1}});var Qa,KE=x(()=>{F();hs();Qa=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Gt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Qa.extension={type:[T.WebGPUSystem],name:"stencil"}});var No,Bg=x(()=>{ug();Ii();oi();No=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!au())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(e.layout.size/4),usage:ht.UNIFORM|ht.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(s.layout.size/4),usage:ht.UNIFORM|ht.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function ZE(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i<t.length;i++){let s=t[i],o=Ja[s.data.type].size,n=Ja[s.data.type].align;if(!Ja[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Ja,Fg=x(()=>{"use strict";Ja={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var ci,kg=x(()=>{"use strict";ci=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
767
767
  var matrix = uv[name].toArray(true);
768
768
  data[offset] = matrix[0];
769
769
  data[offset + 1] = matrix[1];
@@ -846,11 +846,11 @@ fn mainFragment(
846
846
  offset += ${u-o};
847
847
  ${d};
848
848
  `)}o=u}let n=s.join(`
849
- `);return new Function("uv","data","dataInt32","offset",n)}var kg=x(()=>{Fg()});function Ho(r,t){return`
849
+ `);return new Function("uv","data","dataInt32","offset",n)}var Ug=x(()=>{kg()});function Ho(r,t){return`
850
850
  for (let i = 0; i < ${r*t}; i++) {
851
851
  data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
852
852
  }
853
- `}var Ug,ZE,Gg=x(()=>{"use strict";Ug={f32:`
853
+ `}var Gg,QE,Og=x(()=>{"use strict";Gg={f32:`
854
854
  data[offset] = v;`,i32:`
855
855
  dataInt32[offset] = v;`,"vec2<f32>":`
856
856
  data[offset] = v[0];
@@ -886,12 +886,12 @@ fn mainFragment(
886
886
  data[offset + 10] = v[8];`,"mat4x4<f32>":`
887
887
  for (let i = 0; i < 16; i++) {
888
888
  data[offset + i] = v[i];
889
- }`,"mat3x2<f32>":Ho(3,2),"mat4x2<f32>":Ho(4,2),"mat2x3<f32>":Ho(2,3),"mat4x3<f32>":Ho(4,3),"mat2x4<f32>":Ho(2,4),"mat3x4<f32>":Ho(3,4)},ZE={...Ug,"mat2x2<f32>":`
889
+ }`,"mat3x2<f32>":Ho(3,2),"mat4x2<f32>":Ho(4,2),"mat2x3<f32>":Ho(2,3),"mat4x3<f32>":Ho(4,3),"mat2x4<f32>":Ho(2,4),"mat3x4<f32>":Ho(3,4)},QE={...Gg,"mat2x2<f32>":`
890
890
  data[offset] = v[0];
891
891
  data[offset + 1] = v[1];
892
892
  data[offset + 2] = v[2];
893
893
  data[offset + 3] = v[3];
894
- `}});function QE(r,t){let{size:e,align:i}=Ja[r.data.type],s=(i-e)/4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
894
+ `}});function JE(r,t){let{size:e,align:i}=Ja[r.data.type],s=(i-e)/4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
895
895
  v = uv.${r.data.name};
896
896
  ${t!==0?`offset += ${t};`:""}
897
897
 
@@ -907,7 +907,7 @@ fn mainFragment(
907
907
  }
908
908
  ${s!==0?`arrayOffset += ${s};`:""}
909
909
  }
910
- `}var JE=x(()=>{Bg()});function tA(r){return mu(r,"uboWgsl",QE,ZE)}var eA=x(()=>{kg();Gg();JE()});var tl,rA=x(()=>{F();Ig();Bg();eA();tl=class extends No{constructor(){super({createUboElements:KE,generateUboSync:tA})}};tl.extension={type:[T.WebGPUSystem],name:"ubo"}});var Li,gu=x(()=>{Ae();Se();Li=class extends It{constructor({buffer:t,offset:e,size:i}){super(),this.uid=ut("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ut("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ut("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var xu,iA=x(()=>{"use strict";xu=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}});var Di,el,sA=x(()=>{F();Ii();gu();oi();iA();Mi();Di=128,el=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new xu({minUniformOffsetAlignment:Di});let e=256/Di;for(let i=0;i<e;i++){let s=ht.UNIFORM|ht.COPY_DST;i===0&&(s|=ht.COPY_SRC),this._buffers.push(new Yt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Di),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Di)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Di)}getArrayBufferResource(t){let i=this._batchBuffer.addGroup(t)/Di;return this._getBufferResource(i)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Li({buffer:e,offset:(t/2|0)*256,size:Di})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new xe({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Di,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};el.extension={type:[T.WebGPUPipes],name:"uniformBatch"}});function yu(r,t){for(let e in r.attributes){let i=r.attributes[e],s=t[e];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):V(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}j2(r)}function j2(r){let{buffers:t,attributes:e}=r,i={},s={};for(let o in t){let n=t[o];i[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];i[n.buffer.uid]+=$e(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=$e(n.format).stride}}var Og=x(()=>{Pt();cs()});var Wr,Lg=x(()=>{ls();Wr=[];Wr[Gt.NONE]=void 0;Wr[Gt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Wr[Gt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Wr[Gt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Wr[Gt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Wr[Gt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function q2(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function K2(r,t,e,i){return e<<6|r<<3|i<<1|t}var Y2,rl,oA=x(()=>{F();Pt();Og();ls();ta();Lg();Y2={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};rl=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Gt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Wr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(yu(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=q2(t._layoutKey,e._layoutKey,i.data,i._blendModeId,Y2[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Gt.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(e).pipeline,h={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(h.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(h)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let o=e.join("|");return t._layoutKey=ni(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[i++]=a.location}let o=e.join("|");return t._attributeLocationsKey=ni(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let h=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===h){o[a]=c;break}}return this._bindingNamesCache[i]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in e.attributeData){let h=t.attributes[l];(h.divisor??1)!==1&&V(`Attribute ${l} has an invalid divisor value of '${h.divisor}'. WebGPU only supports a divisor value of 1`),h.buffer===o&&(n.arrayStride=h.stride,n.stepMode=h.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:h.offset,format:h.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let t=K2(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};rl.extension={type:[T.WebGPUSystem],name:"pipeline"}});function nA(r,t,e,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-t*r.a,r.ty=-n-e*r.d,r}var aA=x(()=>{"use strict"});function lA(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var hA=x(()=>{"use strict"});var Vo,Dg=x(()=>{mt();he();Uo();aA();ug();io();We();Tt();du();hA();Cg();Vo=class{constructor(t){this.rootViewPort=new tt,this.viewport=new tt,this.onRenderTargetChange=new Go("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=lA(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,h=this.viewport,c=l.pixelWidth,u=l.pixelHeight;if(!s&&t instanceof I&&(s=t.frame),s){let d=l._resolution;h.x=s.x*d+.5|0,h.y=s.y*d+.5|0,h.width=s.width*d+.5|0,h.height=s.height*d+.5|0}else h.x=0,h.y=0,h.width=c,h.height=u;return nA(this.projectionMatrix,0,0,h.width/l.resolution,h.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,h),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ye.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ye.ALL,i,s){let o=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Pe.test(t)&&(t=ys(t).source),t instanceof Xa?e=t:t instanceof wt&&(e=new Xa({colorTextures:[t]}),Pe.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var _u,cA=x(()=>{"use strict";_u=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var bu,uA=x(()=>{Uo();io();We();cA();bu=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),l=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((h,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(h).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&ye.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let h=e&ye.STENCIL?"clear":"load",c=e&ye.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:h,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let h=a.createCommandEncoder(),c=this.getDescriptor(t,e,i),u=h.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=h.finish();a.queue.submit([d])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new _u;return t.colorTextures.forEach((i,s)=>{if(Pe.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=i.source.antialias,i.source.antialias){let o=new wt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var il,dA=x(()=>{F();Dg();uA();il=class extends Vo{constructor(t){super(t),this.adaptor=new bu,this.adaptor.init(t,this)}};il.extension={type:[T.WebGPUSystem],name:"renderTarget"}});var sl,fA=x(()=>{F();sl=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};sl.extension={type:[T.WebGPUSystem],name:"shader"}});var Le,pA=x(()=>{"use strict";Le={};Le.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Le.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Le.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Le.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Le.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Le.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Le["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Le["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Le["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Le.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Le.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Le.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var ol,mA=x(()=>{F();Sr();pA();ol=class{constructor(){this.defaultState=new Qt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Le[t.blendMode]||Le.normal}]}destroy(){this.gpu=null}};ol.extension={type:[T.WebGPUSystem],name:"state"}});var gA,xA=x(()=>{"use strict";gA={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var Ng,Z2,yA,_A=x(()=>{"use strict";Ng={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},Z2={blockBytes:4,blockWidth:1,blockHeight:1},yA={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=Ng[r.format]||Z2;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:l},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var vu,Hg=x(()=>{"use strict";vu={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var bA,vA=x(()=>{Hg();bA={type:"video",upload(r,t,e){vu.upload(r,t,e)}}});var Tu,TA=x(()=>{"use strict";Tu=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
910
+ `}var tA=x(()=>{Fg()});function eA(r){return mu(r,"uboWgsl",JE,QE)}var rA=x(()=>{Ug();Og();tA()});var tl,iA=x(()=>{F();Bg();Fg();rA();tl=class extends No{constructor(){super({createUboElements:ZE,generateUboSync:eA})}};tl.extension={type:[T.WebGPUSystem],name:"ubo"}});var Li,gu=x(()=>{Ae();Se();Li=class extends It{constructor({buffer:t,offset:e,size:i}){super(),this.uid=ut("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ut("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ut("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var xu,sA=x(()=>{"use strict";xu=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}});var Di,el,oA=x(()=>{F();Ii();gu();oi();sA();Mi();Di=128,el=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new xu({minUniformOffsetAlignment:Di});let e=256/Di;for(let i=0;i<e;i++){let s=ht.UNIFORM|ht.COPY_DST;i===0&&(s|=ht.COPY_SRC),this._buffers.push(new Yt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Di),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Di)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Di)}getArrayBufferResource(t){let i=this._batchBuffer.addGroup(t)/Di;return this._getBufferResource(i)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Li({buffer:e,offset:(t/2|0)*256,size:Di})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new xe({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Di,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};el.extension={type:[T.WebGPUPipes],name:"uniformBatch"}});function yu(r,t){for(let e in r.attributes){let i=r.attributes[e],s=t[e];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):V(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}Y2(r)}function Y2(r){let{buffers:t,attributes:e}=r,i={},s={};for(let o in t){let n=t[o];i[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];i[n.buffer.uid]+=$e(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=$e(n.format).stride}}var Lg=x(()=>{Pt();us()});var Wr,Dg=x(()=>{hs();Wr=[];Wr[Gt.NONE]=void 0;Wr[Gt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Wr[Gt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Wr[Gt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Wr[Gt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Wr[Gt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function K2(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function Z2(r,t,e,i){return e<<6|r<<3|i<<1|t}var q2,rl,nA=x(()=>{F();Pt();Lg();hs();ta();Dg();q2={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};rl=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Gt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Wr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(yu(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=K2(t._layoutKey,e._layoutKey,i.data,i._blendModeId,q2[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Gt.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(e).pipeline,h={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(h.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(h)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let o=e.join("|");return t._layoutKey=ni(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[i++]=a.location}let o=e.join("|");return t._attributeLocationsKey=ni(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let h=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===h){o[a]=c;break}}return this._bindingNamesCache[i]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in e.attributeData){let h=t.attributes[l];(h.divisor??1)!==1&&V(`Attribute ${l} has an invalid divisor value of '${h.divisor}'. WebGPU only supports a divisor value of 1`),h.buffer===o&&(n.arrayStride=h.stride,n.stepMode=h.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:h.offset,format:h.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let t=Z2(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};rl.extension={type:[T.WebGPUSystem],name:"pipeline"}});function aA(r,t,e,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-t*r.a,r.ty=-n-e*r.d,r}var lA=x(()=>{"use strict"});function hA(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var cA=x(()=>{"use strict"});var Vo,Ng=x(()=>{mt();he();Uo();lA();dg();io();We();Tt();du();cA();Rg();Vo=class{constructor(t){this.rootViewPort=new tt,this.viewport=new tt,this.onRenderTargetChange=new Go("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=hA(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,h=this.viewport,c=l.pixelWidth,u=l.pixelHeight;if(!s&&t instanceof I&&(s=t.frame),s){let d=l._resolution;h.x=s.x*d+.5|0,h.y=s.y*d+.5|0,h.width=s.width*d+.5|0,h.height=s.height*d+.5|0}else h.x=0,h.y=0,h.width=c,h.height=u;return aA(this.projectionMatrix,0,0,h.width/l.resolution,h.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,h),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ye.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ye.ALL,i,s){let o=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Pe.test(t)&&(t=_s(t).source),t instanceof Xa?e=t:t instanceof wt&&(e=new Xa({colorTextures:[t]}),Pe.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var _u,uA=x(()=>{"use strict";_u=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var bu,dA=x(()=>{Uo();io();We();uA();bu=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),l=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((h,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(h).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&ye.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let h=e&ye.STENCIL?"clear":"load",c=e&ye.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:h,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let h=a.createCommandEncoder(),c=this.getDescriptor(t,e,i),u=h.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=h.finish();a.queue.submit([d])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new _u;return t.colorTextures.forEach((i,s)=>{if(Pe.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=i.source.antialias,i.source.antialias){let o=new wt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var il,fA=x(()=>{F();Ng();dA();il=class extends Vo{constructor(t){super(t),this.adaptor=new bu,this.adaptor.init(t,this)}};il.extension={type:[T.WebGPUSystem],name:"renderTarget"}});var sl,pA=x(()=>{F();sl=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};sl.extension={type:[T.WebGPUSystem],name:"shader"}});var Le,mA=x(()=>{"use strict";Le={};Le.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Le.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Le.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Le.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Le.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Le.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Le["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Le["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Le["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Le.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Le.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Le.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var ol,gA=x(()=>{F();Sr();mA();ol=class{constructor(){this.defaultState=new Qt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Le[t.blendMode]||Le.normal}]}destroy(){this.gpu=null}};ol.extension={type:[T.WebGPUSystem],name:"state"}});var xA,yA=x(()=>{"use strict";xA={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var Hg,Q2,_A,bA=x(()=>{"use strict";Hg={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},Q2={blockBytes:4,blockWidth:1,blockHeight:1},_A={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=Hg[r.format]||Q2;for(let n=0;n<r.resource.length;n++){let a=r.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:l},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var vu,Vg=x(()=>{"use strict";vu={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var vA,TA=x(()=>{Vg();vA={type:"video",upload(r,t,e){vu.upload(r,t,e)}}});var Tu,SA=x(()=>{"use strict";Tu=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
911
911
  var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
912
912
  vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
913
913
 
@@ -931,7 +931,7 @@ fn mainFragment(
931
931
  fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
932
932
  return textureSample(img, imgSampler, texCoord);
933
933
  }
934
- `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let h=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=i.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:h}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),h=d}}if(!o){let l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let h=1;h<t.mipLevelCount;++h)n.copyTextureToTexture({texture:i,mipLevel:h-1},{texture:t,mipLevel:h},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([n.finish()]),o||i.destroy(),t}}});var nl,SA=x(()=>{Ft();F();Ge();So();Mi();xA();_A();Hg();vA();TA();nl=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:vu,buffer:gA,video:bA,compressed:yA},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let i=Ng[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Tu(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new xe({0:e,1:e.style,2:new Ct({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=Y.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Y.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=je.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return je.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};nl.extension={type:[T.WebGPUSystem],name:"texture"}});var PA={};o_(PA,{WebGPURenderer:()=>Vg});var Q2,J2,tk,wA,EA,AA,Vg,CA=x(()=>{F();zw();jw();Yw();Aa();Mg();Dr();zE();$E();XE();jE();YE();qE();rA();sA();oA();dA();fA();mA();SA();Q2=[...fu,tl,Za,Do,qa,nl,il,sl,ol,rl,Ka,Qa,Ya],J2=[...pu,el],tk=[Ra,Ca,Pa],wA=[],EA=[],AA=[];H.handleByNamedList(T.WebGPUSystem,wA);H.handleByNamedList(T.WebGPUPipes,EA);H.handleByNamedList(T.WebGPUPipesAdaptor,AA);H.add(...Q2,...J2,...tk);Vg=class extends Oi{constructor(){let t={name:"webgpu",type:se.WEBGPU,systems:wA,renderPipes:EA,renderPipeAdaptors:AA};super(t)}}});var al,RA=x(()=>{F();mt();as();Fi();ea();ra();ko();ki();Sc();Tr();Ge();al=class{init(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=lr(),i=Gr({name:"graphics",bits:[fo,mo(e),Fo,Lr]});this.shader=new qt({glProgram:i,resources:{localUniforms:t,batchSamplers:go(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let h=l.instructions;for(let c=0;c<l.instructionSize;c++){let u=h[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};al.extension={type:[T.WebGLPipesAdaptor],name:"graphics"}});var ll,MA=x(()=>{F();mt();Fi();ko();ki();dg();Tr();Tt();Pt();ll=class{init(){let t=Gr({name:"mesh",bits:[Fo,Xw,Lr]});this._shader=new qt({glProgram:t,resources:{uTexture:I.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){V("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ll.extension={type:[T.WebGLPipesAdaptor],name:"mesh"}});var hl,IA=x(()=>{F();Sr();hl=class{constructor(){this._tempState=Qt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(e.topology,e.size,e.start)}};hl.extension={type:[T.WebGLPipesAdaptor],name:"batch"}});var cl,BA=x(()=>{"use strict";cl=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(cl||{})});var Su,FA=x(()=>{"use strict";Su=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var ul,kA=x(()=>{F();oi();BA();FA();ul=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,i>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&ht.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=cl.ARRAY_BUFFER;t.descriptor.usage&ht.INDEX?i=cl.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ht.UNIFORM&&(i=cl.UNIFORM_BUFFER);let s=new Su(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};ul.extension={type:[T.WebGLSystem],name:"buffer"}});var Wg,GA,OA=x(()=>{Ft();F();Pt();Wg=class UA{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...UA.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(V("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=Y.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&V("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof Y.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let i,s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&V("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||V("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Wg.extension={type:[T.WebGLSystem],name:"context"};Wg.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};GA=Wg});var wu,zg,yt,$g=x(()=>{"use strict";wu=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(wu||{}),zg=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(zg||{}),yt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(yt||{})});function DA(r){return LA[r]??LA.float32}var LA,NA=x(()=>{$g();LA={uint8x2:yt.UNSIGNED_BYTE,uint8x4:yt.UNSIGNED_BYTE,sint8x2:yt.BYTE,sint8x4:yt.BYTE,unorm8x2:yt.UNSIGNED_BYTE,unorm8x4:yt.UNSIGNED_BYTE,snorm8x2:yt.BYTE,snorm8x4:yt.BYTE,uint16x2:yt.UNSIGNED_SHORT,uint16x4:yt.UNSIGNED_SHORT,sint16x2:yt.SHORT,sint16x4:yt.SHORT,unorm16x2:yt.UNSIGNED_SHORT,unorm16x4:yt.UNSIGNED_SHORT,snorm16x2:yt.SHORT,snorm16x4:yt.SHORT,float16x2:yt.HALF_FLOAT,float16x4:yt.HALF_FLOAT,float32:yt.FLOAT,float32x2:yt.FLOAT,float32x3:yt.FLOAT,float32x4:yt.FLOAT,uint32:yt.UNSIGNED_INT,uint32x2:yt.UNSIGNED_INT,uint32x3:yt.UNSIGNED_INT,uint32x4:yt.UNSIGNED_INT,sint32:yt.INT,sint32x2:yt.INT,sint32x3:yt.INT,sint32x4:yt.INT}});var ek,dl,HA=x(()=>{F();cs();Og();NA();ek={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},dl=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){let i=t.attributes,s=e._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],l=a[n];if(l)return a[e._key]=l,l;yu(t,e._attributeData);let h=t.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let c=0;c<h.length;c++){let u=h[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(t,e){let i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let l=o[a],h=l.buffer,c=s.getGlBuffer(h),u=e._attributeData[a];if(u){n!==c&&(s.bind(h),n=c);let d=u.location;i.enableVertexAttribArray(d);let f=$e(l.format),p=DA(l.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,p,l.stride,l.offset):i.vertexAttribPointer(d,f.size,p,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let g=l.divisor??1;i.vertexAttribDivisor(d,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=ek[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,h=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,h,(i||0)*l,s):o.drawElements(a,e||n.indexBuffer.data.length,h,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};dl.extension={type:[T.WebGLSystem],name:"geometry"}});var rk,Xg,WA,zA=x(()=>{F();Pt();lo();Tr();Sr();We();Tt();hs();rk=new hr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Xg=class VA{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...VA.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(V("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Qt.for2d();let s=new cr({vertex:`
934
+ `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let h=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=i.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:h}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),h=d}}if(!o){let l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let h=1;h<t.mipLevelCount;++h)n.copyTextureToTexture({texture:i,mipLevel:h-1},{texture:t,mipLevel:h},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([n.finish()]),o||i.destroy(),t}}});var nl,wA=x(()=>{Ft();F();Ge();So();Mi();yA();bA();Vg();TA();SA();nl=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:vu,buffer:xA,video:vA,compressed:_A},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let i=Hg[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Tu(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new xe({0:e,1:e.style,2:new Ct({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=Y.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Y.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=je.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return je.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};nl.extension={type:[T.WebGPUSystem],name:"texture"}});var CA={};n_(CA,{WebGPURenderer:()=>Wg});var J2,tk,ek,EA,AA,PA,Wg,RA=x(()=>{F();$w();Yw();qw();Aa();Ig();Dr();$E();XE();jE();YE();qE();KE();iA();oA();nA();fA();pA();gA();wA();J2=[...fu,tl,Za,Do,qa,nl,il,sl,ol,rl,Ka,Qa,Ya],tk=[...pu,el],ek=[Ra,Ca,Pa],EA=[],AA=[],PA=[];H.handleByNamedList(T.WebGPUSystem,EA);H.handleByNamedList(T.WebGPUPipes,AA);H.handleByNamedList(T.WebGPUPipesAdaptor,PA);H.add(...J2,...tk,...ek);Wg=class extends Oi{constructor(){let t={name:"webgpu",type:se.WEBGPU,systems:EA,renderPipes:AA,renderPipeAdaptors:PA};super(t)}}});var al,MA=x(()=>{F();mt();ls();Fi();ea();ra();ko();ki();Sc();Tr();Ge();al=class{init(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=lr(),i=Gr({name:"graphics",bits:[fo,mo(e),Fo,Lr]});this.shader=new qt({glProgram:i,resources:{localUniforms:t,batchSamplers:go(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let h=l.instructions;for(let c=0;c<l.instructionSize;c++){let u=h[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};al.extension={type:[T.WebGLPipesAdaptor],name:"graphics"}});var ll,IA=x(()=>{F();mt();Fi();ko();ki();fg();Tr();Tt();Pt();ll=class{init(){let t=Gr({name:"mesh",bits:[Fo,jw,Lr]});this._shader=new qt({glProgram:t,resources:{uTexture:I.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){V("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ll.extension={type:[T.WebGLPipesAdaptor],name:"mesh"}});var hl,BA=x(()=>{F();Sr();hl=class{constructor(){this._tempState=Qt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)i.texture.bind(s[o],o);i.geometry.draw(e.topology,e.size,e.start)}};hl.extension={type:[T.WebGLPipesAdaptor],name:"batch"}});var cl,FA=x(()=>{"use strict";cl=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(cl||{})});var Su,kA=x(()=>{"use strict";Su=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var ul,UA=x(()=>{F();oi();FA();kA();ul=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,i>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&ht.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=cl.ARRAY_BUFFER;t.descriptor.usage&ht.INDEX?i=cl.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ht.UNIFORM&&(i=cl.UNIFORM_BUFFER);let s=new Su(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};ul.extension={type:[T.WebGLSystem],name:"buffer"}});var zg,OA,LA=x(()=>{Ft();F();Pt();zg=class GA{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...GA.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(V("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=Y.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&V("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof Y.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let i,s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&V("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||V("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};zg.extension={type:[T.WebGLSystem],name:"context"};zg.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};OA=zg});var wu,$g,yt,Xg=x(()=>{"use strict";wu=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(wu||{}),$g=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))($g||{}),yt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(yt||{})});function NA(r){return DA[r]??DA.float32}var DA,HA=x(()=>{Xg();DA={uint8x2:yt.UNSIGNED_BYTE,uint8x4:yt.UNSIGNED_BYTE,sint8x2:yt.BYTE,sint8x4:yt.BYTE,unorm8x2:yt.UNSIGNED_BYTE,unorm8x4:yt.UNSIGNED_BYTE,snorm8x2:yt.BYTE,snorm8x4:yt.BYTE,uint16x2:yt.UNSIGNED_SHORT,uint16x4:yt.UNSIGNED_SHORT,sint16x2:yt.SHORT,sint16x4:yt.SHORT,unorm16x2:yt.UNSIGNED_SHORT,unorm16x4:yt.UNSIGNED_SHORT,snorm16x2:yt.SHORT,snorm16x4:yt.SHORT,float16x2:yt.HALF_FLOAT,float16x4:yt.HALF_FLOAT,float32:yt.FLOAT,float32x2:yt.FLOAT,float32x3:yt.FLOAT,float32x4:yt.FLOAT,uint32:yt.UNSIGNED_INT,uint32x2:yt.UNSIGNED_INT,uint32x3:yt.UNSIGNED_INT,uint32x4:yt.UNSIGNED_INT,sint32:yt.INT,sint32x2:yt.INT,sint32x3:yt.INT,sint32x4:yt.INT}});var rk,dl,VA=x(()=>{F();us();Lg();HA();rk={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},dl=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){let i=t.attributes,s=e._attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],l=a[n];if(l)return a[e._key]=l,l;yu(t,e._attributeData);let h=t.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let c=0;c<h.length;c++){let u=h[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=l,a[n]=l,s.bindVertexArray(null),l}onGeometryDestroy(t,e){let i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(let o in i)this._activeVao!==i[o]&&this.unbind(),s.deleteVertexArray(i[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[i]){let o=this._geometryVaoHash[i];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let l=o[a],h=l.buffer,c=s.getGlBuffer(h),u=e._attributeData[a];if(u){n!==c&&(s.bind(h),n=c);let d=u.location;i.enableVertexAttribArray(d);let f=$e(l.format),p=NA(l.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,f.size,p,l.stride,l.offset):i.vertexAttribPointer(d,f.size,p,f.normalised,l.stride,l.offset),l.instance)if(this.hasInstance){let m=l.divisor??1;i.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=rk[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let l=n.indexBuffer.data.BYTES_PER_ELEMENT,h=l===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,h,(i||0)*l,s):o.drawElements(a,e||n.indexBuffer.data.length,h,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};dl.extension={type:[T.WebGLSystem],name:"geometry"}});var ik,jg,zA,$A=x(()=>{F();Pt();lo();Tr();Sr();We();Tt();cs();ik=new hr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),jg=class WA{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...WA.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(V("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Qt.for2d();let s=new cr({vertex:`
935
935
  attribute vec2 aPosition;
936
936
  out vec2 vUv;
937
937
 
@@ -950,7 +950,7 @@ fn mainFragment(
950
950
 
951
951
  void main() {
952
952
  finalColor = texture(uTexture, vUv);
953
- }`,name:"big-triangle"});this._bigTriangleShader=new qt({glProgram:s,resources:{uTexture:I.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:rk,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new I({source:new wt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Xg.extension={type:[T.WebGLSystem],name:"backBuffer",priority:1};Xg.defaultOptions={useBackBuffer:!1};WA=Xg});var fl,$A=x(()=>{F();fl=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};fl.extension={type:[T.WebGLSystem],name:"colorMask"}});var pl,XA=x(()=>{F();pl=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:i,shader:s,state:o,skipSync:n,topology:a,size:l,start:h,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(i,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,l,h,c??i.instanceCount)}destroy(){this._renderer=null}};pl.extension={type:[T.WebGLSystem],name:"encoder"}});var ml,jA=x(()=>{F();Lg();ls();ml=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Gt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Gt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Gt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Wr[t],n=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===Gt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};ml.extension={type:[T.WebGLSystem],name:"stencil"}});function YA(r){let t=r.map(o=>({data:o,offset:0,size:0})),e=16,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(i=jg[n.data.type],!i)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(i=Math.max(i,e)*n.data.size);let a=i===12?16:i;n.size=i;let l=s%e;l>0&&e-l<a?s+=(e-l)%16:s+=(i-l%i)%i,n.offset=s,s+=i}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var jg,Yg=x(()=>{"use strict";jg={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function qA(r,t){let e=Math.max(jg[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
953
+ }`,name:"big-triangle"});this._bigTriangleShader=new qt({glProgram:s,resources:{uTexture:I.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:ik,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new I({source:new wt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};jg.extension={type:[T.WebGLSystem],name:"backBuffer",priority:1};jg.defaultOptions={useBackBuffer:!1};zA=jg});var fl,XA=x(()=>{F();fl=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};fl.extension={type:[T.WebGLSystem],name:"colorMask"}});var pl,jA=x(()=>{F();pl=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:i,shader:s,state:o,skipSync:n,topology:a,size:l,start:h,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(i,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,l,h,c??i.instanceCount)}destroy(){this._renderer=null}};pl.extension={type:[T.WebGLSystem],name:"encoder"}});var ml,YA=x(()=>{F();Dg();hs();ml=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Gt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Gt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Gt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Wr[t],n=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===Gt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};ml.extension={type:[T.WebGLSystem],name:"stencil"}});function qA(r){let t=r.map(o=>({data:o,offset:0,size:0})),e=16,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(i=Yg[n.data.type],!i)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(i=Math.max(i,e)*n.data.size);let a=i===12?16:i;n.size=i;let l=s%e;l>0&&e-l<a?s+=(e-l)%16:s+=(i-l%i)%i,n.offset=s,s+=i}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var Yg,qg=x(()=>{"use strict";Yg={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function KA(r,t){let e=Math.max(Yg[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
954
954
  v = uv.${r.data.name};
955
955
  offset += ${t};
956
956
 
@@ -966,7 +966,7 @@ fn mainFragment(
966
966
  }
967
967
  ${s!==0?`arrayOffset += ${s};`:""}
968
968
  }
969
- `}var KA=x(()=>{Yg()});function ZA(r){return mu(r,"uboStd40",qA,Ug)}var QA=x(()=>{kg();Gg();KA()});var gl,JA=x(()=>{F();Ig();Yg();QA();gl=class extends No{constructor(){super({createUboElements:YA,generateUboSync:ZA})}};gl.extension={type:[T.WebGLSystem],name:"ubo"}});var Eu,t1=x(()=>{"use strict";Eu=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Au,e1=x(()=>{he();Pt();io();Uo();t1();Au=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new tt}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new tt}copyToTexture(t,e,i,s,o){let n=this._renderTargetSystem,a=this._renderer,l=n.getGpuRenderTarget(t),h=a.gl;return this.finishRenderPass(t),h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),h.copyTexSubImage2D(h.TEXTURE_2D,0,o.x,o.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),l=s.y;t.isRoot&&(l=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let h=this._renderer.gl;h.bindFramebuffer(h.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==l||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,h.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){let i=this._renderTargetSystem.getGpuRenderTarget(t);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(t){let i=this._renderer.gl,s=new Eu,o=t.colorTexture;return Pe.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let o=this._renderer.gl;if(e&ye.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let i=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,i),(t.stencil||t.depth)&&this._resizeStencil(i)}_initColor(t,e){let i=this._renderer,s=i.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let l=n.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:V("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);let c=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,c,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=s.createRenderbuffer();e.msaaRenderBuffer[l]=h})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=a.source;s.texture.bindSource(h,0);let u=s.texture.getGlSource(h).internalFormat,d=e.msaaRenderBuffer[l];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,h.pixelWidth,h.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+l,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&Pe.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Pe.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}});var xl,r1=x(()=>{F();Dg();e1();xl=class extends Vo{constructor(t){super(t),this.adaptor=new Au,this.adaptor.init(t,this)}};xl.extension={type:[T.WebGLSystem],name:"renderTarget"}});function i1(r,t){let e=[],i=[`
969
+ `}var ZA=x(()=>{qg()});function QA(r){return mu(r,"uboStd40",KA,Gg)}var JA=x(()=>{Ug();Og();ZA()});var gl,t1=x(()=>{F();Bg();qg();JA();gl=class extends No{constructor(){super({createUboElements:qA,generateUboSync:QA})}};gl.extension={type:[T.WebGLSystem],name:"ubo"}});var Eu,e1=x(()=>{"use strict";Eu=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Au,r1=x(()=>{he();Pt();io();Uo();e1();Au=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new tt}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new tt}copyToTexture(t,e,i,s,o){let n=this._renderTargetSystem,a=this._renderer,l=n.getGpuRenderTarget(t),h=a.gl;return this.finishRenderPass(t),h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),h.copyTexSubImage2D(h.TEXTURE_2D,0,o.x,o.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),l=s.y;t.isRoot&&(l=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let h=this._renderer.gl;h.bindFramebuffer(h.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==l||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,h.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){let i=this._renderTargetSystem.getGpuRenderTarget(t);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(t){let i=this._renderer.gl,s=new Eu,o=t.colorTexture;return Pe.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let o=this._renderer.gl;if(e&ye.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let i=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,i),(t.stencil||t.depth)&&this._resizeStencil(i)}_initColor(t,e){let i=this._renderer,s=i.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let l=n.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:V("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);let c=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,c,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=s.createRenderbuffer();e.msaaRenderBuffer[l]=h})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=a.source;s.texture.bindSource(h,0);let u=s.texture.getGlSource(h).internalFormat,d=e.msaaRenderBuffer[l];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,h.pixelWidth,h.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+l,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&Pe.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Pe.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}});var xl,i1=x(()=>{F();Ng();r1();xl=class extends Vo{constructor(t){super(t),this.adaptor=new Au,this.adaptor.init(t,this)}};xl.extension={type:[T.WebGLSystem],name:"renderTarget"}});function s1(r,t){let e=[],i=[`
970
970
  var g = s.groups;
971
971
  var sS = r.shader;
972
972
  var p = s.glProgram;
@@ -993,10 +993,10 @@ fn mainFragment(
993
993
  `)),t._gl.uniform1i(f.location,o),e.push(`
994
994
  tS.bind(resources[${c}], ${o});
995
995
  `),o++)}}}let a=[...i,...e].join(`
996
- `);return new Function("r","s","sD",a)}var s1=x(()=>{gu();Ge();We()});var Pu,o1=x(()=>{"use strict";Pu=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function qg(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}var n1=x(()=>{"use strict"});function Kg(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Cu(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Kg(2*t);case"bvec3":return Kg(3*t);case"bvec4":return Kg(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Zg=x(()=>{"use strict"});function Qg(r,t){if(!Ru){let e=Object.keys(a1);Ru={};for(let i=0;i<e.length;++i){let s=e[i];Ru[r[s]]=a1[s]}}return Ru[t]}function l1(r,t){let e=Qg(r,t);return ik[e]||"float32"}var Ru,a1,ik,Jg=x(()=>{"use strict";Ru=null,a1={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},ik={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function h1(r,t,e=!1){let i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(r,n);if(a.name.startsWith("gl_"))continue;let l=l1(t,a.type);i[a.name]={location:0,format:l,stride:$e(l).stride,offset:0,instance:!1,start:0}}let o=Object.keys(i);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)i[o[n]].location=n,t.bindAttribLocation(r,n,o[n]);t.linkProgram(r)}else for(let n=0;n<o.length;n++)i[o[n]].location=t.getAttribLocation(r,o[n]);return i}var c1=x(()=>{cs();Jg()});function u1(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){let o=t.getActiveUniformBlockName(r,s),n=t.getUniformBlockIndex(r,o),a=t.getActiveUniformBlockParameter(r,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var d1=x(()=>{"use strict"});function f1(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Qg(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Cu(l,o.size)}}return e}var p1=x(()=>{Zg();Jg()});function m1(r,t){let e=r.getShaderSource(t).split(`
996
+ `);return new Function("r","s","sD",a)}var o1=x(()=>{gu();Ge();We()});var Pu,n1=x(()=>{"use strict";Pu=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function Kg(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}var a1=x(()=>{"use strict"});function Zg(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Cu(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Zg(2*t);case"bvec3":return Zg(3*t);case"bvec4":return Zg(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Qg=x(()=>{"use strict"});function Jg(r,t){if(!Ru){let e=Object.keys(l1);Ru={};for(let i=0;i<e.length;++i){let s=e[i];Ru[r[s]]=l1[s]}}return Ru[t]}function h1(r,t){let e=Jg(r,t);return sk[e]||"float32"}var Ru,l1,sk,tx=x(()=>{"use strict";Ru=null,l1={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},sk={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function c1(r,t,e=!1){let i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(r,n);if(a.name.startsWith("gl_"))continue;let l=h1(t,a.type);i[a.name]={location:0,format:l,stride:$e(l).stride,offset:0,instance:!1,start:0}}let o=Object.keys(i);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)i[o[n]].location=n,t.bindAttribLocation(r,n,o[n]);t.linkProgram(r)}else for(let n=0;n<o.length;n++)i[o[n]].location=t.getAttribLocation(r,o[n]);return i}var u1=x(()=>{us();tx()});function d1(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){let o=t.getActiveUniformBlockName(r,s),n=t.getUniformBlockIndex(r,o),a=t.getActiveUniformBlockParameter(r,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var f1=x(()=>{"use strict"});function p1(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Jg(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Cu(l,o.size)}}return e}var m1=x(()=>{Qg();tx()});function g1(r,t){let e=r.getShaderSource(t).split(`
997
997
  `).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(`
998
998
  `),o={},n=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),a=[""];n.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(`
999
- `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function g1(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||m1(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||m1(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var x1=x(()=>{"use strict"});function y1(r,t){let e=qg(r,r.VERTEX_SHADER,t.vertex),i=qg(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?V("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||g1(r,s,e,i),t._attributeData=h1(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=f1(s,r),t._uniformBlockData=u1(s,r),r.deleteShader(e),r.deleteShader(i);let n={};for(let l in t._uniformData){let h=t._uniformData[l];n[l]={location:r.getUniformLocation(s,l),value:Cu(h.type,h.size)}}return new Pu(s,n)}var _1=x(()=>{Pt();o1();n1();Zg();c1();d1();p1();x1()});var Mu,yl,b1=x(()=>{F();as();s1();_1();Mu={textureCount:0,blockIndex:0},yl=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=lr()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Mu.textureCount=0,Mu.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,Mu)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Mu)}bindUniformBlock(t,e,i=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,l=s.updateBuffer(a),h=s.freeLocationForBufferBase(l);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(l,h):s.bindBufferRange(l,h,u)}else s.getLastBindBaseLocation(l)!==h&&s.bindBufferBase(l,h);let c=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[i]!==h&&(o.uniformBlockBindings[i]=h,this._renderer.gl.uniformBlockBinding(o.program,c,h))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=y1(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return i1(t,e)}resetState(){this._activeProgram=null}};yl.extension={type:[T.WebGLSystem],name:"shader"}});var v1,T1,S1=x(()=>{"use strict";v1={f32:`if (cv !== v) {
999
+ `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function x1(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||g1(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||g1(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var y1=x(()=>{"use strict"});function _1(r,t){let e=Kg(r,r.VERTEX_SHADER,t.vertex),i=Kg(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?V("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||x1(r,s,e,i),t._attributeData=c1(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=p1(s,r),t._uniformBlockData=d1(s,r),r.deleteShader(e),r.deleteShader(i);let n={};for(let l in t._uniformData){let h=t._uniformData[l];n[l]={location:r.getUniformLocation(s,l),value:Cu(h.type,h.size)}}return new Pu(s,n)}var b1=x(()=>{Pt();n1();a1();Qg();u1();f1();m1();y1()});var Mu,yl,v1=x(()=>{F();ls();o1();b1();Mu={textureCount:0,blockIndex:0},yl=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=lr()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Mu.textureCount=0,Mu.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,Mu)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Mu)}bindUniformBlock(t,e,i=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,l=s.updateBuffer(a),h=s.freeLocationForBufferBase(l);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(l,h):s.bindBufferRange(l,h,u)}else s.getLastBindBaseLocation(l)!==h&&s.bindBufferBase(l,h);let c=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[i]!==h&&(o.uniformBlockBindings[i]=h,this._renderer.gl.uniformBlockBinding(o.program,c,h))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=_1(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return s1(t,e)}resetState(){this._activeProgram=null}};yl.extension={type:[T.WebGLSystem],name:"shader"}});var T1,S1,w1=x(()=>{"use strict";T1={f32:`if (cv !== v) {
1000
1000
  cu.value = v;
1001
1001
  gl.uniform1f(location, v);
1002
1002
  }`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
@@ -1068,7 +1068,7 @@ fn mainFragment(
1068
1068
  cv[2] = v[2];
1069
1069
  cv[3] = v[3];
1070
1070
  gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1071
- }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},T1={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function w1(r,t){let e=[`
1071
+ }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},S1={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function E1(r,t){let e=[`
1072
1072
  var v = null;
1073
1073
  var cv = null;
1074
1074
  var cu = null;
@@ -1081,17 +1081,17 @@ fn mainFragment(
1081
1081
  renderer.shader.updateUniformGroup(uv.${i});
1082
1082
  `):r.uniforms[i]instanceof Li&&e.push(`
1083
1083
  renderer.shader.bindBufferResource(uv.${i}, "${i}");
1084
- `);continue}let s=r.uniformStructures[i],o=!1;for(let n=0;n<ci.length;n++){let a=ci[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${i}";`,ci[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?v1:T1)[s.type].replace("location",`ud["${i}"].location`);e.push(`
1084
+ `);continue}let s=r.uniformStructures[i],o=!1;for(let n=0;n<ci.length;n++){let a=ci[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${i}";`,ci[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?T1:S1)[s.type].replace("location",`ud["${i}"].location`);e.push(`
1085
1085
  cu = ud["${i}"];
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${i}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var E1=x(()=>{gu();Ge();Fg();S1()});var _l,A1=x(()=>{F();E1();_l=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return w1(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};_l.extension={type:[T.WebGLSystem],name:"uniformGroup"}});function P1(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof Y.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var C1=x(()=>{Ft()});var sk,ok,nk,ak,lk,hk,R1,M1,I1=x(()=>{F();Sr();C1();sk=0,ok=1,nk=2,ak=3,lk=4,hk=5,R1=class tx{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[sk]=this.setBlend,this.map[ok]=this.setOffset,this.map[nk]=this.setCullFace,this.map[ak]=this.setDepthTest,this.map[lk]=this.setFrontFace,this.map[hk]=this.setDepthMask,this.checks=[],this.defaultState=Qt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=P1(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(tx._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(tx._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};R1.extension={type:[T.WebGLSystem],name:"state"};M1=R1});var Iu,B1=x(()=>{$g();Iu=class{constructor(t){this.target=zg.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=yt.UNSIGNED_BYTE,this.internalFormat=wu.RGBA,this.format=wu.RGBA,this.samplerType=0}}});var F1,k1=x(()=>{"use strict";F1={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var ck,U1,G1=x(()=>{"use strict";ck={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},U1={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!ck[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var Bu,ex=x(()=>{"use strict";Bu={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,h=r.resourceHeight;l<n||h<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,h,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var O1,L1=x(()=>{ex();O1={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Bu.upload(r,t,e,i)}}});var rx,D1,Fu,N1,H1=x(()=>{"use strict";rx={linear:9729,nearest:9728},D1={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Fu={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},N1={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function ix(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let h=Fu[n?"clamp-to-edge":r.addressModeU],c=Fu[n?"clamp-to-edge":r.addressModeV],u=Fu[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,h),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,rx[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let h=D1[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,h)}}else t[s](l,t.TEXTURE_MIN_FILTER,rx[r.minFilter]);if(i&&r.maxAnisotropy>1){let h=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,N1[r.compare])}var V1=x(()=>{H1()});function W1(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var z1=x(()=>{"use strict"});function $1(r,t){let e={},i=r.RGBA;return r instanceof Y.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var X1=x(()=>{Ft()});function j1(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var Y1=x(()=>{"use strict"});var uk,bl,q1=x(()=>{Ft();F();Tt();B1();k1();G1();ex();L1();V1();z1();X1();Y1();uk=4,bl=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Bu,buffer:F1,video:O1,compressed:U1},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=$1(t,this._renderer.context.extensions),this._mapFormatToType=j1(t),this._mapFormatToFormat=W1(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(I.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=I.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new Iu(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,ix(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,ix(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:i,height:s}=this.getPixels(t),o=Y.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(uk*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),h=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,h.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(I.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};bl.extension={type:[T.WebGLSystem],name:"texture"}});var J1={};o_(J1,{WebGLRenderer:()=>sx});var dk,fk,pk,K1,Z1,Q1,sx,tP=x(()=>{F();RA();MA();IA();Aa();Mg();Dr();kA();OA();HA();zA();$A();XA();jA();JA();r1();b1();A1();I1();q1();dk=[...fu,gl,WA,GA,ul,bl,xl,dl,_l,yl,pl,M1,ml,fl],fk=[...pu],pk=[hl,ll,al],K1=[],Z1=[],Q1=[];H.handleByNamedList(T.WebGLSystem,K1);H.handleByNamedList(T.WebGLPipes,Z1);H.handleByNamedList(T.WebGLPipesAdaptor,Q1);H.add(...dk,...fk,...pk);sx=class extends Oi{constructor(){let t={name:"webgl",type:se.WEBGL,systems:K1,renderPipes:Z1,renderPipeAdaptors:Q1};super(t)}}});var XC=J((Vft,Ux)=>{"use strict";var qU=Object.prototype.hasOwnProperty,Ne="~";function Hl(){}Object.create&&(Hl.prototype=Object.create(null),new Hl().__proto__||(Ne=!1));function KU(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function $C(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new KU(e,i||r,s),n=Ne?Ne+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Md(r,t){--r._eventsCount===0?r._events=new Hl:delete r._events[t]}function Me(){this._events=new Hl,this._eventsCount=0}Me.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)qU.call(e,i)&&t.push(Ne?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Me.prototype.listeners=function(t){var e=Ne?Ne+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Me.prototype.listenerCount=function(t){var e=Ne?Ne+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Me.prototype.emit=function(t,e,i,s,o,n){var a=Ne?Ne+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Me.prototype.on=function(t,e,i){return $C(this,t,e,i,!1)};Me.prototype.once=function(t,e,i){return $C(this,t,e,i,!0)};Me.prototype.removeListener=function(t,e,i,s){var o=Ne?Ne+t:t;if(!this._events[o])return this;if(!e)return Md(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Md(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Md(this,o)}return this};Me.prototype.removeAllListeners=function(t){var e;return t?(e=Ne?Ne+t:t,this._events[e]&&Md(this,e)):(this._events=new Hl,this._eventsCount=0),this};Me.prototype.off=Me.prototype.removeListener;Me.prototype.addListener=Me.prototype.on;Me.prefixed=Ne;Me.EventEmitter=Me;typeof Ux<"u"&&(Ux.exports=Me)});var jC=J((Zo,Qo)=>{(function(r){var t=typeof Zo=="object"&&Zo&&!Zo.nodeType&&Zo,e=typeof Qo=="object"&&Qo&&!Qo.nodeType&&Qo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,h=38,c=700,u=72,d=128,f="-",p=/^xn--/,g=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=n-a,y=Math.floor,w=String.fromCharCode,E;function v(N){throw new RangeError(_[N])}function S(N,L){for(var z=N.length,st=[];z--;)st[z]=L(N[z]);return st}function P(N,L){var z=N.split("@"),st="";z.length>1&&(st=z[0]+"@",N=z[1]),N=N.replace(m,".");var Q=N.split("."),bt=S(Q,L).join(".");return st+bt}function R(N){for(var L=[],z=0,st=N.length,Q,bt;z<st;)Q=N.charCodeAt(z++),Q>=55296&&Q<=56319&&z<st?(bt=N.charCodeAt(z++),(bt&64512)==56320?L.push(((Q&1023)<<10)+(bt&1023)+65536):(L.push(Q),z--)):L.push(Q);return L}function A(N){return S(N,function(L){var z="";return L>65535&&(L-=65536,z+=w(L>>>10&1023|55296),L=56320|L&1023),z+=w(L),z}).join("")}function C(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function M(N,L){return N+22+75*(N<26)-((L!=0)<<5)}function B(N,L,z){var st=0;for(N=z?y(N/c):N>>1,N+=y(N/L);N>b*l>>1;st+=n)N=y(N/b);return y(st+(b+1)*N/(N+h))}function k(N){var L=[],z=N.length,st,Q=0,bt=d,Bt=u,Mt,jt,Zt,xt,ct,vt,Ot,ee,re;for(Mt=N.lastIndexOf(f),Mt<0&&(Mt=0),jt=0;jt<Mt;++jt)N.charCodeAt(jt)>=128&&v("not-basic"),L.push(N.charCodeAt(jt));for(Zt=Mt>0?Mt+1:0;Zt<z;){for(xt=Q,ct=1,vt=n;Zt>=z&&v("invalid-input"),Ot=C(N.charCodeAt(Zt++)),(Ot>=n||Ot>y((o-Q)/ct))&&v("overflow"),Q+=Ot*ct,ee=vt<=Bt?a:vt>=Bt+l?l:vt-Bt,!(Ot<ee);vt+=n)re=n-ee,ct>y(o/re)&&v("overflow"),ct*=re;st=L.length+1,Bt=B(Q-xt,st,xt==0),y(Q/st)>o-bt&&v("overflow"),bt+=y(Q/st),Q%=st,L.splice(Q++,0,bt)}return A(L)}function U(N){var L,z,st,Q,bt,Bt,Mt,jt,Zt,xt,ct,vt=[],Ot,ee,re,He;for(N=R(N),Ot=N.length,L=d,z=0,bt=u,Bt=0;Bt<Ot;++Bt)ct=N[Bt],ct<128&&vt.push(w(ct));for(st=Q=vt.length,Q&&vt.push(f);st<Ot;){for(Mt=o,Bt=0;Bt<Ot;++Bt)ct=N[Bt],ct>=L&&ct<Mt&&(Mt=ct);for(ee=st+1,Mt-L>y((o-z)/ee)&&v("overflow"),z+=(Mt-L)*ee,L=Mt,Bt=0;Bt<Ot;++Bt)if(ct=N[Bt],ct<L&&++z>o&&v("overflow"),ct==L){for(jt=z,Zt=n;xt=Zt<=bt?a:Zt>=bt+l?l:Zt-bt,!(jt<xt);Zt+=n)He=jt-xt,re=n-xt,vt.push(w(M(xt+He%re,0))),jt=y(He/re);vt.push(w(M(jt,0))),bt=B(z,ee,st==Q),z=0,++st}++z,++L}return vt.join("")}function O(N){return P(N,function(L){return p.test(L)?k(L.slice(4).toLowerCase()):L})}function $(N){return P(N,function(L){return g.test(L)?"xn--"+U(L):L})}if(s={version:"1.4.1",ucs2:{decode:R,encode:A},decode:k,encode:U,toASCII:$,toUnicode:O},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Qo.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else r.punycode=s})(Zo)});var ws=J((Wft,YC)=>{"use strict";YC.exports=TypeError});var qC=J(()=>{});var Xl=J((Xft,mR)=>{var $x=typeof Map=="function"&&Map.prototype,Gx=Object.getOwnPropertyDescriptor&&$x?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Bd=$x&&Gx&&typeof Gx.get=="function"?Gx.get:null,KC=$x&&Map.prototype.forEach,Xx=typeof Set=="function"&&Set.prototype,Ox=Object.getOwnPropertyDescriptor&&Xx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Fd=Xx&&Ox&&typeof Ox.get=="function"?Ox.get:null,ZC=Xx&&Set.prototype.forEach,ZU=typeof WeakMap=="function"&&WeakMap.prototype,Wl=ZU?WeakMap.prototype.has:null,QU=typeof WeakSet=="function"&&WeakSet.prototype,zl=QU?WeakSet.prototype.has:null,JU=typeof WeakRef=="function"&&WeakRef.prototype,QC=JU?WeakRef.prototype.deref:null,tG=Boolean.prototype.valueOf,eG=Object.prototype.toString,rG=Function.prototype.toString,iG=String.prototype.match,jx=String.prototype.slice,Wi=String.prototype.replace,sG=String.prototype.toUpperCase,JC=String.prototype.toLowerCase,lR=RegExp.prototype.test,tR=Array.prototype.concat,$r=Array.prototype.join,oG=Array.prototype.slice,eR=Math.floor,Nx=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Lx=Object.getOwnPropertySymbols,Hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Jo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$l=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Jo||!0)?Symbol.toStringTag:null,hR=Object.prototype.propertyIsEnumerable,rR=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function iR(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||lR.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-eR(-r):eR(r);if(i!==r){var s=String(i),o=jx.call(t,s.length+1);return Wi.call(s,e,"$&_")+"."+Wi.call(Wi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Wi.call(t,e,"$&_")}var Vx=qC(),sR=Vx.custom,oR=dR(sR)?sR:null,cR={__proto__:null,double:'"',single:"'"},nG={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};mR.exports=function r(t,e,i,s){var o=e||{};if(fi(o,"quoteStyle")&&!fi(cR,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fi(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=fi(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fi(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(fi(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return pR(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?iR(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?iR(t,h):h}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return Wx(t)?"[Array]":"[Object]";var u=wG(o,i);if(typeof s>"u")s=[];else if(fR(s,t)>=0)return"[Circular]";function d(B,k,U){if(k&&(s=oG.call(s),s.push(k)),U){var O={depth:o.depth};return fi(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(B,O,i+1,s)}return r(B,o,i+1,s)}if(typeof t=="function"&&!nR(t)){var f=mG(t),p=Id(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$r.call(p,", ")+" }":"")}if(dR(t)){var g=Jo?Wi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Hx.call(t);return typeof t=="object"&&!Jo?Vl(g):g}if(vG(t)){for(var m="<"+JC.call(String(t.nodeName)),_=t.attributes||[],b=0;b<_.length;b++)m+=" "+_[b].name+"="+uR(aG(_[b].value),"double",o);return m+=">",t.childNodes&&t.childNodes.length&&(m+="..."),m+="</"+JC.call(String(t.nodeName))+">",m}if(Wx(t)){if(t.length===0)return"[]";var y=Id(t,d);return u&&!SG(y)?"["+zx(y,u)+"]":"[ "+$r.call(y,", ")+" ]"}if(hG(t)){var w=Id(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!hR.call(t,"cause")?"{ ["+String(t)+"] "+$r.call(tR.call("[cause]: "+d(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$r.call(w,", ")+" }"}if(typeof t=="object"&&n){if(oR&&typeof t[oR]=="function"&&Vx)return Vx(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(gG(t)){var E=[];return KC&&KC.call(t,function(B,k){E.push(d(k,t,!0)+" => "+d(B,t))}),aR("Map",Bd.call(t),E,u)}if(_G(t)){var v=[];return ZC&&ZC.call(t,function(B){v.push(d(B,t))}),aR("Set",Fd.call(t),v,u)}if(xG(t))return Dx("WeakMap");if(bG(t))return Dx("WeakSet");if(yG(t))return Dx("WeakRef");if(uG(t))return Vl(d(Number(t)));if(fG(t))return Vl(d(Nx.call(t)));if(dG(t))return Vl(tG.call(t));if(cG(t))return Vl(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!lG(t)&&!nR(t)){var S=Id(t,d),P=rR?rR(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",A=!P&&$l&&Object(t)===t&&$l in t?jx.call(zi(t),8,-1):R?"Object":"",C=P||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=C+(A||R?"["+$r.call(tR.call([],A||[],R||[]),": ")+"] ":"");return S.length===0?M+"{}":u?M+"{"+zx(S,u)+"}":M+"{ "+$r.call(S,", ")+" }"}return String(t)};function uR(r,t,e){var i=e.quoteStyle||t,s=cR[i];return s+r+s}function aG(r){return Wi.call(String(r),/"/g,"&quot;")}function Es(r){return!$l||!(typeof r=="object"&&($l in r||typeof r[$l]<"u"))}function Wx(r){return zi(r)==="[object Array]"&&Es(r)}function lG(r){return zi(r)==="[object Date]"&&Es(r)}function nR(r){return zi(r)==="[object RegExp]"&&Es(r)}function hG(r){return zi(r)==="[object Error]"&&Es(r)}function cG(r){return zi(r)==="[object String]"&&Es(r)}function uG(r){return zi(r)==="[object Number]"&&Es(r)}function dG(r){return zi(r)==="[object Boolean]"&&Es(r)}function dR(r){if(Jo)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Hx)return!1;try{return Hx.call(r),!0}catch{}return!1}function fG(r){if(!r||typeof r!="object"||!Nx)return!1;try{return Nx.call(r),!0}catch{}return!1}var pG=Object.prototype.hasOwnProperty||function(r){return r in this};function fi(r,t){return pG.call(r,t)}function zi(r){return eG.call(r)}function mG(r){if(r.name)return r.name;var t=iG.call(rG.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function fR(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function gG(r){if(!Bd||!r||typeof r!="object")return!1;try{Bd.call(r);try{Fd.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function xG(r){if(!Wl||!r||typeof r!="object")return!1;try{Wl.call(r,Wl);try{zl.call(r,zl)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function yG(r){if(!QC||!r||typeof r!="object")return!1;try{return QC.call(r),!0}catch{}return!1}function _G(r){if(!Fd||!r||typeof r!="object")return!1;try{Fd.call(r);try{Bd.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function bG(r){if(!zl||!r||typeof r!="object")return!1;try{zl.call(r,zl);try{Wl.call(r,Wl)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function vG(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function pR(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return pR(jx.call(r,0,t.maxStringLength),t)+i}var s=nG[t.quoteStyle||"single"];s.lastIndex=0;var o=Wi.call(Wi.call(r,s,"\\$1"),/[\x00-\x1f]/g,TG);return uR(o,"single",t)}function TG(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+sG.call(t.toString(16))}function Vl(r){return"Object("+r+")"}function Dx(r){return r+" { ? }"}function aR(r,t,e,i){var s=i?zx(e,i):$r.call(e,", ");return r+" ("+t+") {"+s+"}"}function SG(r){for(var t=0;t<r.length;t++)if(fR(r[t],`
1090
- `)>=0)return!1;return!0}function wG(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=$r.call(Array(r.indent+1)," ");else return null;return{base:e,prev:$r.call(Array(t+1),e)}}function zx(r,t){if(r.length===0)return"";var e=`
1089
+ `))}var A1=x(()=>{gu();Ge();kg();w1()});var _l,P1=x(()=>{F();A1();_l=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return E1(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};_l.extension={type:[T.WebGLSystem],name:"uniformGroup"}});function C1(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof Y.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var R1=x(()=>{Ft()});var ok,nk,ak,lk,hk,ck,M1,I1,B1=x(()=>{F();Sr();R1();ok=0,nk=1,ak=2,lk=3,hk=4,ck=5,M1=class ex{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[ok]=this.setBlend,this.map[nk]=this.setOffset,this.map[ak]=this.setCullFace,this.map[lk]=this.setDepthTest,this.map[hk]=this.setFrontFace,this.map[ck]=this.setDepthMask,this.checks=[],this.defaultState=Qt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=C1(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(ex._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(ex._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};M1.extension={type:[T.WebGLSystem],name:"state"};I1=M1});var Iu,F1=x(()=>{Xg();Iu=class{constructor(t){this.target=$g.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=yt.UNSIGNED_BYTE,this.internalFormat=wu.RGBA,this.format=wu.RGBA,this.samplerType=0}}});var k1,U1=x(()=>{"use strict";k1={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var uk,G1,O1=x(()=>{"use strict";uk={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},G1={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!uk[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var Bu,rx=x(()=>{"use strict";Bu={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,h=r.resourceHeight;l<n||h<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,h,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var L1,D1=x(()=>{rx();L1={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Bu.upload(r,t,e,i)}}});var ix,N1,Fu,H1,V1=x(()=>{"use strict";ix={linear:9729,nearest:9728},N1={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Fu={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},H1={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function sx(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let h=Fu[n?"clamp-to-edge":r.addressModeU],c=Fu[n?"clamp-to-edge":r.addressModeV],u=Fu[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,h),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,ix[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let h=N1[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,h)}}else t[s](l,t.TEXTURE_MIN_FILTER,ix[r.minFilter]);if(i&&r.maxAnisotropy>1){let h=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,H1[r.compare])}var W1=x(()=>{V1()});function z1(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var $1=x(()=>{"use strict"});function X1(r,t){let e={},i=r.RGBA;return r instanceof Y.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var j1=x(()=>{Ft()});function Y1(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var q1=x(()=>{"use strict"});var dk,bl,K1=x(()=>{Ft();F();Tt();F1();U1();O1();rx();D1();W1();$1();j1();q1();dk=4,bl=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Bu,buffer:k1,video:L1,compressed:G1},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=X1(t,this._renderer.context.extensions),this._mapFormatToType=Y1(t),this._mapFormatToFormat=z1(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(I.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=I.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new Iu(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,sx(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,sx(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:i,height:s}=this.getPixels(t),o=Y.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(dk*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),h=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,h.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(I.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};bl.extension={type:[T.WebGLSystem],name:"texture"}});var tP={};n_(tP,{WebGLRenderer:()=>ox});var fk,pk,mk,Z1,Q1,J1,ox,eP=x(()=>{F();MA();IA();BA();Aa();Ig();Dr();UA();LA();VA();$A();XA();jA();YA();t1();i1();v1();P1();B1();K1();fk=[...fu,gl,zA,OA,ul,bl,xl,dl,_l,yl,pl,I1,ml,fl],pk=[...pu],mk=[hl,ll,al],Z1=[],Q1=[],J1=[];H.handleByNamedList(T.WebGLSystem,Z1);H.handleByNamedList(T.WebGLPipes,Q1);H.handleByNamedList(T.WebGLPipesAdaptor,J1);H.add(...fk,...pk,...mk);ox=class extends Oi{constructor(){let t={name:"webgl",type:se.WEBGL,systems:Z1,renderPipes:Q1,renderPipeAdaptors:J1};super(t)}}});var jC=J(($ft,Gx)=>{"use strict";var ZU=Object.prototype.hasOwnProperty,Ne="~";function Hl(){}Object.create&&(Hl.prototype=Object.create(null),new Hl().__proto__||(Ne=!1));function QU(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function XC(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new QU(e,i||r,s),n=Ne?Ne+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Id(r,t){--r._eventsCount===0?r._events=new Hl:delete r._events[t]}function Me(){this._events=new Hl,this._eventsCount=0}Me.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)ZU.call(e,i)&&t.push(Ne?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Me.prototype.listeners=function(t){var e=Ne?Ne+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Me.prototype.listenerCount=function(t){var e=Ne?Ne+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Me.prototype.emit=function(t,e,i,s,o,n){var a=Ne?Ne+t:t;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,c,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0};Me.prototype.on=function(t,e,i){return XC(this,t,e,i,!1)};Me.prototype.once=function(t,e,i){return XC(this,t,e,i,!0)};Me.prototype.removeListener=function(t,e,i,s){var o=Ne?Ne+t:t;if(!this._events[o])return this;if(!e)return Id(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&Id(this,o);else{for(var a=0,l=[],h=n.length;a<h;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Id(this,o)}return this};Me.prototype.removeAllListeners=function(t){var e;return t?(e=Ne?Ne+t:t,this._events[e]&&Id(this,e)):(this._events=new Hl,this._eventsCount=0),this};Me.prototype.off=Me.prototype.removeListener;Me.prototype.addListener=Me.prototype.on;Me.prefixed=Ne;Me.EventEmitter=Me;typeof Gx<"u"&&(Gx.exports=Me)});var YC=J((Zo,Qo)=>{(function(r){var t=typeof Zo=="object"&&Zo&&!Zo.nodeType&&Zo,e=typeof Qo=="object"&&Qo&&!Qo.nodeType&&Qo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,h=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=n-a,y=Math.floor,w=String.fromCharCode,E;function v(N){throw new RangeError(_[N])}function S(N,L){for(var z=N.length,st=[];z--;)st[z]=L(N[z]);return st}function P(N,L){var z=N.split("@"),st="";z.length>1&&(st=z[0]+"@",N=z[1]),N=N.replace(g,".");var Q=N.split("."),bt=S(Q,L).join(".");return st+bt}function R(N){for(var L=[],z=0,st=N.length,Q,bt;z<st;)Q=N.charCodeAt(z++),Q>=55296&&Q<=56319&&z<st?(bt=N.charCodeAt(z++),(bt&64512)==56320?L.push(((Q&1023)<<10)+(bt&1023)+65536):(L.push(Q),z--)):L.push(Q);return L}function A(N){return S(N,function(L){var z="";return L>65535&&(L-=65536,z+=w(L>>>10&1023|55296),L=56320|L&1023),z+=w(L),z}).join("")}function C(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function M(N,L){return N+22+75*(N<26)-((L!=0)<<5)}function B(N,L,z){var st=0;for(N=z?y(N/c):N>>1,N+=y(N/L);N>b*l>>1;st+=n)N=y(N/b);return y(st+(b+1)*N/(N+h))}function k(N){var L=[],z=N.length,st,Q=0,bt=d,Bt=u,Mt,jt,Zt,xt,ct,vt,Ot,ee,re;for(Mt=N.lastIndexOf(f),Mt<0&&(Mt=0),jt=0;jt<Mt;++jt)N.charCodeAt(jt)>=128&&v("not-basic"),L.push(N.charCodeAt(jt));for(Zt=Mt>0?Mt+1:0;Zt<z;){for(xt=Q,ct=1,vt=n;Zt>=z&&v("invalid-input"),Ot=C(N.charCodeAt(Zt++)),(Ot>=n||Ot>y((o-Q)/ct))&&v("overflow"),Q+=Ot*ct,ee=vt<=Bt?a:vt>=Bt+l?l:vt-Bt,!(Ot<ee);vt+=n)re=n-ee,ct>y(o/re)&&v("overflow"),ct*=re;st=L.length+1,Bt=B(Q-xt,st,xt==0),y(Q/st)>o-bt&&v("overflow"),bt+=y(Q/st),Q%=st,L.splice(Q++,0,bt)}return A(L)}function U(N){var L,z,st,Q,bt,Bt,Mt,jt,Zt,xt,ct,vt=[],Ot,ee,re,He;for(N=R(N),Ot=N.length,L=d,z=0,bt=u,Bt=0;Bt<Ot;++Bt)ct=N[Bt],ct<128&&vt.push(w(ct));for(st=Q=vt.length,Q&&vt.push(f);st<Ot;){for(Mt=o,Bt=0;Bt<Ot;++Bt)ct=N[Bt],ct>=L&&ct<Mt&&(Mt=ct);for(ee=st+1,Mt-L>y((o-z)/ee)&&v("overflow"),z+=(Mt-L)*ee,L=Mt,Bt=0;Bt<Ot;++Bt)if(ct=N[Bt],ct<L&&++z>o&&v("overflow"),ct==L){for(jt=z,Zt=n;xt=Zt<=bt?a:Zt>=bt+l?l:Zt-bt,!(jt<xt);Zt+=n)He=jt-xt,re=n-xt,vt.push(w(M(xt+He%re,0))),jt=y(He/re);vt.push(w(M(jt,0))),bt=B(z,ee,st==Q),z=0,++st}++z,++L}return vt.join("")}function O(N){return P(N,function(L){return p.test(L)?k(L.slice(4).toLowerCase()):L})}function $(N){return P(N,function(L){return m.test(L)?"xn--"+U(L):L})}if(s={version:"1.4.1",ucs2:{decode:R,encode:A},decode:k,encode:U,toASCII:$,toUnicode:O},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Qo.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else r.punycode=s})(Zo)});var ws=J((Xft,qC)=>{"use strict";qC.exports=TypeError});var KC=J(()=>{});var Xl=J((qft,gR)=>{var Xx=typeof Map=="function"&&Map.prototype,Ox=Object.getOwnPropertyDescriptor&&Xx?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Fd=Xx&&Ox&&typeof Ox.get=="function"?Ox.get:null,ZC=Xx&&Map.prototype.forEach,jx=typeof Set=="function"&&Set.prototype,Lx=Object.getOwnPropertyDescriptor&&jx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,kd=jx&&Lx&&typeof Lx.get=="function"?Lx.get:null,QC=jx&&Set.prototype.forEach,JU=typeof WeakMap=="function"&&WeakMap.prototype,Wl=JU?WeakMap.prototype.has:null,tG=typeof WeakSet=="function"&&WeakSet.prototype,zl=tG?WeakSet.prototype.has:null,eG=typeof WeakRef=="function"&&WeakRef.prototype,JC=eG?WeakRef.prototype.deref:null,rG=Boolean.prototype.valueOf,iG=Object.prototype.toString,sG=Function.prototype.toString,oG=String.prototype.match,Yx=String.prototype.slice,zi=String.prototype.replace,nG=String.prototype.toUpperCase,tR=String.prototype.toLowerCase,hR=RegExp.prototype.test,eR=Array.prototype.concat,$r=Array.prototype.join,aG=Array.prototype.slice,rR=Math.floor,Hx=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Dx=Object.getOwnPropertySymbols,Vx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Jo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$l=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Jo||!0)?Symbol.toStringTag:null,cR=Object.prototype.propertyIsEnumerable,iR=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function sR(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||hR.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-rR(-r):rR(r);if(i!==r){var s=String(i),o=Yx.call(t,s.length+1);return zi.call(s,e,"$&_")+"."+zi.call(zi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return zi.call(t,e,"$&_")}var Wx=KC(),oR=Wx.custom,nR=fR(oR)?oR:null,uR={__proto__:null,double:'"',single:"'"},lG={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};gR.exports=function r(t,e,i,s){var o=e||{};if(fi(o,"quoteStyle")&&!fi(uR,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fi(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=fi(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fi(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(fi(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return mR(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?sR(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?sR(t,h):h}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return zx(t)?"[Array]":"[Object]";var u=AG(o,i);if(typeof s>"u")s=[];else if(pR(s,t)>=0)return"[Circular]";function d(B,k,U){if(k&&(s=aG.call(s),s.push(k)),U){var O={depth:o.depth};return fi(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(B,O,i+1,s)}return r(B,o,i+1,s)}if(typeof t=="function"&&!aR(t)){var f=xG(t),p=Bd(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$r.call(p,", ")+" }":"")}if(fR(t)){var m=Jo?zi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Vx.call(t);return typeof t=="object"&&!Jo?Vl(m):m}if(SG(t)){for(var g="<"+tR.call(String(t.nodeName)),_=t.attributes||[],b=0;b<_.length;b++)g+=" "+_[b].name+"="+dR(hG(_[b].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+tR.call(String(t.nodeName))+">",g}if(zx(t)){if(t.length===0)return"[]";var y=Bd(t,d);return u&&!EG(y)?"["+$x(y,u)+"]":"[ "+$r.call(y,", ")+" ]"}if(uG(t)){var w=Bd(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!cR.call(t,"cause")?"{ ["+String(t)+"] "+$r.call(eR.call("[cause]: "+d(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$r.call(w,", ")+" }"}if(typeof t=="object"&&n){if(nR&&typeof t[nR]=="function"&&Wx)return Wx(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(yG(t)){var E=[];return ZC&&ZC.call(t,function(B,k){E.push(d(k,t,!0)+" => "+d(B,t))}),lR("Map",Fd.call(t),E,u)}if(vG(t)){var v=[];return QC&&QC.call(t,function(B){v.push(d(B,t))}),lR("Set",kd.call(t),v,u)}if(_G(t))return Nx("WeakMap");if(TG(t))return Nx("WeakSet");if(bG(t))return Nx("WeakRef");if(fG(t))return Vl(d(Number(t)));if(mG(t))return Vl(d(Hx.call(t)));if(pG(t))return Vl(rG.call(t));if(dG(t))return Vl(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!cG(t)&&!aR(t)){var S=Bd(t,d),P=iR?iR(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",A=!P&&$l&&Object(t)===t&&$l in t?Yx.call($i(t),8,-1):R?"Object":"",C=P||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=C+(A||R?"["+$r.call(eR.call([],A||[],R||[]),": ")+"] ":"");return S.length===0?M+"{}":u?M+"{"+$x(S,u)+"}":M+"{ "+$r.call(S,", ")+" }"}return String(t)};function dR(r,t,e){var i=e.quoteStyle||t,s=uR[i];return s+r+s}function hG(r){return zi.call(String(r),/"/g,"&quot;")}function Es(r){return!$l||!(typeof r=="object"&&($l in r||typeof r[$l]<"u"))}function zx(r){return $i(r)==="[object Array]"&&Es(r)}function cG(r){return $i(r)==="[object Date]"&&Es(r)}function aR(r){return $i(r)==="[object RegExp]"&&Es(r)}function uG(r){return $i(r)==="[object Error]"&&Es(r)}function dG(r){return $i(r)==="[object String]"&&Es(r)}function fG(r){return $i(r)==="[object Number]"&&Es(r)}function pG(r){return $i(r)==="[object Boolean]"&&Es(r)}function fR(r){if(Jo)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Vx)return!1;try{return Vx.call(r),!0}catch{}return!1}function mG(r){if(!r||typeof r!="object"||!Hx)return!1;try{return Hx.call(r),!0}catch{}return!1}var gG=Object.prototype.hasOwnProperty||function(r){return r in this};function fi(r,t){return gG.call(r,t)}function $i(r){return iG.call(r)}function xG(r){if(r.name)return r.name;var t=oG.call(sG.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function pR(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function yG(r){if(!Fd||!r||typeof r!="object")return!1;try{Fd.call(r);try{kd.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function _G(r){if(!Wl||!r||typeof r!="object")return!1;try{Wl.call(r,Wl);try{zl.call(r,zl)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function bG(r){if(!JC||!r||typeof r!="object")return!1;try{return JC.call(r),!0}catch{}return!1}function vG(r){if(!kd||!r||typeof r!="object")return!1;try{kd.call(r);try{Fd.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function TG(r){if(!zl||!r||typeof r!="object")return!1;try{zl.call(r,zl);try{Wl.call(r,Wl)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function SG(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function mR(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return mR(Yx.call(r,0,t.maxStringLength),t)+i}var s=lG[t.quoteStyle||"single"];s.lastIndex=0;var o=zi.call(zi.call(r,s,"\\$1"),/[\x00-\x1f]/g,wG);return dR(o,"single",t)}function wG(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+nG.call(t.toString(16))}function Vl(r){return"Object("+r+")"}function Nx(r){return r+" { ? }"}function lR(r,t,e,i){var s=i?$x(e,i):$r.call(e,", ");return r+" ("+t+") {"+s+"}"}function EG(r){for(var t=0;t<r.length;t++)if(pR(r[t],`
1090
+ `)>=0)return!1;return!0}function AG(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=$r.call(Array(r.indent+1)," ");else return null;return{base:e,prev:$r.call(Array(t+1),e)}}function $x(r,t){if(r.length===0)return"";var e=`
1091
1091
  `+t.prev+t.base;return e+$r.call(r,","+e)+`
1092
- `+t.prev}function Id(r,t){var e=Wx(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=fi(r,s)?t(r[s],r):""}var o=typeof Lx=="function"?Lx(r):[],n;if(Jo){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)fi(r,l)&&(e&&String(Number(l))===l&&l<r.length||Jo&&n["$"+l]instanceof Symbol||(lR.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof Lx=="function")for(var h=0;h<o.length;h++)hR.call(r,o[h])&&i.push("["+t(o[h])+"]: "+t(r[o[h]],r));return i}});var xR=J((jft,gR)=>{"use strict";var EG=Xl(),AG=ws(),kd=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},PG=function(r,t){if(r){var e=kd(r,t);return e&&e.value}},CG=function(r,t,e){var i=kd(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},RG=function(r,t){return r?!!kd(r,t):!1},MG=function(r,t){if(r)return kd(r,t,!0)};gR.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new AG("Side channel does not contain "+EG(i))},delete:function(i){var s=t&&t.next,o=MG(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return PG(t,i)},has:function(i){return RG(t,i)},set:function(i,s){t||(t={next:void 0}),CG(t,i,s)}};return e}});var Yx=J((Yft,yR)=>{"use strict";yR.exports=Object});var bR=J((qft,_R)=>{"use strict";_R.exports=Error});var TR=J((Kft,vR)=>{"use strict";vR.exports=EvalError});var wR=J((Zft,SR)=>{"use strict";SR.exports=RangeError});var AR=J((Qft,ER)=>{"use strict";ER.exports=ReferenceError});var CR=J((Jft,PR)=>{"use strict";PR.exports=SyntaxError});var MR=J((tpt,RR)=>{"use strict";RR.exports=URIError});var BR=J((ept,IR)=>{"use strict";IR.exports=Math.abs});var kR=J((rpt,FR)=>{"use strict";FR.exports=Math.floor});var GR=J((ipt,UR)=>{"use strict";UR.exports=Math.max});var LR=J((spt,OR)=>{"use strict";OR.exports=Math.min});var NR=J((opt,DR)=>{"use strict";DR.exports=Math.pow});var VR=J((npt,HR)=>{"use strict";HR.exports=Math.round});var zR=J((apt,WR)=>{"use strict";WR.exports=Number.isNaN||function(t){return t!==t}});var XR=J((lpt,$R)=>{"use strict";var IG=zR();$R.exports=function(t){return IG(t)||t===0?t:t<0?-1:1}});var YR=J((hpt,jR)=>{"use strict";jR.exports=Object.getOwnPropertyDescriptor});var qx=J((cpt,qR)=>{"use strict";var Ud=YR();if(Ud)try{Ud([],"length")}catch{Ud=null}qR.exports=Ud});var ZR=J((upt,KR)=>{"use strict";var Gd=Object.defineProperty||!1;if(Gd)try{Gd({},"a",{value:1})}catch{Gd=!1}KR.exports=Gd});var JR=J((dpt,QR)=>{"use strict";QR.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var rM=J((fpt,eM)=>{"use strict";var tM=typeof Symbol<"u"&&Symbol,BG=JR();eM.exports=function(){return typeof tM!="function"||typeof Symbol!="function"||typeof tM("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:BG()}});var Kx=J((ppt,iM)=>{"use strict";iM.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Zx=J((mpt,sM)=>{"use strict";var FG=Yx();sM.exports=FG.getPrototypeOf||null});var aM=J((gpt,nM)=>{"use strict";var kG="Function.prototype.bind called on incompatible ",UG=Object.prototype.toString,GG=Math.max,OG="[object Function]",oM=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},LG=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},DG=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};nM.exports=function(t){var e=this;if(typeof e!="function"||UG.apply(e)!==OG)throw new TypeError(kG+e);for(var i=LG(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,oM(i,arguments));return Object(c)===c?c:this}return e.apply(t,oM(i,arguments))},n=GG(0,e.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+DG(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s}});var jl=J((xpt,lM)=>{"use strict";var NG=aM();lM.exports=Function.prototype.bind||NG});var Od=J((ypt,hM)=>{"use strict";hM.exports=Function.prototype.call});var Qx=J((_pt,cM)=>{"use strict";cM.exports=Function.prototype.apply});var dM=J((bpt,uM)=>{"use strict";uM.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var pM=J((vpt,fM)=>{"use strict";var HG=jl(),VG=Qx(),WG=Od(),zG=dM();fM.exports=zG||HG.call(WG,VG)});var Jx=J((Tpt,mM)=>{"use strict";var $G=jl(),XG=ws(),jG=Od(),YG=pM();mM.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new XG("a function is required");return YG($G,jG,t)}});var vM=J((Spt,bM)=>{"use strict";var qG=Jx(),gM=qx(),yM;try{yM=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var ty=!!yM&&gM&&gM(Object.prototype,"__proto__"),_M=Object,xM=_M.getPrototypeOf;bM.exports=ty&&typeof ty.get=="function"?qG([ty.get]):typeof xM=="function"?function(t){return xM(t==null?t:_M(t))}:!1});var AM=J((wpt,EM)=>{"use strict";var TM=Kx(),SM=Zx(),wM=vM();EM.exports=TM?function(t){return TM(t)}:SM?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return SM(t)}:wM?function(t){return wM(t)}:null});var CM=J((Ept,PM)=>{"use strict";var KG=Function.prototype.call,ZG=Object.prototype.hasOwnProperty,QG=jl();PM.exports=QG.call(KG,ZG)});var Nd=J((Apt,kM)=>{"use strict";var pt,JG=Yx(),tO=bR(),eO=TR(),rO=wR(),iO=AR(),sn=CR(),rn=ws(),sO=MR(),oO=BR(),nO=kR(),aO=GR(),lO=LR(),hO=NR(),cO=VR(),uO=XR(),BM=Function,ey=function(r){try{return BM('"use strict"; return ('+r+").constructor;")()}catch{}},Yl=qx(),dO=ZR(),ry=function(){throw new rn},fO=Yl?function(){try{return arguments.callee,ry}catch{try{return Yl(arguments,"callee").get}catch{return ry}}}():ry,tn=rM()(),be=AM(),pO=Zx(),mO=Kx(),FM=Qx(),ql=Od(),en={},gO=typeof Uint8Array>"u"||!be?pt:be(Uint8Array),As={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?pt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?pt:ArrayBuffer,"%ArrayIteratorPrototype%":tn&&be?be([][Symbol.iterator]()):pt,"%AsyncFromSyncIteratorPrototype%":pt,"%AsyncFunction%":en,"%AsyncGenerator%":en,"%AsyncGeneratorFunction%":en,"%AsyncIteratorPrototype%":en,"%Atomics%":typeof Atomics>"u"?pt:Atomics,"%BigInt%":typeof BigInt>"u"?pt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?pt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?pt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?pt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":tO,"%eval%":eval,"%EvalError%":eO,"%Float16Array%":typeof Float16Array>"u"?pt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?pt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?pt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?pt:FinalizationRegistry,"%Function%":BM,"%GeneratorFunction%":en,"%Int8Array%":typeof Int8Array>"u"?pt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?pt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?pt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tn&&be?be(be([][Symbol.iterator]())):pt,"%JSON%":typeof JSON=="object"?JSON:pt,"%Map%":typeof Map>"u"?pt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tn||!be?pt:be(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":JG,"%Object.getOwnPropertyDescriptor%":Yl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?pt:Promise,"%Proxy%":typeof Proxy>"u"?pt:Proxy,"%RangeError%":rO,"%ReferenceError%":iO,"%Reflect%":typeof Reflect>"u"?pt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?pt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tn||!be?pt:be(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?pt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tn&&be?be(""[Symbol.iterator]()):pt,"%Symbol%":tn?Symbol:pt,"%SyntaxError%":sn,"%ThrowTypeError%":fO,"%TypedArray%":gO,"%TypeError%":rn,"%Uint8Array%":typeof Uint8Array>"u"?pt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?pt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?pt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?pt:Uint32Array,"%URIError%":sO,"%WeakMap%":typeof WeakMap>"u"?pt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?pt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?pt:WeakSet,"%Function.prototype.call%":ql,"%Function.prototype.apply%":FM,"%Object.defineProperty%":dO,"%Object.getPrototypeOf%":pO,"%Math.abs%":oO,"%Math.floor%":nO,"%Math.max%":aO,"%Math.min%":lO,"%Math.pow%":hO,"%Math.round%":cO,"%Math.sign%":uO,"%Reflect.getPrototypeOf%":mO};if(be)try{null.error}catch(r){RM=be(be(r)),As["%Error.prototype%"]=RM}var RM,xO=function r(t){var e;if(t==="%AsyncFunction%")e=ey("async function () {}");else if(t==="%GeneratorFunction%")e=ey("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ey("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&be&&(e=be(s.prototype))}return As[t]=e,e},MM={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Kl=jl(),Ld=CM(),yO=Kl.call(ql,Array.prototype.concat),_O=Kl.call(FM,Array.prototype.splice),IM=Kl.call(ql,String.prototype.replace),Dd=Kl.call(ql,String.prototype.slice),bO=Kl.call(ql,RegExp.prototype.exec),vO=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,TO=/\\(\\)?/g,SO=function(t){var e=Dd(t,0,1),i=Dd(t,-1);if(e==="%"&&i!=="%")throw new sn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new sn("invalid intrinsic syntax, expected opening `%`");var s=[];return IM(t,vO,function(o,n,a,l){s[s.length]=a?IM(l,TO,"$1"):n||o}),s},wO=function(t,e){var i=t,s;if(Ld(MM,i)&&(s=MM[i],i="%"+s[0]+"%"),Ld(As,i)){var o=As[i];if(o===en&&(o=xO(i)),typeof o>"u"&&!e)throw new rn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new sn("intrinsic "+t+" does not exist!")};kM.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new rn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new rn('"allowMissing" argument must be a boolean');if(bO(/^%?[^%]*%?$/,t)===null)throw new sn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=SO(t),s=i.length>0?i[0]:"",o=wO("%"+s+"%",e),n=o.name,a=o.value,l=!1,h=o.alias;h&&(s=h[0],_O(i,yO([0,1],h)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Dd(d,0,1),p=Dd(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new sn("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,n="%"+s+"%",Ld(As,n))a=As[n];else if(a!=null){if(!(d in a)){if(!e)throw new rn("base intrinsic for "+t+" exists, but the property is not available.");return}if(Yl&&c+1>=i.length){var g=Yl(a,d);u=!!g,u&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else u=Ld(a,d),a=a[d];u&&!l&&(As[n]=a)}}return a}});var iy=J((Ppt,OM)=>{"use strict";var UM=Nd(),GM=Jx(),EO=GM([UM("%String.prototype.indexOf%")]);OM.exports=function(t,e){var i=UM(t,!!e);return typeof i=="function"&&EO(t,".prototype.")>-1?GM([i]):i}});var sy=J((Cpt,DM)=>{"use strict";var AO=Nd(),Zl=iy(),PO=Xl(),CO=ws(),LM=AO("%Map%",!0),RO=Zl("Map.prototype.get",!0),MO=Zl("Map.prototype.set",!0),IO=Zl("Map.prototype.has",!0),BO=Zl("Map.prototype.delete",!0),FO=Zl("Map.prototype.size",!0);DM.exports=!!LM&&function(){var t,e={assert:function(i){if(!e.has(i))throw new CO("Side channel does not contain "+PO(i))},delete:function(i){if(t){var s=BO(t,i);return FO(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return RO(t,i)},has:function(i){return t?IO(t,i):!1},set:function(i,s){t||(t=new LM),MO(t,i,s)}};return e}});var HM=J((Rpt,NM)=>{"use strict";var kO=Nd(),Vd=iy(),UO=Xl(),Hd=sy(),GO=ws(),on=kO("%WeakMap%",!0),OO=Vd("WeakMap.prototype.get",!0),LO=Vd("WeakMap.prototype.set",!0),DO=Vd("WeakMap.prototype.has",!0),NO=Vd("WeakMap.prototype.delete",!0);NM.exports=on?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new GO("Side channel does not contain "+UO(s))},delete:function(s){if(on&&s&&(typeof s=="object"||typeof s=="function")){if(t)return NO(t,s)}else if(Hd&&e)return e.delete(s);return!1},get:function(s){return on&&s&&(typeof s=="object"||typeof s=="function")&&t?OO(t,s):e&&e.get(s)},has:function(s){return on&&s&&(typeof s=="object"||typeof s=="function")&&t?DO(t,s):!!e&&e.has(s)},set:function(s,o){on&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new on),LO(t,s,o)):Hd&&(e||(e=Hd()),e.set(s,o))}};return i}:Hd});var WM=J((Mpt,VM)=>{"use strict";var HO=ws(),VO=Xl(),WO=xR(),zO=sy(),$O=HM(),XO=$O||zO||WO;VM.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new HO("Side channel does not contain "+VO(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=XO()),t.set(i,s)}};return e}});var Wd=J((Ipt,zM)=>{"use strict";var jO=String.prototype.replace,YO=/%20/g,oy={RFC1738:"RFC1738",RFC3986:"RFC3986"};zM.exports={default:oy.RFC3986,formatters:{RFC1738:function(r){return jO.call(r,YO,"+")},RFC3986:function(r){return String(r)}},RFC1738:oy.RFC1738,RFC3986:oy.RFC3986}});var ly=J((Bpt,XM)=>{"use strict";var qO=Wd(),ny=Object.prototype.hasOwnProperty,Ps=Array.isArray,Xr=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),KO=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Ps(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},$M=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},ZO=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(Ps(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!ny.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Ps(t)&&!Ps(e)&&(s=$M(t,i)),Ps(t)&&Ps(e)?(e.forEach(function(o,n){if(ny.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return ny.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},QO=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},JO=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},ay=1024,tL=function(t,e,i,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=ay){for(var h=n.length>=ay?n.slice(l,l+ay):n,c=[],u=0;u<h.length;++u){var d=h.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===qO.RFC1738&&(d===40||d===41)){c[c.length]=h.charAt(u);continue}if(d<128){c[c.length]=Xr[d];continue}if(d<2048){c[c.length]=Xr[192|d>>6]+Xr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Xr[224|d>>12]+Xr[128|d>>6&63]+Xr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|h.charCodeAt(u)&1023),c[c.length]=Xr[240|d>>18]+Xr[128|d>>12&63]+Xr[128|d>>6&63]+Xr[128|d&63]}a+=c.join("")}return a},eL=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var h=a[l],c=n[h];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:n,prop:h}),i.push(c))}return KO(e),t},rL=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},iL=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},sL=function(t,e){return[].concat(t,e)},oL=function(t,e){if(Ps(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};XM.exports={arrayToObject:$M,assign:QO,combine:sL,compact:eL,decode:JO,encode:tL,isBuffer:iL,isRegExp:rL,maybeMap:oL,merge:ZO}});var QM=J((Fpt,ZM)=>{"use strict";var YM=WM(),zd=ly(),Ql=Wd(),nL=Object.prototype.hasOwnProperty,qM={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},jr=Array.isArray,aL=Array.prototype.push,KM=function(r,t){aL.apply(r,jr(t)?t:[t])},lL=Date.prototype.toISOString,jM=Ql.default,pe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:zd.encode,encodeValuesOnly:!1,filter:void 0,format:jM,formatter:Ql.formatters[jM],indices:!1,serializeDate:function(t){return lL.call(t)},skipNulls:!1,strictNullHandling:!1},hL=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},hy={},cL=function r(t,e,i,s,o,n,a,l,h,c,u,d,f,p,g,m,_,b){for(var y=t,w=b,E=0,v=!1;(w=w.get(hy))!==void 0&&!v;){var S=w.get(t);if(E+=1,typeof S<"u"){if(S===E)throw new RangeError("Cyclic object value");v=!0}typeof w.get(hy)>"u"&&(E=0)}if(typeof c=="function"?y=c(e,y):y instanceof Date?y=f(y):i==="comma"&&jr(y)&&(y=zd.maybeMap(y,function(z){return z instanceof Date?f(z):z})),y===null){if(n)return h&&!m?h(e,pe.encoder,_,"key",p):e;y=""}if(hL(y)||zd.isBuffer(y)){if(h){var P=m?e:h(e,pe.encoder,_,"key",p);return[g(P)+"="+g(h(y,pe.encoder,_,"value",p))]}return[g(e)+"="+g(String(y))]}var R=[];if(typeof y>"u")return R;var A;if(i==="comma"&&jr(y))m&&h&&(y=zd.maybeMap(y,h)),A=[{value:y.length>0?y.join(",")||null:void 0}];else if(jr(c))A=c;else{var C=Object.keys(y);A=u?C.sort(u):C}var M=l?String(e).replace(/\./g,"%2E"):String(e),B=s&&jr(y)&&y.length===1?M+"[]":M;if(o&&jr(y)&&y.length===0)return B+"[]";for(var k=0;k<A.length;++k){var U=A[k],O=typeof U=="object"&&U&&typeof U.value<"u"?U.value:y[U];if(!(a&&O===null)){var $=d&&l?String(U).replace(/\./g,"%2E"):String(U),N=jr(y)?typeof i=="function"?i(B,$):B:B+(d?"."+$:"["+$+"]");b.set(t,E);var L=YM();L.set(hy,b),KM(R,r(O,N,i,s,o,n,a,l,i==="comma"&&m&&jr(y)?null:h,c,u,d,f,p,g,m,_,L))}}return R},uL=function(t){if(!t)return pe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||pe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Ql.default;if(typeof t.format<"u"){if(!nL.call(Ql.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Ql.formatters[i],o=pe.filter;(typeof t.filter=="function"||jr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in qM?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=pe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:pe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:pe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:pe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:pe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?pe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:pe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:pe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:pe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:pe.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:pe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:pe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:pe.strictNullHandling}};ZM.exports=function(r,t){var e=r,i=uL(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):jr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=qM[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=YM(),c=0;c<s.length;++c){var u=s[c],d=e[u];i.skipNulls&&d===null||KM(n,cL(d,u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var f=n.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var rI=J((kpt,eI)=>{"use strict";var Cs=ly(),cy=Object.prototype.hasOwnProperty,JM=Array.isArray,Kt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Cs.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},dL=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},tI=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},fL="utf8=%26%2310003%3B",pL="utf8=%E2%9C%93",mL=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===pL?h="utf-8":n[l]===fL&&(h="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var c=n[l],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,Kt.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Kt.decoder,h,"key"),p=Cs.maybeMap(tI(c.slice(d+1),e,JM(i[f])?i[f].length:0),function(m){return e.decoder(m,Kt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=dL(String(p))),c.indexOf("[]=")>-1&&(p=JM(p)?[p]:p);var g=cy.call(i,f);g&&e.duplicates==="combine"?i[f]=Cs.combine(i[f],p):(!g||e.duplicates==="last")&&(i[f]=p)}return i},gL=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:tI(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:Cs.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var c=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&h!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},xL=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),h=l?o.slice(0,l.index):o,c=[];if(h){if(!i.plainObjects&&cy.call(Object.prototype,h)&&!i.allowPrototypes)return;c.push(h)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&cy.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+o.slice(l.index)+"]")}return gL(c,e,i,s)}},yL=function(t){if(!t)return Kt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?Kt.charset:t.charset,i=typeof t.duplicates>"u"?Kt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Kt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Kt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Kt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Kt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Kt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Kt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Kt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Kt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Kt.decoder,delimiter:typeof t.delimiter=="string"||Cs.isRegExp(t.delimiter)?t.delimiter:Kt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Kt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Kt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Kt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Kt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Kt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Kt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};eI.exports=function(r,t){var e=yL(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?mL(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=xL(a,i[a],e,typeof r=="string");s=Cs.merge(s,l,e)}return e.allowSparse===!0?s:Cs.compact(s)}});var sI=J((Upt,iI)=>{"use strict";var _L=QM(),bL=rI(),vL=Wd();iI.exports={formats:vL,parse:bL,stringify:_L}});var lI=J(an=>{"use strict";var TL=jC();function gr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var SL=/^([a-z0-9.+-]+:)/i,wL=/:[0-9]*$/,EL=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,AL=["<",">",'"',"`"," ","\r",`
1093
- `," "],PL=["{","}","|","\\","^","`"].concat(AL),uy=["'"].concat(PL),oI=["%","/","?",";","#"].concat(uy),nI=["/","?","#"],CL=255,aI=/^[+a-z0-9A-Z_-]{0,63}$/,RL=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ML={javascript:!0,"javascript:":!0},dy={javascript:!0,"javascript:":!0},nn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},fy=sI();function Jl(r,t,e){if(r&&typeof r=="object"&&r instanceof gr)return r;var i=new gr;return i.parse(r,t,e),i}gr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=EL.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=fy.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=SL.exec(a);if(h){h=h[0];var c=h.toLowerCase();this.protocol=c,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(h&&dy[h])&&(a=a.substr(2),this.slashes=!0)}if(!dy[h]&&(u||h&&!nn[h])){for(var d=-1,f=0;f<nI.length;f++){var p=a.indexOf(nI[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var g,m;d===-1?m=a.lastIndexOf("@"):m=a.lastIndexOf("@",d),m!==-1&&(g=a.slice(0,m),a=a.slice(m+1),this.auth=decodeURIComponent(g)),d=-1;for(var f=0;f<oI.length;f++){var p=a.indexOf(oI[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var b=this.hostname.split(/\./),f=0,y=b.length;f<y;f++){var w=b[f];if(w&&!w.match(aI)){for(var E="",v=0,S=w.length;v<S;v++)w.charCodeAt(v)>127?E+="x":E+=w[v];if(!E.match(aI)){var P=b.slice(0,f),R=b.slice(f+1),A=w.match(RL);A&&(P.push(A[1]),R.unshift(A[2])),R.length&&(a="/"+R.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>CL?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=TL.toASCII(this.hostname));var C=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+C,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!ML[c])for(var f=0,y=uy.length;f<y;f++){var B=uy[f];if(a.indexOf(B)!==-1){var k=encodeURIComponent(B);k===B&&(k=escape(B)),a=a.split(B).join(k)}}var U=a.indexOf("#");U!==-1&&(this.hash=a.substr(U),a=a.slice(0,U));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=fy.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),nn[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var C=this.pathname||"",$=this.search||"";this.path=C+$}return this.href=this.format(),this};function IL(r){return typeof r=="string"&&(r=Jl(r)),r instanceof gr?r.format():gr.prototype.format.call(r)}gr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=fy.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||nn[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function BL(r,t){return Jl(r,!1,!0).resolve(t)}gr.prototype.resolve=function(r){return this.resolveObject(Jl(r,!1,!0)).format()};function FL(r,t){return r?Jl(r,!1,!0).resolveObject(t):t}gr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new gr;t.parse(r,!1,!0),r=t}for(var e=new gr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(e[l]=r[l])}return nn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!nn[r.protocol]){for(var h=Object.keys(r),c=0;c<h.length;c++){var u=h[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!dy[r.protocol]){for(var y=(r.pathname||"").split("/");y.length&&!(r.host=y.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",g=r.host||r.pathname&&r.pathname.charAt(0)==="/",m=g||p||e.host&&r.pathname,_=m,b=e.pathname&&e.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],w=e.protocol&&!nn[e.protocol];if(w&&(e.hostname="",e.port=null,e.host&&(b[0]===""?b[0]=e.host:b.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host=null),m=m&&(y[0]===""||b[0]==="")),g)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,b=y;else if(y.length)b||(b=[]),b.pop(),b=b.concat(y),e.search=r.search,e.query=r.query;else if(r.search!=null){if(w){e.host=b.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!b.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var v=b.slice(-1)[0],S=(e.host||r.host||b.length>1)&&(v==="."||v==="..")||v==="",P=0,R=b.length;R>=0;R--)v=b[R],v==="."?b.splice(R,1):v===".."?(b.splice(R,1),P++):P&&(b.splice(R,1),P--);if(!m&&!_)for(;P--;P)b.unshift("..");m&&b[0]!==""&&(!b[0]||b[0].charAt(0)!=="/")&&b.unshift(""),S&&b.join("/").substr(-1)!=="/"&&b.push("");var A=b[0]===""||b[0]&&b[0].charAt(0)==="/";if(w){e.hostname=A?"":b.length?b.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return m=m||e.host&&b.length,m&&!A&&b.unshift(""),b.length>0?e.pathname=b.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};gr.prototype.parseHost=function(){var r=this.host,t=wL.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};an.parse=Jl;an.resolve=BL;an.resolveObject=FL;an.format=IL;an.Url=gr});var AB=()=>{let r=new Map,t=l=>typeof l=="string"&&l.startsWith("blob:"),e=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!t(l.url);return{load:async l=>{let h=[];for(let[c,u]of Object.entries(l))r.has(c)||h.push([c,u]);h.length>0&&await Promise.all(h.map(async([c,u])=>{if(e(u)){r.set(c,{url:u.url,type:u.type,source:"url"});return}let p={buffer:await(await fetch(u.url)).arrayBuffer(),type:u.type,source:"buffer"};r.set(c,p)}))},getBufferMap:()=>{let l={};for(let[h,c]of r.entries())l[h]=c;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};F();var Bw={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(Iw(),k2))}};F();var kw={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Fw(),U2))}};F();pc();lc();F();Ft();Aa();var lu;function Vw(r){return lu!==void 0||(lu=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??Oi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Y.get().getWebGLRenderingContext())return!1;let i=Y.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),lu}Ft();var hu;async function Ww(r={}){return hu!==void 0||(hu=await(async()=>{let t=Y.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),hu}Aa();var eP=["webgl","webgpu","canvas"];async function rP(r){let t=[];r.preference?(t.push(r.preference),eP.forEach(o=>{o!==r.preference&&t.push(o)})):t=eP.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await Ww()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(CA(),PA));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&Vw(r.failIfMajorPerformanceCaveat??Oi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(tP(),J1));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}br();xg();Wt();var iP=class ox{constructor(...t){this.stage=new nt,t[0]!==void 0&&j(rt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await rP(t),ox._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return j(rt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=ox._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};iP._plugins=[];var vl=iP;H.handleByList(T.Application,vl._plugins);H.add(Ga);F();Pi();yp();Ft();F();os();he();Tt();jm();Qm();var Tl=class extends Ro{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],h=new tt(n.x+a.x,n.y+a.y,n.width,n.height),c=new I({source:l,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){ya.install(t)}static uninstall(t){ya.uninstall(t)}};var ku={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let g in f){let m=f[g].split("="),_=m[0],b=m[1].replace(/"/gm,""),y=parseFloat(b),w=isNaN(y)?b:y;p[_]=w}e[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let h=e.char;for(let u=0;u<h.length;u++){let d=h[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),l[f]=p,i.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);i.chars[l[f]].kerning[l[d]]=p}return i}};Ft();var nx={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let h=0;h<o.length;h++)t.pages.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let h=0;h<n.length;h++){let c=n[h],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),l[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<a.length;h++){let c=parseInt(a[h].getAttribute("first"),10),u=parseInt(a[h].getAttribute("second"),10),d=parseInt(a[h].getAttribute("amount"),10);t.chars[l[u]].kerning[l[c]]=d}return t}};var ax={test(r){return typeof r=="string"&&r.includes("<font>")?nx.test(Y.get().parseXML(r)):!1},parse(r){return nx.parse(Y.get().parseXML(r))}};var mk=[".xml",".fnt"],sP={extension:{type:T.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof Tl,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},oP={extension:{type:T.LoadParser,priority:ke.Normal},name:"loadBitmapFont",test(r){return mk.includes(ue.extname(r).toLowerCase())},async testParse(r){return ku.test(r)||ax.test(r)},async parse(r,t,e){let i=ku.test(r)?ku.parse(r):ax.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ue.join(ue.dirname(s),d);f=$n(f,s),n.push({src:f,data:a})}let l=await e.load(n),h=n.map(u=>l[u.src]);return new Tl({data:i,textures:h},s)},async load(r,t){return await(await Y.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};Pt();var Uu=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};Ri();F();Tt();var nP={extension:{type:T.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof I),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};F();async function Gu(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var aP={extension:{type:T.DetectionParser,priority:1},test:async()=>Gu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};F();var lP=["png","jpg","jpeg"],hP={extension:{type:T.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...lP],remove:async r=>r.filter(t=>!lP.includes(t))};F();var gk="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Wo(r){return gk?!1:document.createElement("video").canPlayType(r)!==""}var cP={extension:{type:T.DetectionParser,priority:0},test:async()=>Wo("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};F();var uP={extension:{type:T.DetectionParser,priority:0},test:async()=>Wo("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};F();var dP={extension:{type:T.DetectionParser,priority:0},test:async()=>Wo("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};F();var fP={extension:{type:T.DetectionParser,priority:0},test:async()=>Gu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};Pt();os();zn();ac();var Ou=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||V(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return V(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),i.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=ns(t),n=Ue(t,h=>({alias:[h],src:h,data:{}})),a=n.length,l=n.map(async h=>{let c=ue.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),s[h.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[h.src],new Error(`[Loader.load] Failed to load ${c}.
1094
- ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t,s=>({alias:[s],src:s})).map(async s=>{let o=ue.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&V(`[Assets] loadParser name conflict "${e.name}"`):V("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Ft();F();function dr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}os();function fr(r,t){let e=r.split("?")[0],i=ue.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}Pi();var xk=".json",yk="application/json",pP={extension:{type:T.LoadParser,priority:ke.Low},name:"loadJson",test(r){return dr(r,yk)||fr(r,xk)},async load(r){return await(await Y.get().fetch(r)).json()}};Ft();F();Pi();var _k=".txt",bk="text/plain",mP={name:"loadTxt",extension:{type:T.LoadParser,priority:ke.Low,name:"loadTxt"},test(r){return dr(r,bk)||fr(r,_k)},async load(r){return await(await Y.get().fetch(r)).text()}};Ft();F();Pt();os();Ri();Pi();var vk=["normal","bold","100","200","300","400","500","600","700","800","900"],Tk=[".ttf",".otf",".woff",".woff2"],Sk=["font/ttf","font/otf","font/woff","font/woff2"],wk=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Ek(r){let t=ue.extname(r),s=ue.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(wk)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var Ak=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Pk(r){return Ak.test(r)?r:encodeURI(r)}var gP={extension:{type:T.LoadParser,priority:ke.Low},name:"loadWebFont",test(r){return dr(r,Sk)||fr(r,Tk)},async load(r,t){let e=Y.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??Ek(r),o=t.data?.weights?.filter(a=>vk.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let l=o[a],h=new FontFace(s,`url(${Pk(r)})`,{...n,weight:l});await h.load(),e.add(h),i.push(h)}return St.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return V("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{St.remove(`${t.family}-and-url`),Y.get().getFontFaceSet().delete(t)})}};Ft();F();so();jc();ro();function zo(r,t=1){let e=Qe.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}Pi();Tt();Pt();Ri();function $o(r,t,e){r.label=e,r._sourceOrigin=e;let i=new I({source:r,label:e}),s=()=>{delete t.promiseCache[e],St.has(e)&&St.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(V("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(V("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var Ck=".svg",Rk="image/svg+xml",xP={extension:{type:T.LoadParser,priority:ke.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return dr(r,Rk)||fr(r,Ck)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Ik(r):Mk(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function Mk(r,t,e,i){let o=await(await Y.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),h=l.getContext("2d"),c=t.data?.resolution||zo(r),u=t.data?.width??a.width,d=t.data?.height??a.height;l.width=u*c,l.height=d*c,h.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},g=new ze({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return $o(g,e,r)}async function Ik(r){let e=await(await Y.get().fetch(r)).text(),i=new Oe;return i.svg(e),i}Ft();F();so();var Bk=`(function () {
1092
+ `+t.prev}function Bd(r,t){var e=zx(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=fi(r,s)?t(r[s],r):""}var o=typeof Dx=="function"?Dx(r):[],n;if(Jo){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)fi(r,l)&&(e&&String(Number(l))===l&&l<r.length||Jo&&n["$"+l]instanceof Symbol||(hR.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof Dx=="function")for(var h=0;h<o.length;h++)cR.call(r,o[h])&&i.push("["+t(o[h])+"]: "+t(r[o[h]],r));return i}});var yR=J((Kft,xR)=>{"use strict";var PG=Xl(),CG=ws(),Ud=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},RG=function(r,t){if(r){var e=Ud(r,t);return e&&e.value}},MG=function(r,t,e){var i=Ud(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},IG=function(r,t){return r?!!Ud(r,t):!1},BG=function(r,t){if(r)return Ud(r,t,!0)};xR.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new CG("Side channel does not contain "+PG(i))},delete:function(i){var s=t&&t.next,o=BG(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return RG(t,i)},has:function(i){return IG(t,i)},set:function(i,s){t||(t={next:void 0}),MG(t,i,s)}};return e}});var qx=J((Zft,_R)=>{"use strict";_R.exports=Object});var vR=J((Qft,bR)=>{"use strict";bR.exports=Error});var SR=J((Jft,TR)=>{"use strict";TR.exports=EvalError});var ER=J((tpt,wR)=>{"use strict";wR.exports=RangeError});var PR=J((ept,AR)=>{"use strict";AR.exports=ReferenceError});var RR=J((rpt,CR)=>{"use strict";CR.exports=SyntaxError});var IR=J((ipt,MR)=>{"use strict";MR.exports=URIError});var FR=J((spt,BR)=>{"use strict";BR.exports=Math.abs});var UR=J((opt,kR)=>{"use strict";kR.exports=Math.floor});var OR=J((npt,GR)=>{"use strict";GR.exports=Math.max});var DR=J((apt,LR)=>{"use strict";LR.exports=Math.min});var HR=J((lpt,NR)=>{"use strict";NR.exports=Math.pow});var WR=J((hpt,VR)=>{"use strict";VR.exports=Math.round});var $R=J((cpt,zR)=>{"use strict";zR.exports=Number.isNaN||function(t){return t!==t}});var jR=J((upt,XR)=>{"use strict";var FG=$R();XR.exports=function(t){return FG(t)||t===0?t:t<0?-1:1}});var qR=J((dpt,YR)=>{"use strict";YR.exports=Object.getOwnPropertyDescriptor});var Kx=J((fpt,KR)=>{"use strict";var Gd=qR();if(Gd)try{Gd([],"length")}catch{Gd=null}KR.exports=Gd});var QR=J((ppt,ZR)=>{"use strict";var Od=Object.defineProperty||!1;if(Od)try{Od({},"a",{value:1})}catch{Od=!1}ZR.exports=Od});var tM=J((mpt,JR)=>{"use strict";JR.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var iM=J((gpt,rM)=>{"use strict";var eM=typeof Symbol<"u"&&Symbol,kG=tM();rM.exports=function(){return typeof eM!="function"||typeof Symbol!="function"||typeof eM("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:kG()}});var Zx=J((xpt,sM)=>{"use strict";sM.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Qx=J((ypt,oM)=>{"use strict";var UG=qx();oM.exports=UG.getPrototypeOf||null});var lM=J((_pt,aM)=>{"use strict";var GG="Function.prototype.bind called on incompatible ",OG=Object.prototype.toString,LG=Math.max,DG="[object Function]",nM=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},NG=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},HG=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};aM.exports=function(t){var e=this;if(typeof e!="function"||OG.apply(e)!==DG)throw new TypeError(GG+e);for(var i=NG(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,nM(i,arguments));return Object(c)===c?c:this}return e.apply(t,nM(i,arguments))},n=LG(0,e.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+HG(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s}});var jl=J((bpt,hM)=>{"use strict";var VG=lM();hM.exports=Function.prototype.bind||VG});var Ld=J((vpt,cM)=>{"use strict";cM.exports=Function.prototype.call});var Jx=J((Tpt,uM)=>{"use strict";uM.exports=Function.prototype.apply});var fM=J((Spt,dM)=>{"use strict";dM.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var mM=J((wpt,pM)=>{"use strict";var WG=jl(),zG=Jx(),$G=Ld(),XG=fM();pM.exports=XG||WG.call($G,zG)});var ty=J((Ept,gM)=>{"use strict";var jG=jl(),YG=ws(),qG=Ld(),KG=mM();gM.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new YG("a function is required");return KG(jG,qG,t)}});var TM=J((Apt,vM)=>{"use strict";var ZG=ty(),xM=Kx(),_M;try{_M=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var ey=!!_M&&xM&&xM(Object.prototype,"__proto__"),bM=Object,yM=bM.getPrototypeOf;vM.exports=ey&&typeof ey.get=="function"?ZG([ey.get]):typeof yM=="function"?function(t){return yM(t==null?t:bM(t))}:!1});var PM=J((Ppt,AM)=>{"use strict";var SM=Zx(),wM=Qx(),EM=TM();AM.exports=SM?function(t){return SM(t)}:wM?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return wM(t)}:EM?function(t){return EM(t)}:null});var RM=J((Cpt,CM)=>{"use strict";var QG=Function.prototype.call,JG=Object.prototype.hasOwnProperty,tO=jl();CM.exports=tO.call(QG,JG)});var Hd=J((Rpt,UM)=>{"use strict";var pt,eO=qx(),rO=vR(),iO=SR(),sO=ER(),oO=PR(),sn=RR(),rn=ws(),nO=IR(),aO=FR(),lO=UR(),hO=OR(),cO=DR(),uO=HR(),dO=WR(),fO=jR(),FM=Function,ry=function(r){try{return FM('"use strict"; return ('+r+").constructor;")()}catch{}},Yl=Kx(),pO=QR(),iy=function(){throw new rn},mO=Yl?function(){try{return arguments.callee,iy}catch{try{return Yl(arguments,"callee").get}catch{return iy}}}():iy,tn=iM()(),be=PM(),gO=Qx(),xO=Zx(),kM=Jx(),ql=Ld(),en={},yO=typeof Uint8Array>"u"||!be?pt:be(Uint8Array),As={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?pt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?pt:ArrayBuffer,"%ArrayIteratorPrototype%":tn&&be?be([][Symbol.iterator]()):pt,"%AsyncFromSyncIteratorPrototype%":pt,"%AsyncFunction%":en,"%AsyncGenerator%":en,"%AsyncGeneratorFunction%":en,"%AsyncIteratorPrototype%":en,"%Atomics%":typeof Atomics>"u"?pt:Atomics,"%BigInt%":typeof BigInt>"u"?pt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?pt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?pt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?pt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":rO,"%eval%":eval,"%EvalError%":iO,"%Float16Array%":typeof Float16Array>"u"?pt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?pt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?pt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?pt:FinalizationRegistry,"%Function%":FM,"%GeneratorFunction%":en,"%Int8Array%":typeof Int8Array>"u"?pt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?pt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?pt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tn&&be?be(be([][Symbol.iterator]())):pt,"%JSON%":typeof JSON=="object"?JSON:pt,"%Map%":typeof Map>"u"?pt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tn||!be?pt:be(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":eO,"%Object.getOwnPropertyDescriptor%":Yl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?pt:Promise,"%Proxy%":typeof Proxy>"u"?pt:Proxy,"%RangeError%":sO,"%ReferenceError%":oO,"%Reflect%":typeof Reflect>"u"?pt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?pt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tn||!be?pt:be(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?pt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tn&&be?be(""[Symbol.iterator]()):pt,"%Symbol%":tn?Symbol:pt,"%SyntaxError%":sn,"%ThrowTypeError%":mO,"%TypedArray%":yO,"%TypeError%":rn,"%Uint8Array%":typeof Uint8Array>"u"?pt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?pt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?pt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?pt:Uint32Array,"%URIError%":nO,"%WeakMap%":typeof WeakMap>"u"?pt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?pt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?pt:WeakSet,"%Function.prototype.call%":ql,"%Function.prototype.apply%":kM,"%Object.defineProperty%":pO,"%Object.getPrototypeOf%":gO,"%Math.abs%":aO,"%Math.floor%":lO,"%Math.max%":hO,"%Math.min%":cO,"%Math.pow%":uO,"%Math.round%":dO,"%Math.sign%":fO,"%Reflect.getPrototypeOf%":xO};if(be)try{null.error}catch(r){MM=be(be(r)),As["%Error.prototype%"]=MM}var MM,_O=function r(t){var e;if(t==="%AsyncFunction%")e=ry("async function () {}");else if(t==="%GeneratorFunction%")e=ry("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ry("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&be&&(e=be(s.prototype))}return As[t]=e,e},IM={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Kl=jl(),Dd=RM(),bO=Kl.call(ql,Array.prototype.concat),vO=Kl.call(kM,Array.prototype.splice),BM=Kl.call(ql,String.prototype.replace),Nd=Kl.call(ql,String.prototype.slice),TO=Kl.call(ql,RegExp.prototype.exec),SO=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,wO=/\\(\\)?/g,EO=function(t){var e=Nd(t,0,1),i=Nd(t,-1);if(e==="%"&&i!=="%")throw new sn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new sn("invalid intrinsic syntax, expected opening `%`");var s=[];return BM(t,SO,function(o,n,a,l){s[s.length]=a?BM(l,wO,"$1"):n||o}),s},AO=function(t,e){var i=t,s;if(Dd(IM,i)&&(s=IM[i],i="%"+s[0]+"%"),Dd(As,i)){var o=As[i];if(o===en&&(o=_O(i)),typeof o>"u"&&!e)throw new rn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new sn("intrinsic "+t+" does not exist!")};UM.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new rn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new rn('"allowMissing" argument must be a boolean');if(TO(/^%?[^%]*%?$/,t)===null)throw new sn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=EO(t),s=i.length>0?i[0]:"",o=AO("%"+s+"%",e),n=o.name,a=o.value,l=!1,h=o.alias;h&&(s=h[0],vO(i,bO([0,1],h)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Nd(d,0,1),p=Nd(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new sn("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,n="%"+s+"%",Dd(As,n))a=As[n];else if(a!=null){if(!(d in a)){if(!e)throw new rn("base intrinsic for "+t+" exists, but the property is not available.");return}if(Yl&&c+1>=i.length){var m=Yl(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=Dd(a,d),a=a[d];u&&!l&&(As[n]=a)}}return a}});var sy=J((Mpt,LM)=>{"use strict";var GM=Hd(),OM=ty(),PO=OM([GM("%String.prototype.indexOf%")]);LM.exports=function(t,e){var i=GM(t,!!e);return typeof i=="function"&&PO(t,".prototype.")>-1?OM([i]):i}});var oy=J((Ipt,NM)=>{"use strict";var CO=Hd(),Zl=sy(),RO=Xl(),MO=ws(),DM=CO("%Map%",!0),IO=Zl("Map.prototype.get",!0),BO=Zl("Map.prototype.set",!0),FO=Zl("Map.prototype.has",!0),kO=Zl("Map.prototype.delete",!0),UO=Zl("Map.prototype.size",!0);NM.exports=!!DM&&function(){var t,e={assert:function(i){if(!e.has(i))throw new MO("Side channel does not contain "+RO(i))},delete:function(i){if(t){var s=kO(t,i);return UO(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return IO(t,i)},has:function(i){return t?FO(t,i):!1},set:function(i,s){t||(t=new DM),BO(t,i,s)}};return e}});var VM=J((Bpt,HM)=>{"use strict";var GO=Hd(),Wd=sy(),OO=Xl(),Vd=oy(),LO=ws(),on=GO("%WeakMap%",!0),DO=Wd("WeakMap.prototype.get",!0),NO=Wd("WeakMap.prototype.set",!0),HO=Wd("WeakMap.prototype.has",!0),VO=Wd("WeakMap.prototype.delete",!0);HM.exports=on?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new LO("Side channel does not contain "+OO(s))},delete:function(s){if(on&&s&&(typeof s=="object"||typeof s=="function")){if(t)return VO(t,s)}else if(Vd&&e)return e.delete(s);return!1},get:function(s){return on&&s&&(typeof s=="object"||typeof s=="function")&&t?DO(t,s):e&&e.get(s)},has:function(s){return on&&s&&(typeof s=="object"||typeof s=="function")&&t?HO(t,s):!!e&&e.has(s)},set:function(s,o){on&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new on),NO(t,s,o)):Vd&&(e||(e=Vd()),e.set(s,o))}};return i}:Vd});var zM=J((Fpt,WM)=>{"use strict";var WO=ws(),zO=Xl(),$O=yR(),XO=oy(),jO=VM(),YO=jO||XO||$O;WM.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new WO("Side channel does not contain "+zO(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=YO()),t.set(i,s)}};return e}});var zd=J((kpt,$M)=>{"use strict";var qO=String.prototype.replace,KO=/%20/g,ny={RFC1738:"RFC1738",RFC3986:"RFC3986"};$M.exports={default:ny.RFC3986,formatters:{RFC1738:function(r){return qO.call(r,KO,"+")},RFC3986:function(r){return String(r)}},RFC1738:ny.RFC1738,RFC3986:ny.RFC3986}});var hy=J((Upt,jM)=>{"use strict";var ZO=zd(),ay=Object.prototype.hasOwnProperty,Ps=Array.isArray,Xr=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),QO=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Ps(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},XM=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},JO=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(Ps(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!ay.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Ps(t)&&!Ps(e)&&(s=XM(t,i)),Ps(t)&&Ps(e)?(e.forEach(function(o,n){if(ay.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return ay.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},tL=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},eL=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},ly=1024,rL=function(t,e,i,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=ly){for(var h=n.length>=ly?n.slice(l,l+ly):n,c=[],u=0;u<h.length;++u){var d=h.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===ZO.RFC1738&&(d===40||d===41)){c[c.length]=h.charAt(u);continue}if(d<128){c[c.length]=Xr[d];continue}if(d<2048){c[c.length]=Xr[192|d>>6]+Xr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Xr[224|d>>12]+Xr[128|d>>6&63]+Xr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|h.charCodeAt(u)&1023),c[c.length]=Xr[240|d>>18]+Xr[128|d>>12&63]+Xr[128|d>>6&63]+Xr[128|d&63]}a+=c.join("")}return a},iL=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var h=a[l],c=n[h];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:n,prop:h}),i.push(c))}return QO(e),t},sL=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},oL=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},nL=function(t,e){return[].concat(t,e)},aL=function(t,e){if(Ps(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};jM.exports={arrayToObject:XM,assign:tL,combine:nL,compact:iL,decode:eL,encode:rL,isBuffer:oL,isRegExp:sL,maybeMap:aL,merge:JO}});var JM=J((Gpt,QM)=>{"use strict";var qM=zM(),$d=hy(),Ql=zd(),lL=Object.prototype.hasOwnProperty,KM={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},jr=Array.isArray,hL=Array.prototype.push,ZM=function(r,t){hL.apply(r,jr(t)?t:[t])},cL=Date.prototype.toISOString,YM=Ql.default,pe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:$d.encode,encodeValuesOnly:!1,filter:void 0,format:YM,formatter:Ql.formatters[YM],indices:!1,serializeDate:function(t){return cL.call(t)},skipNulls:!1,strictNullHandling:!1},uL=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},cy={},dL=function r(t,e,i,s,o,n,a,l,h,c,u,d,f,p,m,g,_,b){for(var y=t,w=b,E=0,v=!1;(w=w.get(cy))!==void 0&&!v;){var S=w.get(t);if(E+=1,typeof S<"u"){if(S===E)throw new RangeError("Cyclic object value");v=!0}typeof w.get(cy)>"u"&&(E=0)}if(typeof c=="function"?y=c(e,y):y instanceof Date?y=f(y):i==="comma"&&jr(y)&&(y=$d.maybeMap(y,function(z){return z instanceof Date?f(z):z})),y===null){if(n)return h&&!g?h(e,pe.encoder,_,"key",p):e;y=""}if(uL(y)||$d.isBuffer(y)){if(h){var P=g?e:h(e,pe.encoder,_,"key",p);return[m(P)+"="+m(h(y,pe.encoder,_,"value",p))]}return[m(e)+"="+m(String(y))]}var R=[];if(typeof y>"u")return R;var A;if(i==="comma"&&jr(y))g&&h&&(y=$d.maybeMap(y,h)),A=[{value:y.length>0?y.join(",")||null:void 0}];else if(jr(c))A=c;else{var C=Object.keys(y);A=u?C.sort(u):C}var M=l?String(e).replace(/\./g,"%2E"):String(e),B=s&&jr(y)&&y.length===1?M+"[]":M;if(o&&jr(y)&&y.length===0)return B+"[]";for(var k=0;k<A.length;++k){var U=A[k],O=typeof U=="object"&&U&&typeof U.value<"u"?U.value:y[U];if(!(a&&O===null)){var $=d&&l?String(U).replace(/\./g,"%2E"):String(U),N=jr(y)?typeof i=="function"?i(B,$):B:B+(d?"."+$:"["+$+"]");b.set(t,E);var L=qM();L.set(cy,b),ZM(R,r(O,N,i,s,o,n,a,l,i==="comma"&&g&&jr(y)?null:h,c,u,d,f,p,m,g,_,L))}}return R},fL=function(t){if(!t)return pe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||pe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Ql.default;if(typeof t.format<"u"){if(!lL.call(Ql.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Ql.formatters[i],o=pe.filter;(typeof t.filter=="function"||jr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in KM?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=pe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:pe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:pe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:pe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:pe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?pe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:pe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:pe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:pe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:pe.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:pe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:pe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:pe.strictNullHandling}};QM.exports=function(r,t){var e=r,i=fL(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):jr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=KM[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=qM(),c=0;c<s.length;++c){var u=s[c],d=e[u];i.skipNulls&&d===null||ZM(n,dL(d,u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var f=n.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var iI=J((Opt,rI)=>{"use strict";var Cs=hy(),uy=Object.prototype.hasOwnProperty,tI=Array.isArray,Kt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Cs.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},pL=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},eI=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},mL="utf8=%26%2310003%3B",gL="utf8=%E2%9C%93",xL=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===gL?h="utf-8":n[l]===mL&&(h="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var c=n[l],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,Kt.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Kt.decoder,h,"key"),p=Cs.maybeMap(eI(c.slice(d+1),e,tI(i[f])?i[f].length:0),function(g){return e.decoder(g,Kt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=pL(String(p))),c.indexOf("[]=")>-1&&(p=tI(p)?[p]:p);var m=uy.call(i,f);m&&e.duplicates==="combine"?i[f]=Cs.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},yL=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:eI(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:Cs.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var c=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&h!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},_L=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),h=l?o.slice(0,l.index):o,c=[];if(h){if(!i.plainObjects&&uy.call(Object.prototype,h)&&!i.allowPrototypes)return;c.push(h)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&uy.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+o.slice(l.index)+"]")}return yL(c,e,i,s)}},bL=function(t){if(!t)return Kt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?Kt.charset:t.charset,i=typeof t.duplicates>"u"?Kt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Kt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Kt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Kt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Kt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Kt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Kt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Kt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Kt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Kt.decoder,delimiter:typeof t.delimiter=="string"||Cs.isRegExp(t.delimiter)?t.delimiter:Kt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Kt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Kt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Kt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Kt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Kt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Kt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};rI.exports=function(r,t){var e=bL(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?xL(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=_L(a,i[a],e,typeof r=="string");s=Cs.merge(s,l,e)}return e.allowSparse===!0?s:Cs.compact(s)}});var oI=J((Lpt,sI)=>{"use strict";var vL=JM(),TL=iI(),SL=zd();sI.exports={formats:SL,parse:TL,stringify:vL}});var hI=J(an=>{"use strict";var wL=YC();function gr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var EL=/^([a-z0-9.+-]+:)/i,AL=/:[0-9]*$/,PL=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,CL=["<",">",'"',"`"," ","\r",`
1093
+ `," "],RL=["{","}","|","\\","^","`"].concat(CL),dy=["'"].concat(RL),nI=["%","/","?",";","#"].concat(dy),aI=["/","?","#"],ML=255,lI=/^[+a-z0-9A-Z_-]{0,63}$/,IL=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,BL={javascript:!0,"javascript:":!0},fy={javascript:!0,"javascript:":!0},nn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},py=oI();function Jl(r,t,e){if(r&&typeof r=="object"&&r instanceof gr)return r;var i=new gr;return i.parse(r,t,e),i}gr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=PL.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=py.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=EL.exec(a);if(h){h=h[0];var c=h.toLowerCase();this.protocol=c,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(h&&fy[h])&&(a=a.substr(2),this.slashes=!0)}if(!fy[h]&&(u||h&&!nn[h])){for(var d=-1,f=0;f<aI.length;f++){var p=a.indexOf(aI[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<nI.length;f++){var p=a.indexOf(nI[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var b=this.hostname.split(/\./),f=0,y=b.length;f<y;f++){var w=b[f];if(w&&!w.match(lI)){for(var E="",v=0,S=w.length;v<S;v++)w.charCodeAt(v)>127?E+="x":E+=w[v];if(!E.match(lI)){var P=b.slice(0,f),R=b.slice(f+1),A=w.match(IL);A&&(P.push(A[1]),R.unshift(A[2])),R.length&&(a="/"+R.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>ML?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=wL.toASCII(this.hostname));var C=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+C,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!BL[c])for(var f=0,y=dy.length;f<y;f++){var B=dy[f];if(a.indexOf(B)!==-1){var k=encodeURIComponent(B);k===B&&(k=escape(B)),a=a.split(B).join(k)}}var U=a.indexOf("#");U!==-1&&(this.hash=a.substr(U),a=a.slice(0,U));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=py.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),nn[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var C=this.pathname||"",$=this.search||"";this.path=C+$}return this.href=this.format(),this};function FL(r){return typeof r=="string"&&(r=Jl(r)),r instanceof gr?r.format():gr.prototype.format.call(r)}gr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=py.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||nn[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function kL(r,t){return Jl(r,!1,!0).resolve(t)}gr.prototype.resolve=function(r){return this.resolveObject(Jl(r,!1,!0)).format()};function UL(r,t){return r?Jl(r,!1,!0).resolveObject(t):t}gr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new gr;t.parse(r,!1,!0),r=t}for(var e=new gr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(e[l]=r[l])}return nn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!nn[r.protocol]){for(var h=Object.keys(r),c=0;c<h.length;c++){var u=h[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!fy[r.protocol]){for(var y=(r.pathname||"").split("/");y.length&&!(r.host=y.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,_=g,b=e.pathname&&e.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],w=e.protocol&&!nn[e.protocol];if(w&&(e.hostname="",e.port=null,e.host&&(b[0]===""?b[0]=e.host:b.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host=null),g=g&&(y[0]===""||b[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,b=y;else if(y.length)b||(b=[]),b.pop(),b=b.concat(y),e.search=r.search,e.query=r.query;else if(r.search!=null){if(w){e.host=b.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!b.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var v=b.slice(-1)[0],S=(e.host||r.host||b.length>1)&&(v==="."||v==="..")||v==="",P=0,R=b.length;R>=0;R--)v=b[R],v==="."?b.splice(R,1):v===".."?(b.splice(R,1),P++):P&&(b.splice(R,1),P--);if(!g&&!_)for(;P--;P)b.unshift("..");g&&b[0]!==""&&(!b[0]||b[0].charAt(0)!=="/")&&b.unshift(""),S&&b.join("/").substr(-1)!=="/"&&b.push("");var A=b[0]===""||b[0]&&b[0].charAt(0)==="/";if(w){e.hostname=A?"":b.length?b.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return g=g||e.host&&b.length,g&&!A&&b.unshift(""),b.length>0?e.pathname=b.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};gr.prototype.parseHost=function(){var r=this.host,t=AL.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};an.parse=Jl;an.resolve=kL;an.resolveObject=UL;an.format=FL;an.Url=gr});var PB=()=>{let r=new Map,t=l=>typeof l=="string"&&l.startsWith("blob:"),e=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!t(l.url);return{load:async l=>{let h=[];for(let[c,u]of Object.entries(l))r.has(c)||h.push([c,u]);h.length>0&&await Promise.all(h.map(async([c,u])=>{if(e(u)){r.set(c,{url:u.url,type:u.type,source:"url"});return}let p={buffer:await(await fetch(u.url)).arrayBuffer(),type:u.type,source:"buffer"};r.set(c,p)}))},getBufferMap:()=>{let l={};for(let[h,c]of r.entries())l[h]=c;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};F();var Fw={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(Bw(),U2))}};F();var Uw={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(kw(),G2))}};F();pc();lc();F();Ft();Aa();var lu;function Ww(r){return lu!==void 0||(lu=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??Oi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Y.get().getWebGLRenderingContext())return!1;let i=Y.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),lu}Ft();var hu;async function zw(r={}){return hu!==void 0||(hu=await(async()=>{let t=Y.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),hu}Aa();var rP=["webgl","webgpu","canvas"];async function iP(r){let t=[];r.preference?(t.push(r.preference),rP.forEach(o=>{o!==r.preference&&t.push(o)})):t=rP.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await zw()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(RA(),CA));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&Ww(r.failIfMajorPerformanceCaveat??Oi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(eP(),tP));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}br();yg();Wt();var sP=class nx{constructor(...t){this.stage=new nt,t[0]!==void 0&&j(rt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await iP(t),nx._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return j(rt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=nx._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};sP._plugins=[];var vl=sP;H.handleByList(T.Application,vl._plugins);H.add(Ga);F();Pi();_p();Ft();F();ns();he();Tt();Ym();Jm();var Tl=class extends Ro{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],h=new tt(n.x+a.x,n.y+a.y,n.width,n.height),c=new I({source:l,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){ya.install(t)}static uninstall(t){ya.uninstall(t)}};var ku={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),_=g[0],b=g[1].replace(/"/gm,""),y=parseFloat(b),w=isNaN(y)?b:y;p[_]=w}e[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let h=e.char;for(let u=0;u<h.length;u++){let d=h[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),l[f]=p,i.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);i.chars[l[f]].kerning[l[d]]=p}return i}};Ft();var ax={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let h=0;h<o.length;h++)t.pages.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let h=0;h<n.length;h++){let c=n[h],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),l[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<a.length;h++){let c=parseInt(a[h].getAttribute("first"),10),u=parseInt(a[h].getAttribute("second"),10),d=parseInt(a[h].getAttribute("amount"),10);t.chars[l[u]].kerning[l[c]]=d}return t}};var lx={test(r){return typeof r=="string"&&r.includes("<font>")?ax.test(Y.get().parseXML(r)):!1},parse(r){return ax.parse(Y.get().parseXML(r))}};var gk=[".xml",".fnt"],oP={extension:{type:T.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof Tl,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},nP={extension:{type:T.LoadParser,priority:ke.Normal},name:"loadBitmapFont",test(r){return gk.includes(ue.extname(r).toLowerCase())},async testParse(r){return ku.test(r)||lx.test(r)},async parse(r,t,e){let i=ku.test(r)?ku.parse(r):lx.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ue.join(ue.dirname(s),d);f=$n(f,s),n.push({src:f,data:a})}let l=await e.load(n),h=n.map(u=>l[u.src]);return new Tl({data:i,textures:h},s)},async load(r,t){return await(await Y.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};Pt();var Uu=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};Ri();F();Tt();var aP={extension:{type:T.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof I),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};F();async function Gu(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var lP={extension:{type:T.DetectionParser,priority:1},test:async()=>Gu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};F();var hP=["png","jpg","jpeg"],cP={extension:{type:T.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...hP],remove:async r=>r.filter(t=>!hP.includes(t))};F();var xk="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Wo(r){return xk?!1:document.createElement("video").canPlayType(r)!==""}var uP={extension:{type:T.DetectionParser,priority:0},test:async()=>Wo("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};F();var dP={extension:{type:T.DetectionParser,priority:0},test:async()=>Wo("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};F();var fP={extension:{type:T.DetectionParser,priority:0},test:async()=>Wo("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};F();var pP={extension:{type:T.DetectionParser,priority:0},test:async()=>Gu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};Pt();ns();zn();ac();var Ou=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||V(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return V(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),i.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=as(t),n=Ue(t,h=>({alias:[h],src:h,data:{}})),a=n.length,l=n.map(async h=>{let c=ue.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),s[h.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[h.src],new Error(`[Loader.load] Failed to load ${c}.
1094
+ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t,s=>({alias:[s],src:s})).map(async s=>{let o=ue.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&V(`[Assets] loadParser name conflict "${e.name}"`):V("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Ft();F();function dr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}ns();function fr(r,t){let e=r.split("?")[0],i=ue.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}Pi();var yk=".json",_k="application/json",mP={extension:{type:T.LoadParser,priority:ke.Low},name:"loadJson",test(r){return dr(r,_k)||fr(r,yk)},async load(r){return await(await Y.get().fetch(r)).json()}};Ft();F();Pi();var bk=".txt",vk="text/plain",gP={name:"loadTxt",extension:{type:T.LoadParser,priority:ke.Low,name:"loadTxt"},test(r){return dr(r,vk)||fr(r,bk)},async load(r){return await(await Y.get().fetch(r)).text()}};Ft();F();Pt();ns();Ri();Pi();var Tk=["normal","bold","100","200","300","400","500","600","700","800","900"],Sk=[".ttf",".otf",".woff",".woff2"],wk=["font/ttf","font/otf","font/woff","font/woff2"],Ek=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Ak(r){let t=ue.extname(r),s=ue.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(Ek)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var Pk=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Ck(r){return Pk.test(r)?r:encodeURI(r)}var xP={extension:{type:T.LoadParser,priority:ke.Low},name:"loadWebFont",test(r){return dr(r,wk)||fr(r,Sk)},async load(r,t){let e=Y.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??Ak(r),o=t.data?.weights?.filter(a=>Tk.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let l=o[a],h=new FontFace(s,`url(${Ck(r)})`,{...n,weight:l});await h.load(),e.add(h),i.push(h)}return St.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return V("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{St.remove(`${t.family}-and-url`),Y.get().getFontFaceSet().delete(t)})}};Ft();F();so();jc();ro();function zo(r,t=1){let e=Qe.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}Pi();Tt();Pt();Ri();function $o(r,t,e){r.label=e,r._sourceOrigin=e;let i=new I({source:r,label:e}),s=()=>{delete t.promiseCache[e],St.has(e)&&St.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(V("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(V("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var Rk=".svg",Mk="image/svg+xml",yP={extension:{type:T.LoadParser,priority:ke.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return dr(r,Mk)||fr(r,Rk)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Bk(r):Ik(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function Ik(r,t,e,i){let o=await(await Y.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),h=l.getContext("2d"),c=t.data?.resolution||zo(r),u=t.data?.width??a.width,d=t.data?.height??a.height;l.width=u*c,l.height=d*c,h.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new ze({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return $o(m,e,r)}async function Bk(r){let e=await(await Y.get().fetch(r)).text(),i=new Oe;return i.svg(e),i}Ft();F();so();var Fk=`(function () {
1095
1095
  'use strict';
1096
1096
 
1097
1097
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
@@ -1112,7 +1112,7 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t
1112
1112
  });
1113
1113
 
1114
1114
  })();
1115
- `,Xo=null,jo=class{constructor(){Xo||(Xo=URL.createObjectURL(new Blob([Bk],{type:"application/javascript"}))),this.worker=new Worker(Xo)}};jo.revokeObjectURL=function(){Xo&&(URL.revokeObjectURL(Xo),Xo=null)};var Fk=`(function () {
1115
+ `,Xo=null,jo=class{constructor(){Xo||(Xo=URL.createObjectURL(new Blob([Fk],{type:"application/javascript"}))),this.worker=new Worker(Xo)}};jo.revokeObjectURL=function(){Xo&&(URL.revokeObjectURL(Xo),Xo=null)};var kk=`(function () {
1116
1116
  'use strict';
1117
1117
 
1118
1118
  async function loadImageBitmap(url, alphaMode) {
@@ -1141,20 +1141,20 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t
1141
1141
  };
1142
1142
 
1143
1143
  })();
1144
- `,Yo=null,Sl=class{constructor(){Yo||(Yo=URL.createObjectURL(new Blob([Fk],{type:"application/javascript"}))),this.worker=new Worker(Yo)}};Sl.revokeObjectURL=function(){Yo&&(URL.revokeObjectURL(Yo),Yo=null)};var yP=0,lx,hx=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new jo;e.addEventListener("message",i=>{e.terminate(),jo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){lx===void 0&&(lx=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<lx&&(this._createdWorkers++,t=new Sl().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[yP]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:yP++,id:i})}},cx=new hx;Pi();var kk=[".jpeg",".jpg",".png",".webp",".avif"],Uk=["image/jpeg","image/png","image/webp","image/avif"];async function Gk(r,t){let e=await Y.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Lu={name:"loadTextures",extension:{type:T.LoadParser,priority:ke.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return dr(r,Uk)||fr(r,kk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await cx.isImageBitmapSupported()?i=await cx.loadImageBitmap(r,t):i=await Gk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new ze({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||zo(r),...t.data});return $o(s,e,r)},unload(r){r.destroy(!0)}};F();Ep();wp();var _P=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Ok=_P.map(r=>`video/${r.substring(1)}`);function Lk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Nk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Dk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function Nk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var bP={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=dr(r,Ok),e=fr(r,_P);return t||e},async load(r,t,e){let i={...oo.defaultOptions,resolution:t.data?.resolution||zo(r),alphaMode:t.data?.alphaMode||await dc(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),Lk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=oo.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new oo({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await Dk(s),l($o(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};F();ro();F();ro();var Du={extension:{type:T.ResolveParser,name:"resolveTexture"},test:Lu.test,parse:r=>({resolution:parseFloat(Qe.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var vP={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Qe.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Du.parse};ro();zn();ac();var Nu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Qe,this.loader=new Ou,this.cache=St,this._backgroundLoader=new Uu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){V("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=ns(t),s=Ue(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return St.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=St.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),St.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Ue(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ue(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{St.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},pr=new Nu;H.handleByList(T.LoadParser,pr.loader.parsers).handleByList(T.ResolveParser,pr.resolver.parsers).handleByList(T.CacheParser,pr.cache.parsers).handleByList(T.DetectionParser,pr.detections);H.add(nP,hP,aP,fP,cP,uP,dP,pP,mP,gP,xP,Lu,bP,oP,sP,Du,vP);var TP={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};H.handle(T.Asset,r=>{let t=r.ref;Object.entries(TP).filter(([e])=>!!t[e]).forEach(([e,i])=>H.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(TP).filter(e=>!!t[e]).forEach(e=>H.remove(t[e]))});Tt();Dn();eo();jn();var wl=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof I?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ce.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ce.shared.add(this.update,this,Ir.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(I.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(I.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof I)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ce.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ce.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Vh();Wt();nc();var Hu=class extends Ai{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Te({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function SP(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(j(rt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ga();ms();var Ni=class extends Hu{constructor(...t){let e=SP(t,"Text");super(e,Ht),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=Jt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};mt();he();Eg();Tt();du();Cp();br();zm();jn();ga();ms();_p();Ae();var Hk=Ki(Rc(),1);H.add(Bw,kw);var Vk=new(window.AudioContext||window.webkitAudioContext),ux={},Wk=async(r,t)=>{if(!ux[r]&&t.byteLength!==0)try{let e=await Vk.decodeAudioData(t);ux[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},zk=r=>ux[r],qo={load:Wk,getAsset:zk};var fe=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var dx=({type:r})=>({type:r});var fx=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var Vu={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Wu={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var _s={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var _e={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var bs=(r,t)=>{let e={fill:t?.fill??_e.fill,fontFamily:t?.fontFamily??_e.fontFamily,fontSize:t?.fontSize??_e.fontSize,align:t?.align??_e.align,lineHeight:t?.lineHeight??_e.lineHeight,wordWrap:t?.wordWrap??_e.wordWrap,breakWords:t?.breakWords??_e.breakWords,strokeColor:t?.strokeColor??_e.strokeColor,strokeWidth:t?.strokeWidth??_e.strokeWidth,wordWrapWidth:t?.wordWrapWidth??_e.wordWrapWidth};r.style=e};var $k=(r,t)=>typeof t!="string"?t:r[t]??t,Xk=(r,t,e,i)=>{let s=$k(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},wP=(r,t,e=Wu)=>{for(let i of t)for(let[s,o]of Object.entries(i.tween)){if(!Vu[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&Xk(r,s,e,o.initialValue)}},zu=({animations:r,animationBus:t,completionTracker:e,element:i,targetState:s,onComplete:o})=>{for(let n of r){let a=e.getVersion();e.track(a),t.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{e.complete(a),o?.(n)}}})}};function px(r,t){let e=r.text.substring(0,t),s=Jt.measureText(e,r.style).width;return r.x+s}var jk=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),mx=jk;var ui=Symbol("textRevealRuntime"),Yk=18,qk=64,Kk=1.25,AP=r=>typeof r=="number"&&r>0?r:1,Zk=r=>{let t=new kt(I.EMPTY);if(r?.indicator?.revealing?.src){let e=I.from(r.indicator.revealing.src);t=new kt(e),t.width=r.indicator.revealing.width??e.width,t.height=r.indicator.revealing.height??e.height}return t},El=(r,t)=>{if(!t?.indicator?.complete?.src)return;let e=I.from(t.indicator.complete.src);r.texture=e,r.width=t.indicator.complete.width??e.width,r.height=t.indicator.complete.height??e.height},Al=(r,t,e)=>{r.x=e,r.y=t?t.y+(t.lineMaxHeight-r.height):0},$u=(r,t,e)=>{if(!t||t.text.length===0){r.x=e;return}r.x=px(t,t.text.length-1)+e},Qk=(r,t)=>{if(r[ui]){let e=r[ui];delete r[ui],e()}r[ui]=t},gx=r=>{if(r[ui]){let e=r[ui];delete r[ui],e()}r.onRender=void 0,r.removeChildren().forEach(e=>{e.destroy({children:!0})})},PP=(r,t="",e="")=>{let i=new Ht(r.textStyle),s=new Ni({text:t,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Ht(r.furigana.textStyle);o=new Ni({text:e,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},CP=(r,t)=>{let e=null,i=null,s=0,o=0,n=[];for(let a=0;a<t.content.length;a++){let l=t.content[a],h=new nt({label:`${t.id}-line-${a}`}),c=[],u=null,d=0;r.addChild(h),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let p=l.lineParts[f],{text:g,furiganaText:m}=PP(p,p.text,p.furigana?.text||"");m&&(h.addChild(m),c.push(m)),h.addChild(g),c.push(g),e=g,u=g,s+=p.text.length,d+=p.text.length}if(c.length>0){let f=h.getLocalBounds();n.push({chunk:l,container:h,lastTextObject:u,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else h.destroy()}return{lines:n,lastTextObject:e,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},EP=({contentContainer:r,indicatorSprite:t,element:e})=>{let i=e?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=CP(r,e);Al(t,o,i),$u(t,s,i),El(t,e)},Jk=({indicatorSprite:r,element:t})=>{let e=t?.indicator?.offset??12,i=t.content[0]??null;Al(r,i,e)},tU=async({contentContainer:r,indicatorSprite:t,element:e,signal:i})=>{let s=AP(e.speed??50),o=e?.indicator?.offset??12,n=Math.max(1,Math.floor(1e3/s)),a=Math.max(1,Math.floor(4e3/s));for(let l=0;l<e.content.length;l++){if(i?.aborted||r.destroyed)return!1;let h=e.content[l];Al(t,h,o);for(let c=0;c<h.lineParts.length;c++){if(i?.aborted||r.destroyed)return!1;let u=h.lineParts[c],{text:d,furiganaText:f}=PP(u);f&&r.addChild(f),r.addChild(d);let p=u.text,g=u.furigana?.text||"",m=g.length;for(let _=0;_<p.length;_++){if(i?.aborted||r.destroyed)return!1;if(d.text=p.substring(0,_+1),t.x=px(d,_)+o,f){let b=Math.round((_+1)/p.length*m);f.text=g.substring(0,b)}_<p.length-1&&await mx(n,i)}}l<e.content.length-1&&await mx(a,i)}return El(t,e),!0},eU=({container:r,contentContainer:t,indicatorSprite:e,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=AP(i.speed??50),{lines:l,lastTextObject:h,lastChunk:c,totalCharacters:u,maxLineHeight:d,bounds:f}=CP(t,i);if(Al(e,c,n),l.length===0||u===0||!l.some(A=>A.bounds.width>0&&A.bounds.height>0)||!globalThis.document||!s)return $u(e,h,n),El(e,i),!1;let p=Math.max(Yk,Math.min(qk,Math.round(d*Kk))),g=Math.max(1,Math.round(u/a*1e3)),m=l.map(A=>{let C=Math.max(1,A.totalCharacters),M=1+p/Math.max(1,A.bounds.width);return C*M}),_=m.reduce((A,C)=>A+C,0),b=[],y=0;for(let A=0;A<l.length;A++){let C=m[A],M=_>0?y/_:0;y+=C,b.push({...l[A],startProgress:M,endProgress:_>0?y/_:1})}let w=o.getVersion(),E=`${i.id}-soft-wipe`,v=b.map(A=>{let C=document.createElement("canvas");C.width=Math.max(1,Math.ceil(A.bounds.width+p)),C.height=Math.max(1,Math.ceil(A.bounds.height));let M=C.getContext("2d");if(!M)return null;let B=ys(C),k=new kt(B);return k.x=Math.floor(A.bounds.x-p),k.y=Math.floor(A.bounds.y),A.container.mask=k,t.addChild(k),{canvas:C,context:M,texture:B,sprite:k,line:A}});if(v.some(A=>A===null))return v.forEach(A=>{A&&(A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0))}),$u(e,h,n),El(e,i),!1;let S=!1,P=A=>{S||(S=!0,r[ui]===R&&delete r[ui],v.forEach(C=>{C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0)}),A&&($u(e,h,n),El(e,i)))},R=()=>{s.dispatch({type:"CANCEL",id:E}),P(!1)};return Qk(r,R),o.track(w),s.dispatch({type:"START",payload:{id:E,driver:"custom",duration:g,applyFrame:A=>{let C=g>0?Math.min(A/g,1):1,M=b[0],B=0;for(let k=0;k<b.length;k++){let U=b[k],O=v[k],$=Math.max(1e-6,U.endProgress-U.startProgress),N=Math.max(0,Math.min((C-U.startProgress)/$,1)),{context:L,canvas:z,texture:st}=O;if(L.clearRect(0,0,z.width,z.height),N<=0){st.source.update();continue}let Q=p,bt=0,Bt=U.bounds.width+p,Mt=Q+N*Bt,jt=Math.max(Q,Mt-p);jt>Q&&(L.fillStyle="#ffffff",L.fillRect(Q,bt,Math.min(jt-Q,U.bounds.width),U.bounds.height));let Zt=Math.max(Q,Mt-p),xt=Math.min(Q+U.bounds.width,Mt);if(xt>Zt){let ct=L.createLinearGradient(Zt,0,xt,0);ct.addColorStop(0,"rgba(255, 255, 255, 1)"),ct.addColorStop(1,"rgba(255, 255, 255, 0)"),L.fillStyle=ct,L.fillRect(Zt,bt,xt-Zt,U.bounds.height)}st.source.update(),(N<1||k===b.length-1)&&(M=U,B=Math.min(1,(Mt-Q)/Math.max(1,U.bounds.width)))}Al(e,M.chunk,n),e.x=M.bounds.x+Math.min(M.bounds.width,M.bounds.width*B)+n},applyTargetState:()=>{P(!1)},onComplete:()=>{o.complete(w),P(!0)},onCancel:()=>{o.complete(w),P(!1)},isValid:()=>!!r&&!r.destroyed&&!t.destroyed&&!e.destroyed}}),!0},vs=async({container:r,element:t,completionTracker:e,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;gx(r),r.zIndex=s;let a=new nt({label:`${t.id}-content`}),l=Zk(t);r.addChild(a),r.addChild(l);try{if(n==="paused-initial"){t.revealEffect==="none"?EP({contentContainer:a,indicatorSprite:l,element:t}):Jk({indicatorSprite:l,element:t});return}if(t.revealEffect==="softWipe"){if(!eU({container:r,contentContainer:a,indicatorSprite:l,element:t,animationBus:i,completionTracker:e})&&!o?.aborted&&!r.destroyed){let d=e.getVersion();e.track(d),e.complete(d)}return}let h=e.getVersion(),c=!1;e.track(h),t.revealEffect==="none"?(EP({contentContainer:a,indicatorSprite:l,element:t}),c=!0):c=await tU({contentContainer:a,indicatorSprite:l,element:t,signal:o}),c&&!o?.aborted&&!r.destroyed&&e.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var Xu=({suppressAnimations:r=!1,deferredMountOperations:t=[]}={})=>({suppressAnimations:r,deferredMountOperations:t}),RP=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let t=e=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",t);return}e?.detail?.deltaMS&&r.emitter.update(Number(e.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",t),r.container.customTickerHandler=t;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":vs({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;zu({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},Pl=(r,t)=>{if(t?.type){if(!r?.suppressAnimations){RP(t);return}r.deferredMountOperations.push(t)}},ju=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},MP=(r,t)=>Pl(r,{type:"play-animated-sprite",animatedSprite:t}),IP=(r,t)=>Pl(r,{type:"play-video",video:t}),BP=(r,{app:t,emitter:e,container:i,tickerCallback:s})=>Pl(r,{type:"start-particles",app:t,emitter:e,container:i,tickerCallback:s}),FP=(r,{container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>Pl(r,{type:"autoplay-text-reveal",container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n}),kP=(r,{animations:t,animationBus:e,completionTracker:i,element:s,targetState:o})=>Pl(r,{type:"start-update-animations",animations:t,animationBus:e,completionTracker:i,element:s,targetState:o}),UP=r=>{if(!r?.deferredMountOperations?.length)return;let t=r.deferredMountOperations.splice(0);for(let e of t)RP(e)};var GP=(r=[])=>{if(r instanceof Map)return r;let t=new Map;for(let e of r)t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e);return t},Yu=(r,t)=>r instanceof Map?r.get(t)??[]:r.filter(e=>e.targetId===t),rU=(r,t)=>Yu(r,t).filter(e=>e.type==="update"),qu=(r,t)=>Yu(r,t).find(e=>e.type==="transition")??null,iU=({animations:r,targetId:t,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=rU(r,t);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return wP(s,l),kP(a,{animations:l,animationBus:e,completionTracker:i,element:s,targetState:o}),!0}return zu({animations:l,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var at=iU;var DP=Symbol("routeGraphicsTextAnchorRatios"),NP=Symbol("routeGraphicsTextLayoutState"),OP=(r,t)=>typeof r!="number"||r===0?0:t/r,xx=r=>r?.align??_e.align,LP=r=>{let t=r[NP];return t?.fixedWidth&&typeof t.layoutWidth=="number"?t.layoutWidth:r.width},yx=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},Cl=r=>{let t=r.measuredWidth??r.width,e=yx(r.width,t,xx(r.textStyle));return{x:r.x+e,y:r.y}},Ku=(r,t)=>{let e=t.__fixedWidth&&typeof t.width=="number"?t.width:r.width||t.width,i=r.height||t.height,s=typeof t.__anchorXRatio=="number"?t.__anchorXRatio:OP(e,t.originX),o=typeof t.__anchorYRatio=="number"?t.__anchorYRatio:OP(i,t.originY);r[DP]={x:s,y:o},r[NP]={fixedWidth:!!t.__fixedWidth,layoutWidth:t.width}},sU=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?_e.lineHeight:r.lineHeight/r.fontSize,oU=(r,t)=>{if(!t)return r;let e={...r,...t};if(t.fontSize!==void 0||t.lineHeight!==void 0){let i=t.lineHeight??sU(r);e.lineHeight=Math.round(e.fontSize*i)}return e},zr=(r,t,e)=>{let i=r[DP],s=LP(r),o=oU(t,e);if(!i){bs(r,o);return}let n=yx(s,r.width,xx(r.style)),l=r.x-n+s*i.x,h=r.y+r.height*i.y;bs(r,o);let c=LP(r),u=yx(c,r.width,xx(r.style));r.x=l-c*i.x+u,r.y=h-r.height*i.y},Zu=(r,t)=>{let e=Cl({...t,measuredWidth:r.width,width:t.__fixedWidth&&typeof t.width=="number"?t.width:r.width});r.x=e.x,r.y=e.y};var nU=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},oe=r=>{let t=nU(r);return t===void 0||t===0};var HP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let h=new Ni({label:e.id});h.zIndex=l,h.text=e.content,bs(h,e.textStyle),Ku(h,e),h.alpha=e.alpha,Zu(h,e);let c=e?.hover,u=e?.click,d=e?.rightClick,f={isHovering:!1,isPressed:!1,isRightPressed:!1},p=({isHovering:g,isPressed:m,isRightPressed:_})=>{_&&d?.textStyle?zr(h,e.textStyle,d.textStyle):m&&u?.textStyle?zr(h,e.textStyle,u.textStyle):g&&c?.textStyle?zr(h,e.textStyle,c.textStyle):zr(h,e.textStyle)};if(c){let{cursor:g,soundSrc:m,payload:_}=c;h.eventMode="static";let b=()=>{f.isHovering=!0,_&&s&&s("hover",{_event:{id:h.label},..._}),g&&(h.cursor=g),m&&r.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),p(f)},y=()=>{f.isHovering=!1,h.cursor="auto",p(f)};h.on("pointerover",b),h.on("pointerout",y)}if(u){let{soundSrc:g,soundVolume:m,payload:_}=u;h.eventMode="static";let b=E=>{oe(E)&&(f.isPressed=!0,p(f))},y=E=>{oe(E)&&(f.isPressed=!1,p(f),_&&s&&s("click",{_event:{id:h.label},..._}),g&&r.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1,volume:(m??1e3)/1e3}))},w=()=>{f.isPressed=!1,p(f)};h.on("pointerdown",b),h.on("pointerup",y),h.on("pointerupoutside",w)}if(d){let{soundSrc:g,payload:m}=d;h.eventMode="static";let _=()=>{f.isRightPressed=!0,p(f)},b=()=>{f.isRightPressed=!1,p(f)},y=()=>{f.isRightPressed=!1,p(f),m&&s&&s("rightClick",{_event:{id:h.label},...m}),g&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:g,loop:!1})},w=()=>{f.isRightPressed=!1,p(f)};h.on("rightdown",_),h.on("rightup",b),h.on("rightclick",y),h.on("rightupoutside",w)}t.addChild(h),at({animations:i,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{...Cl(e),alpha:e.alpha},renderContext:a})};var aU=Object.prototype.hasOwnProperty,Et=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!Et(r[n],t[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(t);if(s.length!==o.length)return!1;for(let n of s)if(!aU.call(t,n)||!Et(r[n],t[n]))return!1;return!0};var VP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(f=>f.label===e.id);if(!h)return;h.zIndex=l;let{alpha:c}=i,u=()=>{if(!Et(e,i)){h.text=i.content,bs(h,i.textStyle),Ku(h,i),Zu(h,i),h.alpha=c,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightclick"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let f=i?.hover,p=i?.click,g=i?.rightClick,m={isHovering:!1,isPressed:!1,isRightPressed:!1},_=({isHovering:b,isPressed:y,isRightPressed:w})=>{w&&g?.textStyle?zr(h,i.textStyle,g.textStyle):y&&p?.textStyle?zr(h,i.textStyle,p.textStyle):b&&f?.textStyle?zr(h,i.textStyle,f.textStyle):zr(h,i.textStyle)};if(f){let{cursor:b,soundSrc:y,payload:w}=f;h.eventMode="static";let E=()=>{m.isHovering=!0,w&&s&&s("hover",{_event:{id:h.label},...w}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1}),_(m)},v=()=>{m.isHovering=!1,h.cursor="auto",_(m)};h.on("pointerover",E),h.on("pointerout",v)}if(p){let{soundSrc:b,soundVolume:y,payload:w}=p;h.eventMode="static";let E=P=>{oe(P)&&(m.isPressed=!0,_(m))},v=P=>{oe(P)&&(m.isPressed=!1,_(m),w&&s&&s("click",{_event:{id:h.label},...w}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1,volume:(y??1e3)/1e3}))},S=()=>{m.isPressed=!1,_(m)};h.on("pointerdown",E),h.on("pointerup",v),h.on("pointerupoutside",S)}if(g){let{soundSrc:b,payload:y}=g;h.eventMode="static";let w=()=>{m.isRightPressed=!0,_(m)},E=()=>{m.isRightPressed=!1,_(m)},v=()=>{m.isRightPressed=!1,_(m),y&&s&&s("rightClick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:b,loop:!1})},S=()=>{m.isRightPressed=!1,_(m)};h.on("rightdown",w),h.on("rightup",E),h.on("rightclick",v),h.on("rightupoutside",S)}}};at({animations:o,targetId:e.id,animationBus:n,completionTracker:a,element:h,targetState:{...Cl(i),alpha:c},onComplete:()=>{u()}})||u()};var WP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var zP=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var Ce=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(_s).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(_s).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===_s.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=zP({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var $P=({state:r})=>{let t={..._e,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),typeof r.width=="number"&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=Jt.measureText(e,new Ht(t)),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,h={...Ce({...r,width:a,height:n}),content:e,measuredWidth:o,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(h,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),h};var lU=fe({type:"text",add:HP,update:VP,delete:WP,parse:$P});var XP="__rtglRectScrollHandled",Qu=({canvas:r,rect:t,width:e,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;t.eventMode="static",t.hitArea=new tt(0,0,Math.round(e),Math.round(i));let l=(f,p)=>{p?.[XP]||(p&&(p[XP]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:t.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:t.label},...o.payload}))},h=()=>{a=!0},c=()=>{a=!1},u=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};t.on("pointerover",h),t.on("pointerout",c),t.on("wheel",u),r?.addEventListener("wheel",d,{passive:!1}),t._cleanupScrollInteraction=()=>{a=!1,t.off("pointerover",h),t.off("pointerout",c),t.off("wheel",u),r?.removeEventListener("wheel",d),t.hitArea=null,delete t._cleanupScrollInteraction}};var hU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,jP=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:h,x:c,y:u,width:d,height:f,fill:p,border:g,alpha:m,scaleX:_,scaleY:b}=e,y=new de;y.label=h,y.zIndex=n;let w={x:c,y:u,alpha:m};_!==void 0&&(w.scaleX=_),b!==void 0&&(w.scaleY=b),(()=>{y.clear(),y.rect(0,0,Math.round(d),Math.round(f)).fill(hU(p)),y.x=Math.round(c),y.y=Math.round(u),y.alpha=m,y.scale.x=_??1,y.scale.y=b??1,g&&y.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)})})();let v=e?.hover,S=e?.click,P=e?.rightClick,R=e?.scrollUp,A=e?.scrollDown,C=e?.drag;if(v){let{cursor:M,soundSrc:B,payload:k}=v;y.eventMode="static";let U=()=>{k&&o&&o("hover",{_event:{id:y.label},...k}),M&&(y.cursor=M),B&&r.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},O=()=>{y.cursor="auto"};y.on("pointerover",U),y.on("pointerout",O)}if(S){let{soundSrc:M,soundVolume:B,payload:k}=S;y.eventMode="static";let U=O=>{oe(O)&&(k&&o&&o("click",{_event:{id:y.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(B??1e3)/1e3}))};y.on("pointerup",U)}if(P){let{soundSrc:M,payload:B}=P;y.eventMode="static";let k=()=>{B&&o&&o("rightClick",{_event:{id:y.label},...B}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};y.on("rightclick",k)}if((R||A)&&Qu({canvas:r.canvas,rect:y,width:d,height:f,scrollUpEvent:R,scrollDownEvent:A,eventHandler:o}),C){let{start:M,end:B,move:k}=C;y.eventMode="static";let U=()=>{y._isDragging=!0,M&&o&&o("dragStart",{_event:{id:y.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{y._isDragging=!1,B&&o&&o("dragEnd",{_event:{id:y.label},...typeof B?.payload=="object"?B.payload:{}})},$=N=>{k&&o&&y._isDragging&&o("dragMove",{_event:{id:y.label,x:N.global.x,y:N.global.y},...typeof k?.payload=="object"?k.payload:{}})};y.on("pointerdown",U),y.on("pointerup",O),y.on("globalpointermove",$),y.on("pointerupoutside",O)}t.addChild(y),at({animations:i,targetId:h,animationBus:s,completionTracker:a,element:y,targetState:w,renderContext:l})};var cU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,YP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(v=>v.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:p,border:g,alpha:m,scaleX:_,scaleY:b}=i,y={x:c,y:u,alpha:m};_!==void 0&&(y.scaleX=_),b!==void 0&&(y.scaleY=b);let w=()=>{if(!Et(e,i)){h._cleanupScrollInteraction?.(),h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(cU(p)),h.x=Math.round(c),h.y=Math.round(u),h.alpha=m,h.scale.x=_??1,h.scale.y=b??1,g&&h.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let v=i?.hover,S=i?.click,P=i?.rightClick,R=i?.scrollUp,A=i?.scrollDown,C=i?.drag;if(v){let{cursor:M,soundSrc:B,payload:k}=v;h.eventMode="static";let U=()=>{k&&n&&n("hover",{_event:{id:h.label},...k}),M&&(h.cursor=M),B&&r.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},O=()=>{h.cursor="auto"};h.on("pointerover",U),h.on("pointerout",O)}if(S){let{soundSrc:M,soundVolume:B,payload:k}=S;h.eventMode="static";let U=O=>{oe(O)&&(k&&n&&n("click",{_event:{id:h.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(B??1e3)/1e3}))};h.on("pointerup",U)}if(P){let{soundSrc:M,payload:B}=P;h.eventMode="static";let k=()=>{B&&n&&n("rightClick",{_event:{id:h.label},...B}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};h.on("rightclick",k)}if((R||A)&&Qu({canvas:r.canvas,rect:h,width:d,height:f,scrollUpEvent:R,scrollDownEvent:A,eventHandler:n}),C){let{start:M,end:B,move:k}=C;h.eventMode="static";let U=()=>{h._isDragging=!0,M&&n&&n("dragStart",{_event:{id:h.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{h._isDragging=!1,B&&n&&n("dragEnd",{_event:{id:h.label},...typeof B?.payload=="object"?B.payload:{}})},$=N=>{k&&n&&h._isDragging&&n("dragMove",{_event:{id:h.label,x:N.global.x,y:N.global.y},...typeof k?.payload=="object"?k.payload:{}})};h.on("pointerdown",U),h.on("pointerup",O),h.on("globalpointermove",$),h.on("pointerupoutside",O)}}};at({animations:s,targetId:e.id,animationBus:o,completionTracker:l,element:h,targetState:y,onComplete:()=>{w()}})||w()};var qP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var KP=({state:r})=>{let t=Ce(r),e=r.border?.width,i=t;return typeof e=="number"&&e>0&&(i={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:e}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var uU=fe({type:"rect",add:jP,update:YP,delete:qP,parse:KP});var ZP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:h,x:c,y:u,width:d,height:f,src:p,alpha:g}=e,m=p?I.from(p):I.EMPTY,_=new kt(m);_.label=h,_.zIndex=l,_.x=Math.round(c),_.y=Math.round(u),_.width=Math.round(d),_.height=Math.round(f),_.alpha=g;let b=e?.hover,y=e?.click,w=e?.rightClick,E={isHovering:!1,isPressed:!1,isRightPressed:!1},v=({isHovering:S,isPressed:P,isRightPressed:R})=>{if(R&&w?.src){let A=I.from(w.src);_.texture=A}else if(P&&y?.src){let A=I.from(y.src);_.texture=A}else if(S&&b?.src){let A=I.from(b.src);_.texture=A}else _.texture=m};if(b){let{cursor:S,soundSrc:P,payload:R}=b;_.eventMode="static";let A=()=>{E.isHovering=!0,R&&s&&s("hover",{_event:{id:_.label},...R}),S&&(_.cursor=S),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1}),v(E)},C=()=>{E.isHovering=!1,_.cursor="auto",v(E)};_.on("pointerover",A),_.on("pointerout",C)}if(y){let{soundSrc:S,soundVolume:P,payload:R}=y;_.eventMode="static";let A=B=>{oe(B)&&(E.isPressed=!0,v(E))},C=B=>{oe(B)&&(E.isPressed=!1,v(E),R&&s&&s("click",{_event:{id:_.label},...R}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(P??1e3)/1e3}))},M=()=>{E.isPressed=!1,v(E)};_.on("pointerdown",A),_.on("pointerup",C),_.on("pointerupoutside",M)}if(w){let{soundSrc:S,payload:P}=w;_.eventMode="static";let R=()=>{E.isRightPressed=!0,v(E)},A=()=>{E.isRightPressed=!1,v(E)},C=()=>{E.isRightPressed=!1,v(E),P&&s&&s("rightClick",{_event:{id:_.label},...P}),S&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:S,loop:!1})},M=()=>{E.isRightPressed=!1,v(E)};_.on("rightdown",R),_.on("rightup",A),_.on("rightclick",C),_.on("rightupoutside",M)}t.addChild(_),at({animations:i,targetId:h,animationBus:o,completionTracker:n,element:_,targetState:{x:c,y:u,width:d,height:f,alpha:g},renderContext:a})};var QP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(y=>y.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:p,src:g,alpha:m}=i,_=()=>{if(!Et(e,i)){let y=g?I.from(g):I.EMPTY;h.texture=y,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(p),h.alpha=m,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightclick"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let w=i?.hover,E=i?.click,v=i?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},P=({isHovering:R,isPressed:A,isRightPressed:C})=>{if(C&&v?.src){let M=I.from(v.src);h.texture=M}else if(A&&E?.src){let M=I.from(E.src);h.texture=M}else if(R&&w?.src){let M=I.from(w.src);h.texture=M}else h.texture=y};if(w){let{cursor:R,soundSrc:A,payload:C}=w;h.eventMode="static";let M=()=>{S.isHovering=!0,C&&a&&a("hover",{_event:{id:h.label},...C}),R&&(h.cursor=R),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1}),P(S)},B=()=>{S.isHovering=!1,h.cursor="auto",P(S)};h.on("pointerover",M),h.on("pointerout",B)}if(E){let{soundSrc:R,soundVolume:A,payload:C}=E;h.eventMode="static";let M=U=>{oe(U)&&(S.isPressed=!0,P(S))},B=U=>{oe(U)&&(S.isPressed=!1,P(S),C&&a&&a("click",{_event:{id:h.label},...C}),R&&r.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:(A??1e3)/1e3}))},k=()=>{S.isPressed=!1,P(S)};h.on("pointerdown",M),h.on("pointerup",B),h.on("pointerupoutside",k)}if(v){let{soundSrc:R,payload:A}=v;h.eventMode="static";let C=()=>{S.isRightPressed=!0,P(S)},M=()=>{S.isRightPressed=!1,P(S)},B=()=>{S.isRightPressed=!1,P(S),A&&a&&a("rightClick",{_event:{id:h.label},...A}),R&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},k=()=>{S.isRightPressed=!1,P(S)};h.on("rightdown",C),h.on("rightup",M),h.on("rightclick",B),h.on("rightupoutside",k)}}};at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:p,alpha:m},onComplete:()=>{_()}})||_()};var JP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var tC=({state:r})=>({...Ce(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var dU=fe({type:"sprite",add:ZP,update:QP,delete:JP,parse:tC});var fU=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,_x=({videoElement:r,video:t})=>{t&&r?._videoEndedListener&&t.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Ju=({videoElement:r,video:t,loop:e,completionTracker:i})=>{if(_x({videoElement:r,video:t}),(e??!1)||fU(t))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};t.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var eC=({parent:r,element:t,renderContext:e,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:h,src:c,volume:u,loop:d,alpha:f}=t,p=I.from(c),g=p.source.resource;g.pause(),g.currentTime=0,g.loop=d??!1,g.volume=u/1e3,g.muted=!1;let m=new kt(p);m.label=o,m.zIndex=s,m._videoEndedListener=void 0,m._playbackStateVersion=null,m.x=Math.round(n),m.y=Math.round(a),m.width=Math.round(l),m.height=Math.round(h),m.alpha=f??1,Ju({videoElement:m,video:g,loop:d,completionTracker:i}),IP(e,g),r.addChild(m)};var rC=({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(m=>m.label===t.id);if(!l)return;l.zIndex=a;let{x:h,y:c,width:u,height:d,alpha:f}=e,p=()=>{if(!Et(t,e)){l.x=Math.round(h),l.y=Math.round(c),l.width=Math.round(u),l.height=Math.round(d),l.alpha=f??1;let m=l.texture.source.resource;if(t.src!==e.src){let _=m;_x({videoElement:l,video:_}),_&&_.pause();let b=I.from(e.src);l.texture=b,m=b.source.resource,m.muted=!1,m.pause(),m.currentTime=0}Ju({videoElement:l,video:m,loop:e.loop,completionTracker:n}),m.volume=e.volume/1e3,m.loop=e.loop??!1,t.src!==e.src&&m.play()}};at({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:l,targetState:{x:h,y:c,width:u,height:d,alpha:f??1},onComplete:p})||p()};var iC=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===t.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var sC=({state:r})=>({...Ce(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var pU=fe({type:"video",add:eC,update:rC,delete:iC,parse:sC});var oC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:h,x:c,y:u,width:d,height:f,alpha:p,thumbSrc:g,barSrc:m,direction:_,min:b,max:y,step:w,initialValue:E,originX:v,originY:S,hover:P,change:R}=e,A=new nt;A.label=h,A.zIndex=l,A.x=c,A.y=u,A.alpha=p,A.sortableChildren=!0,A.eventMode="static";let C=0,M=m?I.from(m):I.EMPTY,B=new kt(M);B.label=`${h}-bar`,B.eventMode="static";let k=g?I.from(g):I.EMPTY,U=new kt(k);U.label=`${h}-thumb`,U.eventMode="static";let O=E??b,$=y-b,N=xt=>{let ct=(xt-b)/$;_==="horizontal"?(U.x=ct*(B.width-U.width),U.y=(B.height-U.height)/2):(U.x=(B.width-U.width)/2,U.y=ct*(B.height-U.height))};(()=>{B.width=d,B.height=f;let xt=_==="horizontal"?f-C*2:d-C*2,ct=g?I.from(g):I.EMPTY,vt=ct.width,Ot=ct.height,ee=xt/vt,re=xt/Ot,He=Math.min(ee,re);U.width=vt*He,U.height=Ot*He,N(O)})();let z=k,st=M,Q=!1,bt=xt=>{let ct;if(_==="horizontal"){let Ot=xt.x-U.width/2;ct=Math.max(0,Math.min(1,Ot/(B.width-U.width)))}else{let Ot=xt.y-U.height/2;ct=Math.max(0,Math.min(1,Ot/(B.height-U.height)))}let vt=b+ct*$;return w>0&&(vt=Math.round((vt-b)/w)*w+b,vt=Math.max(b,Math.min(y,vt))),vt},Bt=xt=>{let ct=A.toLocal(xt.global),vt=bt(ct);vt!==O&&(O=vt,N(O),R?.payload&&n&&n("change",{_event:{id:h,value:O},...R.payload}))},Mt=xt=>{Q=!0,Bt(xt)},jt=xt=>{Q&&Bt(xt)},Zt=()=>{Q&&(Q=!1)};if(A.on("pointerdown",Mt),A.on("globalpointermove",jt),A.on("pointerup",Zt),A.on("pointerupoutside",Zt),P){let{cursor:xt,soundSrc:ct,thumbSrc:vt,barSrc:Ot}=P,ee=()=>{xt&&(B.cursor=xt,U.cursor=xt),ct&&r.audioStage.add({id:`hover-${Date.now()}`,url:ct,loop:!1}),vt&&(U.texture=I.from(vt)),Ot&&(B.texture=I.from(Ot))},re=()=>{Q||(B.cursor="auto",U.cursor="auto",U.texture=z,B.texture=st)};A.on("pointerover",ee),A.on("pointerout",re),A.on("pointerupoutside",re)}A.addChild(B),A.addChild(U),t.addChild(A),at({animations:i,targetId:h,animationBus:s,completionTracker:o,element:A,targetState:{x:c,y:u,alpha:p},renderContext:a})};var nC=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(g=>g.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(!Et(e,i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let g=h.getChildByLabel(`${i.id}-bar`),m=h.getChildByLabel(`${i.id}-thumb`),_=!Et(e.hover,i.hover)||!Et(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(g&&m){g.width=i.width,g.height=i.height;let b=0,y=i.direction==="horizontal"?i.height-b*2:i.width-b*2,w=i.thumbSrc?I.from(i.thumbSrc):I.EMPTY,E=w.width||16,v=w.height||16,S=y/E,P=y/v,R=Math.min(S,P);if(m.width=E*R,m.height=v*R,e.barSrc!==i.barSrc){let M=i.barSrc?I.from(i.barSrc):I.EMPTY;g.texture=M}if(e.thumbSrc!==i.thumbSrc){let M=i.thumbSrc?I.from(i.thumbSrc):I.EMPTY;m.texture=M}let A=i.max-i.min,C=(i.initialValue-i.min)/A;i.direction==="horizontal"?(m.x=C*(g.width-m.width),m.y=(g.height-m.height)/2):(m.x=(g.width-m.width)/2,m.y=C*(g.height-m.height))}if(_&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),_){let{hover:b,change:y,min:w,max:E,step:v,direction:S,initialValue:P}=i,R=P??w,A=E-w;h.eventMode="static";let C=z=>{let st=(z-w)/A;S==="horizontal"?(m.x=st*(g.width-m.width),m.y=(g.height-m.height)/2):(m.x=(g.width-m.width)/2,m.y=st*(g.height-m.height))},M=z=>{let st;if(S==="horizontal"){let bt=z.x-m.width/2;st=Math.max(0,Math.min(1,bt/(g.width-m.width)))}else{let bt=z.y-m.height/2;st=Math.max(0,Math.min(1,bt/(g.height-m.height)))}let Q=w+st*A;return v>0&&(Q=Math.round((Q-w)/v)*v+w,Q=Math.max(w,Math.min(E,Q))),Q},B=m.texture,k=g.texture,U=!1,O=z=>{let st=h.toLocal(z.global),Q=M(st);Q!==R&&(R=Q,C(R),y?.payload&&a&&a("change",{_event:{id:i.id,value:R},...y.payload}))},$=z=>{U=!0,O(z)},N=z=>{U&&O(z)},L=()=>{U&&(U=!1)};if(h.on("pointerdown",$),h.on("globalpointermove",N),h.on("pointerup",L),h.on("pointerupoutside",L),b){let{cursor:z,soundSrc:st,thumbSrc:Q,barSrc:bt}=b,Bt=()=>{z&&(h.cursor=z,m.cursor=z),st&&r.audioStage.add({id:`hover-${Date.now()}`,url:st,loop:!1}),Q&&(m.texture=I.from(Q)),bt&&(g.texture=I.from(bt))},Mt=()=>{U||(h.cursor="auto",m.cursor="auto",m.texture=B,g.texture=k)};h.on("pointerover",Bt),h.on("pointerout",Mt),h.on("pointerupoutside",Mt)}}}},{x:u,y:d,alpha:f}=i;at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,alpha:f},onComplete:c})||c()};var aC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};at({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var lC=({state:r})=>{let t=Ce(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<e||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var mU=fe({type:"slider",add:oC,update:nC,delete:aC,parse:lC});var Rl=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(h=>{s=Math.max(h.width+h.x,s),o=Math.max(h.height+h.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let h=new nt({label:`${r.label}-content`});[...r.children].forEach(m=>{h.addChild(m)}),r.addChild(h);let u=new de({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),h.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),p=t.anchorToBottom&&n?d:0,g=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(h.y=p,h.x=g),e&&(r.eventMode="static",r.hitArea=new tt(0,0,t.width||s,t.height||o),r.on("wheel",m=>{if(m.preventDefault(),n&&m.deltaY!==0){let _=p-m.deltaY;_>0?p=0:_<d?p=d:p=_,h.y=p}if(a&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let _=m.deltaX!==0?m.deltaX:m.deltaY,b=g-_;b>0?g=0:b<f?g=f:g=b,h.x=g}}))}},bx=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var Ml=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of Ml(e))t.add(i);return t};var hC=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=Ml(u),f=e instanceof Map?Array.from(e.keys()).some(p=>d.has(p)):e.find(p=>d.has(p.targetId));(!Et(c,u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var td=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,gU=r=>r,xU=r=>r*r,yU=r=>1-(1-r)*(1-r),_U=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,cC=Object.freeze({linear:gU,easeInQuad:xU,easeOutQuad:yU,easeInOutQuad:_U,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-td(1-r),easeOutBounce:td,easeInOutBounce:r=>r<.5?(1-td(1-2*r))/2:(1+td(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),vx=Object.freeze(Object.keys(cC)),bU=(r="linear")=>{let t=cC[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},Il=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},Bl=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},Fl=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*bU(o)(l)}}return r[r.length-1].value};var vU={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Sx=r=>Math.min(1,Math.max(0,r)),ed=(r,t,e)=>{if(r===t)return e<r?0:1;let i=Sx((e-r)/(t-r));return i*i*(3-2*i)},fC=r=>r.getLocalBounds().rectangle.clone(),pC=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),uC=(r,t)=>{let e=pC(fC(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new kt(i);s.x=e.x,s.y=e.y;let o=new nt;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},TU=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:Il([{value:e.initialValue??vU[t]??0},...e.keyframes])})),rd=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=TU(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:Bl(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=Fl(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},SU=r=>Il([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),wU=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},EU=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},Tx=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new kt(I.from(t));a.width=e,a.height=i;let l=new nt;l.addChild(a);let h=hi.create({width:e,height:i});r.renderer.render({container:l,target:h,clear:!0});let c=r.renderer.extract.pixels(h).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=EU(c,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),h.destroy(!0),n},AU=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=Tx({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(e*i)},PU=(r,t,e,i)=>{let s=SU(t),o=Bl([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=Tx({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(h,c)=>ed(h-n,h+n,l[c]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(h=>Tx({app:r,texture:h,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(h,c)=>{let u=Sx(h)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),p=Math.min(l.length-1,f+1),g=u-f,m=(l[f][c]*(1-g)+l[p][c]*g)/255;return ed(h-n,h+n,m)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return ed(h-n,h+n,l[d][c]/255)},destroy:()=>{}}}let a=AU(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,h)=>ed(l-n,l+n,a[h]/255),destroy:()=>{}}},CU=r=>{let t=new nt;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return pC(fC(t))},dC=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new G(1,0,0,1,-i.x,-i.y)})},kl=r=>{r?.texture?.destroy(!0)},RU=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new nt;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=rd(e?.wrapper??null,t.prev?.tween,r),a=rd(i?.wrapper??null,t.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),kl(e),kl(i)}}},MU=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=CU([e,i]),n=new nt,a=new nt;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=hi.create({width:o.width,height:o.height}),h=hi.create({width:o.width,height:o.height}),{canvas:c,context:u}=wU(o.width,o.height),d=u.createImageData(o.width,o.height),f=I.from(c),p=new nt;p.zIndex=s;let g=new kt(f);g.x=o.x,g.y=o.y,p.addChild(g);let m=PU(r,t.mask,o.width,o.height),_=rd(e?.wrapper??null,t.prev?.tween,r),b=rd(i?.wrapper??null,t.next?.tween,r),y=new Uint8ClampedArray(o.width*o.height*4);return{overlay:p,duration:Math.max(_.duration,b.duration,m.duration),apply:w=>{_.apply(w),b.apply(w);let E=y,v=y;e?.wrapper&&(dC({app:r,container:n,target:l,frame:o}),E=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(dC({app:r,container:a,target:h,frame:o}),v=r.renderer.extract.pixels(h).pixels);let S=Sx(Fl(m.progressTimeline,w)),P=d.data;for(let R=0,A=0;R<P.length;R+=4,A+=1){let C=m.sample(S,A),M=1-C;P[R]=Math.round(E[R]*M+v[R]*C),P[R+1]=Math.round(E[R+1]*M+v[R+1]*C),P[R+2]=Math.round(E[R+2]*M+v[R+2]*C),P[R+3]=Math.round(E[R+3]*M+v[R+3]*C)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{p.removeFromParent(),p.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),h.destroy(!0),f.destroy(!0),kl(e),kl(i),m.destroy()}}},IU=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?MU({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):RU({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),BU=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:h,zIndex:c,signal:u})=>{if(!e)return null;let d=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:h,zIndex:c,signal:u});return d&&typeof d.then=="function"?d.then(()=>u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null):u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null},FU=async r=>r&&typeof r.then=="function"?r:r??null,id=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,renderContext:c,plugin:u,zIndex:d,signal:f})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||t.destroyed)return;let p=e?t.children.find(M=>M.label===e.id)??null:null;if(e&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${e.id}".`);let g=p?uC(r,p):null,m=new nt,_=Xu({suppressAnimations:!0}),b=a.getVersion(),y=!1,w=()=>{y||(a.track(b),y=!0)},E=()=>{y&&(a.complete(b),y=!1)},v=({flushDeferredEffects:M})=>{if(!R){if(R=!0,S.value&&!S.value.destroyed&&(S.value.visible=!0),P.value?.destroy(),M){UP(_);return}ju(_)}},S={value:null},P={value:null},R=!1;w();let A=M=>{if(f?.aborted||t.destroyed){ju(_),m.destroy({children:!0}),kl(g),E();return}if(i&&!M)throw ju(_),E(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);S.value=M;let B=M?uC(r,M):null;m.destroy({children:!1}),p&&u.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,renderContext:c,signal:f}),M&&(M.zIndex=d,t.addChild(M),M.visible=!1);let k=IU({app:r,animation:s,prevSubject:g,nextSubject:B,zIndex:d});P.value=k,t.addChild(k.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:k.duration,applyFrame:k.apply,applyTargetState:()=>{v({flushDeferredEffects:!1})},onComplete:()=>{v({flushDeferredEffects:!0}),E()},onCancel:()=>{E()},isValid:()=>!!k.overlay&&!k.overlay.destroyed&&(!M||!M.destroyed)}})},C=i?BU({app:r,parent:m,nextElement:i,plugin:u,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:h,renderContext:_,zIndex:d,signal:f}):null;if(C&&typeof C.then=="function"){FU(C).then(A);return}A(C??null)};var Ts=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h=Xu(),signal:c})=>{t.sortableChildren=!0;let u=new Map(l.map(y=>[y.type,y])),d=GP(s),f=new Map;for(let y=0;y<i.length;y++)f.set(i[y].id,y);let{toAddElement:p,toDeleteElement:g,toUpdateElement:m}=hC(e,i,s),_=y=>{let w=u.get(y);if(!w)throw new Error(`No plugin found for element type: ${y}`);return w},b=y=>t.children.find(w=>w.label===y)?.zIndex??-1;for(let y of t.children){let w=f.get(y.label);w!==void 0&&(y.zIndex=w)}for(let y of g){let w=h.suppressAnimations?null:qu(d,y.id),E=_(y.type);if(w){id({app:r,parent:t,prevElement:y,nextElement:null,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,plugin:E,zIndex:b(y.id),signal:c});continue}E.delete({app:r,parent:t,element:y,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,signal:c})}for(let y of p){let w=h.suppressAnimations?null:qu(d,y.id),E=_(y.type),v=f.get(y.id)??-1;if(w){id({app:r,parent:t,prevElement:null,nextElement:y,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,plugin:E,zIndex:v,signal:c});continue}E.add({app:r,parent:t,element:y,animations:h.suppressAnimations||y.type==="container"?d:[],eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:h,zIndex:v,signal:c})}for(let{prev:y,next:w}of m){let E=_(w.type),v=f.get(w.id)??-1,S=h.suppressAnimations?null:qu(d,w.id);if(S){id({app:r,parent:t,prevElement:y,nextElement:w,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,plugin:E,zIndex:v,signal:c});continue}E.update({app:r,parent:t,prevElement:y,nextElement:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,zIndex:v,signal:c})}};var kU=(r=[])=>{let t=new Set;for(let e of r)if(e?.id){if(t.has(e.id))return!0;t.add(e.id)}return!1},UU=({app:r,container:t,children:e,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let h of e){let c=o.find(u=>u.type===h.type);if(!c)throw new Error(`No plugin found for child element type: ${h.type}`);c.add({app:r,parent:t,element:h,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},mC=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:h,signal:c})=>{let{id:u,x:d,y:f,children:p,scroll:g,alpha:m}=e,_=new nt;_.label=u,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=m,t.addChild(_),p&&p.length>0&&(kU(p)?UU({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:h,signal:c}):Ts({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:h,eventHandler:s,elementPlugins:n,renderContext:a,signal:c})),(g||e.anchorToBottom)&&Rl({container:_,element:e,interactive:!!g,allowViewportWithoutScroll:!!e.anchorToBottom});let y=e?.hover,w=e?.click,E=e?.rightClick;if(y){let{cursor:v,soundSrc:S,payload:P}=y;_.eventMode="static";let R=()=>{P&&s&&s("hover",{_event:{id:_.label},...P}),v&&(_.cursor=v),S&&r.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1})},A=()=>{_.cursor="auto"};_.on("pointerover",R),_.on("pointerout",A)}if(w){let{soundSrc:v,soundVolume:S,payload:P}=w;_.eventMode="static";let R=A=>{oe(A)&&(P&&s&&s("click",{_event:{id:_.label},...P}),v&&r.audioStage.add({id:`click-${Date.now()}`,url:v,loop:!1,volume:(S??1e3)/1e3}))};_.on("pointerup",R)}if(E){let{soundSrc:v,payload:S}=E;_.eventMode="static";let P=()=>{S&&s&&s("rightClick",{_event:{id:_.label},...S}),v&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:v,loop:!1})};_.on("rightclick",P)}};var gC=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:h,completionTracker:c,signal:u})=>{let d=t.children.find(b=>b.label===e.id);if(!d)return;d.zIndex=h;let{x:f,y:p,alpha:g}=i,m=()=>{if(!Et(e,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=g,d.scale.x=1,d.scale.y=1,d.removeAllListeners("pointerover"),d.removeAllListeners("pointerout"),d.removeAllListeners("pointerup"),d.removeAllListeners("rightclick"),d.eventMode="auto",d.cursor="auto";let E=i?.hover,v=i?.click,S=i?.rightClick,P=!!(E||v||S);if(E){let{cursor:C,soundSrc:M,payload:B}=E;d.eventMode="static";let k=()=>{B&&s&&s("hover",{_event:{id:d.label},...B}),C&&(d.cursor=C),M&&r.audioStage.add({id:`hover-${Date.now()}`,url:M,loop:!1})},U=()=>{d.cursor="auto"};d.on("pointerover",k),d.on("pointerout",U)}if(v){let{soundSrc:C,soundVolume:M,payload:B}=v;d.eventMode="static";let k=U=>{oe(U)&&(B&&s&&s("click",{_event:{id:d.label},...B}),C&&r.audioStage.add({id:`click-${Date.now()}`,url:C,loop:!1,volume:(M??1e3)/1e3}))};d.on("pointerup",k)}if(S){let{soundSrc:C,payload:M}=S;d.eventMode="static";let B=()=>{M&&s&&s("rightClick",{_event:{id:d.label},...M}),C&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:C,loop:!1})};d.on("rightclick",B)}let R=e.scroll||e.anchorToBottom,A=i.scroll||i.anchorToBottom;R!==A?A?Rl({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):bx({container:d}):A&&(bx({container:d}),Rl({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom})),!i.scroll&&P&&(d.eventMode="static")}let b=!Et(e.children,i.children),y=Ml({children:i.children}),w=Array.from(y).some(E=>Yu(o,E).length>0);if(b||w){let v=d.children.find(S=>S.label===`${i.id}-content`)||d;Ts({app:r,parent:v,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:c,renderContext:l,signal:u})}};at({animations:o,targetId:e.id,animationBus:n,completionTracker:c,element:d,targetState:{x:f,y:p,alpha:g},onComplete:()=>{m()}})||m()};var xC=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};at({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var yC=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,p=0,g=0,m=0;for(let y=0;y<o.length;y++){let w=y<o.length-1?s:0,E=o[y];y>0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=p,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let v=t.find(S=>S.type===E.type);if(v){let S=(E.scaleX??1)*(r.scaleX??1),P=(E.scaleY??1)*(r.scaleY??1);E=v.parse({state:{...E,scaleX:S,scaleY:P},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+g>r.width&&!i&&!r.anchorToBottom?(h=0,g=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+w,g=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+m>r.height&&!i&&!r.anchorToBottom?(c=0,m=0,p+=d+s,d=E.width,E.x=p,E.y=0):d=Math.max(d,E.width),c+=E.height+w,m=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let b={...Ce({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(b.rightClick=r.rightClick),b};var GU=fe({type:"container",add:mC,update:gC,delete:xC,parse:yC});var _C=async({parent:r,element:t,animationBus:e,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new nt;if(a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),i?.suppressAnimations&&t.revealEffect!=="none"){await vs({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"paused-initial"}),FP(i,{container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n});return}await vs({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"autoplay"})};var bC=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let l=r.children.find(u=>u.label===t.id);if(!l)return;let h=async()=>{e.x!==void 0&&(l.x=e.x),e.y!==void 0&&(l.y=e.y),e.alpha!==void 0&&(l.alpha=e.alpha),await vs({container:l,element:e,completionTracker:o,animationBus:s,zIndex:n,signal:a})};at({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:l,targetState:{x:e.x??l.x,y:e.y??l.y,alpha:e.alpha??l.alpha},onComplete:()=>{h()}})||await h()};var vC=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(gx(o),o.destroy({children:!0}))};at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var OU=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=[...r],h=new WeakSet;for(;l.length>0;){let u=l[0];if(!u.text||u.text.length===0){l.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},p=Jt.measureText(u.text,new Ht(f));if(p.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let g=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!g.endsWith(" ")&&(g+=" ");let m=Jt.measureText(g,new Ht({...u.textStyle,wordWrap:!1,breakWords:!1})),_={text:g,textStyle:f,height:m.height,x:s,y:o};if(u.furigana&&!h.has(u)){h.add(u);let y=Jt.measureText(u.furigana.text,new Ht(u.furigana.textStyle)),w=-y.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(p.lineWidths[0]-y.width)/2),y:w};_.furigana=E}i.push(_),n=Math.max(n,m.height),s+=Math.round(p.lineWidths[0]),a=Math.max(a,s);let b=p.lines.slice(1).join(" ");b&&b.length>0?u.text=b:l.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let g=f.y+(d-p),m=f.furigana;return m&&(m.y=m.y-f.y+g),{...f,...m&&{furigana:m},y:g}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},TC=({state:r})=>{let t={..._e,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let p={...t,...c.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(c.furigana.text),textStyle:p}}return{text:String(c.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=OU(e,i),a=r.width||o,h=Ce({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var LU=fe({type:"text-revealing",add:_C,update:bC,delete:vC,parse:TC});var sd=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},od=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var SC=async({app:r,parent:t,element:e,renderContext:i,zIndex:s,signal:o})=>{if(o?.aborted)return;let{id:n,x:a,y:l,width:h,height:c,spritesheetSrc:u,spritesheetData:d,animation:f,alpha:p}=e,g=d,m=Object.keys(g.frames),_=new Ci(I.from(u),g);if(await _.parse(),o?.aborted||t.destroyed)return;let b=f.frames.map(w=>_.textures[m[w]]),y=new wl(b);y.label=n,y.zIndex=s,y.animationSpeed=f.animationSpeed??.5,y.loop=f.loop??!0,r.debug?sd(y,n,r.debug):MP(i,y),y.x=Math.round(a),y.y=Math.round(l),y.width=Math.round(h),y.height=Math.round(c),y.alpha=p,t.addChild(y)};var wC=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let c=async()=>{if(!(l?.aborted||h.destroyed)&&!Et(e,i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,!Et(e.animation,i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let _=i.spritesheetData,b=Object.keys(_.frames),y=new Ci(I.from(i.spritesheetSrc),_);if(await y.parse(),l?.aborted||h.destroyed)return;let w=i.animation.frames.map(E=>y.textures[b[E]]);h.textures=w,r.debug?e.id!==i.id&&(od(h),sd(h,i.id,r.debug)):h.play()}},{x:u,y:d,width:f,height:p,alpha:g}=i;at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:p,alpha:g},onComplete:()=>{c()}})||await c()};var EC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&od(n),n&&!n.destroyed&&(n.stop(),n.destroy())};at({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var AC=({state:r})=>({...Ce(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var DU=fe({type:"animated-sprite",add:SC,update:wC,delete:EC,parse:AC});var NU=dx({type:"tween"});var Ss=new Map,HU=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),PC=r=>Ss.has(r),Ul=r=>{let t=Ss.get(r);t!==void 0&&(clearTimeout(t),Ss.delete(r))},wx=({app:r,element:t})=>{let e=HU(t);if(Ul(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{Ss.delete(e.id),r.audioStage.add(e)},t.delay);Ss.set(e.id,i);return}r.audioStage.add(e)},Ex=()=>{for(let r of Ss.values())clearTimeout(r);Ss.clear()},CC=({app:r,element:t})=>{wx({app:r,element:t})};var RC=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),wx({app:r,element:e});return}if(PC(i)){Ul(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var MC=({app:r,element:t})=>{Ul(t.id),r.audioStage.remove(t.id)};var VU=fx({type:"sound",add:CC,update:RC,delete:MC});var Gl=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ax(r){let t=new de;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Px(r){let t=new de;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Cx(r){let t=new de;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Ol(r,t,e){return r+(t-r)*e}function ad(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function IC(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(Ol(i,n,e)),c=Math.round(Ol(s,a,e)),u=Math.round(Ol(o,l,e));return h<<16|c<<8|u}var nd=class r{constructor(t,e,i=!1){this.value=i?ad(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Er=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=nd.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?IC(e.value,e.next.value,i):Ol(e.value,e.next.value,i)}};var ld=class{static type="alpha";constructor(t){this.list=new Er(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},hd=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var cd=class{static type="scale";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},ud=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var WU=Math.PI/180,dd=class{static type="speed";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},fd=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},pd=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*WU}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var kdt=Math.PI/180,md=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},gd=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Hi=Math.PI/180,xd=class{static type="rotation";constructor(t){this.minStart=t.minStart*Hi,this.maxStart=t.maxStart*Hi,this.minSpeed=t.minSpeed*Hi,this.maxSpeed=t.maxSpeed*Hi,this.accel=(t.accel??0)*Hi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},yd=class{static type="rotationStatic";constructor(t){this.min=t.min*Hi,this.max=t.max*Hi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},_d=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Hi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var bd=class{static type="color";constructor(t){this.list=new Er(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},vd=class{static type="colorStatic";constructor(t){this.color=ad(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var Td=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},Sd=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Rx=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Mx=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},zU={rect:Td,rectangle:Td,torus:Sd,circle:Sd,point:Rx,line:Mx};var wd=class{static type="spawnShape";constructor(t){let e=zU[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},Ed=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var BC=new Map,FC=new Map;function Ix(r,t){BC.set(r,t)}function Re(r){FC.set(r.type,r)}function kC(r,t){let e=BC.get(r);return e?e(t):null}function UC(r){return FC.get(r)}Ix("circle",Cx);Ix("snowflake",Ax);Ix("raindrop",Px);Re(ld);Re(hd);Re(cd);Re(ud);Re(dd);Re(fd);Re(pd);Re(md);Re(gd);Re(xd);Re(yd);Re(_d);Re(bd);Re(vd);Re(wd);Re(Ed);var Ad=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var Ll=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new Ad(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=UC(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new Gl(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function $U(r,t){let e=new de,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Dl=({app:r,parent:t,element:e,renderContext:i,zIndex:s})=>{let o=new nt;o.label=e.id,o.zIndex=s,t.addChild(o);let n=e.width,a=e.height;o.x=e.x??0,o.y=e.y??0;let l={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},h;if(typeof e.texture=="object"&&e.texture.shape)h=$U(r,e.texture);else{let d=e.texture??"circle";if(h=kC(d,r),!h)try{h=I.from(d)}catch{console.warn(`Failed to load particle texture: ${d}`);return}}l.texture=h;let c=new Ll(o,l);if(o.emitter=c,l.recycleOnBounds){let d=Math.min(e.count??100,l.maxParticles);c.spawn(d);let f=c._activeFirst;for(;f;)f.y=c.random()*a,f.age=c.random()*f.maxLife*.8,f=f.next}let u=d=>{if(c.destroyed){r.ticker.remove(u);return}c.update(d.deltaTime/60)};o.tickerCallback=u,BP(i,{app:r,emitter:c,container:o,tickerCallback:u}),e.alpha!==void 0&&(o.alpha=e.alpha)};var Pd=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};at({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var GC=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){Dl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,XU(e,i))Pd({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),Dl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let c=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:c})||c()}};function XU(r,t){return r.count!==t.count||!Et(r.texture,t.texture)||!Et(r.behaviors,t.behaviors)||!Et(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function OC(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(_s).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(_s).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function LC(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function DC(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function NC(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function HC(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function VC(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var WC=({state:r})=>{OC(r),LC(r),DC(r),NC(r),HC(r),VC(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var jU=fe({type:"particles",add:Dl,update:GC,delete:Pd,parse:WC});var zC=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Bx=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=zC(t,e);for(let a of o){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Je=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Je||{}),Fx=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Fx||{}),Cd=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Cd||{}),et=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(et||{}),Ko=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ko||{}),D=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(D||{}),di=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(di||{}),lt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(lt||{}),W=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(W||{}),mr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(mr||{}),Nl=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Nl||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),tr=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(tr||{}),Vi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Vi||{}),Rd=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Rd||{}),De=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(De||{}),ne=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(ne||{});var Rt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Rt||{}),Ye=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Ye||{});var kx={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:kx,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};lp();var YU=Ei.default??Ei,Pr=YU(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ms=Ki(XC(),1),DL=Ki(Rc(),1);var py=Ki(lI(),1);var hI={};function ft(r,t,e=3){if(hI[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1144
+ `,Yo=null,Sl=class{constructor(){Yo||(Yo=URL.createObjectURL(new Blob([kk],{type:"application/javascript"}))),this.worker=new Worker(Yo)}};Sl.revokeObjectURL=function(){Yo&&(URL.revokeObjectURL(Yo),Yo=null)};var _P=0,hx,cx=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new jo;e.addEventListener("message",i=>{e.terminate(),jo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){hx===void 0&&(hx=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<hx&&(this._createdWorkers++,t=new Sl().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[_P]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:_P++,id:i})}},ux=new cx;Pi();var Uk=[".jpeg",".jpg",".png",".webp",".avif"],Gk=["image/jpeg","image/png","image/webp","image/avif"];async function Ok(r,t){let e=await Y.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Lu={name:"loadTextures",extension:{type:T.LoadParser,priority:ke.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return dr(r,Gk)||fr(r,Uk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await ux.isImageBitmapSupported()?i=await ux.loadImageBitmap(r,t):i=await Ok(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new ze({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||zo(r),...t.data});return $o(s,e,r)},unload(r){r.destroy(!0)}};F();Ap();Ep();var bP=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Lk=bP.map(r=>`video/${r.substring(1)}`);function Dk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Hk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Nk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function Hk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var vP={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=dr(r,Lk),e=fr(r,bP);return t||e},async load(r,t,e){let i={...oo.defaultOptions,resolution:t.data?.resolution||zo(r),alphaMode:t.data?.alphaMode||await dc(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),Dk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=oo.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new oo({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await Nk(s),l($o(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};F();ro();F();ro();var Du={extension:{type:T.ResolveParser,name:"resolveTexture"},test:Lu.test,parse:r=>({resolution:parseFloat(Qe.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var TP={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Qe.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Du.parse};ro();zn();ac();var Nu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Qe,this.loader=new Ou,this.cache=St,this._backgroundLoader=new Uu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){V("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=as(t),s=Ue(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return St.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=St.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),St.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Ue(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ue(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{St.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},pr=new Nu;H.handleByList(T.LoadParser,pr.loader.parsers).handleByList(T.ResolveParser,pr.resolver.parsers).handleByList(T.CacheParser,pr.cache.parsers).handleByList(T.DetectionParser,pr.detections);H.add(aP,cP,lP,pP,uP,dP,fP,mP,gP,xP,yP,Lu,vP,nP,oP,Du,TP);var SP={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};H.handle(T.Asset,r=>{let t=r.ref;Object.entries(SP).filter(([e])=>!!t[e]).forEach(([e,i])=>H.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(SP).filter(e=>!!t[e]).forEach(e=>H.remove(t[e]))});Tt();Dn();eo();jn();var wl=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof I?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ce.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ce.shared.add(this.update,this,Ir.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(I.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(I.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof I)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ce.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ce.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Vh();Wt();nc();var Hu=class extends Ai{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Te({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function wP(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(j(rt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ga();gs();var Ni=class extends Hu{constructor(...t){let e=wP(t,"Text");super(e,Ht),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=Jt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};mt();he();Ag();Tt();du();Rp();br();$m();jn();ga();gs();bp();Ae();var Vk=Zi(Rc(),1);H.add(Fw,Uw);var Wk=new(window.AudioContext||window.webkitAudioContext),dx={},zk=async(r,t)=>{if(!dx[r]&&t.byteLength!==0)try{let e=await Wk.decodeAudioData(t);dx[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},$k=r=>dx[r],qo={load:zk,getAsset:$k};var fe=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var fx=({type:r})=>({type:r});var px=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var Vu={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Wu={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var bs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var _e={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var vs=(r,t)=>{let e={fill:t?.fill??_e.fill,fontFamily:t?.fontFamily??_e.fontFamily,fontSize:t?.fontSize??_e.fontSize,align:t?.align??_e.align,lineHeight:t?.lineHeight??_e.lineHeight,wordWrap:t?.wordWrap??_e.wordWrap,breakWords:t?.breakWords??_e.breakWords,strokeColor:t?.strokeColor??_e.strokeColor,strokeWidth:t?.strokeWidth??_e.strokeWidth,wordWrapWidth:t?.wordWrapWidth??_e.wordWrapWidth};r.style=e};var Xk=(r,t)=>typeof t!="string"?t:r[t]??t,jk=(r,t,e,i)=>{let s=Xk(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},EP=(r,t,e=Wu)=>{for(let i of t)for(let[s,o]of Object.entries(i.tween)){if(!Vu[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&jk(r,s,e,o.initialValue)}},zu=({animations:r,animationBus:t,completionTracker:e,element:i,targetState:s,onComplete:o})=>{for(let n of r){let a=e.getVersion();e.track(a),t.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{e.complete(a),o?.(n)}}})}};function mx(r,t){let e=r.text.substring(0,t),s=Jt.measureText(e,r.style).width;return r.x+s}var Yk=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),gx=Yk;var ui=Symbol("textRevealRuntime"),qk=18,Kk=64,Zk=1.25,PP=r=>typeof r=="number"&&r>0?r:1,Qk=r=>{let t=new kt(I.EMPTY);if(r?.indicator?.revealing?.src){let e=I.from(r.indicator.revealing.src);t=new kt(e),t.width=r.indicator.revealing.width??e.width,t.height=r.indicator.revealing.height??e.height}return t},El=(r,t)=>{if(!t?.indicator?.complete?.src)return;let e=I.from(t.indicator.complete.src);r.texture=e,r.width=t.indicator.complete.width??e.width,r.height=t.indicator.complete.height??e.height},Al=(r,t,e)=>{r.x=e,r.y=t?t.y+(t.lineMaxHeight-r.height):0},$u=(r,t,e)=>{if(!t||t.text.length===0){r.x=e;return}r.x=mx(t,t.text.length-1)+e},Jk=(r,t)=>{if(r[ui]){let e=r[ui];delete r[ui],e()}r[ui]=t},xx=r=>{if(r[ui]){let e=r[ui];delete r[ui],e()}r.onRender=void 0,r.removeChildren().forEach(e=>{e.destroy({children:!0})})},CP=(r,t="",e="")=>{let i=new Ht(r.textStyle),s=new Ni({text:t,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Ht(r.furigana.textStyle);o=new Ni({text:e,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},RP=(r,t)=>{let e=null,i=null,s=0,o=0,n=[];for(let a=0;a<t.content.length;a++){let l=t.content[a],h=new nt({label:`${t.id}-line-${a}`}),c=[],u=null,d=0;r.addChild(h),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let p=l.lineParts[f],{text:m,furiganaText:g}=CP(p,p.text,p.furigana?.text||"");g&&(h.addChild(g),c.push(g)),h.addChild(m),c.push(m),e=m,u=m,s+=p.text.length,d+=p.text.length}if(c.length>0){let f=h.getLocalBounds();n.push({chunk:l,container:h,lastTextObject:u,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else h.destroy()}return{lines:n,lastTextObject:e,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},AP=({contentContainer:r,indicatorSprite:t,element:e})=>{let i=e?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=RP(r,e);Al(t,o,i),$u(t,s,i),El(t,e)},tU=({indicatorSprite:r,element:t})=>{let e=t?.indicator?.offset??12,i=t.content[0]??null;Al(r,i,e)},eU=async({contentContainer:r,indicatorSprite:t,element:e,signal:i})=>{let s=PP(e.speed??50),o=e?.indicator?.offset??12,n=Math.max(1,Math.floor(1e3/s)),a=Math.max(1,Math.floor(4e3/s));for(let l=0;l<e.content.length;l++){if(i?.aborted||r.destroyed)return!1;let h=e.content[l];Al(t,h,o);for(let c=0;c<h.lineParts.length;c++){if(i?.aborted||r.destroyed)return!1;let u=h.lineParts[c],{text:d,furiganaText:f}=CP(u);f&&r.addChild(f),r.addChild(d);let p=u.text,m=u.furigana?.text||"",g=m.length;for(let _=0;_<p.length;_++){if(i?.aborted||r.destroyed)return!1;if(d.text=p.substring(0,_+1),t.x=mx(d,_)+o,f){let b=Math.round((_+1)/p.length*g);f.text=m.substring(0,b)}_<p.length-1&&await gx(n,i)}}l<e.content.length-1&&await gx(a,i)}return El(t,e),!0},rU=({container:r,contentContainer:t,indicatorSprite:e,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=PP(i.speed??50),{lines:l,lastTextObject:h,lastChunk:c,totalCharacters:u,maxLineHeight:d,bounds:f}=RP(t,i);if(Al(e,c,n),l.length===0||u===0||!l.some(A=>A.bounds.width>0&&A.bounds.height>0)||!globalThis.document||!s)return $u(e,h,n),El(e,i),!1;let p=Math.max(qk,Math.min(Kk,Math.round(d*Zk))),m=Math.max(1,Math.round(u/a*1e3)),g=l.map(A=>{let C=Math.max(1,A.totalCharacters),M=1+p/Math.max(1,A.bounds.width);return C*M}),_=g.reduce((A,C)=>A+C,0),b=[],y=0;for(let A=0;A<l.length;A++){let C=g[A],M=_>0?y/_:0;y+=C,b.push({...l[A],startProgress:M,endProgress:_>0?y/_:1})}let w=o.getVersion(),E=`${i.id}-soft-wipe`,v=b.map(A=>{let C=document.createElement("canvas");C.width=Math.max(1,Math.ceil(A.bounds.width+p)),C.height=Math.max(1,Math.ceil(A.bounds.height));let M=C.getContext("2d");if(!M)return null;let B=_s(C),k=new kt(B);return k.x=Math.floor(A.bounds.x-p),k.y=Math.floor(A.bounds.y),A.container.mask=k,t.addChild(k),{canvas:C,context:M,texture:B,sprite:k,line:A}});if(v.some(A=>A===null))return v.forEach(A=>{A&&(A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0))}),$u(e,h,n),El(e,i),!1;let S=!1,P=A=>{S||(S=!0,r[ui]===R&&delete r[ui],v.forEach(C=>{C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0)}),A&&($u(e,h,n),El(e,i)))},R=()=>{s.dispatch({type:"CANCEL",id:E}),P(!1)};return Jk(r,R),o.track(w),s.dispatch({type:"START",payload:{id:E,driver:"custom",duration:m,applyFrame:A=>{let C=m>0?Math.min(A/m,1):1,M=b[0],B=0;for(let k=0;k<b.length;k++){let U=b[k],O=v[k],$=Math.max(1e-6,U.endProgress-U.startProgress),N=Math.max(0,Math.min((C-U.startProgress)/$,1)),{context:L,canvas:z,texture:st}=O;if(L.clearRect(0,0,z.width,z.height),N<=0){st.source.update();continue}let Q=p,bt=0,Bt=U.bounds.width+p,Mt=Q+N*Bt,jt=Math.max(Q,Mt-p);jt>Q&&(L.fillStyle="#ffffff",L.fillRect(Q,bt,Math.min(jt-Q,U.bounds.width),U.bounds.height));let Zt=Math.max(Q,Mt-p),xt=Math.min(Q+U.bounds.width,Mt);if(xt>Zt){let ct=L.createLinearGradient(Zt,0,xt,0);ct.addColorStop(0,"rgba(255, 255, 255, 1)"),ct.addColorStop(1,"rgba(255, 255, 255, 0)"),L.fillStyle=ct,L.fillRect(Zt,bt,xt-Zt,U.bounds.height)}st.source.update(),(N<1||k===b.length-1)&&(M=U,B=Math.min(1,(Mt-Q)/Math.max(1,U.bounds.width)))}Al(e,M.chunk,n),e.x=M.bounds.x+Math.min(M.bounds.width,M.bounds.width*B)+n},applyTargetState:()=>{P(!1)},onComplete:()=>{o.complete(w),P(!0)},onCancel:()=>{o.complete(w),P(!1)},isValid:()=>!!r&&!r.destroyed&&!t.destroyed&&!e.destroyed}}),!0},Hi=async({container:r,element:t,completionTracker:e,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;xx(r),r.zIndex=s;let a=new nt({label:`${t.id}-content`}),l=Qk(t);r.addChild(a),r.addChild(l);try{if(n==="paused-initial"){t.revealEffect==="none"?AP({contentContainer:a,indicatorSprite:l,element:t}):tU({indicatorSprite:l,element:t});return}if(t.revealEffect==="softWipe"){if(!rU({container:r,contentContainer:a,indicatorSprite:l,element:t,animationBus:i,completionTracker:e})&&!o?.aborted&&!r.destroyed){let d=e.getVersion();e.track(d),e.complete(d)}return}let h=e.getVersion(),c=!1;e.track(h),t.revealEffect==="none"?(AP({contentContainer:a,indicatorSprite:l,element:t}),c=!0):c=await eU({contentContainer:a,indicatorSprite:l,element:t,signal:o}),c&&!o?.aborted&&!r.destroyed&&e.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var Xu=({suppressAnimations:r=!1,deferredMountOperations:t=[]}={})=>({suppressAnimations:r,deferredMountOperations:t}),MP=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let t=e=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",t);return}e?.detail?.deltaMS&&r.emitter.update(Number(e.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",t),r.container.customTickerHandler=t;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":Hi({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;zu({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},Pl=(r,t)=>{if(t?.type){if(!r?.suppressAnimations){MP(t);return}r.deferredMountOperations.push(t)}},ju=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},IP=(r,t)=>Pl(r,{type:"play-animated-sprite",animatedSprite:t}),BP=(r,t)=>Pl(r,{type:"play-video",video:t}),FP=(r,{app:t,emitter:e,container:i,tickerCallback:s})=>Pl(r,{type:"start-particles",app:t,emitter:e,container:i,tickerCallback:s}),Yu=(r,{container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>Pl(r,{type:"autoplay-text-reveal",container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n}),kP=(r,{animations:t,animationBus:e,completionTracker:i,element:s,targetState:o})=>Pl(r,{type:"start-update-animations",animations:t,animationBus:e,completionTracker:i,element:s,targetState:o}),UP=r=>{if(!r?.deferredMountOperations?.length)return;let t=r.deferredMountOperations.splice(0);for(let e of t)MP(e)};var GP=(r=[])=>{if(r instanceof Map)return r;let t=new Map;for(let e of r)t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e);return t},qu=(r,t)=>r instanceof Map?r.get(t)??[]:r.filter(e=>e.targetId===t),iU=(r,t)=>qu(r,t).filter(e=>e.type==="update"),Ku=(r,t)=>qu(r,t).find(e=>e.type==="transition")??null,sU=({animations:r,targetId:t,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=iU(r,t);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return EP(s,l),kP(a,{animations:l,animationBus:e,completionTracker:i,element:s,targetState:o}),!0}return zu({animations:l,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var at=sU;var DP=Symbol("routeGraphicsTextAnchorRatios"),NP=Symbol("routeGraphicsTextLayoutState"),OP=(r,t)=>typeof r!="number"||r===0?0:t/r,yx=r=>r?.align??_e.align,LP=r=>{let t=r[NP];return t?.fixedWidth&&typeof t.layoutWidth=="number"?t.layoutWidth:r.width},_x=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},Cl=r=>{let t=r.measuredWidth??r.width,e=_x(r.width,t,yx(r.textStyle));return{x:r.x+e,y:r.y}},Zu=(r,t)=>{let e=t.__fixedWidth&&typeof t.width=="number"?t.width:r.width||t.width,i=r.height||t.height,s=typeof t.__anchorXRatio=="number"?t.__anchorXRatio:OP(e,t.originX),o=typeof t.__anchorYRatio=="number"?t.__anchorYRatio:OP(i,t.originY);r[DP]={x:s,y:o},r[NP]={fixedWidth:!!t.__fixedWidth,layoutWidth:t.width}},oU=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?_e.lineHeight:r.lineHeight/r.fontSize,nU=(r,t)=>{if(!t)return r;let e={...r,...t};if(t.fontSize!==void 0||t.lineHeight!==void 0){let i=t.lineHeight??oU(r);e.lineHeight=Math.round(e.fontSize*i)}return e},zr=(r,t,e)=>{let i=r[DP],s=LP(r),o=nU(t,e);if(!i){vs(r,o);return}let n=_x(s,r.width,yx(r.style)),l=r.x-n+s*i.x,h=r.y+r.height*i.y;vs(r,o);let c=LP(r),u=_x(c,r.width,yx(r.style));r.x=l-c*i.x+u,r.y=h-r.height*i.y},Qu=(r,t)=>{let e=Cl({...t,measuredWidth:r.width,width:t.__fixedWidth&&typeof t.width=="number"?t.width:r.width});r.x=e.x,r.y=e.y};var aU=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},oe=r=>{let t=aU(r);return t===void 0||t===0};var HP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let h=new Ni({label:e.id});h.zIndex=l,h.text=e.content,vs(h,e.textStyle),Zu(h,e),h.alpha=e.alpha,Qu(h,e);let c=e?.hover,u=e?.click,d=e?.rightClick,f={isHovering:!1,isPressed:!1,isRightPressed:!1},p=({isHovering:m,isPressed:g,isRightPressed:_})=>{_&&d?.textStyle?zr(h,e.textStyle,d.textStyle):g&&u?.textStyle?zr(h,e.textStyle,u.textStyle):m&&c?.textStyle?zr(h,e.textStyle,c.textStyle):zr(h,e.textStyle)};if(c){let{cursor:m,soundSrc:g,payload:_}=c;h.eventMode="static";let b=()=>{f.isHovering=!0,_&&s&&s("hover",{_event:{id:h.label},..._}),m&&(h.cursor=m),g&&r.audioStage.add({id:`hover-${Date.now()}`,url:g,loop:!1}),p(f)},y=()=>{f.isHovering=!1,h.cursor="auto",p(f)};h.on("pointerover",b),h.on("pointerout",y)}if(u){let{soundSrc:m,soundVolume:g,payload:_}=u;h.eventMode="static";let b=E=>{oe(E)&&(f.isPressed=!0,p(f))},y=E=>{oe(E)&&(f.isPressed=!1,p(f),_&&s&&s("click",{_event:{id:h.label},..._}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:(g??1e3)/1e3}))},w=()=>{f.isPressed=!1,p(f)};h.on("pointerdown",b),h.on("pointerup",y),h.on("pointerupoutside",w)}if(d){let{soundSrc:m,payload:g}=d;h.eventMode="static";let _=()=>{f.isRightPressed=!0,p(f)},b=()=>{f.isRightPressed=!1,p(f)},y=()=>{f.isRightPressed=!1,p(f),g&&s&&s("rightClick",{_event:{id:h.label},...g}),m&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:m,loop:!1})},w=()=>{f.isRightPressed=!1,p(f)};h.on("rightdown",_),h.on("rightup",b),h.on("rightclick",y),h.on("rightupoutside",w)}t.addChild(h),at({animations:i,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{...Cl(e),alpha:e.alpha},renderContext:a})};var lU=Object.prototype.hasOwnProperty,Et=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!Et(r[n],t[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(t);if(s.length!==o.length)return!1;for(let n of s)if(!lU.call(t,n)||!Et(r[n],t[n]))return!1;return!0};var VP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(f=>f.label===e.id);if(!h)return;h.zIndex=l;let{alpha:c}=i,u=()=>{if(!Et(e,i)){h.text=i.content,vs(h,i.textStyle),Zu(h,i),Qu(h,i),h.alpha=c,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightclick"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let f=i?.hover,p=i?.click,m=i?.rightClick,g={isHovering:!1,isPressed:!1,isRightPressed:!1},_=({isHovering:b,isPressed:y,isRightPressed:w})=>{w&&m?.textStyle?zr(h,i.textStyle,m.textStyle):y&&p?.textStyle?zr(h,i.textStyle,p.textStyle):b&&f?.textStyle?zr(h,i.textStyle,f.textStyle):zr(h,i.textStyle)};if(f){let{cursor:b,soundSrc:y,payload:w}=f;h.eventMode="static";let E=()=>{g.isHovering=!0,w&&s&&s("hover",{_event:{id:h.label},...w}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1}),_(g)},v=()=>{g.isHovering=!1,h.cursor="auto",_(g)};h.on("pointerover",E),h.on("pointerout",v)}if(p){let{soundSrc:b,soundVolume:y,payload:w}=p;h.eventMode="static";let E=P=>{oe(P)&&(g.isPressed=!0,_(g))},v=P=>{oe(P)&&(g.isPressed=!1,_(g),w&&s&&s("click",{_event:{id:h.label},...w}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1,volume:(y??1e3)/1e3}))},S=()=>{g.isPressed=!1,_(g)};h.on("pointerdown",E),h.on("pointerup",v),h.on("pointerupoutside",S)}if(m){let{soundSrc:b,payload:y}=m;h.eventMode="static";let w=()=>{g.isRightPressed=!0,_(g)},E=()=>{g.isRightPressed=!1,_(g)},v=()=>{g.isRightPressed=!1,_(g),y&&s&&s("rightClick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:b,loop:!1})},S=()=>{g.isRightPressed=!1,_(g)};h.on("rightdown",w),h.on("rightup",E),h.on("rightclick",v),h.on("rightupoutside",S)}}};at({animations:o,targetId:e.id,animationBus:n,completionTracker:a,element:h,targetState:{...Cl(i),alpha:c},onComplete:()=>{u()}})||u()};var WP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var zP=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var Ce=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(bs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(bs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===bs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=zP({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var $P=({state:r})=>{let t={..._e,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),typeof r.width=="number"&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=Jt.measureText(e,new Ht(t)),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,h={...Ce({...r,width:a,height:n}),content:e,measuredWidth:o,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(h,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),h};var hU=fe({type:"text",add:HP,update:VP,delete:WP,parse:$P});var XP="__rtglRectScrollHandled",Ju=({canvas:r,rect:t,width:e,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;t.eventMode="static",t.hitArea=new tt(0,0,Math.round(e),Math.round(i));let l=(f,p)=>{p?.[XP]||(p&&(p[XP]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:t.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:t.label},...o.payload}))},h=()=>{a=!0},c=()=>{a=!1},u=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};t.on("pointerover",h),t.on("pointerout",c),t.on("wheel",u),r?.addEventListener("wheel",d,{passive:!1}),t._cleanupScrollInteraction=()=>{a=!1,t.off("pointerover",h),t.off("pointerout",c),t.off("wheel",u),r?.removeEventListener("wheel",d),t.hitArea=null,delete t._cleanupScrollInteraction}};var cU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,jP=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:h,x:c,y:u,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:b}=e,y=new de;y.label=h,y.zIndex=n;let w={x:c,y:u,alpha:g};_!==void 0&&(w.scaleX=_),b!==void 0&&(w.scaleY=b),(()=>{y.clear(),y.rect(0,0,Math.round(d),Math.round(f)).fill(cU(p)),y.x=Math.round(c),y.y=Math.round(u),y.alpha=g,y.scale.x=_??1,y.scale.y=b??1,m&&y.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let v=e?.hover,S=e?.click,P=e?.rightClick,R=e?.scrollUp,A=e?.scrollDown,C=e?.drag;if(v){let{cursor:M,soundSrc:B,payload:k}=v;y.eventMode="static";let U=()=>{k&&o&&o("hover",{_event:{id:y.label},...k}),M&&(y.cursor=M),B&&r.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},O=()=>{y.cursor="auto"};y.on("pointerover",U),y.on("pointerout",O)}if(S){let{soundSrc:M,soundVolume:B,payload:k}=S;y.eventMode="static";let U=O=>{oe(O)&&(k&&o&&o("click",{_event:{id:y.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(B??1e3)/1e3}))};y.on("pointerup",U)}if(P){let{soundSrc:M,payload:B}=P;y.eventMode="static";let k=()=>{B&&o&&o("rightClick",{_event:{id:y.label},...B}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};y.on("rightclick",k)}if((R||A)&&Ju({canvas:r.canvas,rect:y,width:d,height:f,scrollUpEvent:R,scrollDownEvent:A,eventHandler:o}),C){let{start:M,end:B,move:k}=C;y.eventMode="static";let U=()=>{y._isDragging=!0,M&&o&&o("dragStart",{_event:{id:y.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{y._isDragging=!1,B&&o&&o("dragEnd",{_event:{id:y.label},...typeof B?.payload=="object"?B.payload:{}})},$=N=>{k&&o&&y._isDragging&&o("dragMove",{_event:{id:y.label,x:N.global.x,y:N.global.y},...typeof k?.payload=="object"?k.payload:{}})};y.on("pointerdown",U),y.on("pointerup",O),y.on("globalpointermove",$),y.on("pointerupoutside",O)}t.addChild(y),at({animations:i,targetId:h,animationBus:s,completionTracker:a,element:y,targetState:w,renderContext:l})};var uU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,YP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(v=>v.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:b}=i,y={x:c,y:u,alpha:g};_!==void 0&&(y.scaleX=_),b!==void 0&&(y.scaleY=b);let w=()=>{if(!Et(e,i)){h._cleanupScrollInteraction?.(),h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(uU(p)),h.x=Math.round(c),h.y=Math.round(u),h.alpha=g,h.scale.x=_??1,h.scale.y=b??1,m&&h.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let v=i?.hover,S=i?.click,P=i?.rightClick,R=i?.scrollUp,A=i?.scrollDown,C=i?.drag;if(v){let{cursor:M,soundSrc:B,payload:k}=v;h.eventMode="static";let U=()=>{k&&n&&n("hover",{_event:{id:h.label},...k}),M&&(h.cursor=M),B&&r.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},O=()=>{h.cursor="auto"};h.on("pointerover",U),h.on("pointerout",O)}if(S){let{soundSrc:M,soundVolume:B,payload:k}=S;h.eventMode="static";let U=O=>{oe(O)&&(k&&n&&n("click",{_event:{id:h.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(B??1e3)/1e3}))};h.on("pointerup",U)}if(P){let{soundSrc:M,payload:B}=P;h.eventMode="static";let k=()=>{B&&n&&n("rightClick",{_event:{id:h.label},...B}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};h.on("rightclick",k)}if((R||A)&&Ju({canvas:r.canvas,rect:h,width:d,height:f,scrollUpEvent:R,scrollDownEvent:A,eventHandler:n}),C){let{start:M,end:B,move:k}=C;h.eventMode="static";let U=()=>{h._isDragging=!0,M&&n&&n("dragStart",{_event:{id:h.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{h._isDragging=!1,B&&n&&n("dragEnd",{_event:{id:h.label},...typeof B?.payload=="object"?B.payload:{}})},$=N=>{k&&n&&h._isDragging&&n("dragMove",{_event:{id:h.label,x:N.global.x,y:N.global.y},...typeof k?.payload=="object"?k.payload:{}})};h.on("pointerdown",U),h.on("pointerup",O),h.on("globalpointermove",$),h.on("pointerupoutside",O)}}};at({animations:s,targetId:e.id,animationBus:o,completionTracker:l,element:h,targetState:y,onComplete:()=>{w()}})||w()};var qP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var KP=({state:r})=>{let t=Ce(r),e=r.border?.width,i=t;return typeof e=="number"&&e>0&&(i={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:e}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var dU=fe({type:"rect",add:jP,update:YP,delete:qP,parse:KP});var ZP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:h,x:c,y:u,width:d,height:f,src:p,alpha:m}=e,g=p?I.from(p):I.EMPTY,_=new kt(g);_.label=h,_.zIndex=l,_.x=Math.round(c),_.y=Math.round(u),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let b=e?.hover,y=e?.click,w=e?.rightClick,E={isHovering:!1,isPressed:!1,isRightPressed:!1},v=({isHovering:S,isPressed:P,isRightPressed:R})=>{if(R&&w?.src){let A=I.from(w.src);_.texture=A}else if(P&&y?.src){let A=I.from(y.src);_.texture=A}else if(S&&b?.src){let A=I.from(b.src);_.texture=A}else _.texture=g};if(b){let{cursor:S,soundSrc:P,payload:R}=b;_.eventMode="static";let A=()=>{E.isHovering=!0,R&&s&&s("hover",{_event:{id:_.label},...R}),S&&(_.cursor=S),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1}),v(E)},C=()=>{E.isHovering=!1,_.cursor="auto",v(E)};_.on("pointerover",A),_.on("pointerout",C)}if(y){let{soundSrc:S,soundVolume:P,payload:R}=y;_.eventMode="static";let A=B=>{oe(B)&&(E.isPressed=!0,v(E))},C=B=>{oe(B)&&(E.isPressed=!1,v(E),R&&s&&s("click",{_event:{id:_.label},...R}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(P??1e3)/1e3}))},M=()=>{E.isPressed=!1,v(E)};_.on("pointerdown",A),_.on("pointerup",C),_.on("pointerupoutside",M)}if(w){let{soundSrc:S,payload:P}=w;_.eventMode="static";let R=()=>{E.isRightPressed=!0,v(E)},A=()=>{E.isRightPressed=!1,v(E)},C=()=>{E.isRightPressed=!1,v(E),P&&s&&s("rightClick",{_event:{id:_.label},...P}),S&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:S,loop:!1})},M=()=>{E.isRightPressed=!1,v(E)};_.on("rightdown",R),_.on("rightup",A),_.on("rightclick",C),_.on("rightupoutside",M)}t.addChild(_),at({animations:i,targetId:h,animationBus:o,completionTracker:n,element:_,targetState:{x:c,y:u,width:d,height:f,alpha:m},renderContext:a})};var QP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(y=>y.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:p,src:m,alpha:g}=i,_=()=>{if(!Et(e,i)){let y=m?I.from(m):I.EMPTY;h.texture=y,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(p),h.alpha=g,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightclick"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let w=i?.hover,E=i?.click,v=i?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},P=({isHovering:R,isPressed:A,isRightPressed:C})=>{if(C&&v?.src){let M=I.from(v.src);h.texture=M}else if(A&&E?.src){let M=I.from(E.src);h.texture=M}else if(R&&w?.src){let M=I.from(w.src);h.texture=M}else h.texture=y};if(w){let{cursor:R,soundSrc:A,payload:C}=w;h.eventMode="static";let M=()=>{S.isHovering=!0,C&&a&&a("hover",{_event:{id:h.label},...C}),R&&(h.cursor=R),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1}),P(S)},B=()=>{S.isHovering=!1,h.cursor="auto",P(S)};h.on("pointerover",M),h.on("pointerout",B)}if(E){let{soundSrc:R,soundVolume:A,payload:C}=E;h.eventMode="static";let M=U=>{oe(U)&&(S.isPressed=!0,P(S))},B=U=>{oe(U)&&(S.isPressed=!1,P(S),C&&a&&a("click",{_event:{id:h.label},...C}),R&&r.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:(A??1e3)/1e3}))},k=()=>{S.isPressed=!1,P(S)};h.on("pointerdown",M),h.on("pointerup",B),h.on("pointerupoutside",k)}if(v){let{soundSrc:R,payload:A}=v;h.eventMode="static";let C=()=>{S.isRightPressed=!0,P(S)},M=()=>{S.isRightPressed=!1,P(S)},B=()=>{S.isRightPressed=!1,P(S),A&&a&&a("rightClick",{_event:{id:h.label},...A}),R&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},k=()=>{S.isRightPressed=!1,P(S)};h.on("rightdown",C),h.on("rightup",M),h.on("rightclick",B),h.on("rightupoutside",k)}}};at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:p,alpha:g},onComplete:()=>{_()}})||_()};var JP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var tC=({state:r})=>({...Ce(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var fU=fe({type:"sprite",add:ZP,update:QP,delete:JP,parse:tC});var pU=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,bx=({videoElement:r,video:t})=>{t&&r?._videoEndedListener&&t.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},td=({videoElement:r,video:t,loop:e,completionTracker:i})=>{if(bx({videoElement:r,video:t}),(e??!1)||pU(t))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};t.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var eC=({parent:r,element:t,renderContext:e,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:h,src:c,volume:u,loop:d,alpha:f}=t,p=I.from(c),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=u/1e3,m.muted=!1;let g=new kt(p);g.label=o,g.zIndex=s,g._videoEndedListener=void 0,g._playbackStateVersion=null,g.x=Math.round(n),g.y=Math.round(a),g.width=Math.round(l),g.height=Math.round(h),g.alpha=f??1,td({videoElement:g,video:m,loop:d,completionTracker:i}),BP(e,m),r.addChild(g)};var rC=({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(g=>g.label===t.id);if(!l)return;l.zIndex=a;let{x:h,y:c,width:u,height:d,alpha:f}=e,p=()=>{if(!Et(t,e)){l.x=Math.round(h),l.y=Math.round(c),l.width=Math.round(u),l.height=Math.round(d),l.alpha=f??1;let g=l.texture.source.resource;if(t.src!==e.src){let _=g;bx({videoElement:l,video:_}),_&&_.pause();let b=I.from(e.src);l.texture=b,g=b.source.resource,g.muted=!1,g.pause(),g.currentTime=0}td({videoElement:l,video:g,loop:e.loop,completionTracker:n}),g.volume=e.volume/1e3,g.loop=e.loop??!1,t.src!==e.src&&g.play()}};at({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:l,targetState:{x:h,y:c,width:u,height:d,alpha:f??1},onComplete:p})||p()};var iC=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===t.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var sC=({state:r})=>({...Ce(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var mU=fe({type:"video",add:eC,update:rC,delete:iC,parse:sC});var oC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:h,x:c,y:u,width:d,height:f,alpha:p,thumbSrc:m,barSrc:g,direction:_,min:b,max:y,step:w,initialValue:E,originX:v,originY:S,hover:P,change:R}=e,A=new nt;A.label=h,A.zIndex=l,A.x=c,A.y=u,A.alpha=p,A.sortableChildren=!0,A.eventMode="static";let C=0,M=g?I.from(g):I.EMPTY,B=new kt(M);B.label=`${h}-bar`,B.eventMode="static";let k=m?I.from(m):I.EMPTY,U=new kt(k);U.label=`${h}-thumb`,U.eventMode="static";let O=E??b,$=y-b,N=xt=>{let ct=(xt-b)/$;_==="horizontal"?(U.x=ct*(B.width-U.width),U.y=(B.height-U.height)/2):(U.x=(B.width-U.width)/2,U.y=ct*(B.height-U.height))};(()=>{B.width=d,B.height=f;let xt=_==="horizontal"?f-C*2:d-C*2,ct=m?I.from(m):I.EMPTY,vt=ct.width,Ot=ct.height,ee=xt/vt,re=xt/Ot,He=Math.min(ee,re);U.width=vt*He,U.height=Ot*He,N(O)})();let z=k,st=M,Q=!1,bt=xt=>{let ct;if(_==="horizontal"){let Ot=xt.x-U.width/2;ct=Math.max(0,Math.min(1,Ot/(B.width-U.width)))}else{let Ot=xt.y-U.height/2;ct=Math.max(0,Math.min(1,Ot/(B.height-U.height)))}let vt=b+ct*$;return w>0&&(vt=Math.round((vt-b)/w)*w+b,vt=Math.max(b,Math.min(y,vt))),vt},Bt=xt=>{let ct=A.toLocal(xt.global),vt=bt(ct);vt!==O&&(O=vt,N(O),R?.payload&&n&&n("change",{_event:{id:h,value:O},...R.payload}))},Mt=xt=>{Q=!0,Bt(xt)},jt=xt=>{Q&&Bt(xt)},Zt=()=>{Q&&(Q=!1)};if(A.on("pointerdown",Mt),A.on("globalpointermove",jt),A.on("pointerup",Zt),A.on("pointerupoutside",Zt),P){let{cursor:xt,soundSrc:ct,thumbSrc:vt,barSrc:Ot}=P,ee=()=>{xt&&(B.cursor=xt,U.cursor=xt),ct&&r.audioStage.add({id:`hover-${Date.now()}`,url:ct,loop:!1}),vt&&(U.texture=I.from(vt)),Ot&&(B.texture=I.from(Ot))},re=()=>{Q||(B.cursor="auto",U.cursor="auto",U.texture=z,B.texture=st)};A.on("pointerover",ee),A.on("pointerout",re),A.on("pointerupoutside",re)}A.addChild(B),A.addChild(U),t.addChild(A),at({animations:i,targetId:h,animationBus:s,completionTracker:o,element:A,targetState:{x:c,y:u,alpha:p},renderContext:a})};var nC=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(!Et(e,i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let m=h.getChildByLabel(`${i.id}-bar`),g=h.getChildByLabel(`${i.id}-thumb`),_=!Et(e.hover,i.hover)||!Et(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(m&&g){m.width=i.width,m.height=i.height;let b=0,y=i.direction==="horizontal"?i.height-b*2:i.width-b*2,w=i.thumbSrc?I.from(i.thumbSrc):I.EMPTY,E=w.width||16,v=w.height||16,S=y/E,P=y/v,R=Math.min(S,P);if(g.width=E*R,g.height=v*R,e.barSrc!==i.barSrc){let M=i.barSrc?I.from(i.barSrc):I.EMPTY;m.texture=M}if(e.thumbSrc!==i.thumbSrc){let M=i.thumbSrc?I.from(i.thumbSrc):I.EMPTY;g.texture=M}let A=i.max-i.min,C=(i.initialValue-i.min)/A;i.direction==="horizontal"?(g.x=C*(m.width-g.width),g.y=(m.height-g.height)/2):(g.x=(m.width-g.width)/2,g.y=C*(m.height-g.height))}if(_&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),_){let{hover:b,change:y,min:w,max:E,step:v,direction:S,initialValue:P}=i,R=P??w,A=E-w;h.eventMode="static";let C=z=>{let st=(z-w)/A;S==="horizontal"?(g.x=st*(m.width-g.width),g.y=(m.height-g.height)/2):(g.x=(m.width-g.width)/2,g.y=st*(m.height-g.height))},M=z=>{let st;if(S==="horizontal"){let bt=z.x-g.width/2;st=Math.max(0,Math.min(1,bt/(m.width-g.width)))}else{let bt=z.y-g.height/2;st=Math.max(0,Math.min(1,bt/(m.height-g.height)))}let Q=w+st*A;return v>0&&(Q=Math.round((Q-w)/v)*v+w,Q=Math.max(w,Math.min(E,Q))),Q},B=g.texture,k=m.texture,U=!1,O=z=>{let st=h.toLocal(z.global),Q=M(st);Q!==R&&(R=Q,C(R),y?.payload&&a&&a("change",{_event:{id:i.id,value:R},...y.payload}))},$=z=>{U=!0,O(z)},N=z=>{U&&O(z)},L=()=>{U&&(U=!1)};if(h.on("pointerdown",$),h.on("globalpointermove",N),h.on("pointerup",L),h.on("pointerupoutside",L),b){let{cursor:z,soundSrc:st,thumbSrc:Q,barSrc:bt}=b,Bt=()=>{z&&(h.cursor=z,g.cursor=z),st&&r.audioStage.add({id:`hover-${Date.now()}`,url:st,loop:!1}),Q&&(g.texture=I.from(Q)),bt&&(m.texture=I.from(bt))},Mt=()=>{U||(h.cursor="auto",g.cursor="auto",g.texture=B,m.texture=k)};h.on("pointerover",Bt),h.on("pointerout",Mt),h.on("pointerupoutside",Mt)}}}},{x:u,y:d,alpha:f}=i;at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,alpha:f},onComplete:c})||c()};var aC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};at({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var lC=({state:r})=>{let t=Ce(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<e||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var gU=fe({type:"slider",add:oC,update:nC,delete:aC,parse:lC});var Rl=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(h=>{s=Math.max(h.width+h.x,s),o=Math.max(h.height+h.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let h=new nt({label:`${r.label}-content`});[...r.children].forEach(g=>{h.addChild(g)}),r.addChild(h);let u=new de({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),h.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),p=t.anchorToBottom&&n?d:0,m=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(h.y=p,h.x=m),e&&(r.eventMode="static",r.hitArea=new tt(0,0,t.width||s,t.height||o),r.on("wheel",g=>{if(g.preventDefault(),n&&g.deltaY!==0){let _=p-g.deltaY;_>0?p=0:_<d?p=d:p=_,h.y=p}if(a&&(g.deltaX!==0||g.shiftKey&&g.deltaY!==0)){let _=g.deltaX!==0?g.deltaX:g.deltaY,b=m-_;b>0?m=0:b<f?m=f:m=b,h.x=m}}))}},vx=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var Ml=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of Ml(e))t.add(i);return t};var hC=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=Ml(u),f=e instanceof Map?Array.from(e.keys()).some(p=>d.has(p)):e.find(p=>d.has(p.targetId));(!Et(c,u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var ed=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,xU=r=>r,yU=r=>r*r,_U=r=>1-(1-r)*(1-r),bU=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,cC=Object.freeze({linear:xU,easeInQuad:yU,easeOutQuad:_U,easeInOutQuad:bU,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-ed(1-r),easeOutBounce:ed,easeInOutBounce:r=>r<.5?(1-ed(1-2*r))/2:(1+ed(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),Tx=Object.freeze(Object.keys(cC)),vU=(r="linear")=>{let t=cC[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},Il=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},Bl=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},Fl=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*vU(o)(l)}}return r[r.length-1].value};var TU={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},wx=r=>Math.min(1,Math.max(0,r)),rd=(r,t,e)=>{if(r===t)return e<r?0:1;let i=wx((e-r)/(t-r));return i*i*(3-2*i)},fC=r=>r.getLocalBounds().rectangle.clone(),pC=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),uC=(r,t)=>{let e=pC(fC(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new kt(i);s.x=e.x,s.y=e.y;let o=new nt;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},SU=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:Il([{value:e.initialValue??TU[t]??0},...e.keyframes])})),id=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=SU(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:Bl(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=Fl(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},wU=r=>Il([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),EU=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},AU=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},Sx=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new kt(I.from(t));a.width=e,a.height=i;let l=new nt;l.addChild(a);let h=hi.create({width:e,height:i});r.renderer.render({container:l,target:h,clear:!0});let c=r.renderer.extract.pixels(h).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=AU(c,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),h.destroy(!0),n},PU=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=Sx({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(e*i)},CU=(r,t,e,i)=>{let s=wU(t),o=Bl([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=Sx({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(h,c)=>rd(h-n,h+n,l[c]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(h=>Sx({app:r,texture:h,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(h,c)=>{let u=wx(h)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),p=Math.min(l.length-1,f+1),m=u-f,g=(l[f][c]*(1-m)+l[p][c]*m)/255;return rd(h-n,h+n,g)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return rd(h-n,h+n,l[d][c]/255)},destroy:()=>{}}}let a=PU(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,h)=>rd(l-n,l+n,a[h]/255),destroy:()=>{}}},RU=r=>{let t=new nt;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return pC(fC(t))},dC=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new G(1,0,0,1,-i.x,-i.y)})},kl=r=>{r?.texture?.destroy(!0)},MU=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new nt;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=id(e?.wrapper??null,t.prev?.tween,r),a=id(i?.wrapper??null,t.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),kl(e),kl(i)}}},IU=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=RU([e,i]),n=new nt,a=new nt;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=hi.create({width:o.width,height:o.height}),h=hi.create({width:o.width,height:o.height}),{canvas:c,context:u}=EU(o.width,o.height),d=u.createImageData(o.width,o.height),f=I.from(c),p=new nt;p.zIndex=s;let m=new kt(f);m.x=o.x,m.y=o.y,p.addChild(m);let g=CU(r,t.mask,o.width,o.height),_=id(e?.wrapper??null,t.prev?.tween,r),b=id(i?.wrapper??null,t.next?.tween,r),y=new Uint8ClampedArray(o.width*o.height*4);return{overlay:p,duration:Math.max(_.duration,b.duration,g.duration),apply:w=>{_.apply(w),b.apply(w);let E=y,v=y;e?.wrapper&&(dC({app:r,container:n,target:l,frame:o}),E=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(dC({app:r,container:a,target:h,frame:o}),v=r.renderer.extract.pixels(h).pixels);let S=wx(Fl(g.progressTimeline,w)),P=d.data;for(let R=0,A=0;R<P.length;R+=4,A+=1){let C=g.sample(S,A),M=1-C;P[R]=Math.round(E[R]*M+v[R]*C),P[R+1]=Math.round(E[R+1]*M+v[R+1]*C),P[R+2]=Math.round(E[R+2]*M+v[R+2]*C),P[R+3]=Math.round(E[R+3]*M+v[R+3]*C)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{p.removeFromParent(),p.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),h.destroy(!0),f.destroy(!0),kl(e),kl(i),g.destroy()}}},BU=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?IU({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):MU({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),FU=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:h,zIndex:c,signal:u})=>{if(!e)return null;let d=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:h,zIndex:c,signal:u});return d&&typeof d.then=="function"?d.then(()=>u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null):u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null},kU=async r=>r&&typeof r.then=="function"?r:r??null,sd=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,renderContext:c,plugin:u,zIndex:d,signal:f})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||t.destroyed)return;let p=e?t.children.find(M=>M.label===e.id)??null:null;if(e&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${e.id}".`);let m=p?uC(r,p):null,g=new nt,_=Xu({suppressAnimations:!0}),b=a.getVersion(),y=!1,w=()=>{y||(a.track(b),y=!0)},E=()=>{y&&(a.complete(b),y=!1)},v=({flushDeferredEffects:M})=>{if(!R){if(R=!0,S.value&&!S.value.destroyed&&(S.value.visible=!0),P.value?.destroy(),M){UP(_);return}ju(_)}},S={value:null},P={value:null},R=!1;w();let A=M=>{if(f?.aborted||t.destroyed){ju(_),g.destroy({children:!0}),kl(m),E();return}if(i&&!M)throw ju(_),E(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);S.value=M;let B=M?uC(r,M):null;g.destroy({children:!1}),p&&u.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,renderContext:c,signal:f}),M&&(M.zIndex=d,t.addChild(M),M.visible=!1);let k=BU({app:r,animation:s,prevSubject:m,nextSubject:B,zIndex:d});P.value=k,t.addChild(k.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:k.duration,applyFrame:k.apply,applyTargetState:()=>{v({flushDeferredEffects:!1})},onComplete:()=>{v({flushDeferredEffects:!0}),E()},onCancel:()=>{E()},isValid:()=>!!k.overlay&&!k.overlay.destroyed&&(!M||!M.destroyed)}})},C=i?FU({app:r,parent:g,nextElement:i,plugin:u,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:h,renderContext:_,zIndex:d,signal:f}):null;if(C&&typeof C.then=="function"){kU(C).then(A);return}A(C??null)};var Ts=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h=Xu(),signal:c})=>{t.sortableChildren=!0;let u=new Map(l.map(y=>[y.type,y])),d=GP(s),f=new Map;for(let y=0;y<i.length;y++)f.set(i[y].id,y);let{toAddElement:p,toDeleteElement:m,toUpdateElement:g}=hC(e,i,s),_=y=>{let w=u.get(y);if(!w)throw new Error(`No plugin found for element type: ${y}`);return w},b=y=>t.children.find(w=>w.label===y)?.zIndex??-1;for(let y of t.children){let w=f.get(y.label);w!==void 0&&(y.zIndex=w)}for(let y of m){let w=h.suppressAnimations?null:Ku(d,y.id),E=_(y.type);if(w){sd({app:r,parent:t,prevElement:y,nextElement:null,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,plugin:E,zIndex:b(y.id),signal:c});continue}E.delete({app:r,parent:t,element:y,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,signal:c})}for(let y of p){let w=h.suppressAnimations?null:Ku(d,y.id),E=_(y.type),v=f.get(y.id)??-1;if(w){sd({app:r,parent:t,prevElement:null,nextElement:y,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,plugin:E,zIndex:v,signal:c});continue}E.add({app:r,parent:t,element:y,animations:h.suppressAnimations||y.type==="container"?d:[],eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:h,zIndex:v,signal:c})}for(let{prev:y,next:w}of g){let E=_(w.type),v=f.get(w.id)??-1,S=h.suppressAnimations?null:Ku(d,w.id);if(S){sd({app:r,parent:t,prevElement:y,nextElement:w,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,plugin:E,zIndex:v,signal:c});continue}E.update({app:r,parent:t,prevElement:y,nextElement:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:h,zIndex:v,signal:c})}};var UU=(r=[])=>{let t=new Set;for(let e of r)if(e?.id){if(t.has(e.id))return!0;t.add(e.id)}return!1},GU=({app:r,container:t,children:e,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let h of e){let c=o.find(u=>u.type===h.type);if(!c)throw new Error(`No plugin found for child element type: ${h.type}`);c.add({app:r,parent:t,element:h,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},mC=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:h,signal:c})=>{let{id:u,x:d,y:f,children:p,scroll:m,alpha:g}=e,_=new nt;_.label=u,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=g,t.addChild(_),p&&p.length>0&&(UU(p)?GU({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:h,signal:c}):Ts({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:h,eventHandler:s,elementPlugins:n,renderContext:a,signal:c})),(m||e.anchorToBottom)&&Rl({container:_,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom});let y=e?.hover,w=e?.click,E=e?.rightClick;if(y){let{cursor:v,soundSrc:S,payload:P}=y;_.eventMode="static";let R=()=>{P&&s&&s("hover",{_event:{id:_.label},...P}),v&&(_.cursor=v),S&&r.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1})},A=()=>{_.cursor="auto"};_.on("pointerover",R),_.on("pointerout",A)}if(w){let{soundSrc:v,soundVolume:S,payload:P}=w;_.eventMode="static";let R=A=>{oe(A)&&(P&&s&&s("click",{_event:{id:_.label},...P}),v&&r.audioStage.add({id:`click-${Date.now()}`,url:v,loop:!1,volume:(S??1e3)/1e3}))};_.on("pointerup",R)}if(E){let{soundSrc:v,payload:S}=E;_.eventMode="static";let P=()=>{S&&s&&s("rightClick",{_event:{id:_.label},...S}),v&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:v,loop:!1})};_.on("rightclick",P)}};var gC=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:h,completionTracker:c,signal:u})=>{let d=t.children.find(b=>b.label===e.id);if(!d)return;d.zIndex=h;let{x:f,y:p,alpha:m}=i,g=()=>{if(!Et(e,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1,d.removeAllListeners("pointerover"),d.removeAllListeners("pointerout"),d.removeAllListeners("pointerup"),d.removeAllListeners("rightclick"),d.eventMode="auto",d.cursor="auto";let E=i?.hover,v=i?.click,S=i?.rightClick,P=!!(E||v||S);if(E){let{cursor:C,soundSrc:M,payload:B}=E;d.eventMode="static";let k=()=>{B&&s&&s("hover",{_event:{id:d.label},...B}),C&&(d.cursor=C),M&&r.audioStage.add({id:`hover-${Date.now()}`,url:M,loop:!1})},U=()=>{d.cursor="auto"};d.on("pointerover",k),d.on("pointerout",U)}if(v){let{soundSrc:C,soundVolume:M,payload:B}=v;d.eventMode="static";let k=U=>{oe(U)&&(B&&s&&s("click",{_event:{id:d.label},...B}),C&&r.audioStage.add({id:`click-${Date.now()}`,url:C,loop:!1,volume:(M??1e3)/1e3}))};d.on("pointerup",k)}if(S){let{soundSrc:C,payload:M}=S;d.eventMode="static";let B=()=>{M&&s&&s("rightClick",{_event:{id:d.label},...M}),C&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:C,loop:!1})};d.on("rightclick",B)}let R=e.scroll||e.anchorToBottom,A=i.scroll||i.anchorToBottom;R!==A?A?Rl({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):vx({container:d}):A&&(vx({container:d}),Rl({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom})),!i.scroll&&P&&(d.eventMode="static")}let b=!Et(e.children,i.children),y=Ml({children:i.children}),w=Array.from(y).some(E=>qu(o,E).length>0);if(b||w){let v=d.children.find(S=>S.label===`${i.id}-content`)||d;Ts({app:r,parent:v,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:c,renderContext:l,signal:u})}};at({animations:o,targetId:e.id,animationBus:n,completionTracker:c,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var xC=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};at({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var yC=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let y=0;y<o.length;y++){let w=y<o.length-1?s:0,E=o[y];y>0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=p,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let v=t.find(S=>S.type===E.type);if(v){let S=(E.scaleX??1)*(r.scaleX??1),P=(E.scaleY??1)*(r.scaleY??1);E=v.parse({state:{...E,scaleX:S,scaleY:P},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+m>r.width&&!i&&!r.anchorToBottom?(h=0,m=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+w,m=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+g>r.height&&!i&&!r.anchorToBottom?(c=0,g=0,p+=d+s,d=E.width,E.x=p,E.y=0):d=Math.max(d,E.width),c+=E.height+w,g=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let b={...Ce({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(b.rightClick=r.rightClick),b};var OU=fe({type:"container",add:mC,update:gC,delete:xC,parse:yC});var _C=async({parent:r,element:t,animationBus:e,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new nt;if(a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),i?.suppressAnimations&&t.revealEffect!=="none"){await Hi({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"paused-initial"}),Yu(i,{container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n});return}await Hi({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"autoplay"})};var bC=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),LU=(r,t)=>bC(r)!==bC(t),vC=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let h=r.children.find(d=>d.label===t.id);if(!h)return;let c=async()=>{if(e.x!==void 0&&(h.x=e.x),e.y!==void 0&&(h.y=e.y),e.alpha!==void 0&&(h.alpha=e.alpha),!!LU(t,e)){if(o?.suppressAnimations===!0&&e.revealEffect!=="none"){await Hi({container:h,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Yu(o,{container:h,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Hi({container:h,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})}};at({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:h,targetState:{x:e.x??h.x,y:e.y??h.y,alpha:e.alpha??h.alpha},onComplete:()=>{c()}})||await c()};var TC=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(xx(o),o.destroy({children:!0}))};at({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var DU=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=0,h=[...r],c=new WeakSet,u=Math.max(10,r.reduce((f,p)=>f+(p?.text?.length??0),0)*4);for(;h.length>0;){if(l+=1,l>u)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let f=h[0];if(!f.text||f.text.length===0){h.shift();continue}let p=f.text,m=Math.max(1,Math.round(t-s)),g={...f.textStyle,wordWrapWidth:m},_=Jt.measureText(f.text,new Ht(g));if(_.lineWidths[0]>m&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let b=_.lines[0]??"",y=_.lines.slice(1).join(" ");if(_.lines.length===1&&f.text.endsWith(" ")&&!b.endsWith(" ")&&(b+=" "),b.length===0&&p.length>0){let S=p.match(/^\s+/)?.[0]??"";b=S.length>0?S:p[0],y=p.slice(b.length)}if(y===p){let S=p.match(/^\s+/)?.[0]??p[0]??"";if(S.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");b=S,y=p.slice(S.length)}let w=Jt.measureText(b,new Ht({...f.textStyle,wordWrap:!1,breakWords:!1})),E=Math.max(0,Math.round(w.width??_.lineWidths[0]??0)),v={text:b,textStyle:g,height:w.height,x:s,y:o};if(f.furigana&&!c.has(f)){c.add(f);let S=Jt.measureText(f.furigana.text,new Ht(f.furigana.textStyle)),P=-S.height+o+2,R={text:f.furigana.text,textStyle:f.furigana.textStyle,x:Math.round(s+(E-S.width)/2),y:P};v.furigana=R}i.push(v),n=Math.max(n,w.height),s+=E,a=Math.max(a,s),y&&y.length>0?f.text=y:h.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let f=0;f<e.length;f++){let p=e[f].lineMaxHeight;e[f].lineParts=e[f].lineParts.map(m=>{let g=m.height;m.height&&delete m.height;let _=m.y+(p-g),b=m.furigana;return b&&(b.y=b.y-m.y+_),{...m,...b&&{furigana:b},y:_}})}let d=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:d}},SC=({state:r})=>{let t={..._e,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let p={...t,...c.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(c.furigana.text),textStyle:p}}return{text:String(c.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=DU(e,i),a=r.width||o,h=Ce({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var NU=fe({type:"text-revealing",add:_C,update:vC,delete:TC,parse:SC});var od=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},nd=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var wC=async({app:r,parent:t,element:e,renderContext:i,zIndex:s,signal:o})=>{if(o?.aborted)return;let{id:n,x:a,y:l,width:h,height:c,spritesheetSrc:u,spritesheetData:d,animation:f,alpha:p}=e,m=d,g=Object.keys(m.frames),_=new Ci(I.from(u),m);if(await _.parse(),o?.aborted||t.destroyed)return;let b=f.frames.map(w=>_.textures[g[w]]),y=new wl(b);y.label=n,y.zIndex=s,y.animationSpeed=f.animationSpeed??.5,y.loop=f.loop??!0,r.debug?od(y,n,r.debug):IP(i,y),y.x=Math.round(a),y.y=Math.round(l),y.width=Math.round(h),y.height=Math.round(c),y.alpha=p,t.addChild(y)};var EC=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let c=async()=>{if(!(l?.aborted||h.destroyed)&&!Et(e,i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,!Et(e.animation,i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let _=i.spritesheetData,b=Object.keys(_.frames),y=new Ci(I.from(i.spritesheetSrc),_);if(await y.parse(),l?.aborted||h.destroyed)return;let w=i.animation.frames.map(E=>y.textures[b[E]]);h.textures=w,r.debug?e.id!==i.id&&(nd(h),od(h,i.id,r.debug)):h.play()}},{x:u,y:d,width:f,height:p,alpha:m}=i;at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:p,alpha:m},onComplete:()=>{c()}})||await c()};var AC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&nd(n),n&&!n.destroyed&&(n.stop(),n.destroy())};at({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var PC=({state:r})=>({...Ce(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var HU=fe({type:"animated-sprite",add:wC,update:EC,delete:AC,parse:PC});var VU=fx({type:"tween"});var Ss=new Map,WU=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),CC=r=>Ss.has(r),Ul=r=>{let t=Ss.get(r);t!==void 0&&(clearTimeout(t),Ss.delete(r))},Ex=({app:r,element:t})=>{let e=WU(t);if(Ul(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{Ss.delete(e.id),r.audioStage.add(e)},t.delay);Ss.set(e.id,i);return}r.audioStage.add(e)},Ax=()=>{for(let r of Ss.values())clearTimeout(r);Ss.clear()},RC=({app:r,element:t})=>{Ex({app:r,element:t})};var MC=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),Ex({app:r,element:e});return}if(CC(i)){Ul(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var IC=({app:r,element:t})=>{Ul(t.id),r.audioStage.remove(t.id)};var zU=px({type:"sound",add:RC,update:MC,delete:IC});var Gl=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Px(r){let t=new de;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Cx(r){let t=new de;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Rx(r){let t=new de;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Ol(r,t,e){return r+(t-r)*e}function ld(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function BC(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(Ol(i,n,e)),c=Math.round(Ol(s,a,e)),u=Math.round(Ol(o,l,e));return h<<16|c<<8|u}var ad=class r{constructor(t,e,i=!1){this.value=i?ld(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Er=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=ad.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?BC(e.value,e.next.value,i):Ol(e.value,e.next.value,i)}};var hd=class{static type="alpha";constructor(t){this.list=new Er(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},cd=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var ud=class{static type="scale";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},dd=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var $U=Math.PI/180,fd=class{static type="speed";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},pd=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},md=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*$U}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Odt=Math.PI/180,gd=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},xd=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Vi=Math.PI/180,yd=class{static type="rotation";constructor(t){this.minStart=t.minStart*Vi,this.maxStart=t.maxStart*Vi,this.minSpeed=t.minSpeed*Vi,this.maxSpeed=t.maxSpeed*Vi,this.accel=(t.accel??0)*Vi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},_d=class{static type="rotationStatic";constructor(t){this.min=t.min*Vi,this.max=t.max*Vi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},bd=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Vi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var vd=class{static type="color";constructor(t){this.list=new Er(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Td=class{static type="colorStatic";constructor(t){this.color=ld(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var Sd=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},wd=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Mx=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Ix=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},XU={rect:Sd,rectangle:Sd,torus:wd,circle:wd,point:Mx,line:Ix};var Ed=class{static type="spawnShape";constructor(t){let e=XU[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},Ad=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var FC=new Map,kC=new Map;function Bx(r,t){FC.set(r,t)}function Re(r){kC.set(r.type,r)}function UC(r,t){let e=FC.get(r);return e?e(t):null}function GC(r){return kC.get(r)}Bx("circle",Rx);Bx("snowflake",Px);Bx("raindrop",Cx);Re(hd);Re(cd);Re(ud);Re(dd);Re(fd);Re(pd);Re(md);Re(gd);Re(xd);Re(yd);Re(_d);Re(bd);Re(vd);Re(Td);Re(Ed);Re(Ad);var Pd=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var Ll=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new Pd(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=GC(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new Gl(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function jU(r,t){let e=new de,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Dl=({app:r,parent:t,element:e,renderContext:i,zIndex:s})=>{let o=new nt;o.label=e.id,o.zIndex=s,t.addChild(o);let n=e.width,a=e.height;o.x=e.x??0,o.y=e.y??0;let l={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},h;if(typeof e.texture=="object"&&e.texture.shape)h=jU(r,e.texture);else{let d=e.texture??"circle";if(h=UC(d,r),!h)try{h=I.from(d)}catch{console.warn(`Failed to load particle texture: ${d}`);return}}l.texture=h;let c=new Ll(o,l);if(o.emitter=c,l.recycleOnBounds){let d=Math.min(e.count??100,l.maxParticles);c.spawn(d);let f=c._activeFirst;for(;f;)f.y=c.random()*a,f.age=c.random()*f.maxLife*.8,f=f.next}let u=d=>{if(c.destroyed){r.ticker.remove(u);return}c.update(d.deltaTime/60)};o.tickerCallback=u,FP(i,{app:r,emitter:c,container:o,tickerCallback:u}),e.alpha!==void 0&&(o.alpha=e.alpha)};var Cd=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};at({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var OC=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){Dl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,YU(e,i))Cd({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),Dl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let c=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};at({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:c})||c()}};function YU(r,t){return r.count!==t.count||!Et(r.texture,t.texture)||!Et(r.behaviors,t.behaviors)||!Et(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function LC(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(bs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(bs).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function DC(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function NC(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function HC(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function VC(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function WC(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var zC=({state:r})=>{LC(r),DC(r),NC(r),HC(r),VC(r),WC(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var qU=fe({type:"particles",add:Dl,update:OC,delete:Cd,parse:zC});var $C=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Fx=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=$C(t,e);for(let a of o){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Je=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Je||{}),kx=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(kx||{}),Rd=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Rd||{}),et=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(et||{}),Ko=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ko||{}),D=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(D||{}),di=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(di||{}),lt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(lt||{}),W=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(W||{}),mr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(mr||{}),Nl=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Nl||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),tr=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(tr||{}),Wi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Wi||{}),Md=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Md||{}),De=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(De||{}),ne=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(ne||{});var Rt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Rt||{}),Ye=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Ye||{});var Ux={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:Ux,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};hp();var KU=Ei.default??Ei,Pr=KU(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ms=Zi(jC(),1),HL=Zi(Rc(),1);var my=Zi(hI(),1);var cI={};function ft(r,t,e=3){if(cI[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1145
1145
  Deprecated since v${r}`):(i=i.split(`
1146
1146
  `).splice(e).join(`
1147
1147
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
1148
1148
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
1149
- Deprecated since v${r}`),console.warn(i))),hI[t]=!0}var my;function gy(){return typeof my>"u"&&(my=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let t=K.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),my}kf();Uf();Nh([Hh]);var ln=class $d{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 $d)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=$d.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=$d.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=qe(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};ln.shared=new ln,ln.temp=new ln,ln.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Cr=ln;function kL(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[et.NORMAL_NPM]=et.NORMAL,r[et.ADD_NPM]=et.ADD,r[et.SCREEN_NPM]=et.SCREEN,t[et.NORMAL]=et.NORMAL_NPM,t[et.ADD]=et.ADD_NPM,t[et.SCREEN]=et.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var xy=kL();function hn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Rs(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Xd(r){return!(r&r-1)&&!!r}function jd(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function yy(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var UL=0;function pi(){return++UL}var cI=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};cI.EMPTY=new cI(0,0,0,0);var Yd={},er=Object.create(null),Yr=Object.create(null);function _y(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function qd(r,t=1){let e=K.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var X=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(X||{}),by=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},dI=(r,t)=>by(r).priority??t,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(by).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(by).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>dI(o,e)-dI(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var th=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var NL=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1150
- `);function HL(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
1151
- else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Kd(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=NL.replace(/%forloop%/gi,HL(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var vy=0,Ty=1,Sy=2,wy=3,Ey=4,Ay=5,qr=class r{constructor(){this.data=0,this.blendMode=et.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<vy)}set blend(t){!!(this.data&1<<vy)!==t&&(this.data^=1<<vy)}get offsets(){return!!(this.data&1<<Ty)}set offsets(t){!!(this.data&1<<Ty)!==t&&(this.data^=1<<Ty)}get culling(){return!!(this.data&1<<Sy)}set culling(t){!!(this.data&1<<Sy)!==t&&(this.data^=1<<Sy)}get depthTest(){return!!(this.data&1<<wy)}set depthTest(t){!!(this.data&1<<wy)!==t&&(this.data^=1<<wy)}get depthMask(){return!!(this.data&1<<Ay)}set depthMask(t){!!(this.data&1<<Ay)!==t&&(this.data^=1<<Ay)}get clockwiseFrontFace(){return!!(this.data&1<<Ey)}set clockwiseFrontFace(t){!!(this.data&1<<Ey)!==t&&(this.data^=1<<Ey)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==et.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};qr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var eh=[];function cn(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=eh.length-1;i>=0;--i){let s=eh[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var te=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(te.prototype,{dispatch:{value:te.prototype.emit},run:{value:te.prototype.emit}});var rr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new te("setRealSize"),this.onUpdate=new te("update"),this.onError=new te("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Is=class extends rr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===tr.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var VL={scaleMode:mr.NEAREST,alphaMode:tr.NPM},Py=class un extends Ms.default{constructor(t=null,e=null){super(),e=Object.assign({},un.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof rr)&&(t=cn(t,p),t.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=h,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=pi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Xd(this.realWidth)&&Xd(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Yr[this.cacheId],delete er[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),un.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=Yr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new un(t,e),n.cacheId=o,un.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Is(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=D.RGBA,a=lt.FLOAT):t instanceof Int32Array?(n=D.RGBA_INTEGER,a=lt.INT):t instanceof Uint32Array?(n=D.RGBA_INTEGER,a=lt.UNSIGNED_INT):t instanceof Int16Array?(n=D.RGBA_INTEGER,a=lt.SHORT):t instanceof Uint16Array?(n=D.RGBA_INTEGER,a=lt.UNSIGNED_SHORT):t instanceof Int8Array?(n=D.RGBA,a=lt.BYTE):(n=D.RGBA,a=lt.UNSIGNED_BYTE),o.internal=!0,new un(o,Object.assign({},VL,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Yr[e]&&Yr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Yr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Yr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Yr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Yr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Py.defaultOptions={mipmap:Ar.POW2,anisotropicLevel:0,scaleMode:mr.LINEAR,wrapMode:Nl.CLAMP,alphaMode:tr.UNPACK,target:di.TEXTURE_2D,format:D.RGBA,type:lt.UNSIGNED_BYTE},Py._globalBatch=0;var gt=Py;var rh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ko.TRIANGLES,this.start=0,this.size=0,this.data=null}};var WL=0,ae=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=WL++,this.disposeRunner=new te("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Ye.ELEMENT_ARRAY_BUFFER:Ye.ARRAY_BUFFER}get index(){return this.type===Ye.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var dn=class r{constructor(t,e=0,i=!1,s=lt.FLOAT,o,n,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var zL={Float32Array,Uint32Array,Int32Array,Uint8Array};function fI(r,t){let e=0,i=0,s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let l=0;l<r.length;l++){let h=t[l],c=r[l],u=hn(c);s[u]||(s[u]=new zL[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/h|0)*i+a,p=d%h;n[f+p]=c[d]}a+=h}return new Float32Array(o)}var pI={5126:4,5123:2,5121:1},$L=0,XL={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},mi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=$L++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new te("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof ae||(e instanceof Array&&(e=new Float32Array(e)),e=new ae(e));let h=t.split("|");if(h.length>1){for(let u=0;u<h.length;u++)this.addAttribute(h[u],e,i,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new dn(c,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof ae||(t instanceof Array&&(t=new Uint16Array(t)),t=new ae(t)),t.type=Ye.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],i=new ae,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*pI[o.type]/4),o.buffer=0}for(i.data=fI(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new ae(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new dn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Ye.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(let a=0;a<n.buffers.length;a++)i[a]=new XL[hn(n.buffers[a].data)](s[a]),e.buffers[a]=new ae(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)i[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=Ye.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(l+=d.size*pI[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+h]+=a;a+=t[u].buffers[c].data.length/l,h+=d.length}}return e}};var ih=class extends mi{constructor(t=!1){super(),this._buffer=new ae(null,t,!1),this._indexBuffer=new ae(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,lt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,lt.FLOAT).addAttribute("aColor",this._buffer,4,!0,lt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,lt.FLOAT).addIndex(this._indexBuffer)}};var Cy=Math.PI*2,jL=180/Math.PI,YL=Math.PI/180,xr=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(xr||{});var le=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};le.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var Zd=[new le,new le,new le,new le],_t=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=xr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Zd[0].set(t.left,t.top),l=Zd[1].set(t.left,t.bottom),h=Zd[2].set(t.right,t.top),c=Zd[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,g=d*s+f*o,m=d*i+f*n,_=d*s+f*n;if(Math.max(p,g,m,_)<=d*a.x+f*a.y||Math.min(p,g,m,_)>=d*c.x+f*c.y)return!1;let b=u*(a.y-h.y),y=u*(h.x-a.x),w=b*i+y*o,E=b*s+y*o,v=b*i+y*n,S=b*s+y*n;return!(Math.max(w,E,v,S)<=b*a.x+y*a.y||Math.min(w,E,v,S)>=b*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};_t.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Qd=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=xr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new _t(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Qd.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Jd=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=xr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _t(this.x-this.width,this.y-this.height,this.width,this.height)}};Jd.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var tf=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=xr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}};tf.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var ef=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=xr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};ef.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ut=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new le;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new le;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,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-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(Cy-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+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Ut.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var Bs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Fs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ks=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Us=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ry=[],mI=[],rf=Math.sign;function qL(){for(let r=0;r<16;r++){let t=[];Ry.push(t);for(let e=0;e<16;e++){let i=rf(Bs[r]*Bs[e]+ks[r]*Fs[e]),s=rf(Fs[r]*Bs[e]+Us[r]*Fs[e]),o=rf(Bs[r]*ks[e]+ks[r]*Us[e]),n=rf(Fs[r]*ks[e]+Us[r]*Us[e]);for(let a=0;a<16;a++)if(Bs[a]===i&&Fs[a]===s&&ks[a]===o&&Us[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Ut;t.set(Bs[r],Fs[r],ks[r],Us[r],0,0),mI.push(t)}}qL();var Lt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Bs[r],uY:r=>Fs[r],vX:r=>ks[r],vY:r=>Us[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ry[r][t],sub:(r,t)=>Ry[r][Lt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Lt.S:Lt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=mI[Lt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var gi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};gi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var My=class{constructor(){this.worldTransform=new Ut,this.localTransform=new Ut,this.position=new gi(this.onChange,this,0,0),this.scale=new gi(this.onChange,this,1,1),this.pivot=new gi(this.onChange,this,0,0),this.skew=new gi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};My.IDENTITY=new My;var sf=My;sf.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var gI=`varying vec2 vTextureCoord;
1149
+ Deprecated since v${r}`),console.warn(i))),cI[t]=!0}var gy;function xy(){return typeof gy>"u"&&(gy=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let t=K.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),gy}Uf();Gf();Nh([Hh]);var ln=class Xd{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 Xd)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=Xd.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Xd.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=qe(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};ln.shared=new ln,ln.temp=new ln,ln.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Cr=ln;function GL(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[et.NORMAL_NPM]=et.NORMAL,r[et.ADD_NPM]=et.ADD,r[et.SCREEN_NPM]=et.SCREEN,t[et.NORMAL]=et.NORMAL_NPM,t[et.ADD]=et.ADD_NPM,t[et.SCREEN]=et.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var yy=GL();function hn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Rs(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function jd(r){return!(r&r-1)&&!!r}function Yd(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function _y(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var OL=0;function pi(){return++OL}var uI=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};uI.EMPTY=new uI(0,0,0,0);var qd={},er=Object.create(null),Yr=Object.create(null);function by(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Kd(r,t=1){let e=K.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var X=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(X||{}),vy=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},fI=(r,t)=>vy(r).priority??t,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(vy).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(vy).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>fI(o,e)-fI(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var th=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var VL=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1150
+ `);function WL(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
1151
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Zd(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=VL.replace(/%forloop%/gi,WL(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var Ty=0,Sy=1,wy=2,Ey=3,Ay=4,Py=5,qr=class r{constructor(){this.data=0,this.blendMode=et.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ty)}set blend(t){!!(this.data&1<<Ty)!==t&&(this.data^=1<<Ty)}get offsets(){return!!(this.data&1<<Sy)}set offsets(t){!!(this.data&1<<Sy)!==t&&(this.data^=1<<Sy)}get culling(){return!!(this.data&1<<wy)}set culling(t){!!(this.data&1<<wy)!==t&&(this.data^=1<<wy)}get depthTest(){return!!(this.data&1<<Ey)}set depthTest(t){!!(this.data&1<<Ey)!==t&&(this.data^=1<<Ey)}get depthMask(){return!!(this.data&1<<Py)}set depthMask(t){!!(this.data&1<<Py)!==t&&(this.data^=1<<Py)}get clockwiseFrontFace(){return!!(this.data&1<<Ay)}set clockwiseFrontFace(t){!!(this.data&1<<Ay)!==t&&(this.data^=1<<Ay)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==et.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};qr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var eh=[];function cn(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=eh.length-1;i>=0;--i){let s=eh[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var te=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,o,n,a,l);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(te.prototype,{dispatch:{value:te.prototype.emit},run:{value:te.prototype.emit}});var rr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new te("setRealSize"),this.onUpdate=new te("update"),this.onError=new te("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Is=class extends rr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===tr.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var zL={scaleMode:mr.NEAREST,alphaMode:tr.NPM},Cy=class un extends Ms.default{constructor(t=null,e=null){super(),e=Object.assign({},un.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof rr)&&(t=cn(t,p),t.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=h,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=pi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=jd(this.realWidth)&&jd(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Yr[this.cacheId],delete er[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),un.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=Yr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new un(t,e),n.cacheId=o,un.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Is(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=D.RGBA,a=lt.FLOAT):t instanceof Int32Array?(n=D.RGBA_INTEGER,a=lt.INT):t instanceof Uint32Array?(n=D.RGBA_INTEGER,a=lt.UNSIGNED_INT):t instanceof Int16Array?(n=D.RGBA_INTEGER,a=lt.SHORT):t instanceof Uint16Array?(n=D.RGBA_INTEGER,a=lt.UNSIGNED_SHORT):t instanceof Int8Array?(n=D.RGBA,a=lt.BYTE):(n=D.RGBA,a=lt.UNSIGNED_BYTE),o.internal=!0,new un(o,Object.assign({},zL,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Yr[e]&&Yr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Yr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Yr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Yr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Yr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Cy.defaultOptions={mipmap:Ar.POW2,anisotropicLevel:0,scaleMode:mr.LINEAR,wrapMode:Nl.CLAMP,alphaMode:tr.UNPACK,target:di.TEXTURE_2D,format:D.RGBA,type:lt.UNSIGNED_BYTE},Cy._globalBatch=0;var gt=Cy;var rh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ko.TRIANGLES,this.start=0,this.size=0,this.data=null}};var $L=0,ae=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=$L++,this.disposeRunner=new te("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Ye.ELEMENT_ARRAY_BUFFER:Ye.ARRAY_BUFFER}get index(){return this.type===Ye.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var dn=class r{constructor(t,e=0,i=!1,s=lt.FLOAT,o,n,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var XL={Float32Array,Uint32Array,Int32Array,Uint8Array};function pI(r,t){let e=0,i=0,s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let l=0;l<r.length;l++){let h=t[l],c=r[l],u=hn(c);s[u]||(s[u]=new XL[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/h|0)*i+a,p=d%h;n[f+p]=c[d]}a+=h}return new Float32Array(o)}var mI={5126:4,5123:2,5121:1},jL=0,YL={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},mi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=jL++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new te("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof ae||(e instanceof Array&&(e=new Float32Array(e)),e=new ae(e));let h=t.split("|");if(h.length>1){for(let u=0;u<h.length;u++)this.addAttribute(h[u],e,i,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new dn(c,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof ae||(t instanceof Array&&(t=new Uint16Array(t)),t=new ae(t)),t.type=Ye.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],i=new ae,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*mI[o.type]/4),o.buffer=0}for(i.data=pI(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new ae(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new dn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Ye.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(let a=0;a<n.buffers.length;a++)i[a]=new YL[hn(n.buffers[a].data)](s[a]),e.buffers[a]=new ae(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)i[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=Ye.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(l+=d.size*mI[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+h]+=a;a+=t[u].buffers[c].data.length/l,h+=d.length}}return e}};var ih=class extends mi{constructor(t=!1){super(),this._buffer=new ae(null,t,!1),this._indexBuffer=new ae(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,lt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,lt.FLOAT).addAttribute("aColor",this._buffer,4,!0,lt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,lt.FLOAT).addIndex(this._indexBuffer)}};var Ry=Math.PI*2,qL=180/Math.PI,KL=Math.PI/180,xr=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(xr||{});var le=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};le.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var Qd=[new le,new le,new le,new le],_t=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=xr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Qd[0].set(t.left,t.top),l=Qd[1].set(t.left,t.bottom),h=Qd[2].set(t.right,t.top),c=Qd[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*c.x+f*c.y)return!1;let b=u*(a.y-h.y),y=u*(h.x-a.x),w=b*i+y*o,E=b*s+y*o,v=b*i+y*n,S=b*s+y*n;return!(Math.max(w,E,v,S)<=b*a.x+y*a.y||Math.min(w,E,v,S)>=b*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};_t.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Jd=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=xr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new _t(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Jd.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var tf=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=xr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _t(this.x-this.width,this.y-this.height,this.width,this.height)}};tf.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var ef=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=xr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],h=this.points[n*2],c=this.points[n*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}};ef.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var rf=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=xr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};rf.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ut=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new le;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new le;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,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-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(Ry-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+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Ut.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var Bs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Fs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ks=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Us=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],My=[],gI=[],sf=Math.sign;function ZL(){for(let r=0;r<16;r++){let t=[];My.push(t);for(let e=0;e<16;e++){let i=sf(Bs[r]*Bs[e]+ks[r]*Fs[e]),s=sf(Fs[r]*Bs[e]+Us[r]*Fs[e]),o=sf(Bs[r]*ks[e]+ks[r]*Us[e]),n=sf(Fs[r]*ks[e]+Us[r]*Us[e]);for(let a=0;a<16;a++)if(Bs[a]===i&&Fs[a]===s&&ks[a]===o&&Us[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Ut;t.set(Bs[r],Fs[r],ks[r],Us[r],0,0),gI.push(t)}}ZL();var Lt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Bs[r],uY:r=>Fs[r],vX:r=>ks[r],vY:r=>Us[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>My[r][t],sub:(r,t)=>My[r][Lt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Lt.S:Lt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=gI[Lt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var gi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};gi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Iy=class{constructor(){this.worldTransform=new Ut,this.localTransform=new Ut,this.position=new gi(this.onChange,this,0,0),this.scale=new gi(this.onChange,this,1,1),this.pivot=new gi(this.onChange,this,0,0),this.skew=new gi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Iy.IDENTITY=new Iy;var of=Iy;of.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var xI=`varying vec2 vTextureCoord;
1152
1152
 
1153
1153
  uniform sampler2D uSampler;
1154
1154
 
1155
1155
  void main(void){
1156
1156
  gl_FragColor *= texture2D(uSampler, vTextureCoord);
1157
- }`;var xI=`attribute vec2 aVertexPosition;
1157
+ }`;var yI=`attribute vec2 aVertexPosition;
1158
1158
  attribute vec2 aTextureCoord;
1159
1159
 
1160
1160
  uniform mat3 projectionMatrix;
@@ -1165,7 +1165,7 @@ void main(void){
1165
1165
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1166
1166
  vTextureCoord = aTextureCoord;
1167
1167
  }
1168
- `;function of(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Iy(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function sh(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Iy(2*t);case"bvec3":return Iy(3*t);case"bvec4":return Iy(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Kr=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
1168
+ `;function nf(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function By(r){let t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function sh(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return By(2*t);case"bvec3":return By(3*t);case"bvec4":return By(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Kr=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
1169
1169
  if(uv["${r}"] !== ud["${r}"].value)
1170
1170
  {
1171
1171
  ud["${r}"].value = uv["${r}"]
@@ -1285,7 +1285,7 @@ void main(void){
1285
1285
  cv[3] = v[3];
1286
1286
 
1287
1287
  gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
1288
- }`}];var KL={float:`
1288
+ }`}];var QL={float:`
1289
1289
  if (cv !== v)
1290
1290
  {
1291
1291
  cu.value = v;
@@ -1421,7 +1421,7 @@ void main(void){
1421
1421
  cu.value = v;
1422
1422
 
1423
1423
  gl.uniform1i(location, v);
1424
- }`},ZL={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function By(r,t){let e=[`
1424
+ }`},JL={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Fy(r,t){let e=[`
1425
1425
  var v = null;
1426
1426
  var cv = null;
1427
1427
  var cu = null;
@@ -1431,18 +1431,18 @@ void main(void){
1431
1431
  renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
1432
1432
  `):e.push(`
1433
1433
  renderer.shader.syncUniformGroup(uv.${i}, syncData);
1434
- `));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<Kr.length;a++)if(Kr[a].test(s,o)){e.push(Kr[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?KL:ZL)[s.type].replace("location",`ud["${i}"].location`);e.push(`
1434
+ `));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<Kr.length;a++)if(Kr[a].test(s,o)){e.push(Kr[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?QL:JL)[s.type].replace("location",`ud["${i}"].location`);e.push(`
1435
1435
  cu = ud["${i}"];
1436
1436
  cv = cu.value;
1437
1437
  v = uv["${i}"];
1438
1438
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1439
- `))}var yI={},nf=yI;function af(){if(nf===yI||nf?.isContextLost()){let r=K.ADAPTER.createCanvas(),t;K.PREFER_ENV>=Je.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),nf=t}return nf}var lf;function Fy(){if(!lf){lf=De.MEDIUM;let r=af();if(r&&r.getShaderPrecisionFormat){let t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(lf=t.precision?De.HIGH:De.MEDIUM)}}return lf}function _I(r,t){let e=r.getShaderSource(t).split(`
1439
+ `))}var _I={},af=_I;function lf(){if(af===_I||af?.isContextLost()){let r=K.ADAPTER.createCanvas(),t;K.PREFER_ENV>=Je.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),af=t}return af}var hf;function ky(){if(!hf){hf=De.MEDIUM;let r=lf();if(r&&r.getShaderPrecisionFormat){let t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(hf=t.precision?De.HIGH:De.MEDIUM)}}return hf}function bI(r,t){let e=r.getShaderSource(t).split(`
1440
1440
  `).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(`
1441
1441
  `),o={},n=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),a=[""];n.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(`
1442
- `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function ky(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||_I(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||_I(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var QL={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function oh(r){return QL[r]}var hf=null,bI={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function nh(r,t){if(!hf){let e=Object.keys(bI);hf={};for(let i=0;i<e.length;++i){let s=e[i];hf[r[s]]=bI[s]}}return hf[t]}function cf(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===De.HIGH&&e!==De.HIGH&&(i=De.MEDIUM),`precision ${i} float;
1443
- ${r}`}else if(e!==De.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var ah;function uf(){if(typeof ah=="boolean")return ah;try{ah=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ah=!1}return ah}var JL=0,df={},Uy=class fn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=JL++,this.vertexSrc=t||fn.defaultVertexSrc,this.fragmentSrc=e||fn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),df[i]?(df[i]++,i+=`-${df[i]}`):df[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
1442
+ `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Uy(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||bI(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||bI(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var tD={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function oh(r){return tD[r]}var cf=null,vI={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function nh(r,t){if(!cf){let e=Object.keys(vI);cf={};for(let i=0;i<e.length;++i){let s=e[i];cf[r[s]]=vI[s]}}return cf[t]}function uf(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===De.HIGH&&e!==De.HIGH&&(i=De.MEDIUM),`precision ${i} float;
1443
+ ${r}`}else if(e!==De.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var ah;function df(){if(typeof ah=="boolean")return ah;try{ah=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ah=!1}return ah}var eD=0,ff={},Gy=class fn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=eD++,this.vertexSrc=t||fn.defaultVertexSrc,this.fragmentSrc=e||fn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),ff[i]?(ff[i]++,i+=`-${ff[i]}`):ff[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
1444
1444
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
1445
- ${this.fragmentSrc}`,this.vertexSrc=cf(this.vertexSrc,fn.defaultVertexPrecision,De.HIGH),this.fragmentSrc=cf(this.fragmentSrc,fn.defaultFragmentPrecision,Fy())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return xI}static get defaultFragmentSrc(){return gI}static from(t,e,i){let s=t+e,o=Yd[s];return o||(Yd[s]=o=new fn(t,e,i)),o}};Uy.defaultVertexPrecision=De.HIGH,Uy.defaultFragmentPrecision=Pr.apple.device?De.HIGH:De.MEDIUM;var yr=Uy;var tD=0,ir=class r{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=tD++,this.static=!!e,this.ubo=!!i,t instanceof ae?(this.buffer=t,this.buffer.type=Ye.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new ae(new Float32Array(1)),this.buffer.type=Ye.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new r(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new r(t,e,i)}static uboFrom(t,e){return new r(t,e??!0,!0)}};var Gs=class r{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ir?this.uniformGroup=e:this.uniformGroup=new ir(e):this.uniformGroup=new ir({}),this.disposeRunner=new te("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let i in e.uniforms){let s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){let s=yr.from(t,e);return new r(s,i)}};var lh=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let i=new Int32Array(t);for(let o=0;o<t;o++)i[o]=o;this.defaultGroupCache[t]=ir.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new yr(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ut,default:this.defaultGroupCache[t]};return new Gs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1445
+ ${this.fragmentSrc}`,this.vertexSrc=uf(this.vertexSrc,fn.defaultVertexPrecision,De.HIGH),this.fragmentSrc=uf(this.fragmentSrc,fn.defaultFragmentPrecision,ky())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return yI}static get defaultFragmentSrc(){return xI}static from(t,e,i){let s=t+e,o=qd[s];return o||(qd[s]=o=new fn(t,e,i)),o}};Gy.defaultVertexPrecision=De.HIGH,Gy.defaultFragmentPrecision=Pr.apple.device?De.HIGH:De.MEDIUM;var yr=Gy;var rD=0,ir=class r{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=rD++,this.static=!!e,this.ubo=!!i,t instanceof ae?(this.buffer=t,this.buffer.type=Ye.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new ae(new Float32Array(1)),this.buffer.type=Ye.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new r(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new r(t,e,i)}static uboFrom(t,e){return new r(t,e??!0,!0)}};var Gs=class r{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ir?this.uniformGroup=e:this.uniformGroup=new ir(e):this.uniformGroup=new ir({}),this.disposeRunner=new te("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let i in e.uniforms){let s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){let s=yr.from(t,e);return new r(s,i)}};var lh=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let i=new Int32Array(t);for(let o=0;o<t;o++)i[o]=o;this.defaultGroupCache[t]=ir.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new yr(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ut,default:this.defaultGroupCache[t]};return new Gs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1446
1446
  `,e+=`
1447
1447
  `;for(let i=0;i<t;i++)i>0&&(e+=`
1448
1448
  else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
@@ -1450,7 +1450,7 @@ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
1450
1450
  color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
1451
1451
  }`;return e+=`
1452
1452
  `,e+=`
1453
- `,e}};var hh=class{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}};function vI(){return!Pr.apple.device}function TI(r){let t=!0,e=K.ADAPTER.getNavigator();if(Pr.tablet||Pr.phone){if(Pr.apple.device){let i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Pr.android.device){let i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}var Os=class{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}};var SI=`varying vec2 vTextureCoord;
1453
+ `,e}};var hh=class{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}};function TI(){return!Pr.apple.device}function SI(r){let t=!0,e=K.ADAPTER.getNavigator();if(Pr.tablet||Pr.phone){if(Pr.apple.device){let i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Pr.android.device){let i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}var Os=class{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}};var wI=`varying vec2 vTextureCoord;
1454
1454
  varying vec4 vColor;
1455
1455
  varying float vTextureId;
1456
1456
  uniform sampler2D uSamplers[%count%];
@@ -1460,7 +1460,7 @@ void main(void){
1460
1460
  %forloop%
1461
1461
  gl_FragColor = color * vColor;
1462
1462
  }
1463
- `;var wI=`precision highp float;
1463
+ `;var EI=`precision highp float;
1464
1464
  attribute vec2 aVertexPosition;
1465
1465
  attribute vec2 aTextureCoord;
1466
1466
  attribute vec4 aColor;
@@ -1481,14 +1481,14 @@ void main(void){
1481
1481
  vTextureId = aTextureId;
1482
1482
  vColor = aColor * tint;
1483
1483
  }
1484
- `;var ch=class Rr extends Os{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=ih,this.vertexSize=6,this.state=qr.for2d(),this.size=Rr.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??TI(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??vI(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ft("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return wI}static get defaultFragmentTemplate(){return SI}setShaderGenerator({vertex:t=Rr.defaultVertexSrc,fragment:e=Rr.defaultFragmentTemplate}={}){this.shaderGenerator=new lh(t,e)}contextChange(){let t=this.renderer.gl;K.PREFER_ENV===Je.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Rr.defaultMaxTextures),this.maxTextures=Kd(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:e}=Rr,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new rh);for(;e.length<s;)e.push(new hh);for(let o=0;o<this.maxTextures;o++)this._tempBoundTextures[o]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,i=Rr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++gt._globalBatch,l=0,h=i[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u<this._bufferSize;++u){let d=t[u];t[u]=null,d._batchEnabled!==a&&(h.count>=e&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,u),c=u,h=i[++l],++a),d._batchEnabled=a,d.touched=n,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,this._bufferSize),++l,++a);for(let u=0;u<o.length;u++)o[u]=null;gt._globalBatch=a}buildDrawCalls(t,e,i){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,l=Rr._drawCallPool,h=this._dcIndex,c=this._aIndex,u=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){let p=s[f],g=p._texture.baseTexture,m=xy[g.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==m&&(d.size=u-d.start,e=f,d=l[++h],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,o,n,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=m}e<i&&(d.size=u-d.start,++h),this._dcIndex=h,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;Rr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:i}=this.renderer,s=Rr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:l,size:h,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(l,h,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Rr.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=Rs(Math.ceil(t/8)),i=jd(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new th(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=Rs(Math.ceil(t/12)),i=jd(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let o=this._iBuffers[i];return o||(this._iBuffers[i]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,i,s,o){let{uint32View:n,float32View:a}=e,l=s/this.vertexSize,h=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Cr.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let g=0;g<u.length;g+=2)a[s++]=u[g],a[s++]=u[g+1],a[s++]=h[g],a[s++]=h[g+1],n[s++]=p,a[s++]=d;for(let g=0;g<c.length;g++)i[o++]=l+c[g]}};ch.defaultBatchSize=4096,ch.extension={name:"batch",type:X.RendererPlugin},ch._drawCallPool=[],ch._textureArrayPool=[];var xi=ch;Z.add(xi);var EI=`varying vec2 vTextureCoord;
1484
+ `;var ch=class Rr extends Os{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=ih,this.vertexSize=6,this.state=qr.for2d(),this.size=Rr.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??SI(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??TI(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ft("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return EI}static get defaultFragmentTemplate(){return wI}setShaderGenerator({vertex:t=Rr.defaultVertexSrc,fragment:e=Rr.defaultFragmentTemplate}={}){this.shaderGenerator=new lh(t,e)}contextChange(){let t=this.renderer.gl;K.PREFER_ENV===Je.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Rr.defaultMaxTextures),this.maxTextures=Zd(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:e}=Rr,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new rh);for(;e.length<s;)e.push(new hh);for(let o=0;o<this.maxTextures;o++)this._tempBoundTextures[o]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,i=Rr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++gt._globalBatch,l=0,h=i[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u<this._bufferSize;++u){let d=t[u];t[u]=null,d._batchEnabled!==a&&(h.count>=e&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,u),c=u,h=i[++l],++a),d._batchEnabled=a,d.touched=n,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,this._bufferSize),++l,++a);for(let u=0;u<o.length;u++)o[u]=null;gt._globalBatch=a}buildDrawCalls(t,e,i){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,l=Rr._drawCallPool,h=this._dcIndex,c=this._aIndex,u=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){let p=s[f],m=p._texture.baseTexture,g=yy[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=l[++h],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,o,n,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=g}e<i&&(d.size=u-d.start,++h),this._dcIndex=h,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;Rr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:i}=this.renderer,s=Rr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:l,size:h,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(l,h,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Rr.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=Rs(Math.ceil(t/8)),i=Yd(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new th(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=Rs(Math.ceil(t/12)),i=Yd(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let o=this._iBuffers[i];return o||(this._iBuffers[i]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,i,s,o){let{uint32View:n,float32View:a}=e,l=s/this.vertexSize,h=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Cr.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=h[m],a[s++]=h[m+1],n[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)i[o++]=l+c[m]}};ch.defaultBatchSize=4096,ch.extension={name:"batch",type:X.RendererPlugin},ch._drawCallPool=[],ch._textureArrayPool=[];var xi=ch;Z.add(xi);var AI=`varying vec2 vTextureCoord;
1485
1485
 
1486
1486
  uniform sampler2D uSampler;
1487
1487
 
1488
1488
  void main(void){
1489
1489
  gl_FragColor = texture2D(uSampler, vTextureCoord);
1490
1490
  }
1491
- `;var AI=`attribute vec2 aVertexPosition;
1491
+ `;var PI=`attribute vec2 aVertexPosition;
1492
1492
 
1493
1493
  uniform mat3 projectionMatrix;
1494
1494
 
@@ -1514,7 +1514,7 @@ void main(void)
1514
1514
  gl_Position = filterVertexPosition();
1515
1515
  vTextureCoord = filterTextureCoord();
1516
1516
  }
1517
- `;var Gy=class uh extends Gs{constructor(t,e,i){let s=yr.from(t||uh.defaultVertexSrc,e||uh.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=uh.defaultResolution,this.multisample=uh.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new qr}apply(t,e,i,s,o){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return AI}static get defaultFragmentSrc(){return EI}};Gy.defaultResolution=1,Gy.defaultMultisample=Rt.NONE;var Zr=Gy;var yi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Cr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:s}=t,o=i??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};yi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},yi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"background"};Z.add(yi);var pn=class{constructor(t){this.renderer=t,this.emptyRenderer=new Os(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let h=0;h<a;h++){let c=o[h],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[h]=u;continue}for(;l<s;){let d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[h]=l,c._batchLocation=l,e[l]=c;break}}}destroy(){this.renderer=null}};pn.extension={type:X.RendererSystem,name:"batch"};Z.add(pn);var PI=0,_i=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=PI++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=PI++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(K.PREFER_ENV>=Je.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};_i.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},_i.extension={type:X.RendererSystem,name:"context"};Z.add(_i);var $i=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new te("disposeFramebuffer"),this.multisample=Rt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new gt(null,{scaleMode:mr.NEAREST,resolution:1,mipmap:Ar.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new gt(null,{scaleMode:mr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ar.OFF,format:D.DEPTH_COMPONENT,type:lt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var Ls=class extends gt{constructor(t={}){if(typeof t=="number"){let e=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:i,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Rt.NONE),super(null,t),this.mipmap=Ar.OFF,this.valid=!0,this._clear=new Cr([0,0,0,0]),this.framebuffer=new $i(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var me=class extends rr{constructor(t){let e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=_y(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===tr.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}};var Ds=class extends me{constructor(t,e){if(e=e||{},typeof t=="string"){let i=new Image;me.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??K.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===tr.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var Ns=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,h=t.y/o+a;i=Lt.add(i,Lt.NW),this.x0=l+n*Lt.uX(i),this.y0=h+a*Lt.uY(i),i=Lt.add(i,2),this.x1=l+n*Lt.uX(i),this.y1=h+a*Lt.uY(i),i=Lt.add(i,2),this.x2=l+n*Lt.uX(i),this.y2=h+a*Lt.uY(i),i=Lt.add(i,2),this.x3=l+n*Lt.uX(i),this.y3=h+a*Lt.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};Ns.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var CI=new Ns;function ff(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var dh=class r extends Ms.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new _t(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=CI,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new le(n.x,n.y):new le(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&er[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===CI&&(this._uvs=new Ns),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof gt){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${pi()}`,gt.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=er[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof gt)?(e.resolution||(e.resolution=qd(t)),n=new r(new gt(t,e)),n.baseTexture.cacheId=o,gt.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof gt&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(gt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new gt(t,Object.assign({scaleMode:gt.defaultOptions.scaleMode,resolution:qd(e)},s)),{resource:n}=o;n instanceof Ds&&(n.url=e);let a=new r(o);return i||(i=e),gt.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(gt.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),er[e]&&er[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),er[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=er[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete er[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)er[t.textureCacheIds[e]]===t&&delete er[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",h=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new gt),ff(r._EMPTY),ff(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=K.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(gt.from(t)),ff(r._WHITE),ff(r._WHITE.baseTexture)}return r._WHITE}};var Hs=class r extends dh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Ls(t))}};var mn=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Rt.NONE){let s=new Ls(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Hs(s)}getOptimalTexture(t,e,i=1,s=Rt.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Rs(t),e=Rs(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};mn.SCREEN_KEY=-1;var fh=class extends mi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var ph=class extends mi{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new ae(this.vertices),this.uvBuffer=new ae(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var mh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Rt.NONE,this.sourceFrame=new _t,this.destinationFrame=new _t,this.bindingSourceFrame=new _t,this.bindingDestinationFrame=new _t,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var pf=[new le,new le,new le,new le],Oy=new Ut,gn=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new mn,this.statePool=[],this.quad=new fh,this.quadUv=new ph,this.tempRect=new _t,this.activeState={},this.globalUniforms=new ir({outputFrame:new _t,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new mh,n=i.renderTexture,a,l;if(n.current){let m=n.current;a=m.resolution,l=m.multisample}else a=i.resolution,l=i.multisample;let h=e[0].resolution||a,c=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let m=1;m<e.length;m++){let _=e[m];h=Math.min(h,_.resolution||a),c=Math.min(c,_.multisample??l),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=h,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(Oy.copyFrom(i.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,h,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let g=this.tempRect;g.x=0,g.y=0,g.width=o.sourceFrame.width,g.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=i.projection.transform,i.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,g),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let h=s.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,Vi.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let h=e.renderTexture,c=this.getOptimalFilterTexture(h.width,h.height,e.resolution);c.filterFrame=h.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),i[u].apply(this,h,c,Vi.CLEAR,e);let d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,Vi.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Vi.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Vi.CLEAR||e===Vi.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ko.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ko.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Ut.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Rt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=pf[0],s=pf[1],o=pf[2],n=pf[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),h=Math.max(i.x,s.x,o.x,n.x),c=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:h}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(h)>1e-4))return}o=o?Oy.copyFrom(o):Oy.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};gn.extension={type:X.RendererSystem,name:"filter"};Z.add(gn);var gh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Rt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var eD=new _t,xn=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new $i(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new _t,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===Je.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=Cd.COLOR|Cd.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new gh(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),n===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l<n;l++){let h=o[l],c=h.parentTextureArray||h;this.renderer.texture.bind(c,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,h=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,h=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,h,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=Rt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Rt.NONE),i}blit(t,e,i){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;l.blitFramebuffer||(l.blitFramebuffer=new $i(s.width,s.height),l.blitFramebuffer.addColorTexture(0,c)),t=l.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=eD,e.width=s.width,e.height=s.height),i||(i=e);let h=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,l;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,l,i,s):o.renderbufferStorage(o.RENDERBUFFER,l,i,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new _t}destroy(){this.renderer=null}};xn.extension={type:X.RendererSystem,name:"framebuffer"};Z.add(xn);var Ly={5126:4,5123:2,5121:1},yn=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;K.PREFER_ENV===Je.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){let i=t.attributes,s=e.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let l=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID],c=h[l];if(c)return h[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let g in u)f[g]=0,p[g]=0;for(let g in d)!d[g].size&&a.attributeData[g]?d[g].size=a.attributeData[g].size:d[g].size||console.warn(`PIXI Geometry attribute '${g}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[g].buffer]+=d[g].size*Ly[d[g].type];for(let g in d){let m=d[g],_=m.size;m.stride===void 0&&(f[m.buffer]===_*Ly[m.type]?m.stride=0:m.stride=f[m.buffer]),m.start===void 0&&(m.start=p[m.buffer],p[m.buffer]+=_*Ly[m.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let g=0;g<u.length;g++){let m=u[g];n.bind(m),i&&m._glBuffers[o].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,s.bindVertexArray(null),n.unbind(Ye.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(n)for(let a=0;a<o.length;a++){let l=o[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(let h in a){let c=a[h],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[h]){l!==d&&(o.bind(u),l=d);let f=e.attributeData[h].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,i,e||n.getSize(),s||1):o.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};yn.extension={type:X.RendererSystem,name:"geometry"};Z.add(yn);var RI=new Ut,xh=class{constructor(t,e){this._texture=t,this.mapCoord=new Ut,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let s=e.orig,o=e.trim;o&&(RI.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(RI));let n=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+l+h)/n.width,a[1]=(e._frame.y+l+h)/n.height,a[2]=(e._frame.x+e._frame.width-l+h)/n.width,a[3]=(e._frame.y+e._frame.height-l+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var MI=`varying vec2 vMaskCoord;
1517
+ `;var Oy=class uh extends Gs{constructor(t,e,i){let s=yr.from(t||uh.defaultVertexSrc,e||uh.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=uh.defaultResolution,this.multisample=uh.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new qr}apply(t,e,i,s,o){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return PI}static get defaultFragmentSrc(){return AI}};Oy.defaultResolution=1,Oy.defaultMultisample=Rt.NONE;var Zr=Oy;var yi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Cr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:s}=t,o=i??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};yi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},yi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"background"};Z.add(yi);var pn=class{constructor(t){this.renderer=t,this.emptyRenderer=new Os(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let h=0;h<a;h++){let c=o[h],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[h]=u;continue}for(;l<s;){let d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[h]=l,c._batchLocation=l,e[l]=c;break}}}destroy(){this.renderer=null}};pn.extension={type:X.RendererSystem,name:"batch"};Z.add(pn);var CI=0,_i=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=CI++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=CI++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(K.PREFER_ENV>=Je.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};_i.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},_i.extension={type:X.RendererSystem,name:"context"};Z.add(_i);var Xi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new te("disposeFramebuffer"),this.multisample=Rt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new gt(null,{scaleMode:mr.NEAREST,resolution:1,mipmap:Ar.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new gt(null,{scaleMode:mr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ar.OFF,format:D.DEPTH_COMPONENT,type:lt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var Ls=class extends gt{constructor(t={}){if(typeof t=="number"){let e=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:i,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Rt.NONE),super(null,t),this.mipmap=Ar.OFF,this.valid=!0,this._clear=new Cr([0,0,0,0]),this.framebuffer=new Xi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var me=class extends rr{constructor(t){let e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=by(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===tr.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}};var Ds=class extends me{constructor(t,e){if(e=e||{},typeof t=="string"){let i=new Image;me.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??K.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===tr.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var Ns=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,h=t.y/o+a;i=Lt.add(i,Lt.NW),this.x0=l+n*Lt.uX(i),this.y0=h+a*Lt.uY(i),i=Lt.add(i,2),this.x1=l+n*Lt.uX(i),this.y1=h+a*Lt.uY(i),i=Lt.add(i,2),this.x2=l+n*Lt.uX(i),this.y2=h+a*Lt.uY(i),i=Lt.add(i,2),this.x3=l+n*Lt.uX(i),this.y3=h+a*Lt.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};Ns.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var RI=new Ns;function pf(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var dh=class r extends Ms.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new _t(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=RI,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new le(n.x,n.y):new le(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&er[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===RI&&(this._uvs=new Ns),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof gt){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${pi()}`,gt.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=er[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof gt)?(e.resolution||(e.resolution=Kd(t)),n=new r(new gt(t,e)),n.baseTexture.cacheId=o,gt.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof gt&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(gt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new gt(t,Object.assign({scaleMode:gt.defaultOptions.scaleMode,resolution:Kd(e)},s)),{resource:n}=o;n instanceof Ds&&(n.url=e);let a=new r(o);return i||(i=e),gt.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(gt.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),er[e]&&er[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),er[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=er[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete er[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)er[t.textureCacheIds[e]]===t&&delete er[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",h=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new gt),pf(r._EMPTY),pf(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=K.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(gt.from(t)),pf(r._WHITE),pf(r._WHITE.baseTexture)}return r._WHITE}};var Hs=class r extends dh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Ls(t))}};var mn=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Rt.NONE){let s=new Ls(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Hs(s)}getOptimalTexture(t,e,i=1,s=Rt.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Rs(t),e=Rs(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};mn.SCREEN_KEY=-1;var fh=class extends mi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var ph=class extends mi{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new ae(this.vertices),this.uvBuffer=new ae(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var mh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Rt.NONE,this.sourceFrame=new _t,this.destinationFrame=new _t,this.bindingSourceFrame=new _t,this.bindingDestinationFrame=new _t,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var mf=[new le,new le,new le,new le],Ly=new Ut,gn=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new mn,this.statePool=[],this.quad=new fh,this.quadUv=new ph,this.tempRect=new _t,this.activeState={},this.globalUniforms=new ir({outputFrame:new _t,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new mh,n=i.renderTexture,a,l;if(n.current){let g=n.current;a=g.resolution,l=g.multisample}else a=i.resolution,l=i.multisample;let h=e[0].resolution||a,c=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){let _=e[g];h=Math.min(h,_.resolution||a),c=Math.min(c,_.multisample??l),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=h,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(Ly.copyFrom(i.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,h,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=i.projection.transform,i.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let h=s.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,Wi.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let h=e.renderTexture,c=this.getOptimalFilterTexture(h.width,h.height,e.resolution);c.filterFrame=h.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),i[u].apply(this,h,c,Wi.CLEAR,e);let d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,Wi.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Wi.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Wi.CLEAR||e===Wi.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ko.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ko.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Ut.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Rt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=mf[0],s=mf[1],o=mf[2],n=mf[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),h=Math.max(i.x,s.x,o.x,n.x),c=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:h}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(h)>1e-4))return}o=o?Ly.copyFrom(o):Ly.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};gn.extension={type:X.RendererSystem,name:"filter"};Z.add(gn);var gh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Rt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var iD=new _t,xn=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Xi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new _t,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===Je.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=Rd.COLOR|Rd.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new gh(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),n===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l<n;l++){let h=o[l],c=h.parentTextureArray||h;this.renderer.texture.bind(c,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,h=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,h=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,h,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=Rt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Rt.NONE),i}blit(t,e,i){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;l.blitFramebuffer||(l.blitFramebuffer=new Xi(s.width,s.height),l.blitFramebuffer.addColorTexture(0,c)),t=l.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=iD,e.width=s.width,e.height=s.height),i||(i=e);let h=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,l;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,l,i,s):o.renderbufferStorage(o.RENDERBUFFER,l,i,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new _t}destroy(){this.renderer=null}};xn.extension={type:X.RendererSystem,name:"framebuffer"};Z.add(xn);var Dy={5126:4,5123:2,5121:1},yn=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;K.PREFER_ENV===Je.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){let i=t.attributes,s=e.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let l=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID],c=h[l];if(c)return h[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Dy[d[m].type];for(let m in d){let g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*Dy[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*Dy[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let g=u[m];n.bind(g),i&&g._glBuffers[o].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,s.bindVertexArray(null),n.unbind(Ye.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(n)for(let a=0;a<o.length;a++){let l=o[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(let h in a){let c=a[h],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[h]){l!==d&&(o.bind(u),l=d);let f=e.attributeData[h].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,i,e||n.getSize(),s||1):o.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};yn.extension={type:X.RendererSystem,name:"geometry"};Z.add(yn);var MI=new Ut,xh=class{constructor(t,e){this._texture=t,this.mapCoord=new Ut,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let s=e.orig,o=e.trim;o&&(MI.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(MI));let n=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+l+h)/n.width,a[1]=(e._frame.y+l+h)/n.height,a[2]=(e._frame.x+e._frame.width-l+h)/n.width,a[3]=(e._frame.y+e._frame.height-l+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var II=`varying vec2 vMaskCoord;
1518
1518
  varying vec2 vTextureCoord;
1519
1519
 
1520
1520
  uniform sampler2D uSampler;
@@ -1539,7 +1539,7 @@ void main(void)
1539
1539
 
1540
1540
  gl_FragColor = original;
1541
1541
  }
1542
- `;var II=`attribute vec2 aVertexPosition;
1542
+ `;var BI=`attribute vec2 aVertexPosition;
1543
1543
  attribute vec2 aTextureCoord;
1544
1544
 
1545
1545
  uniform mat3 projectionMatrix;
@@ -1555,7 +1555,7 @@ void main(void)
1555
1555
  vTextureCoord = aTextureCoord;
1556
1556
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
1557
1557
  }
1558
- `;var yh=class extends Zr{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||II,e||MI,i),this.maskSprite=s,this.maskMatrix=new Ut}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new xh(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}};var _h=class{constructor(t=null){this.type=ne.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Zr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ne.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var _n=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let o=this.maskDataPool.pop()||new _h;o.pooled=!0,o.maskObject=e,i=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==ne.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ne.SCISSOR:this.renderer.scissor.push(i);break;case ne.STENCIL:this.renderer.stencil.push(i);break;case ne.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ne.COLOR:this.pushColorMask(i);break;default:break}i.type===ne.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ne.SCISSOR:this.renderer.scissor.pop(e);break;case ne.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ne.SPRITE:this.popSpriteMask(e);break;case ne.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===ne.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=ne.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ne.SCISSOR:t.type=ne.STENCIL:t.type=ne.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new yh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};_n.extension={type:X.RendererSystem,name:"mask"};Z.add(_n);var bn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var BI=new Ut,FI=[],kI=class mf extends bn{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,FI.pop()??new _t);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||mf.isMatrixRotated(e.worldTransform)||mf.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){mf.isMatrixRotated(o)||(o=o?BI.copyFrom(o):BI.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&FI.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};kI.extension={type:X.RendererSystem,name:"scissor"};var Dy=kI;Z.add(Dy);var vn=class extends bn{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};vn.extension={type:X.RendererSystem,name:"stencil"};Z.add(vn);var Tn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};Tn.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_plugin"};Z.add(Tn);var Sn=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ut,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};Sn.extension={type:X.RendererSystem,name:"projection"};Z.add(Sn);var rD=new sf,UI=new _t,wn=class{constructor(t){this.renderer=t,this._tempMatrix=new Ut}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(UI)||t.getLocalBounds(UI,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=Hs.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=rD,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};wn.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"textureGenerator"};Z.add(wn);var Vs=new _t,bh=new _t,En=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new _t,this.destinationFrame=new _t,this.viewportFrame=new _t}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(Vs.width=t.frame.width,Vs.height=t.frame.height,e=Vs),i||(bh.x=t.frame.x,bh.y=t.frame.y,bh.width=e.width,bh.height=e.height,i=bh),n=o.framebuffer):(a=s.resolution,e||(Vs.width=s._view.screen.width,Vs.height=s._view.screen.height,e=Vs),i||(i=Vs,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Cr.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};En.extension={type:X.RendererSystem,name:"renderTexture"};Z.add(En);var vh=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function GI(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=t.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=nh(t,o.type),a={type:n,name:o.name,size:oh(n),location:t.getAttribLocation(r,o.name)};e[o.name]=a}return e}function OI(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=nh(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:sh(l,o.size)}}return e}function Ny(r,t){let e=of(r,r.VERTEX_SHADER,t.vertexSrc),i=of(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||ky(r,s,e,i),t.attributeData=GI(s,r),t.uniformData=OI(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((l,h)=>l>h?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);let n={};for(let a in t.uniformData){let l=t.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:sh(l.type,l.size)}}return new vh(s,n)}function iD(r,t,e,i,s){e.buffer.update(s)}var sD={float:`
1558
+ `;var yh=class extends Zr{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||BI,e||II,i),this.maskSprite=s,this.maskMatrix=new Ut}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new xh(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}};var _h=class{constructor(t=null){this.type=ne.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Zr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ne.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var _n=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let o=this.maskDataPool.pop()||new _h;o.pooled=!0,o.maskObject=e,i=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==ne.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ne.SCISSOR:this.renderer.scissor.push(i);break;case ne.STENCIL:this.renderer.stencil.push(i);break;case ne.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ne.COLOR:this.pushColorMask(i);break;default:break}i.type===ne.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ne.SCISSOR:this.renderer.scissor.pop(e);break;case ne.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ne.SPRITE:this.popSpriteMask(e);break;case ne.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===ne.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=ne.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ne.SCISSOR:t.type=ne.STENCIL:t.type=ne.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new yh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};_n.extension={type:X.RendererSystem,name:"mask"};Z.add(_n);var bn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var FI=new Ut,kI=[],UI=class gf extends bn{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,kI.pop()??new _t);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||gf.isMatrixRotated(e.worldTransform)||gf.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){gf.isMatrixRotated(o)||(o=o?FI.copyFrom(o):FI.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&kI.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};UI.extension={type:X.RendererSystem,name:"scissor"};var Ny=UI;Z.add(Ny);var vn=class extends bn{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};vn.extension={type:X.RendererSystem,name:"stencil"};Z.add(vn);var Tn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};Tn.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_plugin"};Z.add(Tn);var Sn=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ut,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};Sn.extension={type:X.RendererSystem,name:"projection"};Z.add(Sn);var sD=new of,GI=new _t,wn=class{constructor(t){this.renderer=t,this._tempMatrix=new Ut}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(GI)||t.getLocalBounds(GI,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=Hs.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=sD,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};wn.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"textureGenerator"};Z.add(wn);var Vs=new _t,bh=new _t,En=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new _t,this.destinationFrame=new _t,this.viewportFrame=new _t}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(Vs.width=t.frame.width,Vs.height=t.frame.height,e=Vs),i||(bh.x=t.frame.x,bh.y=t.frame.y,bh.width=e.width,bh.height=e.height,i=bh),n=o.framebuffer):(a=s.resolution,e||(Vs.width=s._view.screen.width,Vs.height=s._view.screen.height,e=Vs),i||(i=Vs,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Cr.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};En.extension={type:X.RendererSystem,name:"renderTexture"};Z.add(En);var vh=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function OI(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=t.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=nh(t,o.type),a={type:n,name:o.name,size:oh(n),location:t.getAttribLocation(r,o.name)};e[o.name]=a}return e}function LI(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=nh(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:sh(l,o.size)}}return e}function Hy(r,t){let e=nf(r,r.VERTEX_SHADER,t.vertexSrc),i=nf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||Uy(r,s,e,i),t.attributeData=OI(s,r),t.uniformData=LI(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((l,h)=>l>h?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);let n={};for(let a in t.uniformData){let l=t.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:sh(l.type,l.size)}}return new vh(s,n)}function oD(r,t,e,i,s){e.buffer.update(s)}var nD={float:`
1559
1559
  data[offset] = v;
1560
1560
  `,vec2:`
1561
1561
  data[offset] = v[0];
@@ -1593,7 +1593,7 @@ void main(void)
1593
1593
  {
1594
1594
  data[offset + i] = v[i];
1595
1595
  }
1596
- `},LI={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function DI(r){let t=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=LI[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,i%e!==0&&i<16){let a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,i=e):(n.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function NI(r,t){let e=[];for(let i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function Hy(r,t){if(!r.autoManage)return{size:0,syncFunc:iD};let e=NI(r.uniforms,t),{uboElements:i,size:s}=DI(e),o=[`
1596
+ `},DI={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function NI(r){let t=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=DI[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,i%e!==0&&i<16){let a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,i=e):(n.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function HI(r,t){let e=[];for(let i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function Vy(r,t){if(!r.autoManage)return{size:0,syncFunc:oD};let e=HI(r.uniforms,t),{uboElements:i,size:s}=NI(e),o=[`
1597
1597
  var v = null;
1598
1598
  var v2 = null;
1599
1599
  var cv = null;
@@ -1601,7 +1601,7 @@ void main(void)
1601
1601
  var gl = renderer.gl
1602
1602
  var index = 0;
1603
1603
  var data = buffer.data;
1604
- `];for(let n=0;n<i.length;n++){let a=i[n],l=r.uniforms[a.data.name],h=a.data.name,c=!1;for(let u=0;u<Kr.length;u++){let d=Kr[u];if(d.codeUbo&&d.test(a.data,l)){o.push(`offset = ${a.offset/4};`,Kr[u].codeUbo(a.data.name,l)),c=!0;break}}if(!c)if(a.data.size>1){let u=oh(a.data.type),d=Math.max(LI[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;o.push(`
1604
+ `];for(let n=0;n<i.length;n++){let a=i[n],l=r.uniforms[a.data.name],h=a.data.name,c=!1;for(let u=0;u<Kr.length;u++){let d=Kr[u];if(d.codeUbo&&d.test(a.data,l)){o.push(`offset = ${a.offset/4};`,Kr[u].codeUbo(a.data.name,l)),c=!0;break}}if(!c)if(a.data.size>1){let u=oh(a.data.type),d=Math.max(DI[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;o.push(`
1605
1605
  cv = ud.${h}.value;
1606
1606
  v = uv.${h};
1607
1607
  offset = ${a.offset/4};
@@ -1617,7 +1617,7 @@ void main(void)
1617
1617
  offset += ${p};
1618
1618
  }
1619
1619
 
1620
- `)}else{let u=sD[a.data.type];o.push(`
1620
+ `)}else{let u=nD[a.data.type];o.push(`
1621
1621
  cv = ud.${h}.value;
1622
1622
  v = uv.${h};
1623
1623
  offset = ${a.offset/4};
@@ -1625,7 +1625,7 @@ void main(void)
1625
1625
  `)}}return o.push(`
1626
1626
  renderer.buffer.update(buffer);
1627
1627
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
1628
- `))}}var oD=0,gf={textureCount:0,uboCount:0},Xi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=oD++}systemCheck(){if(!uf())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(gf.textureCount=0,gf.uboCount=0,this.syncUniformGroup(t.uniformGroup,gf)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=By(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,gf,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Hy(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=Ny(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Xi.extension={type:X.RendererSystem,name:"shader"};Z.add(Xi);var bi=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};bi.defaultOptions={hello:!1},bi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"startup"};Z.add(bi);function HI(r,t=[]){return t[et.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.ADD]=[r.ONE,r.ONE],t[et.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.NONE]=[0,0],t[et.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[et.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[et.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[et.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[et.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[et.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[et.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[et.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[et.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[et.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var nD=0,aD=1,lD=2,hD=3,cD=4,uD=5,VI=class Vy{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=et.NONE,this._blendEq=!1,this.map=[],this.map[nD]=this.setBlend,this.map[aD]=this.setOffset,this.map[lD]=this.setCullFace,this.map[hD]=this.setDepthTest,this.map[cD]=this.setFrontFace,this.map[uD]=this.setDepthMask,this.checks=[],this.defaultState=new qr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=HI(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Vy.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Vy.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};VI.extension={type:X.RendererSystem,name:"state"};var Wy=VI;Z.add(Wy);var An=class extends Ms.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new te(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Th=class xf{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=xf.defaultMaxIdle,this.checkCountMax=xf.defaultCheckCountMax,this.mode=xf.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Rd.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Th.defaultMode=Rd.AUTO,Th.defaultMaxIdle=60*60,Th.defaultCheckCountMax=60*10,Th.extension={type:X.RendererSystem,name:"textureGC"};var Qr=Th;Z.add(Qr);var Ws=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=lt.UNSIGNED_BYTE,this.internalFormat=D.RGBA,this.samplerType=0}};function WI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:W.FLOAT,[r.RGBA]:W.FLOAT,[r.ALPHA]:W.FLOAT,[r.LUMINANCE]:W.FLOAT,[r.LUMINANCE_ALPHA]:W.FLOAT,[r.R8]:W.FLOAT,[r.R8_SNORM]:W.FLOAT,[r.RG8]:W.FLOAT,[r.RG8_SNORM]:W.FLOAT,[r.RGB8]:W.FLOAT,[r.RGB8_SNORM]:W.FLOAT,[r.RGB565]:W.FLOAT,[r.RGBA4]:W.FLOAT,[r.RGB5_A1]:W.FLOAT,[r.RGBA8]:W.FLOAT,[r.RGBA8_SNORM]:W.FLOAT,[r.RGB10_A2]:W.FLOAT,[r.RGB10_A2UI]:W.FLOAT,[r.SRGB8]:W.FLOAT,[r.SRGB8_ALPHA8]:W.FLOAT,[r.R16F]:W.FLOAT,[r.RG16F]:W.FLOAT,[r.RGB16F]:W.FLOAT,[r.RGBA16F]:W.FLOAT,[r.R32F]:W.FLOAT,[r.RG32F]:W.FLOAT,[r.RGB32F]:W.FLOAT,[r.RGBA32F]:W.FLOAT,[r.R11F_G11F_B10F]:W.FLOAT,[r.RGB9_E5]:W.FLOAT,[r.R8I]:W.INT,[r.R8UI]:W.UINT,[r.R16I]:W.INT,[r.R16UI]:W.UINT,[r.R32I]:W.INT,[r.R32UI]:W.UINT,[r.RG8I]:W.INT,[r.RG8UI]:W.UINT,[r.RG16I]:W.INT,[r.RG16UI]:W.UINT,[r.RG32I]:W.INT,[r.RG32UI]:W.UINT,[r.RGB8I]:W.INT,[r.RGB8UI]:W.UINT,[r.RGB16I]:W.INT,[r.RGB16UI]:W.UINT,[r.RGB32I]:W.INT,[r.RGB32UI]:W.UINT,[r.RGBA8I]:W.INT,[r.RGBA8UI]:W.UINT,[r.RGBA16I]:W.INT,[r.RGBA16UI]:W.UINT,[r.RGBA32I]:W.INT,[r.RGBA32UI]:W.UINT,[r.DEPTH_COMPONENT16]:W.FLOAT,[r.DEPTH_COMPONENT24]:W.FLOAT,[r.DEPTH_COMPONENT32F]:W.FLOAT,[r.DEPTH_STENCIL]:W.FLOAT,[r.DEPTH24_STENCIL8]:W.FLOAT,[r.DEPTH32F_STENCIL8]:W.FLOAT}:t={[r.RGB]:W.FLOAT,[r.RGBA]:W.FLOAT,[r.ALPHA]:W.FLOAT,[r.LUMINANCE]:W.FLOAT,[r.LUMINANCE_ALPHA]:W.FLOAT,[r.DEPTH_STENCIL]:W.FLOAT},t}function zI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[lt.UNSIGNED_BYTE]:{[D.RGBA]:r.RGBA8,[D.RGB]:r.RGB8,[D.RG]:r.RG8,[D.RED]:r.R8,[D.RGBA_INTEGER]:r.RGBA8UI,[D.RGB_INTEGER]:r.RGB8UI,[D.RG_INTEGER]:r.RG8UI,[D.RED_INTEGER]:r.R8UI,[D.ALPHA]:r.ALPHA,[D.LUMINANCE]:r.LUMINANCE,[D.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.BYTE]:{[D.RGBA]:r.RGBA8_SNORM,[D.RGB]:r.RGB8_SNORM,[D.RG]:r.RG8_SNORM,[D.RED]:r.R8_SNORM,[D.RGBA_INTEGER]:r.RGBA8I,[D.RGB_INTEGER]:r.RGB8I,[D.RG_INTEGER]:r.RG8I,[D.RED_INTEGER]:r.R8I},[lt.UNSIGNED_SHORT]:{[D.RGBA_INTEGER]:r.RGBA16UI,[D.RGB_INTEGER]:r.RGB16UI,[D.RG_INTEGER]:r.RG16UI,[D.RED_INTEGER]:r.R16UI,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[lt.SHORT]:{[D.RGBA_INTEGER]:r.RGBA16I,[D.RGB_INTEGER]:r.RGB16I,[D.RG_INTEGER]:r.RG16I,[D.RED_INTEGER]:r.R16I},[lt.UNSIGNED_INT]:{[D.RGBA_INTEGER]:r.RGBA32UI,[D.RGB_INTEGER]:r.RGB32UI,[D.RG_INTEGER]:r.RG32UI,[D.RED_INTEGER]:r.R32UI,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[lt.INT]:{[D.RGBA_INTEGER]:r.RGBA32I,[D.RGB_INTEGER]:r.RGB32I,[D.RG_INTEGER]:r.RG32I,[D.RED_INTEGER]:r.R32I},[lt.FLOAT]:{[D.RGBA]:r.RGBA32F,[D.RGB]:r.RGB32F,[D.RG]:r.RG32F,[D.RED]:r.R32F,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[lt.HALF_FLOAT]:{[D.RGBA]:r.RGBA16F,[D.RGB]:r.RGB16F,[D.RG]:r.RG16F,[D.RED]:r.R16F},[lt.UNSIGNED_SHORT_5_6_5]:{[D.RGB]:r.RGB565},[lt.UNSIGNED_SHORT_4_4_4_4]:{[D.RGBA]:r.RGBA4},[lt.UNSIGNED_SHORT_5_5_5_1]:{[D.RGBA]:r.RGB5_A1},[lt.UNSIGNED_INT_2_10_10_10_REV]:{[D.RGBA]:r.RGB10_A2,[D.RGBA_INTEGER]:r.RGB10_A2UI},[lt.UNSIGNED_INT_10F_11F_11F_REV]:{[D.RGB]:r.R11F_G11F_B10F},[lt.UNSIGNED_INT_5_9_9_9_REV]:{[D.RGB]:r.RGB9_E5},[lt.UNSIGNED_INT_24_8]:{[D.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[lt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[D.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[lt.UNSIGNED_BYTE]:{[D.RGBA]:r.RGBA,[D.RGB]:r.RGB,[D.ALPHA]:r.ALPHA,[D.LUMINANCE]:r.LUMINANCE,[D.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.UNSIGNED_SHORT_5_6_5]:{[D.RGB]:r.RGB},[lt.UNSIGNED_SHORT_4_4_4_4]:{[D.RGBA]:r.RGBA},[lt.UNSIGNED_SHORT_5_5_5_1]:{[D.RGBA]:r.RGBA}},t}var Pn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new gt,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=zI(t),this.samplerTypes=WI(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new Ws(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ws(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==W.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Ws(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??W.FLOAT,this.webGLVersion===2&&t.type===lt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==W.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&yy(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ar.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Nl.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Ar.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===mr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===mr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===mr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===mr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};Pn.extension={type:X.RendererSystem,name:"texture"};Z.add(Pn);var Cn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};Cn.extension={type:X.RendererSystem,name:"transformFeedback"};Z.add(Cn);var vi=class{constructor(t){this.renderer=t}init(t){this.screen=new _t(0,0,t.width,t.height),this.element=t.view||K.ADAPTER.createCanvas(),this.resolution=t.resolution||K.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};vi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},vi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_view"};Z.add(vi);K.PREFER_ENV=Je.WEBGL2;K.STRICT_TEXTURE_CACHE=!1;K.RENDER_OPTIONS={..._i.defaultOptions,...yi.defaultOptions,...vi.defaultOptions,...bi.defaultOptions};Object.defineProperties(K,{WRAP_MODE:{get(){return gt.defaultOptions.wrapMode},set(r){ft("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),gt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return gt.defaultOptions.scaleMode},set(r){ft("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),gt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return gt.defaultOptions.mipmap},set(r){ft("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),gt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return gt.defaultOptions.anisotropicLevel},set(r){ft("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),gt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ft("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Zr.defaultResolution},set(r){Zr.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ft("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Zr.defaultMultisample},set(r){Zr.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return xi.defaultMaxTextures},set(r){ft("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),xi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return xi.defaultBatchSize},set(r){ft("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),xi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return xi.canUploadSameBuffer},set(r){ft("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),xi.canUploadSameBuffer=r}},GC_MODE:{get(){return Qr.defaultMode},set(r){ft("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Qr.defaultMode=r}},GC_MAX_IDLE:{get(){return Qr.defaultMaxIdle},set(r){ft("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Qr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Qr.defaultCheckCountMax},set(r){ft("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Qr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return yr.defaultVertexPrecision},set(r){ft("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return yr.defaultFragmentPrecision},set(r){ft("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yr.defaultFragmentPrecision=r}}});var zs=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(zs||{});var Rn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var $I=class sr{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Rn(null,null,1/0),this.deltaMS=1/sr.targetFPMS,this.elapsedMS=1/sr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=zs.NORMAL){return this._addListener(new Rn(t,e,i))}addOnce(t,e,i=zs.NORMAL){return this._addListener(new Rn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*sr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,sr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!sr._shared){let t=sr._shared=new sr;t.autoStart=!0,t._protected=!0}return sr._shared}static get system(){if(!sr._system){let t=sr._system=new sr;t.autoStart=!0,t._protected=!0}return sr._system}};$I.targetFPMS=.06;var _r=$I;Object.defineProperties(K,{TARGET_FPMS:{get(){return _r.targetFPMS},set(r){ft("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),_r.targetFPMS=r}}});var Sh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,zs.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?_r.shared:new _r,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Sh.extension=X.Application;Z.add(Sh);var dD=[];Z.handleByList(X.Renderer,dD);var wh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Rt.HIGH?this.multisample=Rt.HIGH:e>=Rt.MEDIUM?this.multisample=Rt.MEDIUM:e>=Rt.LOW?this.multisample=Rt.LOW:this.multisample=Rt.NONE}destroy(){}};wh.extension={type:X.RendererSystem,name:"_multisample"};Z.add(wh);var yf=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Eh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new yf(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Eh.extension={type:X.RendererSystem,name:"buffer"};Z.add(Eh);var Ah=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Ah.extension={type:X.RendererSystem,name:"objectRenderer"};Z.add(Ah);var _f=class zy extends An{constructor(t){super(),this.type=Fx.WEBGL,t=Object.assign({},K.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ir({projectionMatrix:new Ut},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:zy.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ft("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=zy.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:gy()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ft("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ft("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ft("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ft("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ft("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ft("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ft("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ft("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};_f.extension={type:X.Renderer,priority:1},_f.__plugins={},_f.__systems={};var bf=_f;Z.handleByMap(X.RendererPlugin,bf.__plugins);Z.handleByMap(X.RendererSystem,bf.__systems);Z.add(bf);var ji=class extends rr{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new gt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof rr?this.addResourceAt(t[i],i):this.addResourceAt(cn(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var Ph=class extends ji{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=di.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){let h=n[l];o[l]<h.dirtyId&&(o[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}};var Ch=class extends me{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var XI=class Rh extends ji{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Rh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Rh.SIDES;a++)this.items[a].target=di.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=di.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=di.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o<Rh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Rh.SIDES}};XI.SIDES=6;var $y=XI;var Mh=class r extends me{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let i=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===tr.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var Xy=class vf extends me{constructor(t,e){e=e||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},vf.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;me.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${pi()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=vf.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&vf.SVG_XML.test(t)}};Xy.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Xy.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var jy=Xy;var Tf=class extends me{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var Yy=class qy extends me{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];me.crossOrigin(i,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:l}=t[o];if(a=a||t[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let h=a.split("?").shift().toLowerCase(),c=h.slice(h.lastIndexOf(".")+1);l=l||qy.MIME_TYPES[c]||`video/${c}`}n.src=a,l&&(n.type=l),i.appendChild(n)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=_r.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(_r.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_r.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_r.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||qy.TYPES.includes(e)}};Yy.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Yy.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Ky=Yy;eh.push(Mh,Ds,Ch,Ky,Tf,jy,Is,$y,Ph);var fD={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},pD={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function jI(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let h in r.uniforms){let c=t[h],u=i[h],d=e[h],f=r.uniforms[h];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?fD:pD)[c.type].call(null,l,d.location,d.value,u)}}function mD(){Object.assign(Xi.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;jI(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}mD();var Ih=new(window.AudioContext||window.webkitAudioContext),gD=(r,t)=>{let e,i=Ih.createGain();i.gain.value=t.volume??1,i.connect(Ih.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let g=qo.getAsset(s.url);if(!g){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Ih.createBufferSource(),e.buffer=g,e.loop=s.loop,i.gain.setValueAtTime(s.volume,Ih.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(Ih.destination))},update:g=>{s={...s,...g}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:g=>{s.url=g},setLoop:g=>{s.loop=g},setVolume:g=>{s.volume=g,i.gain.value=g},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},YI=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let h=r.find(c=>c.id===l.id);if(!h){let c=gD(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(c),c.play();continue}(h.url!==l.url||h.loop!==l.loop)&&(h.stop(),h.setUrl(l.url),h.setLoop(l.loop??!1),h.play()),h.getVolume()!==(l.volume??1)&&h.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(h=>h.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var xD=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var Zy=xD;var qI=({type:r,parse:t})=>({type:r,parse:t});var Qy=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Jy(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function Bh(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function QI(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function JI(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function yD(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function tB(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var Uh={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Qy?173:189,"=":Qy?61:187,";":Qy?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Mr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},Fh={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},we={16:!1,18:!1,17:!1,91:!1},Xt={};for(let r=1;r<20;r++)Uh[`f${r}`]=111+r;var Vt=[],kh=null,eB="all",Ti=new Map,Mn=r=>Uh[r.toLowerCase()]||Mr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),_D=r=>Object.keys(Uh).find(t=>Uh[t]===r),bD=r=>Object.keys(Mr).find(t=>Mr[t]===r),rB=r=>{eB=r||"all"},Gh=()=>eB||"all",vD=()=>Vt.slice(0),TD=()=>Vt.map(r=>_D(r)||bD(r)||String.fromCharCode(r)),SD=()=>{let r=[];return Object.keys(Xt).forEach(t=>{Xt[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>Mn(n))})})}),r},iB=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},wD=r=>(typeof r=="string"&&(r=Mn(r)),Vt.indexOf(r)!==-1),ED=(r,t)=>{let e,i;r||(r=Gh());for(let s in Xt)if(Object.prototype.hasOwnProperty.call(Xt,s))for(e=Xt[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>e_(o)):i++;Gh()===r&&rB(t||"all")};function AD(r){let t=tB(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=Mn(r.key));let e=Vt.indexOf(t);if(e>=0&&Vt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Vt.splice(0,Vt.length),(t===93||t===224)&&(t=91),t in we){we[t]=!1;for(let i in Mr)Mr[i]===t&&(or[i]=!1)}}var sB=(r,...t)=>{if(typeof r>"u")Object.keys(Xt).forEach(e=>{Array.isArray(Xt[e])&&Xt[e].forEach(i=>Sf(i)),delete Xt[e]}),e_(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&Sf(e)});else if(typeof r=="object")r.key&&Sf(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),Sf({key:r,scope:e,method:i,splitKey:"+"})}},Sf=({key:r,scope:t,method:e,splitKey:i="+"})=>{JI(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Mn(a);if(!Xt[l])return;t||(t=Gh());let h=n>1?QI(Mr,o):[],c=[];Xt[l]=Xt[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&yD(u.mods,h);return d&&c.push(u.element),!d}),c.forEach(u=>e_(u))})};function KI(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in we)Object.prototype.hasOwnProperty.call(we,o)&&(!we[o]&&t.mods.indexOf(+o)>-1||we[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!we[16]&&!we[18]&&!we[17]&&!we[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Vt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function ZI(r,t){let e=Xt["*"],i=tB(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(or.filter||iB).call(this,r))return;if((i===93||i===224)&&(i=91),Vt.indexOf(i)===-1&&i!==229&&Vt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=Fh[a];r[a]&&Vt.indexOf(l)===-1?Vt.push(l):!r[a]&&Vt.indexOf(l)>-1?Vt.splice(Vt.indexOf(l),1):a==="metaKey"&&r[a]&&(Vt=Vt.filter(h=>h in Fh||h===i))}),i in we){we[i]=!0;for(let a in Mr)if(Object.prototype.hasOwnProperty.call(Mr,a)){let l=Fh[Mr[a]];or[a]=r[l]}if(!e)return}for(let a in we)Object.prototype.hasOwnProperty.call(we,a)&&(we[a]=r[Fh[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Vt.indexOf(17)===-1&&Vt.push(17),Vt.indexOf(18)===-1&&Vt.push(18),we[17]=!0,we[18]=!0);let s=Gh();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&KI(r,e[a],s,t);if(!(i in Xt))return;let o=Xt[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:h}=l,c=l.key.split(h),u=[];for(let d=0;d<c.length;d++)u.push(Mn(c[d]));u.sort().join("")===Vt.sort().join("")&&KI(r,l,s,t)}}var or=function(r,t,e){Vt=[];let i=JI(r),s=[],o="all",n=document,a=0,l=!1,h=!0,c="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(h=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(c=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&sB(r,o);a<i.length;a++){let f=i[a].split(c);s=[],f.length>1&&(s=QI(Mr,f));let p=f[f.length-1];p=p==="*"?"*":Mn(p),p in Xt||(Xt[p]=[]),Xt[p].push({keyup:l,keydown:h,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Ti.has(n)){let f=(g=window.event)=>ZI(g,n),p=(g=window.event)=>{ZI(g,n),AD(g)};Ti.set(n,{keydownListener:f,keyupListenr:p,capture:u}),Jy(n,"keydown",f,u),Jy(n,"keyup",p,u)}if(!kh){let f=()=>{Vt=[]};kh={listener:f,capture:u},Jy(window,"focus",f,u)}}};function PD(r,t="all"){Object.keys(Xt).forEach(e=>{Xt[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function e_(r){let t=Object.values(Xt).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=Ti.get(r)||{};e&&i&&(Bh(r,"keyup",i,s),Bh(r,"keydown",e,s),Ti.delete(r))}if((t.length<=0||Ti.size<=0)&&(Array.from(Ti.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=Ti.get(e)||{};i&&s&&(Bh(e,"keyup",s,o),Bh(e,"keydown",i,o),Ti.delete(e))}),Ti.clear(),Object.keys(Xt).forEach(e=>delete Xt[e]),kh)){let{listener:e,capture:i}=kh;Bh(window,"focus",e,i),kh=null}}var t_={getPressedKeyString:TD,setScope:rB,getScope:Gh,deleteScope:ED,getPressedKeyCodes:vD,getAllKeyCodes:SD,isPressed:wD,filter:iB,trigger:PD,unbind:sB,keyMap:Uh,modifier:Mr,modifierMap:Fh};for(let r in t_){let t=r;Object.prototype.hasOwnProperty.call(t_,t)&&(or[t]=t_[t])}if(typeof window<"u"){let r=window.hotkeys;or.noConflict=t=>(t&&window.hotkeys===or&&(window.hotkeys=r),or),window.hotkeys=or}var CD=Object.prototype.hasOwnProperty,oB=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let h=t.get(l);h?Et(h.payload,s[l].payload)||(n.push(l),or.unbind(l)):o.push(l)}),t.forEach((l,h)=>{CD.call(s,h)||a.push(h)}),a.forEach(l=>{or.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let c=s[l].payload??{};or(l,()=>{r&&r("keydown",{_event:{key:l},...c})}),t.set(l,{value:l,payload:c})})},destroy:()=>{for(let s of t.keys())or.unbind(s);t.clear()}}};var aB=(r,t)=>typeof t!="string"?t:r[t]??t,RD=(r,t,e,i)=>{let s=aB(e,t);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},nB=(r,t,e,i)=>{let s=aB(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},MD=(r,t,e)=>Object.entries(t).map(([i,s])=>{if(!Vu[i])throw new Error(`${i} is not a supported property for animation.`);let o=RD(r,i,e,0),n=s.initialValue??o,a=Il([{value:n},...s.keyframes]);return{property:i,timeline:a}}),lB=()=>{let r=[],t=new Map,e=new Map,i=0,s=(v,S)=>{e.get(v)?.forEach(P=>{try{P(S)}catch{}})},o=v=>{if(s("completed",{id:v.id}),v.onComplete)try{v.onComplete()}catch{}},n=v=>{let{id:S,element:P,properties:R,targetState:A,onComplete:C,onCancel:M,propertyPathMap:B=Wu}=v,k=MD(P,R,B),U={id:S,kind:"property",element:P,timelines:k,duration:Bl(k),currentTime:0,stateVersion:i,targetState:A,onComplete:C,onCancel:M,applyFrame:O=>{for(let{property:$,timeline:N}of k){let L=Fl(N,O);try{nB(P,$,B,L)}catch{}}},applyTargetState:()=>{if(!(!P||P.destroyed)){if(A===null){P.destroy();return}if(A)for(let[O,$]of Object.entries(A))try{nB(P,O,B,$)}catch{}}},isValid:()=>!!P&&!P.destroyed};U.applyFrame(0),t.set(S,U),s("started",{id:S})},a=v=>{let S={id:v.id,kind:"custom",duration:v.duration??0,currentTime:0,stateVersion:i,onComplete:v.onComplete,onCancel:v.onCancel,applyFrame:v.applyFrame??(()=>{}),applyTargetState:v.applyTargetState??(()=>{}),isValid:v.isValid??(()=>!0)};S.applyFrame(0),t.set(S.id,S),s("started",{id:S.id})},l=v=>{if(v.driver==="custom"){a(v);return}n(v)},h=v=>{try{v.applyTargetState?.()}catch{}if(v.onCancel)try{v.onCancel()}catch{}},c=v=>{switch(v.type){case"START":l(v.payload);break;case"CANCEL":d(v.id);break}},u=()=>{let v=r.splice(0);for(let S of v)c(S)},d=v=>{let S=t.get(v);S&&(h(S),t.delete(v),s("cancelled",{id:v}))},f=v=>{r.push(v)},p=()=>{for(let[v,S]of t)h(S),s("cancelled",{id:v});t.clear(),i++},g=v=>{u();let S=[];for(let[P,R]of t){if(R.stateVersion!==i){S.push(P);continue}if(!R.isValid()){S.push(P);continue}if(R.currentTime+=v,R.currentTime>=R.duration){R.applyFrame(R.duration),o(R),S.push(P);continue}R.applyFrame(R.currentTime)}for(let P of S)t.delete(P)},m=()=>{u()},_=(v,S)=>(e.has(v)||e.set(v,new Set),e.get(v).add(S),()=>b(v,S)),b=(v,S)=>{e.get(v)?.delete(S)};return{dispatch:f,cancelAll:p,flush:m,tick:g,on:_,off:b,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([v,S])=>({id:v,currentTime:S.currentTime,duration:S.duration,progress:S.duration>0?S.currentTime/S.duration:0}))}),isAnimating:v=>t.has(v),destroy:()=>{p(),e.clear()}}};var hB=r=>{let t=0,e=0,i=null;return{reset:h=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=h},track:h=>{h===e&&t++},complete:h=>{h===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var cB=new Set(["update","transition"]),ID=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),BD=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),uB=new Set(["single","sequence","composite"]),Ef=new Set(["red","green","blue","alpha"]),dB=new Set(["max","min","multiply","add"]),FD=new Set(vx),Yi=(r,t)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${t} must be an object.`)},$s=(r,t)=>{if(typeof r!="string"||r.length===0)throw new Error(`${t} must be a non-empty string.`)},wf=(r,t)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${t} must be a number.`)},pB=(r,t)=>{Yi(r,t);let e={};if(r.initialValue!==void 0&&(wf(r.initialValue,`${t}.initialValue`),e.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${t}.keyframes must be a non-empty array.`);return e.keyframes=r.keyframes.map((i,s)=>{let o=`${t}.keyframes[${s}]`;if(Yi(i,o),wf(i.value,`${o}.value`),wf(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!FD.has(i.easing))throw new Error(`${o}.easing must be one of: ${vx.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),e},mB=(r,t,e)=>{Yi(r,t);let i=Object.entries(r).map(([s,o])=>{if(!e.has(s))throw new Error(`${t}.${s} is not a supported animation property.`);return[s,pB(o,`${t}.${s}`)]});if(i.length===0)throw new Error(`${t} must define at least one property.`);return Object.fromEntries(i)},kD=(r,t)=>{if(Yi(r,t),$s(r.texture,`${t}.texture`),r.channel!==void 0&&!Ef.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(Ef).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},UD=(r,t)=>{if(Yi(r,t),!uB.has(r.kind))throw new Error(`${t}.kind must be one of: ${Array.from(uB).join(", ")}.`);let e={kind:r.kind};if(r.channel!==void 0){if(!Ef.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(Ef).join(", ")}.`);e.channel=r.channel}if(r.softness!==void 0&&(wf(r.softness,`${t}.softness`),e.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);e.invert=r.invert}if(r.progress!==void 0&&(e.progress=pB(r.progress,`${t}.progress`)),r.kind==="single"&&($s(r.texture,`${t}.texture`),e.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${t}.textures must be a non-empty array.`);e.textures=r.textures.map((i,s)=>($s(i,`${t}.textures[${s}]`),i)),r.sample!==void 0&&($s(r.sample,`${t}.sample`),e.sample=r.sample)}if(r.kind==="composite"){if(!dB.has(r.combine??"max"))throw new Error(`${t}.combine must be one of: ${Array.from(dB).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${t}.items must be a non-empty array.`);e.combine=r.combine??"max",e.items=r.items.map((i,s)=>kD(i,`${t}.items[${s}]`))}return e.progress||(e.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),e},fB=(r,t)=>{if(Yi(r,t),r.mask!==void 0)throw new Error(`${t}.mask is not valid. Define mask on ${t}.`);let e={};if(r.tween!==void 0&&(e.tween=mB(r.tween,`${t}.tween`,BD)),Object.keys(e).length===0)throw new Error(`${t} must define tween.`);return e},GD=(r,t)=>{let e={};if(r.shader!==void 0)throw new Error(`${t}.shader is not supported.`);if(r.prev!==void 0&&(e.prev=fB(r.prev,`${t}.prev`)),r.next!==void 0&&(e.next=fB(r.next,`${t}.next`)),r.mask!==void 0&&(e.mask=UD(r.mask,`${t}.mask`)),e.prev===void 0&&e.next===void 0&&e.mask===void 0)throw new Error(`${t} must define prev, next, or mask.`);return e},r_=(r,t,e)=>{if(r!==void 0)throw new Error(`${t} ${e}`)},gB=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let t=r.map((i,s)=>{let o=`animations[${s}]`;if(Yi(i,o),$s(i.id,`${o}.id`),$s(i.targetId,`${o}.targetId`),$s(i.type,`${o}.type`),!cB.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(cB).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(Yi(i.complete,`${o}.complete`),n.complete=i.complete),r_(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),r_(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),r_(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=mB(i.tween,`${o}.tween`,ID),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=GD(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),e=new Map;for(let i of t){let s=e.get(i.targetId)??new Set;s.add(i.type),e.set(i.targetId,s)}for(let[i,s]of e)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return t};var i_=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t.animations=gB(t.animations),t};var OD=()=>{let r,t=YI(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,h=!1,c,u,d,f=new Map,p,g=(v,S,P,R)=>{v.clear(),v.rect(0,0,S,P),v.fill(R??0)},m=v=>v?v.startsWith("audio/")?"audio":v.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(v)?"font":v.startsWith("video/")?"video":"texture":"texture",_=(v,S,{revokable:P=!1}={})=>{f.set(v,{url:S,revokable:P})},b=()=>{for(let v of f.values())v?.revokable===!0&&typeof v?.url=="string"&&URL.revokeObjectURL(v.url);f.clear()},y=(v,S,P)=>{o&&o.registerHotkeys(P?.keyboard??{}),v.renderer.events.cursorStyles||(v.renderer.events.cursorStyles={}),v.renderer.events.cursorStyles.default||(v.renderer.events.cursorStyles.default="default"),v.renderer.events.cursorStyles.hover||(v.renderer.events.cursorStyles.hover="pointer");let R=S?.cursorStyles,A=P?.cursorStyles;Et(R,A)||(A?(A.default&&(v.renderer.events.cursorStyles.default=A.default,v.canvas.style.cursor=A.default),A.hover&&(v.renderer.events.cursorStyles.hover=A.hover)):R&&(v.renderer.events.cursorStyles.default="default",v.renderer.events.cursorStyles.hover="pointer"))},w=(v,S,P,R)=>{c&&c.abort(),c=new AbortController;let A=c.signal;a.reset(P.id),y(v,e.global,P.global),n.cancelAll(),Ts({app:v,parent:S,prevComputedTree:e.elements,nextComputedTree:P.elements,animations:P.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:R,signal:A}),n.flush(),Bx({app:v,prevAudioTree:e.audio,nextAudioTree:P.audio,audioPlugins:s.audio}),e=P,a.completeIfEmpty(),h||(h=!0,l&&l())},E={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:v=>r.stage.getChildByLabel(v,!0)??null,extractBase64:async v=>{let S=new tt(0,0,r.renderer.width,r.renderer.height);if(!v)return await r.renderer.extract.base64({target:r.stage,frame:S});let P=r.stage.getChildByLabel(v,!0);if(!P)throw new Error(`Element with label '${v}' not found`);return await r.renderer.extract.base64({target:P,frame:S})},assignStageEvent:(v,S)=>{r.stage.eventMode="static",r.stage.on(v,S)},init:async v=>{let{eventHandler:S,plugins:P,width:R,height:A,backgroundColor:C,debug:M=!1,onFirstRender:B}=v;l=B;let k=[];return P?.elements?.forEach(U=>{U?.parse&&k.push(qI({type:U.type,parse:U.parse}))}),s={animations:P?.animations??[],elements:P?.elements??[],audio:P?.audio??[],parsers:k},i=S,o=oB(S),a=hB(S),r=new vl,r.audioStage=t,await r.init({width:R,height:A,backgroundColor:C,preference:"webgl"}),r.debug=M,d=U=>{U.preventDefault()},r.canvas.addEventListener("contextmenu",d),p=new de,p.label="__route_graphics_background__",g(p,R,A,C),r.stage.addChild(p),r.stage.width=R,r.stage.height=A,r.ticker.add(r.audioStage.tick),n=lB(),M?(u=U=>{U?.detail?.deltaMS&&n.tick(Number(U.detail.deltaMS))},window.addEventListener("snapShotKeyFrame",u)):r.ticker.add(U=>n.tick(U.deltaMS)),E},destroy:()=>{c&&(c.abort(),c=void 0),u&&(window.removeEventListener("snapShotKeyFrame",u),u=void 0),d&&r?.canvas&&(r.canvas.removeEventListener("contextmenu",d),d=void 0),o?.destroy(),Ex(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let v=S=>{for(let P of S.children){let R=P.texture?.source?.resource;R instanceof HTMLVideoElement&&R.pause(),P.children&&v(P)}};r?.stage&&v(r.stage),r&&r.destroy(),p=void 0,b()},loadAssets:async v=>{if(!v)throw new Error("assetBufferMap is required");let S={audio:{},font:{},video:{},texture:{}};for(let[A,C]of Object.entries(v)){let M=m(C.type);S[M][A]=C}await Promise.all(Object.entries(S.audio).map(([A,C])=>qo.load(A,C.buffer))),await Promise.all(Object.entries(S.font).map(async([A,C])=>{let M=new Blob([C.buffer],{type:C.type}),B=URL.createObjectURL(M),k=new FontFace(A,`url(${B})`);try{await k.load(),document.fonts.add(k)}catch(U){console.error(`Failed to load font ${A}:`,U)}finally{URL.revokeObjectURL(B)}}));let P=Object.entries(S.texture).map(async([A,C])=>{if(pr.cache.has(A))return pr.cache.get(A);if(C?.source==="url"&&typeof C?.url=="string")return pr.load({alias:A,src:C.url,parser:"loadTextures"});let M=new Blob([C.buffer],{type:C.type}),B=await createImageBitmap(M),k=I.from(B);return pr.cache.set(A,k),k}),R=Object.entries(S.video).map(async([A,C])=>{let M=C?.source==="url"&&typeof C?.url=="string"?C.url:URL.createObjectURL(new Blob([C.buffer],{type:C.type})),B=C?.source!=="url";_(A,M,{revokable:B});let k={alias:A,src:M,parser:"loadVideo",data:{}};return typeof C?.type=="string"&&C.type.length>0&&(k.data.mime=C.type),pr.load(k).then(U=>U).catch(U=>{throw f.delete(A),B&&URL.revokeObjectURL(M),U})});return Promise.all([...P,...R])},loadAudioAssets:async v=>Promise.all(v.map(async S=>{let R=await(await fetch(S)).arrayBuffer();return qo.load(S,R)})),updatedBackgroundColor:v=>{r.renderer.background.color=v,p&&g(p,r.renderer.width,r.renderer.height,v)},render:v=>{let S=i_(v),P=Zy({JSONObject:S.elements,parserPlugins:s.parsers}),R={...S,elements:P};w(r,r.stage,R,i)},parse:v=>{let S=i_(v),P=Zy({JSONObject:S.elements,parserPlugins:s.parsers});return{...S,elements:P}}};return E},xB=OD;var $At=xB;export{vl as Application,pr as Assets,qo as AudioAsset,DU as animatedSpritePlugin,GU as containerPlugin,dx as createAnimationPlugin,AB as createAssetBufferManager,fx as createAudioPlugin,fe as createElementPlugin,$At as default,jU as particlesPlugin,uU as rectPlugin,Bx as renderAudio,Ts as renderElements,mU as sliderPlugin,VU as soundPlugin,dU as spritePlugin,lU as textPlugin,LU as textRevealingPlugin,NU as tweenPlugin,pU as videoPlugin};
1628
+ `))}}var aD=0,xf={textureCount:0,uboCount:0},ji=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=aD++}systemCheck(){if(!df())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(xf.textureCount=0,xf.uboCount=0,this.syncUniformGroup(t.uniformGroup,xf)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Fy(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,xf,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Vy(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=Hy(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};ji.extension={type:X.RendererSystem,name:"shader"};Z.add(ji);var bi=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};bi.defaultOptions={hello:!1},bi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"startup"};Z.add(bi);function VI(r,t=[]){return t[et.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.ADD]=[r.ONE,r.ONE],t[et.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.NONE]=[0,0],t[et.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[et.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[et.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[et.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[et.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[et.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[et.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[et.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[et.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[et.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[et.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var lD=0,hD=1,cD=2,uD=3,dD=4,fD=5,WI=class Wy{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=et.NONE,this._blendEq=!1,this.map=[],this.map[lD]=this.setBlend,this.map[hD]=this.setOffset,this.map[cD]=this.setCullFace,this.map[uD]=this.setDepthTest,this.map[dD]=this.setFrontFace,this.map[fD]=this.setDepthMask,this.checks=[],this.defaultState=new qr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=VI(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Wy.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Wy.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};WI.extension={type:X.RendererSystem,name:"state"};var zy=WI;Z.add(zy);var An=class extends Ms.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new te(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Th=class yf{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=yf.defaultMaxIdle,this.checkCountMax=yf.defaultCheckCountMax,this.mode=yf.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Md.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Th.defaultMode=Md.AUTO,Th.defaultMaxIdle=60*60,Th.defaultCheckCountMax=60*10,Th.extension={type:X.RendererSystem,name:"textureGC"};var Qr=Th;Z.add(Qr);var Ws=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=lt.UNSIGNED_BYTE,this.internalFormat=D.RGBA,this.samplerType=0}};function zI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:W.FLOAT,[r.RGBA]:W.FLOAT,[r.ALPHA]:W.FLOAT,[r.LUMINANCE]:W.FLOAT,[r.LUMINANCE_ALPHA]:W.FLOAT,[r.R8]:W.FLOAT,[r.R8_SNORM]:W.FLOAT,[r.RG8]:W.FLOAT,[r.RG8_SNORM]:W.FLOAT,[r.RGB8]:W.FLOAT,[r.RGB8_SNORM]:W.FLOAT,[r.RGB565]:W.FLOAT,[r.RGBA4]:W.FLOAT,[r.RGB5_A1]:W.FLOAT,[r.RGBA8]:W.FLOAT,[r.RGBA8_SNORM]:W.FLOAT,[r.RGB10_A2]:W.FLOAT,[r.RGB10_A2UI]:W.FLOAT,[r.SRGB8]:W.FLOAT,[r.SRGB8_ALPHA8]:W.FLOAT,[r.R16F]:W.FLOAT,[r.RG16F]:W.FLOAT,[r.RGB16F]:W.FLOAT,[r.RGBA16F]:W.FLOAT,[r.R32F]:W.FLOAT,[r.RG32F]:W.FLOAT,[r.RGB32F]:W.FLOAT,[r.RGBA32F]:W.FLOAT,[r.R11F_G11F_B10F]:W.FLOAT,[r.RGB9_E5]:W.FLOAT,[r.R8I]:W.INT,[r.R8UI]:W.UINT,[r.R16I]:W.INT,[r.R16UI]:W.UINT,[r.R32I]:W.INT,[r.R32UI]:W.UINT,[r.RG8I]:W.INT,[r.RG8UI]:W.UINT,[r.RG16I]:W.INT,[r.RG16UI]:W.UINT,[r.RG32I]:W.INT,[r.RG32UI]:W.UINT,[r.RGB8I]:W.INT,[r.RGB8UI]:W.UINT,[r.RGB16I]:W.INT,[r.RGB16UI]:W.UINT,[r.RGB32I]:W.INT,[r.RGB32UI]:W.UINT,[r.RGBA8I]:W.INT,[r.RGBA8UI]:W.UINT,[r.RGBA16I]:W.INT,[r.RGBA16UI]:W.UINT,[r.RGBA32I]:W.INT,[r.RGBA32UI]:W.UINT,[r.DEPTH_COMPONENT16]:W.FLOAT,[r.DEPTH_COMPONENT24]:W.FLOAT,[r.DEPTH_COMPONENT32F]:W.FLOAT,[r.DEPTH_STENCIL]:W.FLOAT,[r.DEPTH24_STENCIL8]:W.FLOAT,[r.DEPTH32F_STENCIL8]:W.FLOAT}:t={[r.RGB]:W.FLOAT,[r.RGBA]:W.FLOAT,[r.ALPHA]:W.FLOAT,[r.LUMINANCE]:W.FLOAT,[r.LUMINANCE_ALPHA]:W.FLOAT,[r.DEPTH_STENCIL]:W.FLOAT},t}function $I(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[lt.UNSIGNED_BYTE]:{[D.RGBA]:r.RGBA8,[D.RGB]:r.RGB8,[D.RG]:r.RG8,[D.RED]:r.R8,[D.RGBA_INTEGER]:r.RGBA8UI,[D.RGB_INTEGER]:r.RGB8UI,[D.RG_INTEGER]:r.RG8UI,[D.RED_INTEGER]:r.R8UI,[D.ALPHA]:r.ALPHA,[D.LUMINANCE]:r.LUMINANCE,[D.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.BYTE]:{[D.RGBA]:r.RGBA8_SNORM,[D.RGB]:r.RGB8_SNORM,[D.RG]:r.RG8_SNORM,[D.RED]:r.R8_SNORM,[D.RGBA_INTEGER]:r.RGBA8I,[D.RGB_INTEGER]:r.RGB8I,[D.RG_INTEGER]:r.RG8I,[D.RED_INTEGER]:r.R8I},[lt.UNSIGNED_SHORT]:{[D.RGBA_INTEGER]:r.RGBA16UI,[D.RGB_INTEGER]:r.RGB16UI,[D.RG_INTEGER]:r.RG16UI,[D.RED_INTEGER]:r.R16UI,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[lt.SHORT]:{[D.RGBA_INTEGER]:r.RGBA16I,[D.RGB_INTEGER]:r.RGB16I,[D.RG_INTEGER]:r.RG16I,[D.RED_INTEGER]:r.R16I},[lt.UNSIGNED_INT]:{[D.RGBA_INTEGER]:r.RGBA32UI,[D.RGB_INTEGER]:r.RGB32UI,[D.RG_INTEGER]:r.RG32UI,[D.RED_INTEGER]:r.R32UI,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[lt.INT]:{[D.RGBA_INTEGER]:r.RGBA32I,[D.RGB_INTEGER]:r.RGB32I,[D.RG_INTEGER]:r.RG32I,[D.RED_INTEGER]:r.R32I},[lt.FLOAT]:{[D.RGBA]:r.RGBA32F,[D.RGB]:r.RGB32F,[D.RG]:r.RG32F,[D.RED]:r.R32F,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[lt.HALF_FLOAT]:{[D.RGBA]:r.RGBA16F,[D.RGB]:r.RGB16F,[D.RG]:r.RG16F,[D.RED]:r.R16F},[lt.UNSIGNED_SHORT_5_6_5]:{[D.RGB]:r.RGB565},[lt.UNSIGNED_SHORT_4_4_4_4]:{[D.RGBA]:r.RGBA4},[lt.UNSIGNED_SHORT_5_5_5_1]:{[D.RGBA]:r.RGB5_A1},[lt.UNSIGNED_INT_2_10_10_10_REV]:{[D.RGBA]:r.RGB10_A2,[D.RGBA_INTEGER]:r.RGB10_A2UI},[lt.UNSIGNED_INT_10F_11F_11F_REV]:{[D.RGB]:r.R11F_G11F_B10F},[lt.UNSIGNED_INT_5_9_9_9_REV]:{[D.RGB]:r.RGB9_E5},[lt.UNSIGNED_INT_24_8]:{[D.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[lt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[D.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[lt.UNSIGNED_BYTE]:{[D.RGBA]:r.RGBA,[D.RGB]:r.RGB,[D.ALPHA]:r.ALPHA,[D.LUMINANCE]:r.LUMINANCE,[D.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.UNSIGNED_SHORT_5_6_5]:{[D.RGB]:r.RGB},[lt.UNSIGNED_SHORT_4_4_4_4]:{[D.RGBA]:r.RGBA},[lt.UNSIGNED_SHORT_5_5_5_1]:{[D.RGBA]:r.RGBA}},t}var Pn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new gt,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=$I(t),this.samplerTypes=zI(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new Ws(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ws(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==W.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Ws(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??W.FLOAT,this.webGLVersion===2&&t.type===lt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==W.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&_y(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ar.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Nl.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Ar.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===mr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===mr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===mr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===mr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};Pn.extension={type:X.RendererSystem,name:"texture"};Z.add(Pn);var Cn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};Cn.extension={type:X.RendererSystem,name:"transformFeedback"};Z.add(Cn);var vi=class{constructor(t){this.renderer=t}init(t){this.screen=new _t(0,0,t.width,t.height),this.element=t.view||K.ADAPTER.createCanvas(),this.resolution=t.resolution||K.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};vi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},vi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_view"};Z.add(vi);K.PREFER_ENV=Je.WEBGL2;K.STRICT_TEXTURE_CACHE=!1;K.RENDER_OPTIONS={..._i.defaultOptions,...yi.defaultOptions,...vi.defaultOptions,...bi.defaultOptions};Object.defineProperties(K,{WRAP_MODE:{get(){return gt.defaultOptions.wrapMode},set(r){ft("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),gt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return gt.defaultOptions.scaleMode},set(r){ft("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),gt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return gt.defaultOptions.mipmap},set(r){ft("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),gt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return gt.defaultOptions.anisotropicLevel},set(r){ft("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),gt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ft("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Zr.defaultResolution},set(r){Zr.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ft("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Zr.defaultMultisample},set(r){Zr.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return xi.defaultMaxTextures},set(r){ft("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),xi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return xi.defaultBatchSize},set(r){ft("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),xi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return xi.canUploadSameBuffer},set(r){ft("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),xi.canUploadSameBuffer=r}},GC_MODE:{get(){return Qr.defaultMode},set(r){ft("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Qr.defaultMode=r}},GC_MAX_IDLE:{get(){return Qr.defaultMaxIdle},set(r){ft("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Qr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Qr.defaultCheckCountMax},set(r){ft("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Qr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return yr.defaultVertexPrecision},set(r){ft("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return yr.defaultFragmentPrecision},set(r){ft("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yr.defaultFragmentPrecision=r}}});var zs=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(zs||{});var Rn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var XI=class sr{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Rn(null,null,1/0),this.deltaMS=1/sr.targetFPMS,this.elapsedMS=1/sr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=zs.NORMAL){return this._addListener(new Rn(t,e,i))}addOnce(t,e,i=zs.NORMAL){return this._addListener(new Rn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*sr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,sr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!sr._shared){let t=sr._shared=new sr;t.autoStart=!0,t._protected=!0}return sr._shared}static get system(){if(!sr._system){let t=sr._system=new sr;t.autoStart=!0,t._protected=!0}return sr._system}};XI.targetFPMS=.06;var _r=XI;Object.defineProperties(K,{TARGET_FPMS:{get(){return _r.targetFPMS},set(r){ft("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),_r.targetFPMS=r}}});var Sh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,zs.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?_r.shared:new _r,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Sh.extension=X.Application;Z.add(Sh);var pD=[];Z.handleByList(X.Renderer,pD);var wh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Rt.HIGH?this.multisample=Rt.HIGH:e>=Rt.MEDIUM?this.multisample=Rt.MEDIUM:e>=Rt.LOW?this.multisample=Rt.LOW:this.multisample=Rt.NONE}destroy(){}};wh.extension={type:X.RendererSystem,name:"_multisample"};Z.add(wh);var _f=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Eh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new _f(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Eh.extension={type:X.RendererSystem,name:"buffer"};Z.add(Eh);var Ah=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Ah.extension={type:X.RendererSystem,name:"objectRenderer"};Z.add(Ah);var bf=class $y extends An{constructor(t){super(),this.type=kx.WEBGL,t=Object.assign({},K.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ir({projectionMatrix:new Ut},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:$y.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ft("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=$y.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:xy()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ft("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ft("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ft("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ft("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ft("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ft("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ft("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ft("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};bf.extension={type:X.Renderer,priority:1},bf.__plugins={},bf.__systems={};var vf=bf;Z.handleByMap(X.RendererPlugin,vf.__plugins);Z.handleByMap(X.RendererSystem,vf.__systems);Z.add(vf);var Yi=class extends rr{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new gt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof rr?this.addResourceAt(t[i],i):this.addResourceAt(cn(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var Ph=class extends Yi{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=di.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){let h=n[l];o[l]<h.dirtyId&&(o[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}};var Ch=class extends me{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var jI=class Rh extends Yi{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Rh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Rh.SIDES;a++)this.items[a].target=di.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=di.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=di.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o<Rh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Rh.SIDES}};jI.SIDES=6;var Xy=jI;var Mh=class r extends me{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let i=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===tr.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var jy=class Tf extends me{constructor(t,e){e=e||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Tf.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;me.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${pi()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Tf.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Tf.SVG_XML.test(t)}};jy.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,jy.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Yy=jy;var Sf=class extends me{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var qy=class Ky extends me{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];me.crossOrigin(i,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:l}=t[o];if(a=a||t[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let h=a.split("?").shift().toLowerCase(),c=h.slice(h.lastIndexOf(".")+1);l=l||Ky.MIME_TYPES[c]||`video/${c}`}n.src=a,l&&(n.type=l),i.appendChild(n)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=_r.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(_r.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_r.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_r.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Ky.TYPES.includes(e)}};qy.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],qy.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Zy=qy;eh.push(Mh,Ds,Ch,Zy,Sf,Yy,Is,Xy,Ph);var mD={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},gD={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function YI(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let h in r.uniforms){let c=t[h],u=i[h],d=e[h],f=r.uniforms[h];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?mD:gD)[c.type].call(null,l,d.location,d.value,u)}}function xD(){Object.assign(ji.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;YI(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}xD();var Ih=new(window.AudioContext||window.webkitAudioContext),yD=(r,t)=>{let e,i=Ih.createGain();i.gain.value=t.volume??1,i.connect(Ih.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=qo.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Ih.createBufferSource(),e.buffer=m,e.loop=s.loop,i.gain.setValueAtTime(s.volume,Ih.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(Ih.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},qI=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let h=r.find(c=>c.id===l.id);if(!h){let c=yD(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(c),c.play();continue}(h.url!==l.url||h.loop!==l.loop)&&(h.stop(),h.setUrl(l.url),h.setLoop(l.loop??!1),h.play()),h.getVolume()!==(l.volume??1)&&h.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(h=>h.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var _D=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var Qy=_D;var KI=({type:r,parse:t})=>({type:r,parse:t});var Jy=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function t_(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function Bh(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function JI(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function tB(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function bD(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function eB(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var Uh={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Jy?173:189,"=":Jy?61:187,";":Jy?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Mr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},Fh={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},we={16:!1,18:!1,17:!1,91:!1},Xt={};for(let r=1;r<20;r++)Uh[`f${r}`]=111+r;var Vt=[],kh=null,rB="all",Ti=new Map,Mn=r=>Uh[r.toLowerCase()]||Mr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),vD=r=>Object.keys(Uh).find(t=>Uh[t]===r),TD=r=>Object.keys(Mr).find(t=>Mr[t]===r),iB=r=>{rB=r||"all"},Gh=()=>rB||"all",SD=()=>Vt.slice(0),wD=()=>Vt.map(r=>vD(r)||TD(r)||String.fromCharCode(r)),ED=()=>{let r=[];return Object.keys(Xt).forEach(t=>{Xt[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>Mn(n))})})}),r},sB=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},AD=r=>(typeof r=="string"&&(r=Mn(r)),Vt.indexOf(r)!==-1),PD=(r,t)=>{let e,i;r||(r=Gh());for(let s in Xt)if(Object.prototype.hasOwnProperty.call(Xt,s))for(e=Xt[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>r_(o)):i++;Gh()===r&&iB(t||"all")};function CD(r){let t=eB(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=Mn(r.key));let e=Vt.indexOf(t);if(e>=0&&Vt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Vt.splice(0,Vt.length),(t===93||t===224)&&(t=91),t in we){we[t]=!1;for(let i in Mr)Mr[i]===t&&(or[i]=!1)}}var oB=(r,...t)=>{if(typeof r>"u")Object.keys(Xt).forEach(e=>{Array.isArray(Xt[e])&&Xt[e].forEach(i=>wf(i)),delete Xt[e]}),r_(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&wf(e)});else if(typeof r=="object")r.key&&wf(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),wf({key:r,scope:e,method:i,splitKey:"+"})}},wf=({key:r,scope:t,method:e,splitKey:i="+"})=>{tB(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Mn(a);if(!Xt[l])return;t||(t=Gh());let h=n>1?JI(Mr,o):[],c=[];Xt[l]=Xt[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&bD(u.mods,h);return d&&c.push(u.element),!d}),c.forEach(u=>r_(u))})};function ZI(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in we)Object.prototype.hasOwnProperty.call(we,o)&&(!we[o]&&t.mods.indexOf(+o)>-1||we[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!we[16]&&!we[18]&&!we[17]&&!we[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Vt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function QI(r,t){let e=Xt["*"],i=eB(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(or.filter||sB).call(this,r))return;if((i===93||i===224)&&(i=91),Vt.indexOf(i)===-1&&i!==229&&Vt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=Fh[a];r[a]&&Vt.indexOf(l)===-1?Vt.push(l):!r[a]&&Vt.indexOf(l)>-1?Vt.splice(Vt.indexOf(l),1):a==="metaKey"&&r[a]&&(Vt=Vt.filter(h=>h in Fh||h===i))}),i in we){we[i]=!0;for(let a in Mr)if(Object.prototype.hasOwnProperty.call(Mr,a)){let l=Fh[Mr[a]];or[a]=r[l]}if(!e)return}for(let a in we)Object.prototype.hasOwnProperty.call(we,a)&&(we[a]=r[Fh[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Vt.indexOf(17)===-1&&Vt.push(17),Vt.indexOf(18)===-1&&Vt.push(18),we[17]=!0,we[18]=!0);let s=Gh();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&ZI(r,e[a],s,t);if(!(i in Xt))return;let o=Xt[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:h}=l,c=l.key.split(h),u=[];for(let d=0;d<c.length;d++)u.push(Mn(c[d]));u.sort().join("")===Vt.sort().join("")&&ZI(r,l,s,t)}}var or=function(r,t,e){Vt=[];let i=tB(r),s=[],o="all",n=document,a=0,l=!1,h=!0,c="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(h=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(c=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&oB(r,o);a<i.length;a++){let f=i[a].split(c);s=[],f.length>1&&(s=JI(Mr,f));let p=f[f.length-1];p=p==="*"?"*":Mn(p),p in Xt||(Xt[p]=[]),Xt[p].push({keyup:l,keydown:h,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Ti.has(n)){let f=(m=window.event)=>QI(m,n),p=(m=window.event)=>{QI(m,n),CD(m)};Ti.set(n,{keydownListener:f,keyupListenr:p,capture:u}),t_(n,"keydown",f,u),t_(n,"keyup",p,u)}if(!kh){let f=()=>{Vt=[]};kh={listener:f,capture:u},t_(window,"focus",f,u)}}};function RD(r,t="all"){Object.keys(Xt).forEach(e=>{Xt[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function r_(r){let t=Object.values(Xt).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=Ti.get(r)||{};e&&i&&(Bh(r,"keyup",i,s),Bh(r,"keydown",e,s),Ti.delete(r))}if((t.length<=0||Ti.size<=0)&&(Array.from(Ti.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=Ti.get(e)||{};i&&s&&(Bh(e,"keyup",s,o),Bh(e,"keydown",i,o),Ti.delete(e))}),Ti.clear(),Object.keys(Xt).forEach(e=>delete Xt[e]),kh)){let{listener:e,capture:i}=kh;Bh(window,"focus",e,i),kh=null}}var e_={getPressedKeyString:wD,setScope:iB,getScope:Gh,deleteScope:PD,getPressedKeyCodes:SD,getAllKeyCodes:ED,isPressed:AD,filter:sB,trigger:RD,unbind:oB,keyMap:Uh,modifier:Mr,modifierMap:Fh};for(let r in e_){let t=r;Object.prototype.hasOwnProperty.call(e_,t)&&(or[t]=e_[t])}if(typeof window<"u"){let r=window.hotkeys;or.noConflict=t=>(t&&window.hotkeys===or&&(window.hotkeys=r),or),window.hotkeys=or}var MD=Object.prototype.hasOwnProperty,nB=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let h=t.get(l);h?Et(h.payload,s[l].payload)||(n.push(l),or.unbind(l)):o.push(l)}),t.forEach((l,h)=>{MD.call(s,h)||a.push(h)}),a.forEach(l=>{or.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let c=s[l].payload??{};or(l,()=>{r&&r("keydown",{_event:{key:l},...c})}),t.set(l,{value:l,payload:c})})},destroy:()=>{for(let s of t.keys())or.unbind(s);t.clear()}}};var lB=(r,t)=>typeof t!="string"?t:r[t]??t,ID=(r,t,e,i)=>{let s=lB(e,t);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},aB=(r,t,e,i)=>{let s=lB(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},BD=(r,t,e)=>Object.entries(t).map(([i,s])=>{if(!Vu[i])throw new Error(`${i} is not a supported property for animation.`);let o=ID(r,i,e,0),n=s.initialValue??o,a=Il([{value:n},...s.keyframes]);return{property:i,timeline:a}}),hB=()=>{let r=[],t=new Map,e=new Map,i=0,s=(v,S)=>{e.get(v)?.forEach(P=>{try{P(S)}catch{}})},o=v=>{if(s("completed",{id:v.id}),v.onComplete)try{v.onComplete()}catch{}},n=v=>{let{id:S,element:P,properties:R,targetState:A,onComplete:C,onCancel:M,propertyPathMap:B=Wu}=v,k=BD(P,R,B),U={id:S,kind:"property",element:P,timelines:k,duration:Bl(k),currentTime:0,stateVersion:i,targetState:A,onComplete:C,onCancel:M,applyFrame:O=>{for(let{property:$,timeline:N}of k){let L=Fl(N,O);try{aB(P,$,B,L)}catch{}}},applyTargetState:()=>{if(!(!P||P.destroyed)){if(A===null){P.destroy();return}if(A)for(let[O,$]of Object.entries(A))try{aB(P,O,B,$)}catch{}}},isValid:()=>!!P&&!P.destroyed};U.applyFrame(0),t.set(S,U),s("started",{id:S})},a=v=>{let S={id:v.id,kind:"custom",duration:v.duration??0,currentTime:0,stateVersion:i,onComplete:v.onComplete,onCancel:v.onCancel,applyFrame:v.applyFrame??(()=>{}),applyTargetState:v.applyTargetState??(()=>{}),isValid:v.isValid??(()=>!0)};S.applyFrame(0),t.set(S.id,S),s("started",{id:S.id})},l=v=>{if(v.driver==="custom"){a(v);return}n(v)},h=v=>{try{v.applyTargetState?.()}catch{}if(v.onCancel)try{v.onCancel()}catch{}},c=v=>{switch(v.type){case"START":l(v.payload);break;case"CANCEL":d(v.id);break}},u=()=>{let v=r.splice(0);for(let S of v)c(S)},d=v=>{let S=t.get(v);S&&(h(S),t.delete(v),s("cancelled",{id:v}))},f=v=>{r.push(v)},p=()=>{for(let[v,S]of t)h(S),s("cancelled",{id:v});t.clear(),i++},m=v=>{u();let S=[];for(let[P,R]of t){if(R.stateVersion!==i){S.push(P);continue}if(!R.isValid()){S.push(P);continue}if(R.currentTime+=v,R.currentTime>=R.duration){R.applyFrame(R.duration),o(R),S.push(P);continue}R.applyFrame(R.currentTime)}for(let P of S)t.delete(P)},g=()=>{u()},_=(v,S)=>(e.has(v)||e.set(v,new Set),e.get(v).add(S),()=>b(v,S)),b=(v,S)=>{e.get(v)?.delete(S)};return{dispatch:f,cancelAll:p,flush:g,tick:m,on:_,off:b,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([v,S])=>({id:v,currentTime:S.currentTime,duration:S.duration,progress:S.duration>0?S.currentTime/S.duration:0}))}),isAnimating:v=>t.has(v),destroy:()=>{p(),e.clear()}}};var cB=r=>{let t=0,e=0,i=null;return{reset:h=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=h},track:h=>{h===e&&t++},complete:h=>{h===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var uB=new Set(["update","transition"]),FD=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),kD=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),dB=new Set(["single","sequence","composite"]),Af=new Set(["red","green","blue","alpha"]),fB=new Set(["max","min","multiply","add"]),UD=new Set(Tx),qi=(r,t)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${t} must be an object.`)},$s=(r,t)=>{if(typeof r!="string"||r.length===0)throw new Error(`${t} must be a non-empty string.`)},Ef=(r,t)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${t} must be a number.`)},mB=(r,t)=>{qi(r,t);let e={};if(r.initialValue!==void 0&&(Ef(r.initialValue,`${t}.initialValue`),e.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${t}.keyframes must be a non-empty array.`);return e.keyframes=r.keyframes.map((i,s)=>{let o=`${t}.keyframes[${s}]`;if(qi(i,o),Ef(i.value,`${o}.value`),Ef(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!UD.has(i.easing))throw new Error(`${o}.easing must be one of: ${Tx.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),e},gB=(r,t,e)=>{qi(r,t);let i=Object.entries(r).map(([s,o])=>{if(!e.has(s))throw new Error(`${t}.${s} is not a supported animation property.`);return[s,mB(o,`${t}.${s}`)]});if(i.length===0)throw new Error(`${t} must define at least one property.`);return Object.fromEntries(i)},GD=(r,t)=>{if(qi(r,t),$s(r.texture,`${t}.texture`),r.channel!==void 0&&!Af.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(Af).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},OD=(r,t)=>{if(qi(r,t),!dB.has(r.kind))throw new Error(`${t}.kind must be one of: ${Array.from(dB).join(", ")}.`);let e={kind:r.kind};if(r.channel!==void 0){if(!Af.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(Af).join(", ")}.`);e.channel=r.channel}if(r.softness!==void 0&&(Ef(r.softness,`${t}.softness`),e.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);e.invert=r.invert}if(r.progress!==void 0&&(e.progress=mB(r.progress,`${t}.progress`)),r.kind==="single"&&($s(r.texture,`${t}.texture`),e.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${t}.textures must be a non-empty array.`);e.textures=r.textures.map((i,s)=>($s(i,`${t}.textures[${s}]`),i)),r.sample!==void 0&&($s(r.sample,`${t}.sample`),e.sample=r.sample)}if(r.kind==="composite"){if(!fB.has(r.combine??"max"))throw new Error(`${t}.combine must be one of: ${Array.from(fB).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${t}.items must be a non-empty array.`);e.combine=r.combine??"max",e.items=r.items.map((i,s)=>GD(i,`${t}.items[${s}]`))}return e.progress||(e.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),e},pB=(r,t)=>{if(qi(r,t),r.mask!==void 0)throw new Error(`${t}.mask is not valid. Define mask on ${t}.`);let e={};if(r.tween!==void 0&&(e.tween=gB(r.tween,`${t}.tween`,kD)),Object.keys(e).length===0)throw new Error(`${t} must define tween.`);return e},LD=(r,t)=>{let e={};if(r.shader!==void 0)throw new Error(`${t}.shader is not supported.`);if(r.prev!==void 0&&(e.prev=pB(r.prev,`${t}.prev`)),r.next!==void 0&&(e.next=pB(r.next,`${t}.next`)),r.mask!==void 0&&(e.mask=OD(r.mask,`${t}.mask`)),e.prev===void 0&&e.next===void 0&&e.mask===void 0)throw new Error(`${t} must define prev, next, or mask.`);return e},i_=(r,t,e)=>{if(r!==void 0)throw new Error(`${t} ${e}`)},xB=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let t=r.map((i,s)=>{let o=`animations[${s}]`;if(qi(i,o),$s(i.id,`${o}.id`),$s(i.targetId,`${o}.targetId`),$s(i.type,`${o}.type`),!uB.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(uB).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(qi(i.complete,`${o}.complete`),n.complete=i.complete),i_(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),i_(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),i_(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=gB(i.tween,`${o}.tween`,FD),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=LD(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),e=new Map;for(let i of t){let s=e.get(i.targetId)??new Set;s.add(i.type),e.set(i.targetId,s)}for(let[i,s]of e)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return t};var s_=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t.animations=xB(t.animations),t};var DD=()=>{let r,t=qI(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,h=!1,c,u,d,f=new Map,p,m=(v,S,P,R)=>{v.clear(),v.rect(0,0,S,P),v.fill(R??0)},g=v=>v?v.startsWith("audio/")?"audio":v.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(v)?"font":v.startsWith("video/")?"video":"texture":"texture",_=(v,S,{revokable:P=!1}={})=>{f.set(v,{url:S,revokable:P})},b=()=>{for(let v of f.values())v?.revokable===!0&&typeof v?.url=="string"&&URL.revokeObjectURL(v.url);f.clear()},y=(v,S,P)=>{o&&o.registerHotkeys(P?.keyboard??{}),v.renderer.events.cursorStyles||(v.renderer.events.cursorStyles={}),v.renderer.events.cursorStyles.default||(v.renderer.events.cursorStyles.default="default"),v.renderer.events.cursorStyles.hover||(v.renderer.events.cursorStyles.hover="pointer");let R=S?.cursorStyles,A=P?.cursorStyles;Et(R,A)||(A?(A.default&&(v.renderer.events.cursorStyles.default=A.default,v.canvas.style.cursor=A.default),A.hover&&(v.renderer.events.cursorStyles.hover=A.hover)):R&&(v.renderer.events.cursorStyles.default="default",v.renderer.events.cursorStyles.hover="pointer"))},w=(v,S,P,R)=>{c&&c.abort(),c=new AbortController;let A=c.signal;a.reset(P.id),y(v,e.global,P.global),n.cancelAll(),Ts({app:v,parent:S,prevComputedTree:e.elements,nextComputedTree:P.elements,animations:P.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:R,signal:A}),n.flush(),Fx({app:v,prevAudioTree:e.audio,nextAudioTree:P.audio,audioPlugins:s.audio}),e=P,a.completeIfEmpty(),h||(h=!0,l&&l())},E={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:v=>r.stage.getChildByLabel(v,!0)??null,extractBase64:async v=>{let S=new tt(0,0,r.renderer.width,r.renderer.height);if(!v)return await r.renderer.extract.base64({target:r.stage,frame:S});let P=r.stage.getChildByLabel(v,!0);if(!P)throw new Error(`Element with label '${v}' not found`);return await r.renderer.extract.base64({target:P,frame:S})},assignStageEvent:(v,S)=>{r.stage.eventMode="static",r.stage.on(v,S)},init:async v=>{let{eventHandler:S,plugins:P,width:R,height:A,backgroundColor:C,debug:M=!1,onFirstRender:B}=v;l=B;let k=[];return P?.elements?.forEach(U=>{U?.parse&&k.push(KI({type:U.type,parse:U.parse}))}),s={animations:P?.animations??[],elements:P?.elements??[],audio:P?.audio??[],parsers:k},i=S,o=nB(S),a=cB(S),r=new vl,r.audioStage=t,await r.init({width:R,height:A,backgroundColor:C,preference:"webgl"}),r.debug=M,d=U=>{U.preventDefault()},r.canvas.addEventListener("contextmenu",d),p=new de,p.label="__route_graphics_background__",m(p,R,A,C),r.stage.addChild(p),r.stage.width=R,r.stage.height=A,r.ticker.add(r.audioStage.tick),n=hB(),M?(u=U=>{U?.detail?.deltaMS&&n.tick(Number(U.detail.deltaMS))},window.addEventListener("snapShotKeyFrame",u)):r.ticker.add(U=>n.tick(U.deltaMS)),E},destroy:()=>{c&&(c.abort(),c=void 0),u&&(window.removeEventListener("snapShotKeyFrame",u),u=void 0),d&&r?.canvas&&(r.canvas.removeEventListener("contextmenu",d),d=void 0),o?.destroy(),Ax(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let v=S=>{for(let P of S.children){let R=P.texture?.source?.resource;R instanceof HTMLVideoElement&&R.pause(),P.children&&v(P)}};r?.stage&&v(r.stage),r&&r.destroy(),p=void 0,b()},loadAssets:async v=>{if(!v)throw new Error("assetBufferMap is required");let S={audio:{},font:{},video:{},texture:{}};for(let[A,C]of Object.entries(v)){let M=g(C.type);S[M][A]=C}await Promise.all(Object.entries(S.audio).map(([A,C])=>qo.load(A,C.buffer))),await Promise.all(Object.entries(S.font).map(async([A,C])=>{let M=new Blob([C.buffer],{type:C.type}),B=URL.createObjectURL(M),k=new FontFace(A,`url(${B})`);try{await k.load(),document.fonts.add(k)}catch(U){console.error(`Failed to load font ${A}:`,U)}finally{URL.revokeObjectURL(B)}}));let P=Object.entries(S.texture).map(async([A,C])=>{if(pr.cache.has(A))return pr.cache.get(A);if(C?.source==="url"&&typeof C?.url=="string")return pr.load({alias:A,src:C.url,parser:"loadTextures"});let M=new Blob([C.buffer],{type:C.type}),B=await createImageBitmap(M),k=I.from(B);return pr.cache.set(A,k),k}),R=Object.entries(S.video).map(async([A,C])=>{let M=C?.source==="url"&&typeof C?.url=="string"?C.url:URL.createObjectURL(new Blob([C.buffer],{type:C.type})),B=C?.source!=="url";_(A,M,{revokable:B});let k={alias:A,src:M,parser:"loadVideo",data:{}};return typeof C?.type=="string"&&C.type.length>0&&(k.data.mime=C.type),pr.load(k).then(U=>U).catch(U=>{throw f.delete(A),B&&URL.revokeObjectURL(M),U})});return Promise.all([...P,...R])},loadAudioAssets:async v=>Promise.all(v.map(async S=>{let R=await(await fetch(S)).arrayBuffer();return qo.load(S,R)})),updatedBackgroundColor:v=>{r.renderer.background.color=v,p&&m(p,r.renderer.width,r.renderer.height,v)},render:v=>{let S=s_(v),P=Qy({JSONObject:S.elements,parserPlugins:s.parsers}),R={...S,elements:P};w(r,r.stage,R,i)},parse:v=>{let S=s_(v),P=Qy({JSONObject:S.elements,parserPlugins:s.parsers});return{...S,elements:P}}};return E},yB=DD;var YAt=yB;export{vl as Application,pr as Assets,qo as AudioAsset,HU as animatedSpritePlugin,OU as containerPlugin,fx as createAnimationPlugin,PB as createAssetBufferManager,px as createAudioPlugin,fe as createElementPlugin,YAt as default,qU as particlesPlugin,dU as rectPlugin,Fx as renderAudio,Ts as renderElements,gU as sliderPlugin,zU as soundPlugin,fU as spritePlugin,hU as textPlugin,NU as textRevealingPlugin,VU as tweenPlugin,mU as videoPlugin};
1629
1629
  /*! Bundled license information:
1630
1630
 
1631
1631
  punycode/punycode.js: