summaryrefslogtreecommitdiff
path: root/2026/games/sunshoes/assets/index-DvAPfvr6.js
diff options
context:
space:
mode:
Diffstat (limited to '2026/games/sunshoes/assets/index-DvAPfvr6.js')
-rw-r--r--2026/games/sunshoes/assets/index-DvAPfvr6.js300
1 files changed, 0 insertions, 300 deletions
diff --git a/2026/games/sunshoes/assets/index-DvAPfvr6.js b/2026/games/sunshoes/assets/index-DvAPfvr6.js
deleted file mode 100644
index 4694962..0000000
--- a/2026/games/sunshoes/assets/index-DvAPfvr6.js
+++ /dev/null
@@ -1,300 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["games/sunshoes/assets/browserAll-1STCoqOQ.js","games/sunshoes/assets/webworkerAll-3Ebn88U3.js","games/sunshoes/assets/Filter-BiIvpnZm.js","games/sunshoes/assets/WebGPURenderer-Ddwua8JA.js","games/sunshoes/assets/BufferResource-BZpoqTVb.js","games/sunshoes/assets/RenderTargetSystem-Cp6tD-lP.js","games/sunshoes/assets/WebGLRenderer-CdpFaPwH.js","games/sunshoes/assets/CanvasRenderer-Yf_04ykh.js"])))=>i.map(i=>d[i]);
-var ra=Object.defineProperty;var na=(s,t,e)=>t in s?ra(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var G=(s,t,e)=>na(s,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();const oa="modulepreload",aa=function(s){return"/"+s},ji={},pe=function(t,e,i){let r=Promise.resolve();if(e&&e.length>0){let o=function(l){return Promise.all(l.map(c=>Promise.resolve(c).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),h=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=o(e.map(l=>{if(l=aa(l),l in ji)return;ji[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":oa,c||(f.as="script"),f.crossOrigin="",f.href=l,h&&f.setAttribute("nonce",h),document.head.appendChild(f),c)return new Promise((d,p)=>{f.addEventListener("load",d),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return t().catch(n)})};var I=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.TextureUploaderWebGL="texture-uploader-webgl",s.TextureUploaderWebGPU="texture-uploader-webgpu",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(I||{});const ni=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Je=(s,t)=>ni(s).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(ni).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(ni).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,r=this._queue;i[e]?(o=i[e])==null||o.call(i,t):(r[e]=r[e]||[],(n=r[e])==null||n.push(t))})}),this},handle(s,t,e){var o;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((o=n[s])==null||o.forEach(a=>t(a)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,o)=>Je(o.value,e)-Je(n.value,e)))},i=>{const r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>Je(n,e)-Je(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(s,...t){for(const e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}},ha={extension:{type:I.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await pe(()=>import("./browserAll-1STCoqOQ.js"),__vite__mapDeps([0,1,2]))}},la={extension:{type:I.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await pe(()=>import("./webworkerAll-3Ebn88U3.js"),__vite__mapDeps([1,2]))}};class ot{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new ot(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function ca(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ls={exports:{}},Yi;function ua(){return Yi||(Yi=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,u||h,f),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],d]:h._events[p].push(d):(h._events[p]=d,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,p=new Array(d);f<d;f++)p[f]=u[f].fn;return p},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,f,d,p){var g=e?e+l:l;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,y,x;if(m.fn){switch(m.once&&this.removeListener(l,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,u),!0;case 4:return m.fn.call(m.context,c,u,f),!0;case 5:return m.fn.call(m.context,c,u,f,d),!0;case 6:return m.fn.call(m.context,c,u,f,d,p),!0}for(x=1,y=new Array(_-1);x<_;x++)y[x-1]=arguments[x];m.fn.apply(m.context,y)}else{var w=m.length,v;for(x=0;x<w;x++)switch(m[x].once&&this.removeListener(l,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,c);break;case 3:m[x].fn.call(m[x].context,c,u);break;case 4:m[x].fn.call(m[x].context,c,u,f);break;default:if(!y)for(v=1,y=new Array(_-1);v<_;v++)y[v-1]=arguments[v];m[x].fn.apply(m[x].context,y)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,f){var d=e?e+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===c&&(!f||p.once)&&(!u||p.context===u)&&o(this,d);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==c||f&&!p[g].once||u&&p[g].context!==u)&&m.push(p[g]);m.length?this._events[d]=m.length===1?m[0]:m:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,s.exports=a})(Ls)),Ls.exports}var da=ua();const ft=ca(da),fa=Math.PI*2,pa=180/Math.PI,ma=Math.PI/180;class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(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 Bs.x=0,Bs.y=0,Bs}}const Bs=new lt;class W{constructor(t=1,e=0,i=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const 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 lt;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new lt;const i=this.a,r=this.b,n=this.c,o=this.d,a=this.tx,h=this.ty,l=1/(i*o+n*-r),c=t.x,u=t.y;return e.x=o*l*c+-n*l*u+(h*n-a*o)*l,e.y=i*l*u+-r*l*c+(-h*i+a*r)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){const i=t.a,r=t.b,n=t.c,o=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,f=e.d;return this.a=i*l+r*u,this.b=i*c+r*f,this.c=n*l+o*u,this.d=n*c+o*f,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*f+e.ty,this}setTransform(t,e,i,r,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*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){const e=this.a,i=this.b,r=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-r,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(fa-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,o=t*r-e*i;return this.a=r/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-r*n)/o,this.ty=-(t*this.ty-e*n)/o,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(){const t=new W;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 _a.identity()}static get shared(){return ga.identity()}}const ga=new W,_a=new W,qt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Kt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Qt=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],oi=[],mn=[],ts=Math.sign;function ya(){for(let s=0;s<16;s++){const t=[];oi.push(t);for(let e=0;e<16;e++){const i=ts(qt[s]*qt[e]+Qt[s]*Kt[e]),r=ts(Kt[s]*qt[e]+Zt[s]*Kt[e]),n=ts(qt[s]*Qt[e]+Qt[s]*Zt[e]),o=ts(Kt[s]*Qt[e]+Zt[s]*Zt[e]);for(let a=0;a<16;a++)if(qt[a]===i&&Kt[a]===r&&Qt[a]===n&&Zt[a]===o){t.push(a);break}}}for(let s=0;s<16;s++){const t=new W;t.set(qt[s],Kt[s],Qt[s],Zt[s],0,0),mn.push(t)}}ya();const O={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:s=>qt[s],uY:s=>Kt[s],vX:s=>Qt[s],vY:s=>Zt[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>oi[s][t],sub:(s,t)=>oi[s][O.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?O.S:O.N:Math.abs(t)*2<=Math.abs(s)?s>0?O.E:O.W:t>0?s>0?O.SE:O.SW:s>0?O.NE:O.NW,matrixAppendRotationInv:(s,t,e=0,i=0,r=0,n=0)=>{const o=mn[O.inv(t)],a=o.a,h=o.b,l=o.c,c=o.d,u=e-Math.min(0,a*r,l*n,a*r+l*n),f=i-Math.min(0,h*r,c*n,h*r+c*n),d=s.a,p=s.b,g=s.c,m=s.d;s.a=a*d+h*g,s.b=a*p+h*m,s.c=l*d+c*g,s.d=l*p+c*m,s.tx=u*d+f*g+s.tx,s.ty=u*p+f*m+s.ty},transformRectCoords:(s,t,e,i)=>{const{x:r,y:n,width:o,height:a}=s,{x:h,y:l,width:c,height:u}=t;return e===O.E?(i.set(r+h,n+l,o,a),i):e===O.S?i.set(c-n-a+h,r+l,a,o):e===O.W?i.set(c-r-o+h,u-n-a+l,o,a):e===O.N?i.set(n+h,u-r-o+l,a,o):i.set(r+h,n+l,o,a)}},es=[new lt,new lt,new lt,new lt];class tt{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}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 tt(0,0,0,0)}clone(){return new tt(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,r=.5){const{width:n,height:o}=this;if(n<=0||o<=0)return!1;const a=this.x,h=this.y,l=i*(1-r),c=i-l,u=a-l,f=a+n+l,d=h-l,p=h+o+l,g=a+c,m=a+n-c,_=h+c,y=h+o-c;return t>=u&&t<=f&&e>=d&&e<=p&&!(t>g&&t<m&&e>_&&e<y)}intersects(t,e){if(!e){const k=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=k)return!1;const S=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>S}const i=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=i||o<=n)return!1;const a=es[0].set(t.left,t.top),h=es[1].set(t.left,t.bottom),l=es[2].set(t.right,t.top),c=es[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=r||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const f=u*(h.y-a.y),d=u*(a.x-h.x),p=f*i+d*n,g=f*r+d*n,m=f*i+d*o,_=f*r+d*o;if(Math.max(p,g,m,_)<=f*a.x+d*a.y||Math.min(p,g,m,_)>=f*c.x+d*c.y)return!1;const y=u*(a.y-l.y),x=u*(l.x-a.x),w=y*i+x*n,v=y*r+x*n,b=y*i+x*o,A=y*r+x*o;return!(Math.max(w,v,b,A)<=y*a.x+x*a.y||Math.min(w,v,b,A)>=y*c.x+x*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=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=r-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t||(t=new tt),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,r=t.x+t.width,n=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&r>=this.x&&r<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(t,e,i,r){return this.x=t,this.y=e,this.width=i,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Fs={default:-1};function J(s="default"){return Fs[s]===void 0&&(Fs[s]=-1),++Fs[s]}const Xi=new Set,_t="8.0.0",xa="8.3.4",ue={quiet:!1,noColor:!1},X=((s,t,e=3)=>{if(ue.quiet||Xi.has(t))return;let i=new Error().stack;const r=`${t}
-Deprecated since v${s}`,n=typeof console.groupCollapsed=="function"&&!ue.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",r):(i=i.split(`
-`).splice(e).join(`
-`),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(i))),Xi.add(t)});Object.defineProperties(X,{quiet:{get:()=>ue.quiet,set:s=>{ue.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>ue.noColor,set:s=>{ue.noColor=s},enumerable:!0,configurable:!1}});const gn=()=>{};function _e(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function qi(s){return!(s&s-1)&&!!s}function _n(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const Ki=Object.create(null);function ba(s){const t=Ki[s];return t===void 0&&(Ki[s]=J("resource")),t}const yn=class xn extends ft{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...xn.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){X(_t,"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._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=ba(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};yn.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let ye=yn;const bn=class wn extends ft{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=J("textureSource"),this._resourceType="textureSource",this._resourceId=J("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.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...wn.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.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.transient=t.transient??!1,this.alphaMode=t.alphaMode,this.style=new ye(_n(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}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){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var t,e;this._resourceId=J("resource"),this.emit("change",this),this.emit("unload",this);for(const i in this._gpuData)(e=(t=this._gpuData[i])==null?void 0:t.destroy)==null||e.call(t);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{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);const r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=J("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=qi(this.pixelWidth)&&qi(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};bn.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let St=bn;class Ri extends St{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let 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}}Ri.extension=I.TextureSource;const Qi=new W;class wa{constructor(t,e){this.mapCoord=new W,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),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){var e;this._texture!==t&&((e=this._texture)==null||e.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);const i=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],o=t[r+1];e[r]=n*i.a+o*i.c+i.tx,e[r+1]=n*i.b+o*i.d+i.ty}return e}update(){const t=this._texture;this._updateID++;const 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);const i=t.orig,r=t.trim;r&&(Qi.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Qi));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,h=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+h)/n.width,o[1]=(t.frame.y+a+h)/n.height,o[2]=(t.frame.x+t.frame.width-a+h)/n.width,o[3]=(t.frame.y+t.frame.height-a+h)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}class U extends ft{constructor({source:t,label:e,frame:i,orig:r,trim:n,defaultAnchor:o,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=J("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==null?void 0:t.source)??new St,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=h??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new wa(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:r}=this._source,n=e.x/i,o=e.y/r,a=e.width/i,h=e.height/r;let l=this.rotate;if(l){const c=a/2,u=h/2,f=n+c,d=o+u;l=O.add(l,O.NW),t.x0=f+c*O.uX(l),t.y0=d+u*O.uY(l),l=O.add(l,2),t.x1=f+c*O.uX(l),t.y1=d+u*O.uY(l),l=O.add(l,2),t.x2=f+c*O.uX(l),t.y2=d+u*O.uY(l),l=O.add(l,2),t.x3=f+c*O.uX(l),t.y3=d+u*O.uY(l)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+h,t.x3=n,t.y3=o+h}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(_t,"Texture.baseTexture is now Texture.source"),this._source}}U.EMPTY=new U({label:"EMPTY",source:new St({label:"EMPTY"})});U.EMPTY.destroy=gn;U.WHITE=new U({source:new Ri({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});U.WHITE.destroy=gn;function vn(s,t,e){const{width:i,height:r}=e.orig,n=e.trim;if(n){const o=n.width,a=n.height;s.minX=n.x-t._x*i,s.maxX=s.minX+o,s.minY=n.y-t._y*r,s.maxY=s.minY+a}else s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*r,s.maxY=s.minY+r}const Zi=new W;class vt{constructor(t=1/0,e=1/0,i=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Zi,this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new tt);const 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=Zi,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);const o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty;let f=this.minX,d=this.minY,p=this.maxX,g=this.maxY,m=o*t+h*e+c,_=a*t+l*e+u;m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),m=o*i+h*e+c,_=a*i+l*e+u,m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),m=o*t+h*r+c,_=a*t+l*r+u,m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),m=o*i+h*r+c,_=a*i+l*r+u,m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),this.minX=f,this.minY=d,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){const e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,{a:o,b:a,c:h,d:l,tx:c,ty:u}=t;let f=o*e+h*i+c,d=a*e+l*i+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*r+h*i+c,d=a*r+l*i+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*e+h*n+c,d=a*e+l*n+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*r+h*n+c,d=a*r+l*n+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>r&&(this.maxY=r),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 vt(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){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const 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,r){let n=this.minX,o=this.minY,a=this.maxX,h=this.maxY;r||(r=this.matrix);const l=r.a,c=r.b,u=r.c,f=r.d,d=r.tx,p=r.ty;for(let g=e;g<i;g+=2){const m=t[g],_=t[g+1],y=l*m+u*_+d,x=c*m+f*_+p;n=y<n?y:n,o=x<o?x:o,a=y>a?y:a,h=x>h?x:h}this.minX=n,this.minY=o,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var va={grad:.9,turn:360,rad:360/(2*Math.PI)},Et=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},rt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},bt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},An=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Ji=function(s){return{r:bt(s.r,0,255),g:bt(s.g,0,255),b:bt(s.b,0,255),a:bt(s.a)}},Gs=function(s){return{r:rt(s.r),g:rt(s.g),b:rt(s.b),a:rt(s.a,3)}},Aa=/^#([0-9a-f]{3,8})$/i,ss=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Sn=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},Cn=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:r}},tr=function(s){return{h:An(s.h),s:bt(s.s,0,100),l:bt(s.l,0,100),a:bt(s.a)}},er=function(s){return{h:rt(s.h),s:rt(s.s),l:rt(s.l),a:rt(s.a,3)}},sr=function(s){return Cn((e=(t=s).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},Ge=function(s){return{h:(t=Sn(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},Sa=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ca=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ta=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pa=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ai={string:[[function(s){var t=Aa.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?rt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?rt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Ta.exec(s)||Pa.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ji({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(s){var t=Sa.exec(s)||Ca.exec(s);if(!t)return null;var e,i,r=tr({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(va[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return sr(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return Et(t)&&Et(e)&&Et(i)?Ji({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!Et(t)||!Et(e)||!Et(i))return null;var o=tr({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return sr(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!Et(t)||!Et(e)||!Et(i))return null;var o=(function(a){return{h:An(a.h),s:bt(a.s,0,100),v:bt(a.v,0,100),a:bt(a.a)}})({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Cn(o)},"hsv"]]},ir=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},Ma=function(s){return typeof s=="string"?ir(s.trim(),ai.string):typeof s=="object"&&s!==null?ir(s,ai.object):[null,void 0]},Ds=function(s,t){var e=Ge(s);return{h:e.h,s:bt(e.s+100*t,0,100),l:e.l,a:e.a}},Os=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},rr=function(s,t){var e=Ge(s);return{h:e.h,s:e.s,l:bt(e.l+100*t,0,100),a:e.a}},hi=(function(){function s(t){this.parsed=Ma(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return rt(Os(this.rgba),2)},s.prototype.isDark=function(){return Os(this.rgba)<.5},s.prototype.isLight=function(){return Os(this.rgba)>=.5},s.prototype.toHex=function(){return t=Gs(this.rgba),e=t.r,i=t.g,r=t.b,o=(n=t.a)<1?ss(rt(255*n)):"","#"+ss(e)+ss(i)+ss(r)+o;var t,e,i,r,n,o},s.prototype.toRgb=function(){return Gs(this.rgba)},s.prototype.toRgbString=function(){return t=Gs(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return er(Ge(this.rgba))},s.prototype.toHslString=function(){return t=er(Ge(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Sn(this.rgba),{h:rt(t.h),s:rt(t.s),v:rt(t.v),a:rt(t.a,3)};var t},s.prototype.invert=function(){return Pt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),Pt(Ds(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),Pt(Ds(this.rgba,-t))},s.prototype.grayscale=function(){return Pt(Ds(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),Pt(rr(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),Pt(rr(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?Pt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):rt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=Ge(this.rgba);return typeof t=="number"?Pt({h:t,s:e.s,l:e.l,a:e.a}):rt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===Pt(t).toHex()},s})(),Pt=function(s){return s instanceof hi?s:new hi(s)},nr=[],ka=function(s){s.forEach(function(t){nr.indexOf(t)<0&&(t(hi,ai),nr.push(t))})};function Ea(s,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 r in e)i[e[r]]=r;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,f="black";if(!n.length)for(var d in e)n[d]=new s(e[d]).toRgb();for(var p in e){var g=(a=c,h=n[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<u&&(u=g,f=p)}return f}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new s(h).toRgb():null},"name"])}ka([Ea]);const xe=class Be{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 Be)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){const 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((n,o)=>n===e[o]);if(t!==null&&e!==null){const n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=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(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=Be._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const 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._value=null,this}_normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Be.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Pt(t);o.isValid()&&({r:e,g:i,b:r,a:n}=o.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[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((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Be||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}};xe.shared=new xe;xe._temp=new xe;xe.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let q=xe;const Ia={cullArea:null,cullable:!1,cullableChildren:!0};let Ws=0;const or=500;function Y(...s){Ws!==or&&(Ws++,Ws===or?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}const Qe={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)},release(){this._registeredResources.forEach(s=>s.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(s){return this._registeredResources.has(s)},reset(){this._registeredResources.clear()}};class Ra{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){var i;let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),(i=e.init)==null||i.call(e,t),e}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}class La{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 Ra(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const 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}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const At=new La;Qe.register(At);const Ba={get isCachedAsTexture(){var s;return!!((s=this.renderGroup)!=null&&s.isCachedAsTexture)},cacheAsTexture(s){typeof s=="boolean"&&s===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(s===!0?{}:s))},updateCacheTexture(){var s;(s=this.renderGroup)==null||s.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(s){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(s)}};function Fa(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r<n;++r)s[r]=s[r+e];s.length=n}const Ga={allowChildren:!0,removeChildren(s=0,t){var n;const e=t??this.children.length,i=e-s,r=[];if(i>0&&i<=e){for(let a=e-1;a>=s;a--){const h=this.children[a];h&&(r.push(h),h.parent=null)}Fa(this.children,s,e);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(r);for(let a=0;a<r.length;++a){const h=r[a];(n=h.parentRenderLayer)==null||n.detach(h),this.emit("childRemoved",h,this,a),r[a].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}else if(i===0&&this.children.length===0)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(s){const t=this.getChildAt(s);return this.removeChild(t)},getChildAt(s){if(s<0||s>=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||X(_t,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);const i=s.parent===this;if(s.parent){const n=s.parent.children.indexOf(s);if(i){if(n===t)return s;s.parent.children.splice(n,1)}else s.removeFromParent()}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s._updateFlags=15;const r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(s),this.sortableChildren&&(this.sortDirty=!0),i||(this.emit("childAdded",s,this,t),s.emit("added",this)),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=s;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var s;(s=this.parent)==null||s.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),s.setFromMatrix(e),s},replaceChild(s,t){s.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(s)),t.setFromMatrix(s.localTransform),t.updateLocalTransform(),this.removeChild(s)}},Da={collectRenderables(s,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(s,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,s):this.collectRenderablesWithEffects(s,t,e))},collectRenderablesSimple(s,t,e){const i=this.children,r=i.length;for(let n=0;n<r;n++)i[n].collectRenderables(s,t,e)},collectRenderablesWithEffects(s,t,e){const{renderPipes:i}=t;for(let r=0;r<this.effects.length;r++){const n=this.effects[r];i[n.pipe].push(n,this,s)}this.collectRenderablesSimple(s,t,e);for(let r=this.effects.length-1;r>=0;r--){const n=this.effects[r];i[n.pipe].pop(n,this,s)}}};class ar{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}}class Oa{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++){const i=this._tests[e];if(i.test(t))return At.get(i.maskClass,t)}return t}returnMaskEffect(t){At.return(t)}}const li=new Oa;K.handleByList(I.MaskEffect,li._effectClasses);const Wa={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0)},addEffect(s){this.effects.indexOf(s)===-1&&(this.effects.push(s),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(s){const t=this._maskEffect;(t==null?void 0:t.mask)!==s&&(t&&(this.removeEffect(t),li.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=li.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){var s;return(s=this._maskEffect)==null?void 0:s.mask},setMask(s){this._maskOptions={...this._maskOptions,...s},s.mask&&(this.mask=s.mask),this._markStructureAsChanged()},set filters(s){var n;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new ar);s=s;const e=(s==null?void 0:s.length)>0,i=((n=t.filters)==null?void 0:n.length)>0,r=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),r&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){var s;return(s=this._filterEffect)==null?void 0:s.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new ar),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},Ua={label:null,get name(){return X(_t,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){X(_t,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let i=0;i<e.length;i++){const r=e[i];if(r.label===s||s instanceof RegExp&&s.test(r.label))return r}if(t)for(let i=0;i<e.length;i++){const n=e[i].getChildByLabel(s,!0);if(n)return n}return null},getChildrenByLabel(s,t=!1,e=[]){const i=this.children;for(let r=0;r<i.length;r++){const n=i[r];(n.label===s||s instanceof RegExp&&s.test(n.label))&&e.push(n)}if(t)for(let r=0;r<i.length;r++)i[r].getChildrenByLabel(s,!0,e);return e}},ut=At.getPool(W),Lt=At.getPool(vt),za=new W,Ha={getFastGlobalBounds(s,t){t||(t=new vt),t.clear(),this._getGlobalBoundsRecursive(!!s,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(s,t,e){let i=t;if(s&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const r=!!this.effects.length;if((this.renderGroup||r)&&(i=Lt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;i.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const n=this.children;for(let o=0;o<n.length;o++)n[o]._getGlobalBoundsRecursive(s,i,e)}if(r){let n=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(n||(n=!0,i.applyMatrix(o.worldTransform)),this.effects[a].addBounds(i,!0));n&&i.applyMatrix(o.worldTransform.copyTo(za).invert()),t.addBounds(i),Lt.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Lt.return(i))}};function Tn(s,t,e){e.clear();let i,r;return s.parent?t?i=s.parent.worldTransform:(r=ut.get().identity(),i=Li(s,r)):i=W.IDENTITY,Pn(s,e,i,t),r&&ut.return(r),e.isValid||e.set(0,0,0,0),e}function Pn(s,t,e,i){var a,h;if(!s.visible||!s.measurable)return;let r;i?r=s.worldTransform:(s.updateLocalTransform(),r=ut.get(),r.appendFrom(s.localTransform,e));const n=t,o=!!s.effects.length;if(o&&(t=Lt.get().clear()),s.boundsArea)t.addRect(s.boundsArea,r);else{const l=s.bounds;l&&!l.isEmpty()&&(t.matrix=r,t.addBounds(l));for(let c=0;c<s.children.length;c++)Pn(s.children[c],t,r,i)}if(o){for(let l=0;l<s.effects.length;l++)(h=(a=s.effects[l]).addBounds)==null||h.call(a,t);n.addBounds(t,W.IDENTITY),Lt.return(t)}i||ut.return(r)}function Li(s,t){const e=s.parent;return e&&(Li(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function Mn(s,t){if(s===16777215||!t)return t;if(t===16777215||!s)return s;const e=s>>16&255,i=s>>8&255,r=s&255,n=t>>16&255,o=t>>8&255,a=t&255,h=e*n/255|0,l=i*o/255|0,c=r*a/255|0;return(h<<16)+(l<<8)+c}const hr=16777215;function lr(s,t){return s===hr?t:t===hr?s:Mn(s,t)}function fs(s){return((s&255)<<16)+(s&65280)+(s>>16&255)}const Na={getGlobalAlpha(s){if(s)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(s=new W,t){if(t)return s.copyFrom(this.worldTransform);this.updateLocalTransform();const e=Li(this,ut.get().identity());return s.appendFrom(this.localTransform,e),ut.return(e),s},getGlobalTint(s){if(s)return this.renderGroup?fs(this.renderGroup.worldColor):this.parentRenderGroup?fs(lr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=lr(t,e.localColor),e=e.parent;return fs(t)}};function kn(s,t,e){return t.clear(),e||(e=W.IDENTITY),En(s,t,e,s,!0),t.isValid||t.set(0,0,0,0),t}function En(s,t,e,i,r){var h,l;let n;if(r)n=ut.get(),n=e.copyTo(n);else{if(!s.visible||!s.measurable)return;s.updateLocalTransform();const c=s.localTransform;n=ut.get(),n.appendFrom(c,e)}const o=t,a=!!s.effects.length;if(a&&(t=Lt.get().clear()),s.boundsArea)t.addRect(s.boundsArea,n);else{s.renderPipeId&&(t.matrix=n,t.addBounds(s.bounds));const c=s.children;for(let u=0;u<c.length;u++)En(c[u],t,n,i,!1)}if(a){for(let c=0;c<s.effects.length;c++)(l=(h=s.effects[c]).addLocalBounds)==null||l.call(h,t,i);o.addBounds(t,W.IDENTITY),Lt.return(t)}ut.return(n)}function In(s,t){const e=s.children;for(let i=0;i<e.length;i++){const r=e[i],n=r.uid,o=(r._didViewChangeTick&65535)<<16|r._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,r.children.length&&In(r,t)}return t.didChange}const Va=new W,$a={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(s,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=s/t*e:this.scale.x=e},_setHeight(s,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=s/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new vt});const s=this._localBoundsCacheData;return s.index=1,s.didChange=!1,s.data[0]!==this._didViewChangeTick&&(s.didChange=!0,s.data[0]=this._didViewChangeTick),In(this,s),s.didChange&&kn(this,s.localBounds,Va),s.localBounds},getBounds(s,t){return Tn(this,s,t||new vt)}},ja={_onRender:null,set onRender(s){const t=this.renderGroup||this.parentRenderGroup;if(!s){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=s},get onRender(){return this._onRender}},Ya={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(s){this._zIndex!==s&&(this._zIndex=s,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(Xa))}};function Xa(s,t){return s._zIndex-t._zIndex}const qa={getGlobalPosition(s=new lt,t=!1){return this.parent?this.parent.toGlobal(this._position,s,t):(s.x=this._position.x,s.y=this._position.y),s},toGlobal(s,t,e=!1){const i=this.getGlobalTransform(ut.get(),e);return t=i.apply(s,t),ut.return(i),t},toLocal(s,t,e,i){t&&(s=t.toGlobal(s,e,i));const r=this.getGlobalTransform(ut.get(),i);return e=r.applyInverse(s,e),ut.return(r),e}};class Rn{constructor(){this.uid=J("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let Ka=0;class Qa{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new ye(this.textureOptions)}createTexture(t,e,i,r){const n=new St({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:r});return new U({source:n,label:`texturePool_${Ka++}`})}getOptimalTexture(t,e,i=1,r,n=!1){let o=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);o=_e(o),a=_e(a);const h=r?1:0,l=n?1:0,c=(o<<17)+(a<<2)+(l<<1)+h;this._texturePool[c]||(this._texturePool[c]=[]);let u=this._texturePool[c].pop();return u||(u=this.createTexture(o,a,r,n)),u.source._resolution=i,u.source.width=o/i,u.source.height=a/i,u.source.pixelWidth=o,u.source.pixelHeight=a,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=c,u}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t,e=!1){const i=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this._texturePool={}}}const Ts=new Qa;Qe.register(Ts);class Za{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new W,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 Rn,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let i=0;i<e.length;i++){const r=e[i];r._updateFlags=15,this.addChild(r)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Ts.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const 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){const 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);const 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}const 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=[]){const 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;const i=t.children;for(let r=0;r<i.length;r++)this._getChildren(i[r],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new W),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new W),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;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new W),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function Ja(s,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(s[i]=t[i])}const Us=new ot(null),is=new ot(null),zs=new ot(null,1,1),rs=new ot(null),cr=1,th=2,Hs=4;class Ut extends ft{constructor(t={}){var e,i;super(),this.uid=J("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.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new W,this.relativeGroupTransform=new W,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ot(this,0,0),this._scale=zs,this._pivot=is,this._origin=rs,this._skew=Us,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=[],Ja(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(r=>this.addChild(r)),(i=t.parent)==null||i.addChild(this)}static mixin(t){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),K.mixin(Ut,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||X(_t,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r<t.length;r++)this.addChild(t[r]);return t[0]}const 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 r=0;r<t.length;r++)this.removeChild(t[r]);return t[0]}const 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;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=At.get(Za,this),this.groupTransform=W.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),At.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new W),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*pa}set angle(t){this.rotation=t*ma}get pivot(){return this._pivot===is&&(this._pivot=new ot(this,0,0)),this._pivot}set pivot(t){this._pivot===is&&(this._pivot=new ot(this,0,0),this._origin!==rs&&Y("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Us&&(this._skew=new ot(this,0,0)),this._skew}set skew(t){this._skew===Us&&(this._skew=new ot(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===zs&&(this._scale=new ot(this,1,1)),this._scale}set scale(t){this._scale===zs&&(this._scale=new ot(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===rs&&(this._origin=new ot(this,0,0)),this._origin}set origin(t){this._origin===rs&&(this._origin=new ot(this,0,0),this._pivot!==is&&Y("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const 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){const 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(){const 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:this.scale.x,typeof t.scaleY=="number"?t.scaleY: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.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,r=this._pivot,n=this._origin,o=this._position,a=i._x,h=i._y,l=r._x,c=r._y,u=-n._x,f=-n._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*h,e.d=this._sy*h,e.tx=o._x-(l*e.a+c*e.c)+(u*e.a+f*e.c)-u,e.ty=o._y-(l*e.b+c*e.d)+(u*e.b+f*e.d)-f}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=cr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=q.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=cr,this._onUpdate())}get tint(){return fs(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=th,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Hs,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Hs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Hs,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var r;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._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t==null?void 0:t.children)&&e)for(let n=0;n<e.length;++n)e[n].destroy(t);(r=this.renderGroup)==null||r.destroy(),this.renderGroup=null}}K.mixin(Ut,Ga,Ha,qa,ja,$a,Wa,Ua,Ya,Ia,Ba,Na,Da);class Ln extends Ut{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new vt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!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){const e=this.bounds,{x:i,y:r}=t;return i>=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:r}=e;r.blendMode.pushBlendMode(this,this.groupBlendMode,t);const o=r[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,t),this.didViewUpdate=!1;const a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,i);r.blendMode.popBlendMode(t)}}class yt extends Ln{constructor(t=U.EMPTY){t instanceof U&&(t={texture:t});const{texture:e=U.EMPTY,anchor:i,roundPixels:r,width:n,height:o,...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 ot({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof U?new yt(t):new yt(U.from(t,e))}set texture(t){t||(t=U.EMPTY);const 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 vn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return X("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:r,height:n}=e.orig;i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*n,i.maxY=i.minY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0: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)}}const eh=new vt;function Bn(s,t,e){const i=eh;s.measurable=!0,Tn(s,e,i),t.addBoundsMask(i),s.measurable=!1}function Fn(s,t,e){const i=Lt.get();s.measurable=!0;const r=ut.get().identity(),n=Gn(s,e,r);kn(s,i,n),s.measurable=!1,t.addBoundsMask(i),ut.return(r),Lt.return(i)}function Gn(s,t,e){return s?(s!==t&&(Gn(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(Y("Mask bounds, renderable is not inside the root container"),e)}class Dn{constructor(t){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof yt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||Bn(this.mask,t,e)}addLocalBounds(t,e){Fn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof yt}}Dn.extension=I.MaskEffect;class On{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}On.extension=I.MaskEffect;class Wn{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){Bn(this.mask,t,e)}addLocalBounds(t,e){Fn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Ut}}Wn.extension=I.MaskEffect;const sh={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};let ur=sh;const z={get(){return ur},set(s){ur=s}};class Un extends St{constructor(t){t.resource||(t.resource=z.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}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"))}}Un.extension=I.TextureSource;class be extends St{constructor(t){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}}be.extension=I.TextureSource;var ze=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(ze||{});class Ns{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}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));const 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);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const zn=class gt{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 Ns(null,null,1/0),this.deltaMS=1/gt.targetFPMS,this.elapsedMS=1/gt.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=ze.NORMAL){return this._addListener(new Ns(t,e,i))}addOnce(t,e,i=ze.NORMAL){return this._addListener(new Ns(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){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*gt.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.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){const e=Math.min(Math.max(0,t)/1e3,gt.targetFPMS);this._maxElapsedMS=1/e,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){t===0?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!gt._shared){const t=gt._shared=new gt;t.autoStart=!0,t._protected=!0}return gt._shared}static get system(){if(!gt._system){const t=gt._system=new gt;t.autoStart=!0,t._protected=!0}return gt._system}};zn.targetFPMS=.06;let dt=zn,Vs;async function Hn(){return Vs??(Vs=(async()=>{var o;const t=z.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),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);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),(o=t.getExtension("WEBGL_lose_context"))==null||o.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Vs}const Ps=class Nn extends St{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Nn.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),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=dt.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;const 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.isValid||t.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await Hn(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,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(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const 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.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const 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("loadedmetadata",this._onLoadedMetadata),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&&(dt.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||(dt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(dt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ps.extension=I.TextureSource;Ps.defaultOptions={...St.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ps.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let De=Ps;const Tt=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class ih{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){const e=this._cache.get(t);return e||Y(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=Tt(t);let r;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.test(e)){r=l.getCacheableAssets(i,e);break}}const n=new Map(Object.entries(r||{}));r||i.forEach(h=>{n.set(h,e)});const o=[...n.keys()],a={cacheKeys:o,keys:i};i.forEach(h=>{this._cacheMap.set(h,a)}),o.forEach(h=>{const l=r?r[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&Y("[Cache] already has key:",h),this._cache.set(h,n.get(h))})}remove(t){if(!this._cacheMap.has(t)){Y(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const nt=new ih,ci=[];K.handleByList(I.TextureSource,ci);function Vn(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let r=0;r<ci.length;r++){const n=ci[r];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function rh(s={},t=!1){const e=s&&s.resource,i=e?s.resource:s,r=e?s:{resource:s};if(!t&&nt.has(i))return nt.get(i);const n=new U({source:Vn(r)});return n.on("destroy",()=>{nt.has(i)&&nt.remove(i)}),t||nt.set(i,n),n}function nh(s,t=!1){return typeof s=="string"?nt.get(s):s instanceof St?new U({source:s}):rh(s,t)}U.from=nh;St.from=Vn;K.add(Dn,On,Wn,De,be,Un,Ri);var Gt=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Gt||{});function Ct(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Ce(s){return s.split("?")[0].split("#")[0]}function oh(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ah(s,t,e){return s.replace(new RegExp(oh(t),"g"),e)}function hh(s,t){let e="",i=0,r=-1,n=0,o=-1;for(let a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=a,n=0;continue}}}else e.length>0?e+=`/${s.slice(r+1,a)}`:e=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const at={toPosix(s){return ah(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Ct(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(Ct(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Ce(this.toPosix(t??z.get().getBaseUrl())),r=Ce(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?at.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Ct(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=hh(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return Ct(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const i=s[e];if(Ct(i),i.length>0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(Ct(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),o=s;s=s.slice(n.length);for(let a=s.length-1;a>=1;--a)if(t=s.charCodeAt(a),t===47){if(!r){i=a;break}}else r=!1;return i===-1?e?"/":this.isUrl(o)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){Ct(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){Ct(s),t&&Ct(t),s=Ce(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let o=t.length-1,a=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){Ct(s),s=Ce(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!r){e=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){Ct(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=Ce(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,o=0,a=-1,h=!0,l=s.length-1,c=0;for(;l>=r;--l){if(e=s.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=s.slice(1,a):t.base=t.name=s.slice(o,a)):(o===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,a)):(t.name=s.slice(o,n),t.base=s.slice(o,a)),t.ext=s.slice(n,a)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function $n(s,t,e,i,r){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?$n(s.replace(i[e],a),t,e+1,i,r):r.push(s.replace(i[e],a))}}function lh(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const r=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),$n(s,r,0,e,i)}else i.push(s);return i}const gs=s=>!Array.isArray(s);class ve{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{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return Tt(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>(o==null?void 0:o.src)??o):n!=null&&n.src?n.src:n,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&Y("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),r.forEach(n=>{const o=n.src,a=n.alias;let h;if(typeof a=="string"){const l=this._createBundleAssetId(t,a);i.push(l),h=[a,l]}else{const l=a.map(c=>this._createBundleAssetId(t,c));i.push(...l),h=[...a,...l]}this.add({...n,alias:h,src:o})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=n=>{this.hasKey(n)&&Y(`[Resolver] already has key: ${n} overwriting`)},Tt(e).forEach(n=>{const{src:o}=n;let{data:a,format:h,loadParser:l,parser:c}=n;const u=Tt(o).map(g=>typeof g=="string"?lh(g):Array.isArray(g)?g:[g]),f=this.getAlias(n);Array.isArray(f)?f.forEach(i):i(f);const d=[],p=g=>{const m=this._parsers.find(_=>_.test(g));return{src:g,...m==null?void 0:m.parse(g)}};u.forEach(g=>{g.forEach(m=>{let _={};if(typeof m!="object"?_=p(m):(a=m.data??a,h=m.format??h,(m.loadParser||m.parser)&&(l=m.loadParser??l,c=m.parser??c),_={...p(m.src),...m}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:f,data:a,format:h,loadParser:l,parser:c,progressSize:n.progressSize}),d.push(_)})}),f.forEach(g=>{this._assetMap[g]=d})})}resolveBundle(t){const e=gs(t);t=Tt(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(r,h)]=l}i[r]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=gs(t);t=Tt(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(h=>{const l=n.filter(c=>c[a]?c[a]===h:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),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++){const i=t[e],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,parser:o,format:a,progressSize:h}=e;return(this._basePath||this._rootPath)&&(t.src=at.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??ch(t.src),h!==void 0&&(t.progressSize=h),t}}ve.RETINA_PREFIX=/@([0-9\.]+)x/;function ch(s){return s.split(".").pop().split("?").shift().split("#").shift()}const ui=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},jn=class Fe{constructor(t,e){this.linkedSheets=[];let i=t;(t==null?void 0:t.source)instanceof St&&(i={texture:t,data:e});const{texture:r,data:n,cachePrefix:o=""}=i;this.cachePrefix=o,this._texture=r instanceof U?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=n;const a=parseFloat(n.meta.scale);a?(this.resolution=a,r.source.resolution=this.resolution):this.resolution=r.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<=Fe.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,e=!1){let i=t;const r=e?1/0:Fe.BATCH_SIZE;for(;i-t<r&&i<this._frameKeys.length;){const n=this._frameKeys[i],o=this._frames[n],a=o.frame;if(a){let h=null,l=null;const c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new tt(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?h=new tt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new tt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.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(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new U({source:this.textureSource,frame:h,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:n.toString()})}i++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Fe.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Fe.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};jn.BATCH_SIZE=1e3;let dr=jn;const uh=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Yn(s,t,e){const i={};if(s.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=at.dirname(s[0]);t.linkedSheets.forEach((n,o)=>{const a=Yn([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const dh={extension:I.Asset,cache:{test:s=>s instanceof dr,getCacheableAssets:(s,t)=>Yn(s,t,!1)},resolver:{extension:{type:I.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&uh.includes(r)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=ve.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:I.LoadParser,priority:Gt.Normal,name:"spritesheetLoader"},async testParse(s,t){return at.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var u,f;const{texture:i,imageFilename:r,textureOptions:n,cachePrefix:o}=(t==null?void 0:t.data)??{};let a=at.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(i instanceof U)h=i;else{const d=ui(a+(r??s.meta.image),t.src);h=(await e.load([{src:d,data:n}]))[d]}const l=new dr({texture:h.source,data:s,cachePrefix:o});await l.parse();const c=(u=s==null?void 0:s.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(c)){const d=[];for(const g of c){if(typeof g!="string")continue;let m=a+g;(f=t.data)!=null&&f.ignoreMultiPack||(m=ui(m,t.src),d.push(e.load({src:m,data:{textureOptions:n,ignoreMultiPack:!0}})))}const p=await Promise.all(d);l.linkedSheets=p,p.forEach(g=>{g.linkedSheets=[l].concat(l.linkedSheets.filter(m=>m!==g))})}return l},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};K.add(dh);const $s=Object.create(null),fr=Object.create(null);function Bi(s,t){let e=fr[s];return e===void 0&&($s[t]===void 0&&($s[t]=1),fr[s]=e=$s[t]++),e}let ne;function Xn(){return(!ne||ne!=null&&ne.isContextLost())&&(ne=z.get().createCanvas().getContext("webgl",{})),ne}let ns;function fh(){if(!ns){ns="mediump";const s=Xn();s&&s.getShaderPrecisionFormat&&(ns=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return ns}function ph(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),`
-
- #ifdef GL_ES // This checks if it is WebGL1
- #define in varying
- #define finalColor gl_FragColor
- #define texture texture2D
- #endif
- ${s}
- `):`
-
- #ifdef GL_ES // This checks if it is WebGL1
- #define in attribute
- #define out varying
- #endif
- ${s}
- `}function mh(s,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let r=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float;
-${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function gh(s,t){return t?`#version 300 es
-${s}`:s}const _h={},yh={};function xh(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?_h:yh;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`}
-${s}`}function bh(s,t){return t?s.replace("#version 300 es",""):s}const js={stripVersion:bh,ensurePrecision:mh,addProgramDefines:ph,setProgramName:xh,insertVersion:gh},Te=Object.create(null),qn=class di{constructor(t){t={...di.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:fh()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(js).forEach(o=>{const a=i[o];r=js[o](r,a,!0),n=js[o](n,a,!1)}),this.fragment=r,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Bi(`${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,Te[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Te[e]||(Te[e]=new di(t),Te[e]._cacheKey=e),Te[e]}};qn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Kn=qn;const pr={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 wh(s){return pr[s]??pr.float32}const vh={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",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},mr=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function gr(s,t){let e;for(;(e=mr.exec(s))!==null;){const i=vh[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:i,stride:wh(i).stride,offset:0,instance:!1,start:0}}mr.lastIndex=0}function Ah(s){return s.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Sh({source:s,entryPoint:t}){const e={},i=Ah(s),r=i.indexOf(`fn ${t}(`);if(r===-1)return e;const n=i.indexOf("->",r);if(n===-1)return e;const o=i.substring(r,n);if(gr(o,e),Object.keys(e).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const h=a[1],l=new RegExp(`struct\\s+${h}\\s*\\{([^}]+)\\}`,"s"),c=i.match(l);c&&gr(c[1],e)}}return e}function Ys(s){var u,f;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,n=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=(u=s.match(t))==null?void 0:u.map(d=>({group:parseInt(d.match(e)[1],10),binding:parseInt(d.match(i)[1],10),name:d.match(r)[2],isUniform:d.match(r)[1]==="<uniform>",type:d.match(n)[1]}));if(!l)return{groups:[],structs:[]};const c=((f=s.match(o))==null?void 0:f.map(d=>{const p=d.match(h)[1],g=d.match(a).reduce((m,_)=>{const[y,x]=_.split(":");return m[y.trim()]=x.trim(),m},{});return g?{name:p,members:g}:null}).filter(({name:d})=>l.some(p=>p.type===d||p.type.includes(`<${d}>`))))??[];return{groups:l,structs:c}}var Jt=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(Jt||{});function Ch({groups:s}){const t=[];for(let e=0;e<s.length;e++){const i=s[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:Jt.VERTEX|Jt.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):i.type==="texture_2d_array"||i.type.startsWith("texture_2d_array<")?t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(i.type==="texture_cube"||i.type.startsWith("texture_cube<"))&&t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function Th({groups:s}){const t=[];for(let e=0;e<s.length;e++){const i=s[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function Ph(s,t){const e=new Set,i=new Set,r=[...s.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...s.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:r,groups:n}}const Pe=Object.create(null);class Ms{constructor(t){var a,h;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:r,gpuLayout:n,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=i,e.source===i.source){const l=Ys(e.source);this.structsAndGroups=l}else{const l=Ys(i.source),c=Ys(e.source);this.structsAndGroups=Ph(l,c)}this.layout=r??Th(this.structsAndGroups),this.gpuLayout=n??Ch(this.structsAndGroups),this.autoAssignGlobalUniforms=((a=this.layout[0])==null?void 0:a.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((h=this.layout[1])==null?void 0:h.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Bi(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Sh(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Pe[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Pe[e]||(Pe[e]=new Ms(t),Pe[e]._cacheKey=e),Pe[e]}}const Qn=["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>"],Mh=Qn.reduce((s,t)=>(s[t]=!0,s),{});function kh(s,t){switch(s){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}const Zn=class Jn{constructor(t,e){this._touched=0,this.uid=J("uniform"),this._resourceType="uniformGroup",this._resourceId=J("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Jn.defaultOptions,...e},this.uniformStructures=t;const i={};for(const r in t){const n=t[r];if(n.name=r,n.size=n.size??1,!Mh[n.type]){const o=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,h]=o;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${a}', size: ${h} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${Qn.join(", ")}`)}n.value??(n.value=kh(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Bi(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Zn.defaultOptions={ubo:!1,isStatic:!1};let to=Zn;class ps{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var r,n;const i=this.resources[e];t!==i&&((r=i==null?void 0:i.off)==null||r.call(i,"change",this.onResourceChange,this),(n=t.on)==null||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const r in i)i[r]._gcLastUsed=t,i[r]._touched=e}destroy(){var e;const t=this.resources;for(const i in t){const r=t[i];(e=r==null?void 0:r.off)==null||e.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var fi=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(fi||{});class Fi extends ft{constructor(t){super(),this.uid=J("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:r,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=fi.WEBGPU),i&&(o|=fi.WEBGL)),this.compatibleRenderers=o;const h={};if(!n&&!r&&(n={}),n&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&a)for(const l in a)for(const c in a[l]){const u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&r&&!a){const l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(n){r={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(const c in n)h[c]||(r[99]||(r[99]=new ps,this._ownedBindGroups.push(r[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(const c in n){const u=c;let f=n[c];!f.source&&!f._resourceType&&(f=new to(f));const d=h[u];d&&(r[d.group]||(r[d.group]=new ps,this._ownedBindGroups.push(r[d.group])),r[d.group].setResource(f,d.binding))}}this.groups=r,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(r,h)}addResource(t,e,i){var r,n;(r=this._uniformBindMap)[e]||(r[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new ps,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const r in e){const n=e[r];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return i}destroy(t=!1){var e,i;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...r}=t;let n,o;return e&&(n=Ms.from(e)),i&&(o=Kn.from(i)),new Fi({gpuProgram:n,glProgram:o,...r})}}const pi=[];K.handleByNamedList(I.Environment,pi);async function Eh(s){if(!s)for(let t=0;t<pi.length;t++){const e=pi[t];if(e.value.test()){await e.value.load();return}}}let Me;function Ih(){if(typeof Me=="boolean")return Me;try{Me=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Me=!1}return Me}const He=new Set;let mi=!1;function _r(s,t,e=2){const i=t&&t.length,r=i?t[0]*e:s.length;He.size&&He.clear();let n=eo(s,0,r,e,!0);const o=[];if(!n||n.next===n.prev)return o;let a=0,h=0,l=0;if(i&&(n=Gh(s,t,n,e)),s.length>80*e){a=s[0],h=s[1];let c=a,u=h;for(let f=e;f<r;f+=e){const d=s[f],p=s[f+1];d<a&&(a=d),p<h&&(h=p),d>c&&(c=d),p>u&&(u=p)}l=Math.max(c-a,u-h),l=l!==0?32767/l:0}return gi(n,o,a,h,l),o}function eo(s,t,e,i,r){let n=null;if(r===qh(s,t,e,i)>0)for(let o=t;o<e;o+=i)n=br(o/i|0,s[o],s[o+1],n);else for(let o=e-i;o>=t;o-=i)n=br(o/i|0,s[o],s[o+1],n);return n&&Ne(n,n.next)&&($e(n),n=n.next),n}function ie(s,t=s){const e=t===s;let i=s,r;do r=!1,i!==i.next&&(He.size===0||!He.has(i))&&(Ne(i,i.next)||st(i.prev,i,i.next)===0)?((e||i===t)&&(t=i.prev),mi=!0,$e(i),i=i.prev,r=!0):(e||i!==t)&&(i=i.next,r=!e);while(r||i!==t);return t}function gi(s,t,e,i,r){r&&Nh(s,e,i,r);let n=s,o=!1;for(;s.prev!==s.next;){const a=s.prev,h=s.next;if(st(a,s,h)<0&&(r?Lh(s,e,i,r):Rh(s))){t.push(a.i,s.i,h.i),$e(s),s=h,n=h;continue}if(s=h,s===n){if(mi=!1,s=ie(s),mi){n=s;continue}if(!o){s=Bh(s,t),n=s,o=!0;continue}Fh(s,t,e,i,r);break}}}function Rh(s){const t=s.prev,e=s,i=s.next,r=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,c=Math.min(r,n,o),u=Math.min(a,h,l),f=Math.max(r,n,o),d=Math.max(a,h,l);let p=i.next;for(;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=u&&p.y<=d&&!(r===p.x&&a===p.y)&&ys(r,a,n,h,o,l,p.x,p.y)&&st(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Lh(s,t,e,i){const r=s.prev,n=s,o=s.next,a=r.x,h=n.x,l=o.x,c=r.y,u=n.y,f=o.y,d=Math.min(a,h,l),p=Math.min(c,u,f),g=Math.max(a,h,l),m=Math.max(c,u,f),_=bi(d,p,t,e,i),y=bi(g,m,t,e,i);let x=s.prevZ;for(;x&&x.z>=_;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=m&&x!==o&&!(a===x.x&&c===x.y)&&ys(a,c,h,u,l,f,x.x,x.y)&&st(x.prev,x,x.next)>=0)return!1;x=x.prevZ}let w=s.nextZ;for(;w&&w.z<=y;){if(w.x>=d&&w.x<=g&&w.y>=p&&w.y<=m&&w!==o&&!(a===w.x&&c===w.y)&&ys(a,c,h,u,l,f,w.x,w.y)&&st(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Bh(s,t){let e=s,i=!1;do{const r=e.prev,n=e.next.next;ro(r,e,e.next,n,!1)&&Ve(r,n)&&Ve(n,r)&&(t.push(r.i,e.i,n.i),$e(e),$e(e.next),e=s=n,i=!0),e=e.next}while(e!==s);return i?ie(e):e}function Fh(s,t,e,i,r){let n=s;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&jh(n,o)){let a=no(n,o);n=ie(n,n.next),a=ie(a,a.next),gi(n,t,e,i,r),gi(a,t,e,i,r);return}o=o.next}n=n.next}while(n!==s)}let _i=!1;function Gh(s,t,e,i){const r=[];for(let n=0,o=t.length;n<o;n++){const a=t[n]*i,h=n<o-1?t[n+1]*i:s.length,l=eo(s,a,h,i,!1);l===l.next&&He.add(l),r.push($h(l))}r.sort(Dh),Wh(s.length/i,t.length),io(e,e),_i=!0;for(let n=0;n<r.length;n++)e=Oh(r[n],e);return _i=!1,ie(e)}function Dh(s,t){return s.x-t.x||s.y-t.y||(s.next.y-s.y)/(s.next.x-s.x)-(t.next.y-t.y)/(t.next.x-t.x)}function Oh(s,t){const e=zh(s,t);if(!e)return t;const i=no(e,s),r=i.next;return io(e,r.next),ie(i,i.next),ie(e,e.next)}const so=16;let Z=new Float64Array(0),_s=0;const yi=[],xi=[];function Wh(s,t){const e=Math.ceil((s+2*t)/so)+t+2;Z.length<e*4&&(Z=new Float64Array(e*4)),_s=0}function io(s,t){let e=s;do{const i=_s++;yi[i]=e;let r=1/0,n=1/0,o=-1/0,a=-1/0,h=0;do{const c=e.next;e.z=i,e.x<r&&(r=e.x),e.x>o&&(o=e.x),e.y<n&&(n=e.y),e.y>a&&(a=e.y),c.x<r&&(r=c.x),c.x>o&&(o=c.x),c.y<n&&(n=c.y),c.y>a&&(a=c.y),e=c}while(++h<so&&e!==t);xi[i]=e;const l=i*4;Z[l]=r,Z[l+1]=n,Z[l+2]=o,Z[l+3]=a}while(e!==t)}function Uh(s,t){const e=s.z*4;t.x<Z[e]&&(Z[e]=t.x),t.y<Z[e+1]&&(Z[e+1]=t.y),t.x>Z[e+2]&&(Z[e+2]=t.x),t.y>Z[e+3]&&(Z[e+3]=t.y)}function yr(s){let t=xi[s];for(;t.prev.next!==t;)t=t.next;return xi[s]=t,t}function xr(s){let t=yi[s];for(;t.prev.next!==t;)t=t.next;return yi[s]=t,t}function zh(s,t){let e=t;const i=s.x,r=s.y;let n=-1/0,o;if(Ne(s,e))return e;for(let f=0,d=0;f<_s;f++,d+=4){if(r<Z[d+1]||r>Z[d+3]||Z[d]>i||Z[d+2]<=n)continue;const p=yr(f);e=xr(f);do{if(e.prev.next===e){if(Ne(s,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){const g=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(g<=i&&g>n&&(n=g,o=e.x<e.next.x?e:e.next,g===i))return o}}e=e.next}while(e!==p)}if(!o)return null;const a=o.x,h=o.y,l=Math.min(r,h),c=Math.max(r,h);let u=1/0;for(let f=0,d=0;f<_s;f++,d+=4){if(Z[d+2]<a||Z[d]>i||Z[d+3]<l||Z[d+1]>c)continue;const p=yr(f);e=xr(f);do{if(e.prev.next===e&&i>=e.x&&e.x>=a&&i!==e.x&&ys(r<h?i:n,r,a,h,r<h?n:i,r,e.x,e.y)){const g=Math.abs(r-e.y)/(i-e.x);(Ve(e,s)||e.y===r&&e.next.y===r&&e.next.x>i)&&(g<u||g===u&&(e.x>o.x||e.x===o.x&&Hh(o,e)))&&(o=e,u=g)}e=e.next}while(e!==p)}return o}function Hh(s,t){return st(s.prev,s,t.prev)<0&&st(t.next,s,s.next)<0}const xt=[];let ke=[],jt=new Uint32Array(0),Ee=new Uint32Array(0);const Ie=new Uint32Array(256);function Nh(s,t,e,i){let r=s,n=0;do r.z=bi(r.x,r.y,t,e,i),xt[n++]=r,r=r.next;while(r!==s);Vh(n);let o=null;for(let a=0;a<n;a++){const h=xt[a];h.prevZ=o,o&&(o.nextZ=h),o=h}o.nextZ=null}function Vh(s){if(s<=32){for(let t=1;t<s;t++){const e=xt[t],i=e.z;let r=t-1;for(;r>=0&&xt[r].z>i;)xt[r+1]=xt[r],r--;xt[r+1]=e}return}jt.length<s&&(jt=new Uint32Array(s),Ee=new Uint32Array(s),ke=new Array(s));for(let t=0;t<s;t++)jt[t]=xt[t].z;os(s,xt,jt,ke,Ee,0),os(s,ke,Ee,xt,jt,8),os(s,xt,jt,ke,Ee,16),os(s,ke,Ee,xt,jt,24)}function os(s,t,e,i,r,n){Ie.fill(0);for(let a=0;a<s;a++)Ie[e[a]>>>n&255]++;let o=0;for(let a=0;a<256;a++){const h=Ie[a];Ie[a]=o,o+=h}for(let a=0;a<s;a++){const h=e[a],l=Ie[h>>>n&255]++;i[l]=t[a],r[l]=h}}function bi(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function $h(s){let t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function ys(s,t,e,i,r,n,o,a){return(r-o)*(t-a)>=(s-o)*(n-a)&&(s-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(i-a)}function jh(s,t){const e=Ne(s,t)&&st(s.prev,s,s.next)>0&&st(t.prev,t,t.next)>0;return s.next.i!==t.i&&(e||Ve(s,t)&&Ve(t,s)&&(st(s.prev,s,t.prev)!==0||st(s,t.prev,t)!==0))&&!Yh(s,t)&&(e||Xh(s,t))}function st(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function Ne(s,t){return s.x===t.x&&s.y===t.y}function ro(s,t,e,i,r=!0){const n=st(s,t,e),o=st(s,t,i),a=st(e,i,s),h=st(e,i,t);return(n>0&&o<0||n<0&&o>0)&&(a>0&&h<0||a<0&&h>0)?!0:r?!!(n===0&&as(s,e,t)||o===0&&as(s,i,t)||a===0&&as(e,s,i)||h===0&&as(e,t,i)):!1}function as(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Yh(s,t){const e=Math.min(s.x,t.x),i=Math.max(s.x,t.x),r=Math.min(s.y,t.y),n=Math.max(s.y,t.y);let o=s;do{const a=o.next;if(o.x>i&&a.x>i||o.x<e&&a.x<e||o.y>n&&a.y>n||o.y<r&&a.y<r){o=a;continue}if(o.i!==s.i&&a.i!==s.i&&o.i!==t.i&&a.i!==t.i&&ro(o,a,s,t))return!0;o=a}while(o!==s);return!1}function Ve(s,t){return st(s.prev,s,s.next)<0?st(s,t,s.next)>=0&&st(s,s.prev,t)>=0:st(s,t,s.prev)<0||st(s,s.next,t)<0}function Xh(s,t){let e=s,i=!1;const r=(s.x+t.x)/2,n=(s.y+t.y)/2;do{const o=e.next;e.y>n!=o.y>n&&r<(o.x-e.x)*(n-e.y)/(o.y-e.y)+e.x&&(i=!i),e=o}while(e!==s);return i}function no(s,t){const e=wi(s.i,s.x,s.y),i=wi(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function br(s,t,e,i){const r=wi(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function $e(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ),_i&&Uh(s.prev,s.next)}function wi(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function qh(s,t,e,i){let r=0;for(let n=t,o=e-i;n<e;n+=i)r+=(s[o]-s[n])*(s[n+1]+s[o+1]),o=n;return r}const Kh=_r.default||_r;var oo=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=16384]="COLOR",s[s.STENCIL=1024]="STENCIL",s[s.DEPTH=256]="DEPTH",s[s.COLOR_DEPTH=16640]="COLOR_DEPTH",s[s.COLOR_STENCIL=17408]="COLOR_STENCIL",s[s.DEPTH_STENCIL=1280]="DEPTH_STENCIL",s[s.ALL=17664]="ALL",s))(oo||{});class Qh{constructor(t){this.items=[],this._name=t}emit(t,e,i,r,n,o,a,h){const{name:l,items:c}=this;for(let u=0,f=c.length;u<f;u++)c[u][l](t,e,i,r,n,o,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const 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}}const Zh=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],ao=class ho extends ft{constructor(t){super(),this.tick=0,this.uid=J("renderer"),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;const e=[...Zh,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Eh(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...ho.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){this.tick++;let i=t;if(i instanceof Ut&&(i={container:i},e&&(X(_t,"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){const r=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=r?i.clearColor:q.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(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){const r=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!==r&&this.runners.resolutionChange.emit(i)}clear(t={}){const e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=oo.ALL);const{clear:i,clearColor:r,target:n,mipLevel:o,layer:a}=t;q.shared.setValue(r??this.background.colorRgba),e.renderTarget.clear(n,i,q.shared.toArray(),o??0,a??0)}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 Qh(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,e){const i=e.reduce((r,n)=>(r[n.name]=n.value,r),{});t.forEach(r=>{const n=r.value,o=r.name,a=i[o];this.renderPipes[o]=new n(this,a?new a:null),this.runners.destroy.add(this.renderPipes[o])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&Qe.release(),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Ih())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()}};ao.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let lo=ao,hs;function Jh(s){return hs!==void 0||(hs=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??lo.defaultOptions.failIfMajorPerformanceCaveat};try{if(!z.get().getWebGLRenderingContext())return!1;let r=z.get().createCanvas().getContext("webgl",t);const n=!!((e=r==null?void 0:r.getContextAttributes())!=null&&e.stencil);if(r){const o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,n}catch{return!1}})()),hs}let ls;async function tl(s={}){return ls!==void 0||(ls=await(async()=>{const t=z.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),ls}const wr=["webgl","webgpu","canvas"];async function el(s){let t=[];s.preference?Array.isArray(s.preference)?t=s.preference.slice():(t.push(s.preference),wr.forEach(n=>{n!==s.preference&&t.push(n)})):t=wr.slice();let e,i={};for(let n=0;n<t.length;n++){const o=t[n];if(o==="webgpu"&&await tl()){const{WebGPURenderer:a}=await pe(async()=>{const{WebGPURenderer:h}=await import("./WebGPURenderer-Ddwua8JA.js");return{WebGPURenderer:h}},__vite__mapDeps([3,4,2,5]));e=a,i={...s,...s.webgpu};break}else if(o==="webgl"&&Jh(s.failIfMajorPerformanceCaveat??lo.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await pe(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-CdpFaPwH.js");return{WebGLRenderer:h}},__vite__mapDeps([6,4,2,5]));e=a,i={...s,...s.webgl};break}else if(o==="canvas"){const{CanvasRenderer:a}=await pe(async()=>{const{CanvasRenderer:h}=await import("./CanvasRenderer-Yf_04ykh.js");return{CanvasRenderer:h}},__vite__mapDeps([7,5,2]));e=a,i={...s,...s.canvasOptions};break}}if(delete i.webgpu,delete i.webgl,delete i.canvasOptions,!e)throw new Error("No available renderer for the current environment");const r=new e;return await r.init(i),r}const co="8.19.0";class uo{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,co)}static destroy(){}}uo.extension=I.Application;class sl{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,co)}destroy(){this._renderer=null}}sl.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"initHook",priority:-10};class fo{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,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{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}fo.extension=I.Application;class po{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,ze.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?dt.shared:new dt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}po.extension=I.Application;K.add(fo);K.add(po);const mo=class vi{constructor(...t){this.stage=new Ut,t[0]!==void 0&&X(_t,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new Ut),this.renderer=await el(t),vi._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(_t,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){var t;return(t=this.renderer.renderPipes.dom)==null?void 0:t._domElement}destroy(t=!1,e=!1){const i=vi._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};mo._plugins=[];let go=mo;K.handleByList(I.Application,go._plugins);K.add(uo);const Xs={test(s){return typeof s=="string"&&s.startsWith("info face=")},parse(s){const t=s.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const u in t){const f=t[u].match(/^[a-z]+/gm)[0],d=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(const g in d){const m=d[g].split("="),_=m[0],y=m[1].replace(/"/gm,""),x=parseFloat(y),w=isNaN(x)?y:x;p[_]=w}e[f].push(p)}const i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[r]=e.info,[n]=e.common,[o]=e.distanceField??[];o&&(i.distanceField={range:parseInt(o.distanceRange,10),type:o.fieldType}),i.fontSize=parseInt(r.size,10),i.fontFamily=r.face,i.lineHeight=parseInt(n.lineHeight,10);const 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});const h={};i.baseLineOffset=i.lineHeight-parseInt(n.base,10);const l=e.char;for(let u=0;u<l.length;u++){const f=l[u],d=parseInt(f.id,10);let p=f.letter??f.char??String.fromCharCode(d);p==="space"&&(p=" "),h[d]=p,i.chars[p]={id:d,page:parseInt(f.page,10)||0,x:parseInt(f.x,10),y:parseInt(f.y,10),width:parseInt(f.width,10),height:parseInt(f.height,10),xOffset:parseInt(f.xoffset,10),yOffset:parseInt(f.yoffset,10),xAdvance:parseInt(f.xadvance,10),kerning:{}}}const c=e.kerning||[];for(let u=0;u<c.length;u++){const f=parseInt(c[u].first,10),d=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);i.chars[h[d]]&&(i.chars[h[d]].kerning[h[f]]=p)}return i}},vr={test(s){const t=s;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(s){const t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=s.getElementsByTagName("info")[0],i=s.getElementsByTagName("common")[0],r=s.getElementsByTagName("distanceField")[0];r&&(t.distanceField={type:r.getAttribute("fieldType"),range:parseInt(r.getAttribute("distanceRange"),10)});const n=s.getElementsByTagName("page"),o=s.getElementsByTagName("char"),a=s.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let l=0;l<n.length;l++)t.pages.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});const h={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let l=0;l<o.length;l++){const c=o[l],u=parseInt(c.getAttribute("id"),10);let f=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);f==="space"&&(f=" "),h[u]=f,t.chars[f]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){const c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),f=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]]&&(t.chars[h[u]].kerning[h[c]]=f)}return t}},Ar={test(s){return typeof s=="string"&&s.match(/<font(\s|>)/)?vr.test(z.get().parseXML(s)):!1},parse(s){return vr.parse(z.get().parseXML(s))}},il=[".xml",".fnt"],rl={extension:{type:I.CacheParser,name:"cacheBitmapFont"},test:s=>!!(s!=null&&s.pages)&&!!(s!=null&&s.chars)&&typeof(s==null?void 0:s.fontFamily)=="string"&&s.fontFamily!=="",getCacheableAssets(s,t){const e={};return s.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},nl={extension:{type:I.LoadParser,priority:Gt.Normal},name:"loadBitmapFont",id:"bitmap-font",test(s){return il.includes(at.extname(s).toLowerCase())},async testParse(s){return Xs.test(s)||Ar.test(s)},async parse(s,t,e){const i=Xs.test(s)?Xs.parse(s):Ar.parse(s),{src:r}=t,{pages:n}=i,o=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let f=0;f<n.length;++f){const d=n[f].file;let p=at.join(at.dirname(r),d);p=ui(p,r),o.push({src:p,data:a})}const[h,{BitmapFont:l}]=await Promise.all([e.load(o),pe(()=>import("./BitmapFont-CoN36Cy_.js"),[])]),c=o.map(f=>h[f.src]);return new l({data:i,textures:c},r)},async load(s,t){return await(await z.get().fetch(s)).text()},async unload(s,t,e){await Promise.all(s.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),s.destroy()}};class ol{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;const 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())}}const al={extension:{type:I.CacheParser,name:"cacheTextureArray"},test:s=>Array.isArray(s)&&s.every(t=>t instanceof U),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};async function _o(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const hl={extension:{type:I.DetectionParser,priority:1},test:async()=>_o("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")},Sr=["png","jpg","jpeg"],ll={extension:{type:I.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Sr],remove:async s=>s.filter(t=>!Sr.includes(t))},cl="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ks(s){return cl?!1:document.createElement("video").canPlayType(s)!==""}const ul={extension:{type:I.DetectionParser,priority:0},test:async()=>ks("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")},dl={extension:{type:I.DetectionParser,priority:0},test:async()=>ks("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")},fl={extension:{type:I.DetectionParser,priority:0},test:async()=>ks("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")},pl={extension:{type:I.DetectionParser,priority:0},test:async()=>_o("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")},yo=class ms{constructor(){this.loadOptions={...ms.defaultOptions},this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let r=null,n=null;if((e.parser||e.loadParser)&&(n=this._parserHash[e.parser||e.loadParser],e.loadParser&&Y(`[Assets] "loadParser" is deprecated, use "parser" instead for ${t}`),n||Y(`[Assets] specified load parser "${e.parser||e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return Y(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,i.parser=l)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();const i=typeof e=="function"?{...ms.defaultOptions,...this.loadOptions,onProgress:e}:{...ms.defaultOptions,...this.loadOptions,...e||{}},{onProgress:r,onError:n,strategy:o,retryCount:a,retryDelay:h}=i;let l=0;const c={},u=gs(t),f=Tt(t,g=>({alias:[g],src:g,data:{}})),d=f.reduce((g,m)=>g+(m.progressSize||1),0),p=f.map(async g=>{const m=at.toAbsolute(g.src);c[g.src]||(await this._loadAssetWithRetry(m,g,{onProgress:r,onError:n,strategy:o,retryCount:a,retryDelay:h},c),l+=g.progressSize||1,r&&r(l/d))});return await Promise.all(p),u?c[f[0].src]:c}async unload(t){const i=Tt(t,r=>({alias:[r],src:r})).map(async r=>{var a,h;const n=at.toAbsolute(r.src),o=this.promiseCache[n];if(o){const l=await o.promise;delete this.promiseCache[n],await((h=(a=o.parser)==null?void 0:a.unload)==null?void 0:h.call(a,l,r,this))}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id?Y("[Assets] parser should have an id"):(t[e.name]||t[e.id])&&Y(`[Assets] parser id conflict "${e.id}"`),t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,i,r){let n=0;const{onError:o,strategy:a,retryCount:h,retryDelay:l}=i,c=u=>new Promise(f=>setTimeout(f,u));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),r[e.src]=await this.promiseCache[t].promise;return}catch(u){delete this.promiseCache[t],delete r[e.src],n++;const f=a!=="retry"||n>h;if(a==="retry"&&!f){o&&o(u,e),await c(l);continue}if(a==="skip"){o&&o(u,e);return}o&&o(u,e);const d=new Error(`[Loader.load] Failed to load ${t}.
-${u}`);throw u instanceof Error&&u.stack&&(d.stack=u.stack),d}}};yo.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let ml=yo;function Ae(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function Se(s,t){const e=s.split("?")[0],i=at.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const gl=".json",_l="application/json",yl={extension:{type:I.LoadParser,priority:Gt.Low},name:"loadJson",id:"json",test(s){return Ae(s,_l)||Se(s,gl)},async load(s){return await(await z.get().fetch(s)).json()}},xl=".txt",bl="text/plain",wl={name:"loadTxt",id:"text",extension:{type:I.LoadParser,priority:Gt.Low,name:"loadTxt"},test(s){return Ae(s,bl)||Se(s,xl)},async load(s){return await(await z.get().fetch(s)).text()}},vl=["normal","bold","100","200","300","400","500","600","700","800","900"],Al=[".ttf",".otf",".woff",".woff2"],Sl=["font/ttf","font/otf","font/woff","font/woff2"],Cl=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Tl(s){const t=at.extname(s),r=at.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1));let n=r.length>0;for(const a of r)if(!a.match(Cl)){n=!1;break}let o=r.join(" ");return n||(o=`"${o.replace(/[\\"]/g,"\\$&")}"`),o}const Pl=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Ml(s){return Pl.test(s)?s:encodeURI(s)}const kl={extension:{type:I.LoadParser,priority:Gt.Low},name:"loadWebFont",id:"web-font",test(s){return Ae(s,Sl)||Se(s,Al)},async load(s,t){var i,r,n;const e=z.get().getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Tl(s),h=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(c=>vl.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],f=new FontFace(a,`url('${Ml(s)}')`,{...l,weight:u});await f.load(),e.add(f),o.push(f)}return nt.has(`${a}-and-url`)?nt.get(`${a}-and-url`).entries.push({url:s,faces:o}):nt.set(`${a}-and-url`,{entries:[{url:s,faces:o}]}),o.length===1?o[0]:o}return Y("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(s){const t=Array.isArray(s)?s:[s],e=t[0].family,i=nt.get(`${e}-and-url`),r=i.entries.find(n=>n.faces.some(o=>t.indexOf(o)!==-1));r.faces=r.faces.filter(n=>t.indexOf(n)===-1),r.faces.length===0&&(i.entries=i.entries.filter(n=>n!==r)),t.forEach(n=>{z.get().getFontFaceSet().delete(n)}),i.entries.length===0&&nt.remove(`${e}-and-url`)}},qs={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},El=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Il=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function Rl(s){const t=[];return s.replace(El,(e,i,r)=>{let n=i.toLowerCase(),o=i;const a=Ll(r);for(n==="m"&&a.length>2&&(t.push([o,...a.splice(0,2)]),n="l",o=o==="m"?"l":"L");;){if(a.length===qs[n])return t.push([o,...a]),"";if(a.length<qs[n])throw new Error("malformed path data");t.push([o,...a.splice(0,qs[n])])}}),t}function Ll(s){const t=s.match(Il);return t?t.map(Number):[]}function Bl(s,t){const e=Rl(s),i=[];let r=null,n=0,o=0;for(let a=0;a<e.length;a++){const h=e[a],l=h[0],c=h;switch(l){case"M":n=c[1],o=c[2],t.moveTo(n,o);break;case"m":n+=c[1],o+=c[2],t.moveTo(n,o);break;case"H":n=c[1],t.lineTo(n,o);break;case"h":n+=c[1],t.lineTo(n,o);break;case"V":o=c[1],t.lineTo(n,o);break;case"v":o+=c[1],t.lineTo(n,o);break;case"L":n=c[1],o=c[2],t.lineTo(n,o);break;case"l":n+=c[1],o+=c[2],t.lineTo(n,o);break;case"C":n=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,o);break;case"c":t.bezierCurveTo(n+c[1],o+c[2],n+c[3],o+c[4],n+c[5],o+c[6]),n+=c[5],o+=c[6];break;case"S":n=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],n,o);break;case"s":t.bezierCurveToShort(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"Q":n=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],n,o);break;case"q":t.quadraticCurveTo(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"T":n=c[1],o=c[2],t.quadraticCurveToShort(n,o);break;case"t":n+=c[1],o+=c[2],t.quadraticCurveToShort(n,o);break;case"A":n=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"a":n+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"Z":case"z":t.closePath(),i.length>0&&(r=i.pop(),r?(n=r.startX,o=r.startY):(n=0,o=0)),r=null;break;default:Y(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&r===null&&(r={startX:n,startY:o},i.push(r))}return t}class Gi{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Gi(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}strokeContains(t,e,i,r=.5){if(this.radius===0)return!1;const n=this.x-t,o=this.y-e,a=this.radius,h=(1-r)*i,l=Math.sqrt(n*n+o*o);return l<=a+h&&l>a-(i-h)}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}]`}}class Di{constructor(t=0,e=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=r}clone(){return new Di(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,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,e,i,r=.5){const{halfWidth:n,halfHeight:o}=this;if(n<=0||o<=0)return!1;const a=i*(1-r),h=i-a,l=n-h,c=o-h,u=n+a,f=o+a,d=t-this.x,p=e-this.y,g=d*d/(l*l)+p*p/(c*c),m=d*d/(u*u)+p*p/(f*f);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 Fl(s,t,e,i,r,n){const o=s-e,a=t-i,h=r-e,l=n-i,c=o*h+a*l,u=h*h+l*l;let f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=i):f>1?(d=r,p=n):(d=e+f*h,p=i+f*l);const g=s-d,m=t-p;return g*g+m*m}let Gl,Dl;class Oe{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;r<n;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let r=0;r<i;r+=2){const n=e[r],o=e[r+1],a=e[(r+2)%i],h=e[(r+3)%i];t+=(a-n)*(h+o)}return t<0}containsPolygon(t){const e=this.getBounds(Gl),i=t.getBounds(Dl);if(!e.containsRect(i))return!1;const r=t.points;for(let n=0;n<r.length;n+=2){const o=r[n],a=r[n+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new Oe(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let n=0,o=r-1;n<r;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}strokeContains(t,e,i,r=.5){const n=i*i,o=n*(1-r),a=n-o,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){const u=h[c],f=h[c+1],d=h[(c+2)%h.length],p=h[(c+3)%h.length],g=Fl(t,e,u,f,d,p),m=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(g<=(m<0?a:o))return!0}return!1}getBounds(t){t||(t=new tt);const e=this.points;let i=1/0,r=-1/0,n=1/0,o=-1/0;for(let a=0,h=e.length;a<h;a+=2){const l=e[a],c=e[a+1];i=l<i?l:i,r=l>r?l:r,n=c<n?c:n,o=c>o?c:o}return t.x=i,t.width=r-i,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}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 X("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return X("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const cs=(s,t,e,i,r,n,o)=>{const a=s-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=r-n&&l<=r+o};class Oi{constructor(t=0,e=0,i=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n}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 Oi(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){const 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 r=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(r*r+n*n<=o||(r=t-(this.x+this.width-i),r*r+n*n<=o)||(n=e-(this.y+this.height-i),r*r+n*n<=o)||(r=t-(this.x+i),r*r+n*n<=o))return!0}return!1}strokeContains(t,e,i,r=.5){const{x:n,y:o,width:a,height:h,radius:l}=this,c=i*(1-r),u=i-c,f=n+l,d=o+l,p=a-l*2,g=h-l*2,m=n+a,_=o+h;return(t>=n-c&&t<=n+u||t>=m-u&&t<=m+c)&&e>=d&&e<=d+g||(e>=o-c&&e<=o+u||e>=_-u&&e<=_+c)&&t>=f&&t<=f+p?!0:t<f&&e<d&&cs(t,e,f,d,l,u,c)||t>m-l&&e<d&&cs(t,e,m-l,d,l,u,c)||t>m-l&&e>_-l&&cs(t,e,m-l,_-l,l,u,c)||t<f&&e>_-l&&cs(t,e,f,_-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const xo={};function Ol(s,t,e){let i=2166136261;for(let r=0;r<t;r++)i^=s[r].uid,i=Math.imul(i,16777619),i>>>=0;return xo[i]||Wl(s,t,i,e)}function Wl(s,t,e,i){const r={};let n=0;for(let a=0;a<i;a++){const h=a<t?s[a]:U.EMPTY.source;r[n++]=h.source,r[n++]=h.style}const o=new ps(r);return xo[e]=o,o}class Cr{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.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=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 Tr(s,t,e,i){if(e??(e=0),i??(i=Math.min(s.byteLength-e,t.byteLength)),!(e&7)&&!(i&7)){const r=i/8;new Float64Array(t,0,r).set(new Float64Array(s,e,r))}else if(!(e&3)&&!(i&3)){const r=i/4;new Float32Array(t,0,r).set(new Float32Array(s,e,r))}else new Uint8Array(t).set(new Uint8Array(s,e,i))}const Ul={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var zl=(s=>(s[s.DISABLED=0]="DISABLED",s[s.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",s[s.MASK_ACTIVE=2]="MASK_ACTIVE",s[s.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",s[s.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",s[s.NONE=5]="NONE",s))(zl||{});function Pr(s,t){return t.alphaMode==="no-premultiply-alpha"&&Ul[s]||s}const Hl=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
-`);function Nl(s){let t="";for(let e=0;e<s;++e)e>0&&(t+=`
-else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function Vl(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const i=Hl.replace(/%forloop%/gi,Nl(s));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}}finally{t.deleteShader(e)}return s}let oe=null;function $l(){var t;if(oe)return oe;const s=Xn();return oe=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),oe=Vl(oe,s),(t=s.getExtension("WEBGL_lose_context"))==null||t.loseContext(),oe}class jl{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class Yl{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new jl,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const We=[];let xs=0;Qe.register({clear:()=>{if(We.length>0)for(const s of We)s&&s.destroy();We.length=0,xs=0}});function Mr(){return xs>0?We[--xs]:new Yl}function kr(s){s.elements=null,We[xs++]=s}let Re=0;const bo=class wo{constructor(t){this.uid=J("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...wo.defaultOptions,...t},t.maxTextures||(X("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=$l());const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new Cr(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)kr(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){const 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;const 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){const e=this._elements;if(!e[this.elementStart])return;let i=Mr(),r=i.textures;r.clear();const n=e[this.elementStart];let o=Pr(n.blendMode,n.texture._source),a=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",p=[];const g=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const _=e[m];e[m]=null;const x=_.texture._source,w=Pr(_.blendMode,x),v=o!==w||a!==_.topology;if(x._batchTick===Re&&!v){_._textureId=x._textureBindLocation,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,h,l,_._attributeStart,_._textureId),this.packQuadIndex(c,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,h,l,_._attributeStart,_._textureId),this.packIndex(_,c,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=i,p.push(_);continue}x._batchTick=Re,(r.count>=g||v)&&(this._finishBatch(i,f,u-f,r,o,a,t,d,p),d="renderBatch",f=u,o=w,a=_.topology,i=Mr(),r=i.textures,r.clear(),p=[],++Re),_._textureId=x._textureBindLocation=r.count,r.ids[x.uid]=r.count,r.textures[r.count++]=x,_._batch=i,p.push(_),u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,h,l,_._attributeStart,_._textureId),this.packQuadIndex(c,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,h,l,_._attributeStart,_._textureId),this.packIndex(_,c,_._indexStart,_._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(i,f,u-f,r,o,a,t,d,p),f=u,++Re),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u}_finishBatch(t,e,i,r,n,o,a,h,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=r,t.blendMode=n,t.topology=o,t.start=e,t.size=i,t.elements=l,++Re,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){const e=Math.max(t,this.attributeBuffer.size*2),i=new Cr(e);Tr(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)r[n]=e[n];else Tr(e.buffer,r.buffer);this.indexBuffer=r}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,r){const n=t.indices,o=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<o;l++)e[i++]=r+n[l+a]-h}destroy(t={}){var e;if(this.batches!==null){for(let i=0;i<this.batchIndex;i++)kr(this.batches[i]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&((e=this.shader)==null||e.destroy(),this.shader=null);for(let i=0;i<this._elements.length;i++)this._elements[i]&&(this._elements[i]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};bo.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Xl=bo;var pt=(s=>(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(pt||{});class je extends ft{constructor(t){let{data:e,size:i}=t;const{usage:r,label:n,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=J("buffer"),this._resourceType="buffer",this._resourceId=J("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==null?void 0:e.byteLength);const a=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=o??!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&pt.STATIC)}set static(t){t?this.descriptor.usage|=pt.STATIC:this.descriptor.usage&=~pt.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,this._dataInt32=null,!r||r.length!==t.length){!this.shrinkToFit&&r&&t.byteLength<r.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=J("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function vo(s,t){if(!(s instanceof je)){let e=t?pt.INDEX:pt.VERTEX;s instanceof Array&&(t?(s=new Uint32Array(s),e=pt.INDEX|pt.COPY_DST):(s=new Float32Array(s),e=pt.VERTEX|pt.COPY_DST)),s=new je({data:s,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return s}function ql(s,t,e){const i=s.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const r=i.buffer.data;let n=1/0,o=1/0,a=-1/0,h=-1/0;const l=r.BYTES_PER_ELEMENT,c=(i.offset||0)/l,u=(i.stride||8)/l;for(let f=c;f<r.length;f+=u){const d=r[f],p=r[f+1];d>a&&(a=d),p>h&&(h=p),d<n&&(n=d),p<o&&(o=p)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=h,e}function Kl(s){return(s instanceof je||Array.isArray(s)||s.BYTES_PER_ELEMENT)&&(s={buffer:s}),s.buffer=vo(s.buffer,!1),s}class Ql extends ft{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=J("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new vt,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:r}=t;if(this.buffers=[],this.attributes={},e)for(const n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=r||"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(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const i=Kl(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=vo(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,ql(this,"aPosition",this._bounds)):this._bounds}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(i=>i.destroy()),this.unload(),(e=this.indexBuffer)==null||e.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Zl=new Float32Array(1),Jl=new Uint32Array(1);class tc extends Ql{constructor(){const e=new je({data:Zl,label:"attribute-batch-buffer",usage:pt.VERTEX|pt.COPY_DST,shrinkToFit:!1}),i=new je({data:Jl,label:"index-batch-buffer",usage:pt.INDEX|pt.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:20}},indexBuffer:i})}}function Er(s,t,e){if(s)for(const i in s){const r=i.toLocaleLowerCase(),n=t[r];if(n){let o=s[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}else Y(`${i} placement hook does not exist in shader`)}}const ec=/\{\{(.*?)\}\}/g;function Ir(s){var i;const t={};return(((i=s.match(ec))==null?void 0:i.map(r=>r.replace(/[{()}]/g,"")))??[]).forEach(r=>{t[r]=[]}),t}function Rr(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function Lr(s,t,e=!1){const i=[];Rr(t,i),s.forEach(a=>{a.header&&Rr(a.header,i)});const r=i;e&&r.sort();const n=r.map((a,h)=>` @location(${h}) ${a},`).join(`
-`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
-${n}
-`),o}function Br(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function sc(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function ic(s){const t=/@.*?\s+/g;return s.replace(t,"")}function rc(s,t){const e=[];Br(t,e),s.forEach(h=>{h.header&&Br(h.header,e)});let i=0;const r=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${i++}) ${h}`).join(`,
-`),n=e.sort().map(h=>` var ${ic(h)};`).join(`
-`),o=`return VSOutput(
- ${e.sort().map(h=>` ${sc(h)}`).join(`,
-`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
-${r}
-`),a=a.replace("{{start}}",`
-${n}
-`),a=a.replace("{{return}}",`
-${o}
-`),a}function Fr(s,t){let e=s;for(const i in t){const r=t[i];r.join(`
-`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
-${r.join(`
-`)}
-//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const Wt=Object.create(null),Ks=new Map;let nc=0;function oc({template:s,bits:t}){const e=Ao(s,t);if(Wt[e])return Wt[e];const{vertex:i,fragment:r}=hc(s,t);return Wt[e]=So(i,r,t),Wt[e]}function ac({template:s,bits:t}){const e=Ao(s,t);return Wt[e]||(Wt[e]=So(s.vertex,s.fragment,t)),Wt[e]}function hc(s,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let r=Lr(e,s.vertex,!0);r=rc(e,r);const n=Lr(i,s.fragment,!0);return{vertex:r,fragment:n}}function Ao(s,t){return t.map(e=>(Ks.has(e)||Ks.set(e,nc++),Ks.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function So(s,t,e){const i=Ir(s),r=Ir(t);return e.forEach(n=>{Er(n.vertex,i,n.name),Er(n.fragment,r,n.name)}),{vertex:Fr(s,i),fragment:Fr(t,r)}}const lc=`
- @in aPosition: vec2<f32>;
- @in aUV: vec2<f32>;
-
- @out @builtin(position) vPosition: vec4<f32>;
- @out vUV : vec2<f32>;
- @out vColor : vec4<f32>;
-
- {{header}}
-
- struct VSOutput {
- {{struct}}
- };
-
- @vertex
- fn main( {{in}} ) -> VSOutput {
-
- var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
- var modelMatrix = mat3x3<f32>(
- 1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0,
- 0.0, 0.0, 1.0
- );
- var position = aPosition;
- var uv = aUV;
-
- {{start}}
-
- vColor = vec4<f32>(1., 1., 1., 1.);
-
- {{main}}
-
- vUV = uv;
-
- var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
-
- vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
-
- vColor *= globalUniforms.uWorldColorAlpha;
-
- {{end}}
-
- {{return}}
- };
-`,cc=`
- @in vUV : vec2<f32>;
- @in vColor : vec4<f32>;
-
- {{header}}
-
- @fragment
- fn main(
- {{in}}
- ) -> @location(0) vec4<f32> {
-
- {{start}}
-
- var outColor:vec4<f32>;
-
- {{main}}
-
- var finalColor:vec4<f32> = outColor * vColor;
-
- {{end}}
-
- return finalColor;
- };
-`,uc=`
- in vec2 aPosition;
- in vec2 aUV;
-
- out vec4 vColor;
- out vec2 vUV;
-
- {{header}}
-
- void main(void){
-
- mat3 worldTransformMatrix = uWorldTransformMatrix;
- mat3 modelMatrix = mat3(
- 1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0,
- 0.0, 0.0, 1.0
- );
- vec2 position = aPosition;
- vec2 uv = aUV;
-
- {{start}}
-
- vColor = vec4(1.);
-
- {{main}}
-
- vUV = uv;
-
- mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
-
- gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
-
- vColor *= uWorldColorAlpha;
-
- {{end}}
- }
-`,dc=`
-
- in vec4 vColor;
- in vec2 vUV;
-
- out vec4 finalColor;
-
- {{header}}
-
- void main(void) {
-
- {{start}}
-
- vec4 outColor;
-
- {{main}}
-
- finalColor = outColor * vColor;
-
- {{end}}
- }
-`,fc={name:"global-uniforms-bit",vertex:{header:`
- struct GlobalUniforms {
- uProjectionMatrix:mat3x3<f32>,
- uWorldTransformMatrix:mat3x3<f32>,
- uWorldColorAlpha: vec4<f32>,
- uResolution: vec2<f32>,
- }
-
- @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
- `}},pc={name:"global-uniforms-bit",vertex:{header:`
- uniform mat3 uProjectionMatrix;
- uniform mat3 uWorldTransformMatrix;
- uniform vec4 uWorldColorAlpha;
- uniform vec2 uResolution;
- `}};function mc({bits:s,name:t}){const e=oc({template:{fragment:cc,vertex:lc},bits:[fc,...s]});return Ms.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function gc({bits:s,name:t}){return new Kn({name:t,...ac({template:{vertex:uc,fragment:dc},bits:[pc,...s]})})}const _c={name:"color-bit",vertex:{header:`
- @in aColor: vec4<f32>;
- `,main:`
- vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
- `}},yc={name:"color-bit",vertex:{header:`
- in vec4 aColor;
- `,main:`
- vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
- `}},Qs={};function xc(s){const t=[];if(s===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<s;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(`
-`)}function bc(s){const t=[];if(s===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<s;e++)e===s-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(`
-`)}function wc(s){return Qs[s]||(Qs[s]={name:"texture-batch-bit",vertex:{header:`
- @in aTextureIdAndRound: vec2<u32>;
- @out @interpolate(flat) vTextureId : u32;
- `,main:`
- vTextureId = aTextureIdAndRound.y;
- `,end:`
- if(aTextureIdAndRound.x == 1)
- {
- vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
- }
- `},fragment:{header:`
- @in @interpolate(flat) vTextureId: u32;
-
- ${xc(s)}
- `,main:`
- var uvDx = dpdx(vUV);
- var uvDy = dpdy(vUV);
-
- ${bc(s)}
- `}}),Qs[s]}const Zs={};function vc(s){const t=[];for(let e=0;e<s;e++)e>0&&t.push("else"),e<s-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
-`)}function Ac(s){return Zs[s]||(Zs[s]={name:"texture-batch-bit",vertex:{header:`
- in vec2 aTextureIdAndRound;
- out float vTextureId;
-
- `,main:`
- vTextureId = aTextureIdAndRound.y;
- `,end:`
- if(aTextureIdAndRound.x == 1.)
- {
- gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
- }
- `},fragment:{header:`
- in float vTextureId;
-
- uniform sampler2D uTextures[${s}];
-
- `,main:`
-
- ${vc(s)}
- `}}),Zs[s]}const Sc={name:"round-pixels-bit",vertex:{header:`
- fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
- {
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
- }
- `}},Cc={name:"round-pixels-bit",vertex:{header:`
- vec2 roundPixels(vec2 position, vec2 targetSize)
- {
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
- }
- `}},Gr={};function Tc(s){let t=Gr[s];if(t)return t;const e=new Int32Array(s);for(let i=0;i<s;i++)e[i]=i;return t=Gr[s]=new to({uTextures:{value:e,type:"i32",size:s}},{isStatic:!0}),t}class Dr extends Fi{constructor(t){const e=gc({name:"batch",bits:[yc,Ac(t),Cc]}),i=mc({name:"batch",bits:[_c,wc(t),Sc]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Tc(t)}}),this.maxTextures=t}}let Le=null;const Co=class To extends Xl{constructor(t){super(t),this.geometry=new tc,this.name=To.extension.name,this.vertexSize=6,Le??(Le=new Dr(t.maxTextures)),this.shader=Le}packAttributes(t,e,i,r,n){const o=n<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,{positions:p,uvs:g}=t,m=t.color,_=t.attributeOffset,y=_+t.attributeSize;for(let x=_;x<y;x++){const w=x*2,v=p[w],b=p[w+1];e[r++]=h*v+c*b+f,e[r++]=u*b+l*v+d,e[r++]=g[w],e[r++]=g[w+1],i[r++]=m,i[r++]=o}}packQuadAttributes(t,e,i,r,n){const o=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,p=t.bounds,g=p.maxX,m=p.minX,_=p.maxY,y=p.minY,x=o.uvs,w=t.color,v=n<<16|t.roundPixels&65535;e[r+0]=h*m+c*y+f,e[r+1]=u*y+l*m+d,e[r+2]=x.x0,e[r+3]=x.y0,i[r+4]=w,i[r+5]=v,e[r+6]=h*g+c*y+f,e[r+7]=u*y+l*g+d,e[r+8]=x.x1,e[r+9]=x.y1,i[r+10]=w,i[r+11]=v,e[r+12]=h*g+c*_+f,e[r+13]=u*_+l*g+d,e[r+14]=x.x2,e[r+15]=x.y2,i[r+16]=w,i[r+17]=v,e[r+18]=h*m+c*_+f,e[r+19]=u*_+l*m+d,e[r+20]=x.x3,e[r+21]=x.y3,i[r+22]=w,i[r+23]=v}_updateMaxTextures(t){this.shader.maxTextures!==t&&(Le=new Dr(t),this.shader=Le)}destroy(){this.shader=null,super.destroy()}};Co.extension={type:[I.Batcher],name:"default"};let Pc=Co;class Po{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:r,priority:n,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,n??0),this._onUnload=r,this.name=o}add(t){return this.items[t.uid]?!1:(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){var r;if(!this.items[t.uid])return;const i=t._gpuData[this._renderer.uid];i&&((r=this._onUnload)==null||r.call(this,t,...e),i.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach(e=>e&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function Mc(s,t,e,i,r,n,o,a=null){let h=0;e*=t,r*=n;const l=a.a,c=a.b,u=a.c,f=a.d,d=a.tx,p=a.ty;for(;h<o;){const g=s[e],m=s[e+1];i[r]=l*g+u*m+d,i[r+1]=c*g+f*m+p,r+=n,e+=t,h++}}function kc(s,t,e,i){let r=0;for(t*=e;r<i;)s[t]=0,s[t+1]=0,t+=e,r++}function Mo(s,t,e,i,r){const n=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),i||(i=2),r||(r=s.length/i-e);let u=e*i;for(let f=0;f<r;f++){const d=s[u],p=s[u+1];s[u]=n*d+a*p+l,s[u+1]=o*d+h*p+c,u+=i}}const Ec=new W;class ko{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.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Mn(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||Ec}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"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Ye={extension:{type:I.ShapeBuilder,name:"circle"},build(s,t){let e,i,r,n,o,a;if(s.type==="circle"){const w=s;if(o=a=w.radius,o<=0)return!1;e=w.x,i=w.y,r=n=0}else if(s.type==="ellipse"){const w=s;if(o=w.halfWidth,a=w.halfHeight,o<=0||a<=0)return!1;e=w.x,i=w.y,r=n=0}else{const w=s,v=w.width/2,b=w.height/2;e=w.x+v,i=w.y+b,o=a=Math.max(0,Math.min(w.radius,Math.min(v,b))),r=v-o,n=b-a}if(r<0||n<0)return!1;const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(r?4:0)+(n?4:0);if(l===0)return!1;if(h===0)return t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n,!0;let c=0,u=h*4+(r?2:0)+2,f=u,d=l,p=r+o,g=n,m=e+p,_=e-p,y=i+g;if(t[c++]=m,t[c++]=y,t[--u]=y,t[--u]=_,n){const w=i-g;t[f++]=_,t[f++]=w,t[--d]=w,t[--d]=m}for(let w=1;w<h;w++){const v=Math.PI/2*(w/h),b=r+Math.cos(v)*o,A=n+Math.sin(v)*a,k=e+b,P=e-b,S=i+A,T=i-A;t[c++]=k,t[c++]=S,t[--u]=S,t[--u]=P,t[f++]=P,t[f++]=T,t[--d]=T,t[--d]=k}p=r,g=n+a,m=e+p,_=e-p,y=i+g;const x=i-g;return t[c++]=m,t[c++]=y,t[--d]=x,t[--d]=m,r&&(t[c++]=_,t[c++]=y,t[--d]=x,t[--d]=_),!0},triangulate(s,t,e,i,r,n){if(s.length===0)return;let o=0,a=0;for(let c=0;c<s.length;c+=2)o+=s[c],a+=s[c+1];o/=s.length/2,a/=s.length/2;let h=i;t[h*e]=o,t[h*e+1]=a;const l=h++;for(let c=0;c<s.length;c+=2)t[h*e]=s[c],t[h*e+1]=s[c+1],c>0&&(r[n++]=h,r[n++]=l,r[n++]=h-1),h++;r[n++]=l+1,r[n++]=l,r[n++]=h-1}},Ic={...Ye,extension:{...Ye.extension,name:"ellipse"}},Rc={...Ye,extension:{...Ye.extension,name:"roundedRectangle"}},Eo=1e-4,Or=1e-4;function Lc(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,r=s[t-2],n=s[t-1];i<t;i+=2){const o=s[i],a=s[i+1];e+=(o-r)*(a+n),r=o,n=a}return e<0?-1:1}function Wr(s,t,e,i,r,n,o,a){const h=s-e*r,l=t-i*r,c=s+e*n,u=t+i*n;let f,d;o?(f=i,d=-e):(f=-i,d=e);const p=h+f,g=l+d,m=c+f,_=u+d;return a.push(p,g),a.push(m,_),2}function Yt(s,t,e,i,r,n,o,a){const h=e-s,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(r-s,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c;const d=u-c,p=Math.abs(d),g=Math.sqrt(h*h+l*l),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,_=d/m;if(f+=_,a){o.push(s,t),o.push(e,i);for(let y=1,x=f;y<m;y++,x+=_)o.push(s,t),o.push(s+Math.sin(x)*g,t+Math.cos(x)*g);o.push(s,t),o.push(r,n)}else{o.push(e,i),o.push(s,t);for(let y=1,x=f;y<m;y++,x+=_)o.push(s+Math.sin(x)*g,t+Math.cos(x)*g),o.push(s,t);o.push(r,n),o.push(s,t)}return m*2}function Bc(s,t,e,i,r,n){const o=Eo;if(s.length===0)return;const a=t;let h=a.alignment;if(t.alignment!==.5){let L=Lc(s);h=(h-.5)*L+.5}const l=new lt(s[0],s[1]),c=new lt(s[s.length-2],s[s.length-1]),u=i,f=Math.abs(l.x-c.x)<o&&Math.abs(l.y-c.y)<o;if(u){s=s.slice(),f&&(s.pop(),s.pop(),c.set(s[s.length-2],s[s.length-1]));const L=(l.x+c.x)*.5,H=(c.y+l.y)*.5;s.unshift(L,H),s.push(L,H)}const d=r,p=s.length/2;let g=s.length;const m=d.length/2,_=a.width/2,y=_*_,x=a.miterLimit*a.miterLimit;let w=s[0],v=s[1],b=s[2],A=s[3],k=0,P=0,S=-(v-A),T=w-b,M=0,R=0,B=Math.sqrt(S*S+T*T);S/=B,T/=B,S*=_,T*=_;const ht=h,C=(1-ht)*2,E=ht*2;u||(a.cap==="round"?g+=Yt(w-S*(C-E)*.5,v-T*(C-E)*.5,w-S*C,v-T*C,w+S*E,v+T*E,d,!0)+2:a.cap==="square"&&(g+=Wr(w,v,S,T,C,E,!0,d))),d.push(w-S*C,v-T*C),d.push(w+S*E,v+T*E);for(let L=1;L<p-1;++L){w=s[(L-1)*2],v=s[(L-1)*2+1],b=s[L*2],A=s[L*2+1],k=s[(L+1)*2],P=s[(L+1)*2+1],S=-(v-A),T=w-b,B=Math.sqrt(S*S+T*T),S/=B,T/=B,S*=_,T*=_,M=-(A-P),R=b-k,B=Math.sqrt(M*M+R*R),M/=B,R/=B,M*=_,R*=_;const H=b-w,V=v-A,D=b-k,et=P-A,ct=H*D+V*et,mt=V*D-et*H,it=mt<0;if(Math.abs(mt)<.001*Math.abs(ct)){d.push(b-S*C,A-T*C),d.push(b+S*E,A+T*E),ct>=0&&(a.join==="round"?g+=Yt(b,A,b-S*C,A-T*C,b-M*C,A-R*C,d,!1)+4:g+=2,d.push(b-M*E,A-R*E),d.push(b+M*C,A+R*C));continue}const kt=(-S+w)*(-T+A)-(-S+b)*(-T+v),zt=(-M+k)*(-R+A)-(-M+b)*(-R+P),re=(H*zt-D*kt)/mt,Ze=(et*kt-V*zt)/mt,Rs=(re-b)*(re-b)+(Ze-A)*(Ze-A),Ht=b+(re-b)*C,Nt=A+(Ze-A)*C,Vt=b-(re-b)*E,$t=A-(Ze-A)*E,sa=Math.min(H*H+V*V,D*D+et*et),$i=it?C:E,ia=sa+$i*$i*y;Rs<=ia?a.join==="bevel"||Rs/y>x?(it?(d.push(Ht,Nt),d.push(b+S*E,A+T*E),d.push(Ht,Nt),d.push(b+M*E,A+R*E)):(d.push(b-S*C,A-T*C),d.push(Vt,$t),d.push(b-M*C,A-R*C),d.push(Vt,$t)),g+=2):a.join==="round"?it?(d.push(Ht,Nt),d.push(b+S*E,A+T*E),g+=Yt(b,A,b+S*E,A+T*E,b+M*E,A+R*E,d,!0)+4,d.push(Ht,Nt),d.push(b+M*E,A+R*E)):(d.push(b-S*C,A-T*C),d.push(Vt,$t),g+=Yt(b,A,b-S*C,A-T*C,b-M*C,A-R*C,d,!1)+4,d.push(b-M*C,A-R*C),d.push(Vt,$t)):(d.push(Ht,Nt),d.push(Vt,$t)):(d.push(b-S*C,A-T*C),d.push(b+S*E,A+T*E),a.join==="round"?it?g+=Yt(b,A,b+S*E,A+T*E,b+M*E,A+R*E,d,!0)+2:g+=Yt(b,A,b-S*C,A-T*C,b-M*C,A-R*C,d,!1)+2:a.join==="miter"&&Rs/y<=x&&(it?(d.push(Vt,$t),d.push(Vt,$t)):(d.push(Ht,Nt),d.push(Ht,Nt)),g+=2),d.push(b-M*C,A-R*C),d.push(b+M*E,A+R*E),g+=2)}w=s[(p-2)*2],v=s[(p-2)*2+1],b=s[(p-1)*2],A=s[(p-1)*2+1],S=-(v-A),T=w-b,B=Math.sqrt(S*S+T*T),S/=B,T/=B,S*=_,T*=_,d.push(b-S*C,A-T*C),d.push(b+S*E,A+T*E),u||(a.cap==="round"?g+=Yt(b-S*(C-E)*.5,A-T*(C-E)*.5,b-S*C,A-T*C,b+S*E,A+T*E,d,!1)+2:a.cap==="square"&&(g+=Wr(b,A,S,T,C,E,!1,d)));const N=Or*Or;for(let L=m;L<g+m-2;++L)w=d[L*2],v=d[L*2+1],b=d[(L+1)*2],A=d[(L+1)*2+1],k=d[(L+2)*2],P=d[(L+2)*2+1],!(Math.abs(w*(A-P)+b*(P-v)+k*(v-A))<N)&&n.push(L,L+1,L+2)}function Fc(s,t,e,i){const r=Eo;if(s.length===0)return;const n=s[0],o=s[1],a=s[s.length-2],h=s[s.length-1],l=t||Math.abs(n-a)<r&&Math.abs(o-h)<r,c=e,u=s.length/2,f=c.length/2;for(let d=0;d<u;d++)c.push(s[d*2]),c.push(s[d*2+1]);for(let d=0;d<u-1;d++)i.push(f+d,f+d+1);l&&i.push(f+u-1,f)}function Io(s,t,e,i,r,n,o){const a=Kh(s,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)n[o++]=a[l]+r,n[o++]=a[l+1]+r,n[o++]=a[l+2]+r;let h=r*i;for(let l=0;l<s.length;l+=2)e[h]=s[l],e[h+1]=s[l+1],h+=i}const Gc=[],Dc={extension:{type:I.ShapeBuilder,name:"polygon"},build(s,t){for(let e=0;e<s.points.length;e++)t[e]=s.points[e];return!0},triangulate(s,t,e,i,r,n){Io(s,Gc,t,e,i,r,n)}},Oc={extension:{type:I.ShapeBuilder,name:"rectangle"},build(s,t){const e=s,i=e.x,r=e.y,n=e.width,o=e.height;return n>0&&o>0?(t[0]=i,t[1]=r,t[2]=i+n,t[3]=r,t[4]=i+n,t[5]=r+o,t[6]=i,t[7]=r+o,!0):!1},triangulate(s,t,e,i,r,n){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[6],t[i+o+1]=s[7],o+=e,t[i+o]=s[4],t[i+o+1]=s[5],o+=e;const a=i/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2}},Wc={extension:{type:I.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,!0},triangulate(s,t,e,i,r,n){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[4],t[i+o+1]=s[5];const a=i/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2}},Ur=[{offset:0,color:"white"},{offset:1,color:"black"}],Wi=class Ai{constructor(...t){this.uid=J("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=Uc(t);e={...e.type==="radial"?Ai.defaultRadialOptions:Ai.defaultLinearOptions,..._n(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(r=>{this.addColorStop(r.offset,r.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:q.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:r}=this.end,n=i-t,o=r-e;const a=n<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){const m=t;t=i,i=m,n*=-1}if(o<0){const m=e;e=r,r=m,o*=-1}}const h=this.colorStops.length?this.colorStops:Ur,l=this._textureSize,{canvas:c,context:u}=Hr(l,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);zr(f,h),u.fillStyle=f,u.fillRect(0,0,l,1),this.texture=new U({source:new be({resource:c,addressMode:this._wrapMode})});const d=Math.sqrt(n*n+o*o),p=Math.atan2(o,n),g=new W;g.scale(d/l,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:Ur,e=this._textureSize,{canvas:i,context:r}=Hr(e,e),{x:n,y:o}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,f=h-c,d=e/(c*2),p=(n-u)*d,g=(o-f)*d,m=r.createRadialGradient(p,g,l*d,(a-u)*d,(h-f)*d,c*d);zr(m,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=m,r.translate(p,g),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-p,-g),r.fillRect(0,0,e,e),this.texture=new U({source:new be({resource:i,addressMode:this._wrapMode})});const _=new W;this.textureSpace==="local"?_.scale(2*c,2*c):_.scale(1/d,1/d),_.translate(u,f),this.transform=_}destroy(){var t;(t=this.texture)==null||t.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};Wi.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Wi.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Ft=Wi;function zr(s,t){for(let e=0;e<t.length;e++){const i=t[e];s.addColorStop(i.offset,i.color)}}function Hr(s,t){const e=z.get().createCanvas(s,t),i=e.getContext("2d");return{canvas:e,context:i}}function Uc(s){let t=s[0]??{};return(typeof t=="number"||s[1])&&(X("8.5.2","use options object instead"),t={type:"linear",start:{x:s[0],y:s[1]},end:{x:s[2],y:s[3]},textureSpace:s[4],textureSize:s[5]??Ft.defaultLinearOptions.textureSize}),t}const zc=new W,Hc=new tt;function Nc(s,t,e,i){const r=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const o=e.getBounds(Hc);t.width&&o.pad(t.width);const{x:a,y:h}=o,l=1/o.width,c=1/o.height,u=-a*l,f=-h*c,d=r.a,p=r.b,g=r.c,m=r.d;r.a*=l,r.b*=l,r.c*=c,r.d*=c,r.tx=u*d+f*g+r.tx,r.ty=u*p+f*m+r.ty}else r.translate(t.texture.frame.x,t.texture.frame.y),r.scale(1/t.texture.source.width,1/t.texture.source.height);const n=t.texture.source.style;return!(t.fill instanceof Ft)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),i&&r.append(zc.copyFrom(i).invert()),r}const Es={};K.handleByMap(I.ShapeBuilder,Es);K.add(Oc,Dc,Wc,Ye,Ic,Rc);const Vc=new tt,$c=new W;function jc(s,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r<s.instructions.length;r++){const n=s.instructions[r];if(n.action==="texture")Yc(n.data,i,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,h=n.data.style,l=n.data.hole;o&&l&&Nr(l.shapePath,h,!0,i,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Nr(a,h,o,i,e)}}}function Yc(s,t,e){const i=[],r=Es.rectangle,n=Vc;n.x=s.dx,n.y=s.dy,n.width=s.dw,n.height=s.dh;const o=s.transform;if(!r.build(n,i))return;const{vertices:a,uvs:h,indices:l}=e,c=l.length,u=a.length/2;o&&Mo(i,o),r.triangulate(i,a,2,u,l,c);const f=s.image,d=f.uvs;h.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const p=At.get(ko);p.indexOffset=c,p.indexSize=l.length-c,p.attributeOffset=u,p.attributeSize=a.length/2-u,p.baseColor=s.style,p.alpha=s.alpha,p.texture=f,p.geometryData=e,t.push(p)}function Nr(s,t,e,i,r){const{vertices:n,uvs:o,indices:a}=r;s.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{const u=[],f=Es[h.type];if(!f.build(h,u))return;const d=a.length,p=n.length/2;let g="triangle-list";if(l&&Mo(u,l),e){const x=h.closePath??!0,w=t;w.pixelLine?(Fc(u,x,n,a),g="line-list"):Bc(u,w,!1,x,n,a)}else if(c){const x=[],w=u.slice();Xc(c).forEach(b=>{x.push(w.length/2),w.push(...b)}),Io(w,x,n,2,p,a,d)}else f.triangulate(u,n,2,p,a,d);const m=o.length/2,_=t.texture;if(_!==U.WHITE){const x=Nc($c,t,h,l);Mc(n,2,p,o,m,2,n.length/2-p,x)}else kc(o,m,2,n.length/2-p);const y=At.get(ko);y.indexOffset=d,y.indexSize=a.length-d,y.attributeOffset=p,y.attributeSize=n.length/2-p,y.baseColor=t.color,y.alpha=t.alpha,y.texture=_,y.geometryData=r,y.topology=g,i.push(y)})}function Xc(s){const t=[];for(let e=0;e<s.length;e++){const i=s[e].shape,r=[];Es[i.type].build(i,r)&&t.push(r)}return t}class qc{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{At.return(t)}),this.graphicsData&&At.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class Kc{constructor(){this.instructions=new Rn}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Pc({maxTextures:e}),this.instructions.reset()}get geometry(){return X(xa,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const Ui=class Si{constructor(t){this._renderer=t,this._managedContexts=new Po({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Si.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??Si.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),jc(t,i);const r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"?i.isBatchable=i.geometryData.vertices.length<400:i.isBatchable=!0,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=At.get(Kc,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:r,geometryData:n}=i;i.graphicsData=e;const o=n.vertices.length,a=n.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=!1;const h=e.batcher;h.ensureAttributeBuffer(o),h.ensureIndexBuffer(a),h.begin();for(let u=0;u<r.length;u++){const f=r[u];h.add(f)}h.finish(e.instructions);const l=h.geometry;l.indexBuffer.setDataWithSize(h.indexBuffer,h.indexSize,!0),l.buffers[0].setDataWithSize(h.attributeBuffer.float32View,h.attributeSize,!0);const c=h.batches;for(let u=0;u<c.length;u++){const f=c[u];f.bindGroup=Ol(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new qc;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Ui.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"graphicsContext"};Ui.defaultOptions={bezierSmoothness:.5};let Ro=Ui;const Qc=8,us=11920929e-14,Zc=1;function Lo(s,t,e,i,r,n,o,a,h,l){const u=Math.min(.99,Math.max(0,l??Ro.defaultOptions.bezierSmoothness));let f=(Zc-u)/1;return f*=f,Jc(t,e,i,r,n,o,a,h,s,f),s}function Jc(s,t,e,i,r,n,o,a,h,l){Ci(s,t,e,i,r,n,o,a,h,l,0),h.push(o,a)}function Ci(s,t,e,i,r,n,o,a,h,l,c){if(c>Qc)return;const u=(s+e)/2,f=(t+i)/2,d=(e+r)/2,p=(i+n)/2,g=(r+o)/2,m=(n+a)/2,_=(u+d)/2,y=(f+p)/2,x=(d+g)/2,w=(p+m)/2,v=(_+x)/2,b=(y+w)/2;if(c>0){let A=o-s,k=a-t;const P=Math.abs((e-o)*k-(i-a)*A),S=Math.abs((r-o)*k-(n-a)*A);if(P>us&&S>us){if((P+S)*(P+S)<=l*(A*A+k*k)){h.push(v,b);return}}else if(P>us){if(P*P<=l*(A*A+k*k)){h.push(v,b);return}}else if(S>us){if(S*S<=l*(A*A+k*k)){h.push(v,b);return}}else if(A=v-(s+o)/2,k=b-(t+a)/2,A*A+k*k<=l){h.push(v,b);return}}Ci(s,t,u,f,_,y,v,b,h,l,c+1),Ci(v,b,x,w,g,m,o,a,h,l,c+1)}const tu=8,eu=11920929e-14,su=1;function iu(s,t,e,i,r,n,o,a){const l=Math.min(.99,Math.max(0,a??Ro.defaultOptions.bezierSmoothness));let c=(su-l)/1;return c*=c,ru(t,e,i,r,n,o,s,c),s}function ru(s,t,e,i,r,n,o,a){Ti(o,s,t,e,i,r,n,a,0),o.push(r,n)}function Ti(s,t,e,i,r,n,o,a,h){if(h>tu)return;const l=(t+i)/2,c=(e+r)/2,u=(i+n)/2,f=(r+o)/2,d=(l+u)/2,p=(c+f)/2;let g=n-t,m=o-e;const _=Math.abs((i-n)*m-(r-o)*g);if(_>eu){if(_*_<=a*(g*g+m*m)){s.push(d,p);return}}else if(g=d-(t+n)/2,m=p-(e+o)/2,g*g+m*m<=a){s.push(d,p);return}Ti(s,t,e,l,c,d,p,a,h+1),Ti(s,d,p,u,f,n,o,a,h+1)}function Bo(s,t,e,i,r,n,o,a){let h=Math.abs(r-n);(!o&&r>n||o&&n>r)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=r;l*=o?-1:1;for(let u=0;u<a+1;u++){const f=Math.cos(c),d=Math.sin(c),p=t+f*i,g=e+d*i;s.push(p,g),c+=l}}function nu(s,t,e,i,r,n){const o=s[s.length-2],h=s[s.length-1]-e,l=o-t,c=r-e,u=i-t,f=Math.abs(h*u-l*c);if(f<1e-8||n===0){(s[s.length-2]!==t||s[s.length-1]!==e)&&s.push(t,e);return}const d=h*h+l*l,p=c*c+u*u,g=h*c+l*u,m=n*Math.sqrt(d)/f,_=n*Math.sqrt(p)/f,y=m*g/d,x=_*g/p,w=m*u+_*l,v=m*c+_*h,b=l*(_+y),A=h*(_+y),k=u*(m+x),P=c*(m+x),S=Math.atan2(A-v,b-w),T=Math.atan2(P-v,k-w);Bo(s,w+t,v+e,n,S,T,l*c>u*h)}const Ue=Math.PI*2,Js={centerX:0,centerY:0,ang1:0,ang2:0},ti=({x:s,y:t},e,i,r,n,o,a,h)=>{s*=e,t*=i;const l=r*s-n*t,c=n*s+r*t;return h.x=l+o,h.y=c+a,h};function ou(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),n=Math.sin(s),o=Math.cos(s+t),a=Math.sin(s+t);return[{x:r-n*i,y:n+r*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const Vr=(s,t,e,i)=>{const r=s*i-t*e<0?-1:1;let n=s*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},au=(s,t,e,i,r,n,o,a,h,l,c,u,f)=>{const d=Math.pow(r,2),p=Math.pow(n,2),g=Math.pow(c,2),m=Math.pow(u,2);let _=d*p-d*m-p*g;_<0&&(_=0),_/=d*m+p*g,_=Math.sqrt(_)*(o===a?-1:1);const y=_*r/n*u,x=_*-n/r*c,w=l*y-h*x+(s+e)/2,v=h*y+l*x+(t+i)/2,b=(c-y)/r,A=(u-x)/n,k=(-c-y)/r,P=(-u-x)/n,S=Vr(1,0,b,A);let T=Vr(b,A,k,P);a===0&&T>0&&(T-=Ue),a===1&&T<0&&(T+=Ue),f.centerX=w,f.centerY=v,f.ang1=S,f.ang2=T};function hu(s,t,e,i,r,n,o,a=0,h=0,l=0){if(n===0||o===0)return;const c=Math.sin(a*Ue/360),u=Math.cos(a*Ue/360),f=u*(t-i)/2+c*(e-r)/2,d=-c*(t-i)/2+u*(e-r)/2;if(f===0&&d===0)return;n=Math.abs(n),o=Math.abs(o);const p=Math.pow(f,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(o,2);p>1&&(n*=Math.sqrt(p),o*=Math.sqrt(p)),au(t,e,i,r,n,o,h,l,c,u,f,d,Js);let{ang1:g,ang2:m}=Js;const{centerX:_,centerY:y}=Js;let x=Math.abs(m)/(Ue/4);Math.abs(1-x)<1e-7&&(x=1);const w=Math.max(Math.ceil(x),1);m/=w;let v=s[s.length-2],b=s[s.length-1];const A={x:0,y:0};for(let k=0;k<w;k++){const P=ou(g,m),{x:S,y:T}=ti(P[0],n,o,u,c,_,y,A),{x:M,y:R}=ti(P[1],n,o,u,c,_,y,A),{x:B,y:ht}=ti(P[2],n,o,u,c,_,y,A);Lo(s,v,b,S,T,M,R,B,ht),v=B,b=ht,g+=m}}function lu(s,t,e){const i=(o,a)=>{const h=a.x-o.x,l=a.y-o.y,c=Math.sqrt(h*h+l*l),u=h/c,f=l/c;return{len:c,nx:u,ny:f}},r=(o,a)=>{o===0?s.moveTo(a.x,a.y):s.lineTo(a.x,a.y)};let n=t[t.length-1];for(let o=0;o<t.length;o++){const a=t[o%t.length],h=a.radius??e;if(h<=0){r(o,a),n=a;continue}const l=t[(o+1)%t.length],c=i(a,n),u=i(a,l);if(c.len<1e-4||u.len<1e-4){r(o,a),n=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=!0):f>0&&(d=-1,p=!0);const g=f/2;let m,_=Math.abs(Math.cos(g)*h/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=h;const y=a.x+u.nx*_+-u.ny*m*d,x=a.y+u.ny*_+u.nx*m*d,w=Math.atan2(c.ny,c.nx)+Math.PI/2*d,v=Math.atan2(u.ny,u.nx)-Math.PI/2*d;o===0&&s.moveTo(y+Math.cos(w)*m,x+Math.sin(w)*m),s.arc(y,x,m,w,v,p),n=a}}function cu(s,t,e,i){const r=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),n=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),o=t.length;for(let a=0;a<o;a++){const h=t[(a+1)%o],l=h.radius??e;if(l<=0){a===0?s.moveTo(h.x,h.y):s.lineTo(h.x,h.y);continue}const c=t[a],u=t[(a+2)%o],f=r(c,h);let d;if(f<1e-4)d=h;else{const m=Math.min(f/2,l);d=n(h,c,m/f)}const p=r(u,h);let g;if(p<1e-4)g=h;else{const m=Math.min(p/2,l);g=n(h,u,m/p)}a===0?s.moveTo(d.x,d.y):s.lineTo(d.x,d.y),s.quadraticCurveTo(h.x,h.y,g.x,g.y,i)}}const uu=new tt;class du{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new vt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,r,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return Bo(a,t,e,i,r,n,o),this}arcTo(t,e,i,r,n){this._ensurePoly();const o=this._currentPoly.points;return nu(o,t,e,i,r,n),this}arcToSvg(t,e,i,r,n,o,a){const h=this._currentPoly.points;return hu(h,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,o,a){this._ensurePoly();const h=this._currentPoly;return Lo(this._currentPoly.points,h.lastX,h.lastY,t,e,i,r,n,o,a),this}quadraticCurveTo(t,e,i,r,n){this._ensurePoly();const o=this._currentPoly;return iu(this._currentPoly.points,o.lastX,o.lastY,t,e,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const i=this.shapePrimitives,r=i.length;for(let n=0;n<t.instructions.length;n++){const o=t.instructions[n];this[o.action](...o.data)}if(t.checkForHoles&&i.length-r>1){let n=null;for(let o=r;o<i.length;o++){const a=i[o];if(a.shape.type==="polygon"){const h=a.shape,l=n==null?void 0:n.shape;l&&l.containsPolygon(h)?(n.holes||(n.holes=[]),n.holes.push(a),i.copyWithin(o,o+1),i.length--,o--):n=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,r,n){return this.drawShape(new tt(t,e,i,r),n),this}circle(t,e,i,r){return this.drawShape(new Gi(t,e,i),r),this}poly(t,e,i){const r=new Oe(t);return r.closePath=e,this.drawShape(r,i),this}regularPoly(t,e,i,r,n=0,o){r=Math.max(r|0,3);const a=-1*Math.PI/2+n,h=Math.PI*2/r,l=[];for(let c=0;c<r;c++){const u=a-c*h;l.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(l,!0,o),this}roundPoly(t,e,i,r,n,o=0,a){if(r=Math.max(r|0,3),n<=0)return this.regularPoly(t,e,i,r,o);const h=i*Math.sin(Math.PI/r)-.001;n=Math.min(n,h);const l=-1*Math.PI/2+o,c=Math.PI*2/r,u=(r-2)*Math.PI/r/2;for(let f=0;f<r;f++){const d=f*c+l,p=t+i*Math.cos(d),g=e+i*Math.sin(d),m=d+Math.PI+u,_=d-Math.PI-u,y=p+n*Math.cos(m),x=g+n*Math.sin(m),w=p+n*Math.cos(_),v=g+n*Math.sin(_);f===0?this.moveTo(y,x):this.lineTo(y,x),this.quadraticCurveTo(p,g,w,v,a)}return this.closePath()}roundShape(t,e,i=!1,r){return t.length<3?this:(i?cu(this,t,e,r):lu(this,t,e),this.closePath())}filletRect(t,e,i,r,n){if(n===0)return this.rect(t,e,i,r);const o=Math.min(i,r)/2,a=Math.min(o,Math.max(-o,n)),h=t+i,l=e+r,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+i-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,i,r,n,o){if(n<=0)return this.rect(t,e,i,r);const a=Math.min(n,Math.min(i,r)/2),h=t+i,l=e+r,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,o)}ellipse(t,e,i,r,n){return this.drawShape(new Di(t,e,i,r),n),this}roundRect(t,e,i,r,n,o){return this.drawShape(new Oi(t,e,i,r,n),o),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 Oe,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const 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 Oe,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=i;i=n.a*i+n.c*r+n.tx,r=n.b*o+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const r=e[i],n=r.shape.getBounds(uu);r.transform?t.addRect(n,r.transform):t.addRect(n)}return t}}class Bt{constructor(t,e=!1){this.instructions=[],this.uid=J("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Bl(t,this):this.instructions=(t==null?void 0:t.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new du(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,r,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(lt.shared);let h=0,l=0;if(!o||o.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=o.data[2],l=o.data[3];const c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,i,r,n]}),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){const r=this.instructions[this.instructions.length-1],n=this.getLastPoint(lt.shared);let o=0,a=0;if(!r||r.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=r.data[0],a=r.data[1];const h=n.x,l=n.y;o=h+(h-o),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,r,n){return this.instructions.push({action:"rect",data:[t,e,i,r,n]}),this._dirty=!0,this}circle(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),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,r,n,o,a){n||(n=r/2);const h=-1*Math.PI/2+o,l=i*2,c=Math.PI*2/l,u=[];for(let f=0;f<l;f++){const d=f%2?n:r,p=f*c+h;u.push(t+d*Math.cos(p),e+d*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){const e=new Bt;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const r=this.instructions[i];e.instructions.push({action:r.action,data:r.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,i=t.b,r=t.c,n=t.d,o=t.tx,a=t.ty;let h=0,l=0,c=0,u=0,f=0,d=0,p=0,g=0;for(let m=0;m<this.instructions.length;m++){const _=this.instructions[m],y=_.data;switch(_.action){case"moveTo":case"lineTo":h=y[0],l=y[1],y[0]=e*h+r*l+o,y[1]=i*h+n*l+a;break;case"bezierCurveTo":c=y[0],u=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*c+r*u+o,y[1]=i*c+n*u+a,y[2]=e*f+r*d+o,y[3]=i*f+n*d+a,y[4]=e*h+r*l+o,y[5]=i*h+n*l+a;break;case"quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+r*u+o,y[1]=i*c+n*u+a,y[2]=e*h+r*l+o,y[3]=i*h+n*l+a;break;case"arcToSvg":h=y[5],l=y[6],p=y[0],g=y[1],y[0]=e*p+r*g,y[1]=i*p+n*g,y[5]=e*h+r*l+o,y[6]=i*h+n*l+a;break;case"circle":y[4]=ae(y[3],t);break;case"rect":y[4]=ae(y[4],t);break;case"ellipse":y[8]=ae(y[8],t);break;case"roundRect":y[5]=ae(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=ae(y[2],t);break;case"regularPoly":case"chamferRect":y[5]=ae(y[5],t);break;case"closePath":break;default:Y("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 ae(s,t){return s?s.prepend(t):t.clone()}function Q(s,t,e){const i=s.getAttribute(t);return i?Number(i):e}function fu(s,t){const e=s.querySelectorAll("defs");for(let i=0;i<e.length;i++){const r=e[i];for(let n=0;n<r.children.length;n++){const o=r.children[n];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=pu(o);break;case"radialgradient":t.defs[o.id]=mu();break}}}}function pu(s){const t=Q(s,"x1",0),e=Q(s,"y1",0),i=Q(s,"x2",1),r=Q(s,"y2",0),n=s.getAttribute("gradientUnits")||"objectBoundingBox",o=new Ft(t,e,i,r,n==="objectBoundingBox"?"local":"global");for(let a=0;a<s.children.length;a++){const h=s.children[a],l=Q(h,"offset",0),c=q.shared.setValue(h.getAttribute("stop-color")).toNumber();o.addColorStop(l,c)}return o}function mu(s){return Y("[SVG Parser] Radial gradients are not yet supported"),new Ft(0,0,1,0)}function $r(s){const t=s.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const jr={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 Fo(s,t){const e=s.getAttribute("style"),i={},r={},n={strokeStyle:i,fillStyle:r,useFill:!1,useStroke:!1};for(const o in jr){const a=s.getAttribute(o);a&&Yr(t,n,o,a.trim())}if(e){const o=e.split(";");for(let a=0;a<o.length;a++){const h=o[a].trim(),[l,c]=h.split(":");jr[l]&&Yr(t,n,l,c.trim())}}return{strokeStyle:n.useStroke?i:null,fillStyle:n.useFill?r:null,useFill:n.useFill,useStroke:n.useStroke}}function Yr(s,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){const r=$r(i);t.strokeStyle.fill=s.defs[r]}else t.strokeStyle.color=q.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(")){const r=$r(i);t.fillStyle.fill=s.defs[r]}else t.fillStyle.color=q.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}}function gu(s){if(s.length<=2)return!0;const t=s.map(a=>a.area).sort((a,h)=>h-a),[e,i]=t,r=t[t.length-1],n=e/i,o=i/r;return!(n>3&&o<2)}function _u(s){return s.split(/(?=[Mm])/).filter(i=>i.trim().length>0)}function yu(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),i=[],r=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(i.push(e[c]),r.push(e[c+1]));if(i.length===0||r.length===0)return 0;const n=Math.min(...i),o=Math.max(...i),a=Math.min(...r),h=Math.max(...r);return(o-n)*(h-a)}function Xr(s,t){const e=new Bt(s,!1);for(const i of e.instructions)t.instructions.push(i)}function xu(s,t){if(typeof s=="string"){const o=document.createElement("div");o.innerHTML=s.trim(),s=o.querySelector("svg")}const e={context:t,defs:{},path:new Bt};fu(s,e);const i=s.children,{fillStyle:r,strokeStyle:n}=Fo(s,e);for(let o=0;o<i.length;o++){const a=i[o];a.nodeName.toLowerCase()!=="defs"&&Go(a,e,r,n)}return t}function Go(s,t,e,i){const r=s.children,{fillStyle:n,strokeStyle:o}=Fo(s,t);n&&e?e={...e,...n}:n&&(e=n),o&&i?i={...i,...o}:o&&(i=o);const a=!e&&!i;a&&(e={color:0});let h,l,c,u,f,d,p,g,m,_,y,x,w,v,b,A,k;switch(s.nodeName.toLowerCase()){case"path":{v=s.getAttribute("d");const P=s.getAttribute("fill-rule"),S=_u(v),T=P==="evenodd",M=S.length>1;if(T&&M){const B=S.map(C=>({path:C,area:yu(C)}));if(B.sort((C,E)=>E.area-C.area),S.length>3||!gu(B))for(let C=0;C<B.length;C++){const E=B[C],N=C===0;t.context.beginPath();const L=new Bt(void 0,!0);Xr(E.path,L),t.context.path(L),N?(e&&t.context.fill(e),i&&t.context.stroke(i)):t.context.cut()}else for(let C=0;C<B.length;C++){const E=B[C],N=C%2===1;t.context.beginPath();const L=new Bt(void 0,!0);Xr(E.path,L),t.context.path(L),N?t.context.cut():(e&&t.context.fill(e),i&&t.context.stroke(i))}}else{const B=P?P==="evenodd":!0;b=new Bt(v,B),t.context.path(b),e&&t.context.fill(e),i&&t.context.stroke(i)}break}case"circle":p=Q(s,"cx",0),g=Q(s,"cy",0),m=Q(s,"r",0),t.context.ellipse(p,g,m,m),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":h=Q(s,"x",0),l=Q(s,"y",0),A=Q(s,"width",0),k=Q(s,"height",0),_=Q(s,"rx",0),y=Q(s,"ry",0),_||y?t.context.roundRect(h,l,A,k,_||y):t.context.rect(h,l,A,k),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Q(s,"cx",0),g=Q(s,"cy",0),_=Q(s,"rx",0),y=Q(s,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,_,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Q(s,"x1",0),u=Q(s,"y1",0),f=Q(s,"x2",0),d=Q(s,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),i&&t.context.stroke(i);break;case"polygon":w=s.getAttribute("points"),x=w.match(/-?\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=s.getAttribute("points"),x=w.match(/-?\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{Y(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<r.length;P++)Go(r[P],t,e,i)}function bu(s){return s.texture!==void 0}const qr={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"}};class Is{constructor(t,e){this.uid=J("fillPattern"),this._tick=0,this.transform=new W;const i=bu(t)?t:{texture:t,repetition:e};this.texture=i.texture,this.textureSpace=i.textureSpace??"global";const r=i.repetition;r&&(this.texture.source.style.addressModeU=qr[r].addressModeU,this.texture.source.style.addressModeV=qr[r].addressModeV)}setTransform(t){if(t){if(this.transform.equals(t))return;this.transform.copyFrom(t)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function wu(s){return q.isColorLike(s)}function Kr(s){return s instanceof Is}function Qr(s){return s instanceof Ft}function vu(s){return s instanceof U}function Au(s,t,e){const i=q.shared.setValue(t??0);return s.color=i.toNumber(),s.alpha=i.alpha===1?e.alpha:i.alpha,s.texture=U.WHITE,{...e,...s}}function Su(s,t,e){return s.texture=t,{...e,...s}}function Zr(s,t,e){return s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Jr(s,t,e){return t.buildGradient(),s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Cu(s,t){const e={...t,...s},i=q.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function se(s,t){if(s==null)return null;const e={},i=s;return wu(s)?Au(e,s,t):vu(s)?Su(e,s,t):Kr(s)?Zr(e,s,t):Qr(s)?Jr(e,s,t):i.fill&&Kr(i.fill)?Zr(i,i.fill,t):i.fill&&Qr(i.fill)?Jr(i,i.fill,t):Cu(i,t)}function bs(s,t){const{width:e,alignment:i,miterLimit:r,cap:n,join:o,pixelLine:a,...h}=t,l=se(s,h);return l?{width:e,alignment:i,miterLimit:r,cap:n,join:o,pixelLine:a,...l}:null}function Tu(s,t){let e=1;const i=s.shapePath.shapePrimitives;for(let r=0;r<i.length;r++){const n=i[r].shape;if(n.type!=="polygon")continue;const o=n.points,a=o.length;if(a<6)continue;const h=n.closePath;for(let l=0;l<a;l+=2){if(!h&&(l===0||l===a-2))continue;const c=(l-2+a)%a,u=(l+2)%a,f=o[c],d=o[c+1],p=o[l],g=o[l+1],m=o[u],_=o[u+1],y=f-p,x=d-g,w=m-p,v=_-g,b=y*y+x*x,A=w*w+v*v;if(b<1e-12||A<1e-12)continue;let S=(y*w+x*v)/Math.sqrt(b*A);S<-1?S=-1:S>1&&(S=1);const T=Math.sqrt((1-S)*.5);if(T<1e-6)continue;const M=Math.min(1/T,t);M>e&&(e=M)}}return e}const Pu=new lt,tn=new W,zi=class Mt extends ft{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=J("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new Bt,this._transform=new W,this._fillStyle={...Mt.defaultFillStyle},this._strokeStyle={...Mt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new vt,this._boundsDirty=!0}clone(){const t=new Mt;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=se(t,Mt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=bs(t,Mt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=se(t,Mt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=se(t,Mt.defaultStrokeStyle),this}texture(t,e,i,r,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:r||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Bt,this}fill(t,e){let i;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="stroke"?i=r.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(X(_t,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=se(t,Mt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(lt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=bs(t,Mt.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++){const 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,r,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,r,n,o),this}arcTo(t,e,i,r,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*r+o.tx,o.b*i+o.d*r+o.ty,n),this}arcToSvg(t,e,i,r,n,o,a){this._tick++;const h=this._transform;return this._activePath.arcToSvg(t,e,i,r,n,h.a*o+h.c*a+h.tx,h.b*o+h.d*a+h.ty),this}bezierCurveTo(t,e,i,r,n,o,a){this._tick++;const h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*i+h.c*r+h.tx,h.b*i+h.d*r+h.ty,h.a*n+h.c*o+h.tx,h.b*n+h.d*o+h.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,r){return this._tick++,this._activePath.ellipse(t,e,i,r,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++;const 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++;const i=this._transform,r=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,o=i.b*t+i.d*e+i.ty;return r.length===1&&r[0].action==="moveTo"?(r[0].data[0]=n,r[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,i,r,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*r+o.tx,o.b*i+o.d*r+o.ty,n),this}rect(t,e,i,r){return this._tick++,this._activePath.rect(t,e,i,r,this._transform.clone()),this}roundRect(t,e,i,r,n){return this._tick++,this._activePath.roundRect(t,e,i,r,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,r,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,r,n,o),this}roundPoly(t,e,i,r,n,o){return this._tick++,this._activePath.roundPoly(t,e,i,r,n,o),this}roundShape(t,e,i,r){return this._tick++,this._activePath.roundShape(t,e,i,r),this}filletRect(t,e,i,r,n){return this._tick++,this._activePath.filletRect(t,e,i,r,n),this}chamferRect(t,e,i,r,n,o){return this._tick++,this._activePath.chamferRect(t,e,i,r,n,o),this}star(t,e,i,r,n=0,o=0){return this._tick++,this._activePath.star(t,e,i,r,n,o,this._transform.clone()),this}svg(t){return this._tick++,xu(t,this),this}restore(){const 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,r,n,o){return t instanceof W?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,r,n,o),this)}transform(t,e,i,r,n,o){return t instanceof W?(this._transform.append(t),this):(tn.set(t,e,i,r,n,o),this._transform.append(tn),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._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const i=this.instructions[e],r=i.action;if(r==="fill"){const n=i.data;t.addBounds(n.path.bounds)}else if(r==="texture"){const n=i.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(r==="stroke"){const n=i.data,o=n.style.alignment;let a=n.style.width*(1-o);n.style.join==="miter"&&(a*=Tu(n.path,n.style.miterLimit));const h=n.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){var r;if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let i=!1;for(let n=0;n<e.length;n++){const o=e[n],a=o.data,h=a.path;if(!o.action||!h)continue;const l=a.style,c=h.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){const f=c[u].shape;if(!l||!f)continue;const d=c[u].transform,p=d?d.applyInverse(t,Pu):t;if(o.action==="fill")i=f.contains(p.x,p.y);else{const m=l;i=f.strokeContains(p.x,p.y,m.width,m.alignment)}const g=a.hole;if(g){const m=(r=g.shapePath)==null?void 0:r.shapePrimitives;if(m)for(let _=0;_<m.length;_++)m[_].shape.contains(p.x,p.y)&&(i=!1)}if(i)return!0}}return i}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(i)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():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}};zi.defaultFillStyle={color:16777215,alpha:1,texture:U.WHITE,matrix:null,fill:null,textureSpace:"local"};zi.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:U.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let te=zi;function Hi(s,t=1){var i;const e=(i=ve.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}function Ni(s,t,e){s.label=e,s._sourceOrigin=e;const i=new U({source:s,label:e}),r=()=>{delete t.promiseCache[e],nt.has(e)&&nt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(Y("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),r())}),i.once("destroy",()=>{s.destroyed||(Y("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),i}const Mu=".svg",ku="image/svg+xml",Eu={extension:{type:I.LoadParser,priority:Gt.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(s){return Ae(s,ku)||Se(s,Mu)},async load(s,t,e){var i;return((i=t.data)==null?void 0:i.parseAsGraphicsContext)??this.config.parseAsGraphicsContext?Ru(s):Iu(s,t,e,this.config.crossOrigin)},unload(s){s.destroy(!0)}};async function Iu(s,t,e,i){var m,_,y;const r=await z.get().fetch(s),n=z.get().createImage();n.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await r.text())}`,n.crossOrigin=i,await n.decode();const o=((m=t.data)==null?void 0:m.width)??n.width,a=((_=t.data)==null?void 0:_.height)??n.height,h=((y=t.data)==null?void 0:y.resolution)||Hi(s),l=Math.ceil(o*h),c=Math.ceil(a*h),u=z.get().createCanvas(l,c),f=u.getContext("2d");f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(n,0,0,o*h,a*h);const{parseAsGraphicsContext:d,...p}=t.data??{},g=new be({resource:u,alphaMode:"premultiply-alpha-on-upload",resolution:h,...p});return Ni(g,e,s)}async function Ru(s){const e=await(await z.get().fetch(s)).text(),i=new te;return i.svg(e),i}const Lu=`(function () {
- 'use strict';
-
- const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
- async function checkImageBitmap() {
- try {
- if (typeof createImageBitmap !== "function") return false;
- const response = await fetch(WHITE_PNG);
- const imageBlob = await response.blob();
- const imageBitmap = await createImageBitmap(imageBlob);
- return imageBitmap.width === 1 && imageBitmap.height === 1;
- } catch (_e) {
- return false;
- }
- }
- void checkImageBitmap().then((result) => {
- self.postMessage(result);
- });
-
-})();
-`;let me=null,Pi=class{constructor(){me||(me=URL.createObjectURL(new Blob([Lu],{type:"application/javascript"}))),this.worker=new Worker(me)}};Pi.revokeObjectURL=function(){me&&(URL.revokeObjectURL(me),me=null)};const Bu=`(function () {
- 'use strict';
-
- async function loadImageBitmap(url, alphaMode) {
- const response = await fetch(url);
- if (!response.ok) {
- throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
- }
- const imageBlob = await response.blob();
- return alphaMode === "premultiplied-alpha" ? createImageBitmap(imageBlob, { premultiplyAlpha: "none" }) : createImageBitmap(imageBlob);
- }
- self.onmessage = async (event) => {
- try {
- const imageBitmap = await loadImageBitmap(event.data.data[0], event.data.data[1]);
- self.postMessage({
- data: imageBitmap,
- uuid: event.data.uuid,
- id: event.data.id
- }, [imageBitmap]);
- } catch (e) {
- self.postMessage({
- error: e,
- uuid: event.data.uuid,
- id: event.data.id
- });
- }
- };
-
-})();
-`;let ge=null;class Do{constructor(){ge||(ge=URL.createObjectURL(new Blob([Bu],{type:"application/javascript"}))),this.worker=new Worker(ge)}}Do.revokeObjectURL=function(){ge&&(URL.revokeObjectURL(ge),ge=null)};let en=0,ei;class Fu{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=>{const{worker:e}=new Pi;e.addEventListener("message",i=>{e.terminate(),Pi.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){ei===void 0&&(ei=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<ei&&(this._createdWorkers++,t=new Do().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){this._resolveHash[t.uuid]&&(t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),delete this._resolveHash[t.uuid])}async _run(t,e){await this._initWorkers();const i=new Promise((r,n)=>{this._queue.push({id:t,arguments:e,resolve:r,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[en]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:en++,id:i})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>{t==null||t(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}}const sn=new Fu,Gu=[".jpeg",".jpg",".png",".webp",".avif"],Du=["image/jpeg","image/png","image/webp","image/avif"];async function Ou(s,t){var r;const e=await z.get().fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const i=await e.blob();return((r=t==null?void 0:t.data)==null?void 0:r.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const Oo={name:"loadTextures",id:"texture",extension:{type:I.LoadParser,priority:Gt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return Ae(s,Du)||Se(s,Gu)},async load(s,t,e){var n;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await sn.isImageBitmapSupported()?i=await sn.loadImageBitmap(s,t):i=await Ou(s,t):i=await new Promise((o,a)=>{i=z.get().createImage(),i.crossOrigin=this.config.crossOrigin,i.src=s,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=a)});const r=new be({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((n=t.data)==null?void 0:n.resolution)||Hi(s),...t.data});return Ni(r,e,s)},unload(s){s.destroy(!0)}},Wu=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let si,ii;function Uu(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=Hu(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function zu(s){return new Promise((t,e)=>{s.addEventListener("canplaythrough",i),s.addEventListener("error",r),s.load();function i(){n(),t()}function r(o){n(),e(o)}function n(){s.removeEventListener("canplaythrough",i),s.removeEventListener("error",r)}})}function Hu(s,t=globalThis.location){if(s.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Nu(){const s=[],t=[];for(const e of Wu){const i=De.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;ks(i)&&(s.push(e),t.includes(i)||t.push(i))}return{validVideoExtensions:s,validVideoMime:t}}const Vu={name:"loadVideo",id:"video",extension:{type:I.LoadParser,name:"loadVideo"},test(s){if(!si||!ii){const{validVideoExtensions:i,validVideoMime:r}=Nu();si=i,ii=r}const t=Ae(s,ii),e=Se(s,si);return t||e},async load(s,t,e){var h,l;const i={...De.defaultOptions,resolution:((h=t.data)==null?void 0:h.resolution)||Hi(s),alphaMode:((l=t.data)==null?void 0:l.alphaMode)||await Hn(),...t.data},r=document.createElement("video"),n={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(n).forEach(c=>{const u=n[c];u!==void 0&&r.setAttribute(c,u)}),i.muted===!0&&(r.muted=!0),Uu(r,s,i.crossorigin);const o=document.createElement("source");let a;if(i.mime)a=i.mime;else if(s.startsWith("data:"))a=s.slice(5,s.indexOf(";"));else if(!s.startsWith("blob:")){const c=s.split("?")[0].slice(s.lastIndexOf(".")+1).toLowerCase();a=De.MIME_TYPES[c]||`video/${c}`}return o.src=s,a&&(o.type=a),new Promise((c,u)=>{i.preload&&!i.autoPlay&&r.load(),r.addEventListener("canplay",f),r.addEventListener("error",d),o.addEventListener("error",d),r.appendChild(o);async function f(){const g=new De({...i,resource:r});p(),t.data.preload&&await zu(r),c(Ni(g,e,s))}function d(g){p(),u(g)}function p(){r.removeEventListener("canplay",f),r.removeEventListener("error",d),o.removeEventListener("error",d)}})},unload(s){s.destroy(!0)}},Wo={extension:{type:I.ResolveParser,name:"resolveTexture"},test:Oo.test,parse:s=>{var t;return{resolution:parseFloat(((t=ve.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:s.split(".").pop(),src:s}}},$u={extension:{type:I.ResolveParser,priority:-2,name:"resolveJson"},test:s=>ve.RETINA_PREFIX.test(s)&&s.endsWith(".json"),parse:Wo.parse};class ju{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ve,this.loader=new ml,this.cache=nt,this._backgroundLoader=new ol(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){Y("[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 a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences),t.loadOptions&&(this.loader.loadOptions={...this.loader.loadOptions,...t.loadOptions})}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=gs(t),r=Tt(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(r),o=await this._mapLoadToResolve(n,e);return i?o[r[0]]:o}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]);const r=this.resolver.resolveBundle(t),n={},o=Object.keys(r);let a=0;const h=[],l=()=>{e==null||e(h.reduce((u,f)=>u+f,0)/a)},c=o.map((u,f)=>{const d=r[u],p=Object.values(d),m=[...new Set(p.flat())].reduce((_,y)=>_+(y.progressSize||1),0);return h.push(0),a+=m,this._mapLoadToResolve(d,_=>{h[f]=_*m,l()}).then(_=>{n[u]=_})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const 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 nt.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=nt.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const r=await this.loader.load(i,e);this._backgroundLoader.active=!0;const n={};return i.forEach(o=>{const a=r[o.src],h=[o.src];o.alias&&h.push(...o.alias),h.forEach(l=>{n[l]=a}),nt.set(h,a)}),n}async unload(t){this._initialized||await this.init();const e=Tt(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Tt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{nt.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(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),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]})})}}const de=new ju;K.handleByList(I.LoadParser,de.loader.parsers).handleByList(I.ResolveParser,de.resolver.parsers).handleByList(I.CacheParser,de.cache.parsers).handleByList(I.DetectionParser,de.detections);K.add(al,ll,hl,pl,ul,dl,fl,yl,wl,kl,Eu,Oo,Vu,nl,rl,Wo,$u);const rn={loader:I.LoadParser,resolver:I.ResolveParser,cache:I.CacheParser,detection:I.DetectionParser};K.handle(I.Asset,s=>{const t=s.ref;Object.entries(rn).filter(([e])=>!!t[e]).forEach(([e,i])=>K.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(rn).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});let he;function nn(s){const t=z.get().createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=s,e.fillRect(0,0,6,1),t}function Yu(){if(he!==void 0)return he;try{const s=nn("#ff00ff"),t=nn("#ffff00"),i=z.get().createCanvas(6,1).getContext("2d");i.globalCompositeOperation="multiply",i.drawImage(s,0,0),i.drawImage(t,2,0);const r=i.getImageData(2,0,1,1);if(!r)he=!1;else{const n=r.data;he=n[0]===255&&n[1]===0&&n[2]===0}}catch{he=!1}return he}const $={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:Yu(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:s=>{const t=s.source,e=t==null?void 0:t.resource;if(!e)return null;const i=t.alphaMode==="premultiplied-alpha",r=t.resourceWidth??t.pixelWidth,n=t.resourceHeight??t.pixelHeight,o=r!==t.pixelWidth||n!==t.pixelHeight;if(i){if((e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)&&!o)return e;const a=$._unpremultipliedCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas}if(e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof ArrayBuffer){const a=$._canvasSourceCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas;const h=z.get().createCanvas(t.pixelWidth,t.pixelHeight),l=h.getContext("2d"),c=l.createImageData(t.pixelWidth,t.pixelHeight),u=c.data,f=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.format==="bgra8unorm")for(let d=0;d<u.length&&d+3<f.length;d+=4)u[d]=f[d+2],u[d+1]=f[d+1],u[d+2]=f[d],u[d+3]=f[d+3];else u.set(f.subarray(0,u.length));return l.putImageData(c,0,0),$._canvasSourceCache.set(t,{canvas:h,resourceId:t._resourceId}),h}if(i){const a=z.get().createCanvas(t.pixelWidth,t.pixelHeight),h=a.getContext("2d",{willReadFrequently:!0});a.width=t.pixelWidth,a.height=t.pixelHeight,h.drawImage(e,0,0);const l=h.getImageData(0,0,a.width,a.height),c=l.data;for(let u=0;u<c.length;u+=4){const f=c[u+3];if(f>0){const d=255/f;c[u]=Math.min(255,c[u]*d+.5),c[u+1]=Math.min(255,c[u+1]*d+.5),c[u+2]=Math.min(255,c[u+2]*d+.5)}}return h.putImageData(l,0,0),$._unpremultipliedCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(o){const a=$._canvasSourceCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas;const h=z.get().createCanvas(t.pixelWidth,t.pixelHeight),l=h.getContext("2d");return h.width=t.pixelWidth,h.height=t.pixelHeight,l.drawImage(e,0,0),$._canvasSourceCache.set(t,{canvas:h,resourceId:t._resourceId}),h}return e},getTintedCanvas:(s,t)=>{const e=s.texture,i=q.shared.setValue(t).toHex(),r=e.tintCache||(e.tintCache={}),n=r[i],o=e.source._resourceId;if((n==null?void 0:n.tintId)===o)return n;const a=n&&"getContext"in n?n:z.get().createCanvas();return $.tintMethod(e,t,a),a.tintId=o,r[i]=a,r[i]},getTintedPattern:(s,t)=>{const e=q.shared.setValue(t).toHex(),i=s.patternCache||(s.patternCache={}),r=s.source._resourceId;let n=i[e];return(n==null?void 0:n.tintId)===r||($.canvas||($.canvas=z.get().createCanvas()),$.tintMethod(s,t,$.canvas),n=$.canvas.getContext("2d").createPattern($.canvas,"repeat"),n.tintId=r,i[e]=n),n},applyPatternTransform:(s,t,e=!0)=>{if(!t)return;const i=s;if(!i.setTransform)return;const r=globalThis.DOMMatrix;if(!r)return;const n=new r([t.a,t.b,t.c,t.d,t.tx,t.ty]);i.setTransform(e?n.inverse():n)},tintWithMultiply:(s,t,e)=>{const i=e.getContext("2d"),r=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;r.x*=n,r.y*=n,r.width*=n,r.height*=n;const a=O.isVertical(o),h=a?r.height:r.width,l=a?r.width:r.height;e.width=Math.ceil(h),e.height=Math.ceil(l),i.save(),i.fillStyle=q.shared.setValue(t).toHex(),i.fillRect(0,0,h,l),i.globalCompositeOperation="multiply";const c=$.getCanvasSource(s);if(!c){i.restore();return}o&&$._applyInverseRotation(i,o,r.width,r.height),i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.globalCompositeOperation="destination-atop",i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.restore()},tintWithOverlay:(s,t,e)=>{const i=e.getContext("2d"),r=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;r.x*=n,r.y*=n,r.width*=n,r.height*=n;const a=O.isVertical(o),h=a?r.height:r.width,l=a?r.width:r.height;e.width=Math.ceil(h),e.height=Math.ceil(l),i.save(),i.globalCompositeOperation="copy",i.fillStyle=q.shared.setValue(t).toHex(),i.fillRect(0,0,h,l),i.globalCompositeOperation="destination-atop";const c=$.getCanvasSource(s);if(!c){i.restore();return}o&&$._applyInverseRotation(i,o,r.width,r.height),i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.restore()},tintWithPerPixel:(s,t,e)=>{const i=e.getContext("2d"),r=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;r.x*=n,r.y*=n,r.width*=n,r.height*=n;const a=O.isVertical(o),h=a?r.height:r.width,l=a?r.width:r.height;e.width=Math.ceil(h),e.height=Math.ceil(l),i.save(),i.globalCompositeOperation="copy";const c=$.getCanvasSource(s);if(!c){i.restore();return}o&&$._applyInverseRotation(i,o,r.width,r.height),i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.restore();const u=t>>16&255,f=t>>8&255,d=t&255,p=i.getImageData(0,0,h,l),g=p.data;for(let m=0;m<g.length;m+=4)g[m]=g[m]*u/255,g[m+1]=g[m+1]*f/255,g[m+2]=g[m+2]*d/255;i.putImageData(p,0,0)},_applyInverseRotation:(s,t,e,i)=>{const r=O.inv(t),n=O.uX(r),o=O.uY(r),a=O.vX(r),h=O.vY(r),l=-Math.min(0,n*e,a*i,n*e+a*i),c=-Math.min(0,o*e,h*i,o*e+h*i);s.transform(n,o,a,h,l,c)}};$.tintMethod=$.canUseMultiply?$.tintWithMultiply:$.tintWithPerPixel;class Xu{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=z.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=_e(t),e=_e(e);const r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,r),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Mi=new Xu;Qe.register(Mi);const qu=new vt;function Ku(s,t,e,i,r=!1){const n=qu;n.minX=0,n.minY=0,n.maxX=s.width/i|0,n.maxY=s.height/i|0;const o=Ts.getOptimalTexture(n.width,n.height,i,!1,r);return o.source.uploadMethodId="image",o.source.resource=s,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}class ws extends yt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const{animationSpeed:i=1,autoPlay:r=!1,autoUpdate:n=!0,loop:o=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...f}=e,[d]=c;super({...f,texture:d instanceof U?d:d.texture}),this._textures=null,this._durations=null,this._autoUpdate=n,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=o,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,r&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(dt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(dt.shared.add(this.update,this,ze.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,r=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<r||this.animationSpeed<0&&this.currentFrame>r)&&this.onLoop(),this._updateTexture())}_updateTexture(){const 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(t=!1){if(typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._textures.forEach(r=>{this.texture!==r&&r.destroy(i)})}this._textures=[],this._durations=null,this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;i<t.length;++i)e.push(U.from(t[i]));return new ws(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(U.from(t[i]));return new ws(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof U)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}.`);const 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?(dt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(dt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Qu extends Ln{constructor(t,e){const{text:i,resolution:r,style:n,anchor:o,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t||(t={}),(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),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){const e=this.bounds.width,i=this.bounds.height,r=-e*this.anchor.x;let n=0;return t.x>=r&&t.x<=r+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}function Zu(s,t){let e=s[0]??{};return(typeof e=="string"||s[1])&&(X(_t,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:s[1]}),e}let Xt=null,Rt=null;function Ju(s,t){Xt||(Xt=z.get().createCanvas(256,128),Rt=Xt.getContext("2d",{willReadFrequently:!0}),Rt.globalCompositeOperation="copy",Rt.globalAlpha=1),(Xt.width<s||Xt.height<t)&&(Xt.width=_e(s),Xt.height=_e(t))}function on(s,t,e){for(let i=0,r=4*e*t;i<t;++i,r+=4)if(s[r+3]!==0)return!1;return!0}function an(s,t,e,i,r){const n=4*t;for(let o=i,a=i*n+4*e;o<=r;++o,a+=n)if(s[a+3]!==0)return!1;return!0}function td(...s){let t=s[0];t.canvas||(t={canvas:s[0],resolution:s[1]});const{canvas:e}=t,i=Math.min(t.resolution??1,1),r=t.width??e.width,n=t.height??e.height;let o=t.output;if(Ju(r,n),!Rt)throw new TypeError("Failed to get canvas 2D context");Rt.drawImage(e,0,0,r,n,0,0,r*i,n*i);const h=Rt.getImageData(0,0,r,n).data;let l=0,c=0,u=r-1,f=n-1;for(;c<n&&on(h,r,c);)++c;if(c===n)return tt.EMPTY;for(;on(h,r,f);)--f;for(;an(h,r,l,c,f);)++l;for(;an(h,r,u,c,f);)--u;return++u,++f,Rt.globalCompositeOperation="source-over",Rt.strokeRect(l,c,u-l,f-c),Rt.globalCompositeOperation="copy",o??(o=new tt),o.set(l/i,c/i,(u-l)/i,(f-c)/i),o}/**
- * tiny-lru
- *
- * @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
- * @license BSD-3-Clause
- * @version 11.4.7
- */class ed{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++){const r=t[i];e[i]=[r,this.get(r)]}return e}evict(t=!1){if(t||this.size>0){const e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;e!==null;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let r=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(r={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=n:this.last.next=n,this.last=n}return r}set(t,e,i=!1,r=this.resetTtl){let n=this.items[t];return i||n!==void 0?(n.value=e,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(n)):(this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=n:this.last.next=n,this.last=n),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function sd(s=1e3,t=0,e=!1){if(isNaN(s)||s<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof e!="boolean")throw new TypeError("Invalid resetTtl value");return new ed(s,t,e)}function Uo(s){return!!s.tagStyles&&Object.keys(s.tagStyles).length>0}function zo(s){return s.includes("<")}function id(s,t){return s.clone().assign(t)}function rd(s,t){const e=[],i=t.tagStyles;if(!Uo(t)||!zo(s))return e.push({text:s,style:t}),e;const r=[t],n=[];let o="",a=0;for(;a<s.length;){const h=s[a];if(h==="<"){const l=s.indexOf(">",a);if(l===-1){o+=h,a++;continue}const c=s.indexOf("<",a+1);if(c!==-1&&c<l){o+=h,a++;continue}const u=s.slice(a+1,l);if(u.startsWith("/")){const f=u.slice(1).trim();if(n.length>0&&n[n.length-1]===f){o.length>0&&(e.push({text:o,style:r[r.length-1]}),o=""),r.pop(),n.pop(),a=l+1;continue}else{o+=s.slice(a,l+1),a=l+1;continue}}else{const f=u.trim();if(i[f]){o.length>0&&(e.push({text:o,style:r[r.length-1]}),o="");const d=r[r.length-1],p=id(d,i[f]);r.push(p),n.push(f),a=l+1;continue}else{o+=s.slice(a,l+1),a=l+1;continue}}}else o+=h,a++}return o.length>0&&e.push({text:o,style:r[r.length-1]}),e}const nd=[10,13],od=new Set(nd),ad=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],hd=new Set(ad),ld=[9,32],cd=new Set(ld),ud=[45,8208,8211,8212,173],dd=new Set(ud),fd=/(\r\n|\r|\n)/,pd=/(?:\r\n|\r|\n)/;function vs(s){return typeof s!="string"?!1:od.has(s.charCodeAt(0))}function wt(s,t){return typeof s!="string"?!1:hd.has(s.charCodeAt(0))}function Yd(s){return typeof s!="string"?!1:cd.has(s.charCodeAt(0))}function md(s){return typeof s!="string"?!1:dd.has(s.charCodeAt(0))}function Ho(s){return s==="normal"||s==="pre-line"}function No(s){return s==="normal"}function It(s){if(typeof s!="string")return"";let t=s.length-1;for(;t>=0&&wt(s[t]);)t--;return t<s.length-1?s.slice(0,t+1):s}function Vo(s){const t=[],e=[];if(typeof s!="string")return t;for(let i=0;i<s.length;i++){const r=s[i],n=s[i+1];if(wt(r)||vs(r)){e.length>0&&(t.push(e.join("")),e.length=0),r==="\r"&&n===`
-`?(t.push(`\r
-`),i++):t.push(r);continue}e.push(r),md(r)&&n&&!wt(n)&&!vs(n)&&(t.push(e.join("")),e.length=0)}return e.length>0&&t.push(e.join("")),t}function $o(s,t,e,i){const r=e(s),n=[];for(let o=0;o<r.length;o++){let a=r[o],h=a,l=1;for(;r[o+l];){const c=r[o+l];if(!i(h,c,s,o,t))a+=c,h=c,l++;else break}o+=l-1,n.push(a)}return n}const gd=/\r\n|\r|\n/g;function _d(s,t,e,i,r,n,o,a,h){var B,ht;const l=rd(s,t);if(No(t.whiteSpace))for(let C=0;C<l.length;C++){const E=l[C];l[C]={text:E.text.replace(gd," "),style:E.style}}const u=[];let f=[];for(const C of l){const E=C.text.split(fd);for(let N=0;N<E.length;N++){const L=E[N];L===`\r
-`||L==="\r"||L===`
-`?(u.push(f),f=[]):L.length>0&&f.push({text:L,style:C.style})}}(f.length>0||u.length===0)&&u.push(f);const d=e?yd(u,t,i,n,a,h):u,p=[],g=[],m=[],_=[],y=[];let x=0;const w=t._fontString,v=o(w);v.fontSize===0&&(v.fontSize=t.fontSize,v.ascent=t.fontSize);let b="",A=!!t.dropShadow,k=((B=t._stroke)==null?void 0:B.width)||0;for(const C of d){let E=0,N=v.ascent,L=v.descent,H="";for(const D of C){const et=D.style._fontString,ct=o(et);et!==b&&(i.font=et,b=et);const mt=r(D.text,D.style.letterSpacing,i);E+=mt,N=Math.max(N,ct.ascent),L=Math.max(L,ct.descent),H+=D.text;const it=((ht=D.style._stroke)==null?void 0:ht.width)||0;it>k&&(k=it),!A&&D.style.dropShadow&&(A=!0)}C.length===0&&(N=v.ascent,L=v.descent),p.push(E),g.push(N),m.push(L),y.push(H);const V=t.lineHeight||N+L;_.push(V+t.leading),x=Math.max(x,E)}const P=k,S=x+P+(t.dropShadow?t.dropShadow.distance:0);let T=0;for(let C=0;C<_.length;C++)T+=_[C];T=Math.max(T,_[0]+P);const M=T+(t.dropShadow?t.dropShadow.distance:0),R=t.lineHeight||v.fontSize;return{width:S,height:M,lines:y,lineWidths:p,lineHeight:R+t.leading,maxLineWidth:x,fontProperties:v,runsByLine:d,lineAscents:g,lineDescents:m,lineHeights:_,hasDropShadow:A}}function yd(s,t,e,i,r,n){var m;const{letterSpacing:o,whiteSpace:a,wordWrapWidth:h,breakWords:l}=t,c=Ho(a),u=h+o,f={};let d="";const p=(_,y)=>{const x=`${_}|${y.styleKey}`;let w=f[x];if(w===void 0){const v=y._fontString;v!==d&&(e.font=v,d=v),w=i(_,y.letterSpacing,e)+y.letterSpacing,f[x]=w}return w},g=[];for(const _ of s){const y=xd(_),x=g.length,w=M=>{let R=0,B=M;do{const{token:ht,style:C}=y[B];R+=p(ht,C),B++}while(B<y.length&&y[B].continuesFromPrevious);return R},v=M=>{const R=[];let B=M;do R.push({token:y[B].token,style:y[B].style}),B++;while(B<y.length&&y[B].continuesFromPrevious);return R};let b=[],A=0,k=!c,P=null;const S=()=>{P&&P.text.length>0&&b.push(P),P=null},T=()=>{if(S(),b.length>0){const M=b[b.length-1];M.text=It(M.text),M.text.length===0&&b.pop()}g.push(b),b=[],A=0,k=!1};for(let M=0;M<y.length;M++){const{token:R,style:B,continuesFromPrevious:ht}=y[M],C=p(R,B);if(c){const L=wt(R),H=(P==null?void 0:P.text[P.text.length-1])??((m=b[b.length-1])==null?void 0:m.text.slice(-1))??"",V=H?wt(H):!1;if(L&&V)continue}const E=!ht,N=E?w(M):C;if(N>u&&E)if(A>0&&T(),l){const L=v(M);for(let H=0;H<L.length;H++){const V=L[H].token,D=L[H].style,et=$o(V,l,n,r);for(const ct of et){const mt=p(ct,D);mt+A>u&&T(),!P||P.style!==D?(S(),P={text:ct,style:D}):P.text+=ct,A+=mt}}M+=L.length-1}else{const L=v(M);S(),g.push(L.map(H=>({text:H.token,style:H.style}))),k=!1,M+=L.length-1}else if(N+A>u&&E){if(wt(R)){k=!1;continue}T(),P={text:R,style:B},A=C}else if(ht&&!l)!P||P.style!==B?(S(),P={text:R,style:B}):P.text+=R,A+=C;else{const L=wt(R);if(A===0&&L&&!k)continue;!P||P.style!==B?(S(),P={text:R,style:B}):P.text+=R,A+=C}}if(S(),b.length>0){const M=b[b.length-1];M.text=It(M.text),M.text.length===0&&b.pop()}(b.length>0||g.length===x)&&g.push(b)}return g}function xd(s){const t=[];let e=!1;for(const i of s){const r=Vo(i.text);let n=!0;for(const o of r){const a=wt(o)||vs(o),h=n&&e&&!a;t.push({token:o,style:i.style,continuesFromPrevious:h}),e=!a,n=!1}}return t}const bd={willReadFrequently:!0};function hn(s,t,e,i,r){let n=e[s];return typeof n!="number"&&(n=r(s,t,i)+t,e[s]=n),n}function wd(s,t,e,i,r,n,o){const a=e.getContext("2d",bd);a.font=t._fontString;let h=0,l="";const c=[],u=Object.create(null),{letterSpacing:f,whiteSpace:d}=t,p=Ho(d),g=No(d);let m=!p;const _=t.wordWrapWidth+f,y=Vo(s);for(let w=0;w<y.length;w++){let v=y[w];if(vs(v)){if(!g){c.push(It(l)),m=!p,l="",h=0;continue}v=" "}if(p){const A=wt(v),k=wt(l[l.length-1]);if(A&&k)continue}const b=hn(v,f,u,a,i);if(b>_)if(l!==""&&(c.push(It(l)),l="",h=0),r(v,t.breakWords)){const A=$o(v,t.breakWords,o,n);for(const k of A){const P=hn(k,f,u,a,i);P+h>_&&(c.push(It(l)),m=!1,l="",h=0),l+=k,h+=P}}else l.length>0&&(c.push(It(l)),l="",h=0),c.push(It(v)),m=!1,l="",h=0;else b+h>_&&(m=!1,c.push(It(l)),l="",h=0),(l.length>0||!wt(v)||m)&&(l+=v,h+=b)}const x=It(l);return x.length>0&&c.push(x),c.join(`
-`)}const ln={willReadFrequently:!0},Dt=class F{static get experimentalLetterSpacingSupported(){let t=F._experimentalLetterSpacingSupported;if(t===void 0){const e=z.get().getCanvasRenderingContext2D().prototype;t=F._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,r,n,o,a,h,l,c){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",e,i=F._canvas,r=e.wordWrap){var w;const n=`${t}-${e.styleKey}-wordWrap-${r}`;if(F._measurementCache.has(n))return F._measurementCache.get(n);if(Uo(e)&&zo(t)){const v=_d(t,e,r,F._context,F._measureText,F._measureTextAdvance,F.measureFont,F.canBreakChars,F.wordWrapSplit),b=new F(t,e,v.width,v.height,v.lines,v.lineWidths,v.lineHeight,v.maxLineWidth,v.fontProperties,{runsByLine:v.runsByLine,lineAscents:v.lineAscents,lineDescents:v.lineDescents,lineHeights:v.lineHeights,hasDropShadow:v.hasDropShadow});return F._measurementCache.set(n,b),b}const a=e._fontString,h=F.measureFont(a);h.fontSize===0&&(h.fontSize=e.fontSize,h.ascent=e.fontSize,h.descent=0);const l=F._context;l.font=a;const u=(r?F._wordWrap(t,e,i):t).split(pd),f=new Array(u.length);let d=0;for(let v=0;v<u.length;v++){const b=F._measureText(u[v],e.letterSpacing,l);f[v]=b,d=Math.max(d,b)}const p=((w=e._stroke)==null?void 0:w.width)??0,g=e.lineHeight||h.fontSize,m=F._adjustWidthForStyle(d,e),_=Math.max(g,h.fontSize+p)+(u.length-1)*(g+e.leading),y=F._adjustHeightForStyle(_,e),x=new F(t,e,m,y,u,f,g+e.leading,d,h);return F._measurementCache.set(n,x),x}static _adjustWidthForStyle(t,e){var n;const i=((n=e._stroke)==null?void 0:n.width)||0;let r=t+i;return e.dropShadow&&(r+=e.dropShadow.distance),r}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _measureText(t,e,i){const{metricWidth:r,metrics:n,letterSpacingVal:o}=F._measureTextCore(t,e,i),a=-(n.actualBoundingBoxLeft??0);let l=(n.actualBoundingBoxRight??0)-a;return n.width>0&&(l+=o),Math.max(r,l)}static _measureTextAdvance(t,e,i){return F._measureTextCore(t,e,i).metricWidth}static _measureTextCore(t,e,i){let r=!1;F.experimentalLetterSpacingSupported&&(F.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,r=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));const n=i.measureText(t);let o=n.width,a=0;return o>0&&(r?a=-e:a=(F.graphemeSegmenter(t).length-1)*e,o+=a),{metricWidth:o,metrics:n,letterSpacingVal:a}}static _wordWrap(t,e,i=F._canvas){return wd(t,e,i,F._measureTextAdvance,F.canBreakWords,F.canBreakChars,F.wordWrapSplit)}static isBreakingSpace(t,e){return wt(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,n){return!0}static wordWrapSplit(t){return F.graphemeSegmenter(t)}static measureFont(t){if(F._fonts[t])return F._fonts[t];const e=F._context;e.font=t;const i=e.measureText(F.METRICS_STRING+F.BASELINE_SYMBOL),r=i.actualBoundingBoxAscent??0,n=i.actualBoundingBoxDescent??0,o={ascent:r,descent:n,fontSize:r+n};return F._fonts[t]=o,o}static clearMetrics(t=""){t?delete F._fonts[t]:F._fonts={}}static get _canvas(){if(!F.__canvas){let t;try{const e=new OffscreenCanvas(0,0),i=e.getContext("2d",ln);if(i!=null&&i.measureText)return F.__canvas=e,e;t=z.get().createCanvas()}catch{t=z.get().createCanvas()}t.width=t.height=10,F.__canvas=t}return F.__canvas}static get _context(){return F.__context||(F.__context=F._canvas.getContext("2d",ln)),F.__context}};Dt.METRICS_STRING="|ÉqÅ";Dt.BASELINE_SYMBOL="M";Dt.BASELINE_MULTIPLIER=1.4;Dt.HEIGHT_MULTIPLIER=2;Dt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>{const e=s.segment(t),i=[];let r=0;for(const n of e)i[r++]=n.segment;return i}}return s=>[...s]})();Dt.experimentalLetterSpacing=!1;Dt._fonts={};Dt._measurementCache=sd(1e3);let Ot=Dt;const vd=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function ki(s){const t=typeof s.fontSize=="number"?`${s.fontSize}px`:s.fontSize;let e=s.fontFamily;Array.isArray(s.fontFamily)||(e=s.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!vd.includes(r)&&(r=`"${r}"`),e[i]=r}return`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${t} ${e.join(",")}`}const cn=1e5;function ds(s,t,e,i=0,r=0,n=0){if(s.texture===U.WHITE&&!s.fill)return q.shared.setValue(s.color).setAlpha(s.alpha??1).toHexa();if(s.fill){if(s.fill instanceof Is){const o=s.fill,a=t.createPattern(o.texture.source.resource,"repeat");return $.applyPatternTransform(a,o.transform,!1),a}else if(s.fill instanceof Ft){const o=s.fill,a=o.type==="linear",h=o.textureSpace==="local";let l=1,c=1;h&&e&&(l=e.width+i,c=e.height+i);let u,f=!1;if(a){const{start:d,end:p}=o;u=t.createLinearGradient(d.x*l+r,d.y*c+n,p.x*l+r,p.y*c+n),f=Math.abs(p.x-d.x)<Math.abs((p.y-d.y)*.1)}else{const{center:d,innerRadius:p,outerCenter:g,outerRadius:m}=o;u=t.createRadialGradient(d.x*l+r,d.y*c+n,p*l,g.x*l+r,g.y*c+n,m*l)}if(f&&h&&e){const d=e.lineHeight/c;for(let p=0;p<e.lines.length;p++){const g=(p*e.lineHeight+i/2)/c;o.colorStops.forEach(m=>{let _=g+m.offset*d;_=Math.max(0,Math.min(1,_)),u.addColorStop(Math.floor(_*cn)/cn,q.shared.setValue(m.color).toHex())})}}else o.colorStops.forEach(d=>{u.addColorStop(d.offset,q.shared.setValue(d.color).toHex())});return u}}else{const o=t.createPattern(s.texture.source.resource,"repeat"),a=s.matrix.copyTo(W.shared);return a.scale(s.texture.source.pixelWidth,s.texture.source.pixelHeight),o.setTransform(a),o}return Y("FillStyle not recognised",s),"red"}const un=new tt;function le(s){let t=0;for(let e=0;e<s.length;e++)s.charCodeAt(e)===32&&t++;return t}class Ad{getCanvasAndContext(t){const{text:e,style:i,resolution:r=1}=t,n=i._getFinalPadding(),o=Ot.measureText(e||" ",i),a=Math.ceil(Math.ceil(Math.max(1,o.width)+n*2)*r),h=Math.ceil(Math.ceil(Math.max(1,o.height)+n*2)*r),l=Mi.getOptimalCanvasAndContext(a,h);this._renderTextToCanvas(i,n,r,l,o);const c=i.trim?td({canvas:l.canvas,width:a,height:h,resolution:1,output:un}):un.set(0,0,a,h);return{canvasAndContext:l,frame:c}}returnCanvasAndContext(t){Mi.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,i,r,n){var v,b,A;if(n.runsByLine&&n.runsByLine.length>0){this._renderTaggedTextToCanvas(n,t,e,i,r);return}const{canvas:o,context:a}=r,h=ki(t),l=n.lines,c=n.lineHeight,u=n.lineWidths,f=n.maxLineWidth,d=n.fontProperties,p=o.height;if(a.resetTransform(),a.scale(i,i),a.textBaseline=t.textBaseline,(v=t._stroke)!=null&&v.width){const k=t._stroke;a.lineWidth=k.width,a.miterLimit=k.miterLimit,a.lineJoin=k.join,a.lineCap=k.cap}a.font=h;let g,m;const _=t.dropShadow?2:1,x=(((b=t._stroke)==null?void 0:b.width)??0)/2;let w=(c-d.fontSize)/2;c-d.fontSize<0&&(w=0);for(let k=0;k<_;++k){const P=t.dropShadow&&k===0,S=P?Math.ceil(Math.max(1,p)+e*2):0,T=S*i;if(P)this._setupDropShadow(a,t,i,T);else{const M=t._gradientBounds,R=t._gradientOffset;if(M){const B={width:M.width,height:M.height,lineHeight:M.height,lines:n.lines};this._setFillAndStrokeStyles(a,t,B,e,x,(R==null?void 0:R.x)??0,(R==null?void 0:R.y)??0)}else R?this._setFillAndStrokeStyles(a,t,n,e,x,R.x,R.y):this._setFillAndStrokeStyles(a,t,n,e,x);a.shadowColor="rgba(0,0,0,0)"}for(let M=0;M<l.length;M++){g=x,m=x+M*c+d.ascent+w,g+=this._getAlignmentOffset(u[M],f,t.align);let R=0;if(t.align==="justify"&&t.wordWrap&&M<l.length-1){const B=le(l[M]);B>0&&(R=(f-u[M])/B)}(A=t._stroke)!=null&&A.width&&this._drawLetterSpacing(l[M],t,r,g+e,m+e-S,!0,R),t._fill!==void 0&&this._drawLetterSpacing(l[M],t,r,g+e,m+e-S,!1,R)}}}_renderTaggedTextToCanvas(t,e,i,r,n){var x,w,v;const{canvas:o,context:a}=n,{runsByLine:h,lineWidths:l,maxLineWidth:c,lineAscents:u,lineHeights:f,hasDropShadow:d}=t,p=o.height;a.resetTransform(),a.scale(r,r),a.textBaseline=e.textBaseline;const g=d?2:1;let m=((x=e._stroke)==null?void 0:x.width)??0;for(const b of h)for(const A of b){const k=((w=A.style._stroke)==null?void 0:w.width)??0;k>m&&(m=k)}const _=m/2,y=[];for(let b=0;b<h.length;b++){const A=h[b],k=[];for(const P of A){const S=ki(P.style);a.font=S,k.push({width:Ot._measureText(P.text,P.style.letterSpacing,a),font:S})}y.push(k)}for(let b=0;b<g;++b){const A=d&&b===0,k=A?Math.ceil(Math.max(1,p)+i*2):0,P=k*r;A||(a.shadowColor="rgba(0,0,0,0)");let S=_;for(let T=0;T<h.length;T++){const M=h[T],R=l[T],B=u[T],ht=f[T],C=y[T];let E=_;E+=this._getAlignmentOffset(R,c,e.align);let N=0;if(e.align==="justify"&&e.wordWrap&&T<h.length-1){let V=0;for(const D of M)V+=le(D.text);V>0&&(N=(c-R)/V)}const L=S+B;let H=E+i;for(let V=0;V<M.length;V++){const D=M[V],{width:et,font:ct}=C[V];if(a.font=ct,a.textBaseline=D.style.textBaseline,(v=D.style._stroke)!=null&&v.width){const it=D.style._stroke;if(a.lineWidth=it.width,a.miterLimit=it.miterLimit,a.lineJoin=it.join,a.lineCap=it.cap,A)if(D.style.dropShadow)this._setupDropShadow(a,D.style,r,P);else{const kt=le(D.text);H+=et+kt*N;continue}else{const kt=Ot.measureFont(ct),zt=D.style.lineHeight||kt.fontSize,re={width:et,height:zt,lineHeight:zt,lines:[D.text]};a.strokeStyle=ds(it,a,re,i*2,H-i,S)}this._drawLetterSpacing(D.text,D.style,n,H,L+i-k,!0,N)}const mt=le(D.text);H+=et+mt*N}H=E+i;for(let V=0;V<M.length;V++){const D=M[V],{width:et,font:ct}=C[V];if(a.font=ct,a.textBaseline=D.style.textBaseline,D.style._fill!==void 0){if(A)if(D.style.dropShadow)this._setupDropShadow(a,D.style,r,P);else{const it=le(D.text);H+=et+it*N;continue}else{const it=Ot.measureFont(ct),kt=D.style.lineHeight||it.fontSize,zt={width:et,height:kt,lineHeight:kt,lines:[D.text]};a.fillStyle=ds(D.style._fill,a,zt,i*2,H-i,S)}this._drawLetterSpacing(D.text,D.style,n,H,L+i-k,!1,N)}const mt=le(D.text);H+=et+mt*N}S+=ht}}}_setFillAndStrokeStyles(t,e,i,r,n,o=0,a=0){var h;if(t.fillStyle=e._fill?ds(e._fill,t,i,r*2,o,a):null,(h=e._stroke)!=null&&h.width){const l=n+r*2;t.strokeStyle=ds(e._stroke,t,i,l,o,a)}}_setupDropShadow(t,e,i,r){t.fillStyle="black",t.strokeStyle="black";const n=e.dropShadow,o=n.color,a=n.alpha;t.shadowColor=q.shared.setValue(o).setAlpha(a).toRgbaString();const h=n.blur*i,l=n.distance*i;t.shadowBlur=h,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l+r}_getAlignmentOffset(t,e,i){return i==="right"?e-t:i==="center"?(e-t)/2:0}_drawLetterSpacing(t,e,i,r,n,o=!1,a=0){const{context:h}=i,l=e.letterSpacing;let c=!1;if(Ot.experimentalLetterSpacingSupported&&(Ot.experimentalLetterSpacing?(h.letterSpacing=`${l}px`,h.textLetterSpacing=`${l}px`,c=!0):(h.letterSpacing="0px",h.textLetterSpacing="0px")),(l===0||c)&&a===0){o?h.strokeText(t,r,n):h.fillText(t,r,n);return}if(a!==0&&(l===0||c)){const g=t.split(" ");let m=r;const _=h.measureText(" ").width;for(let y=0;y<g.length;y++)o?h.strokeText(g[y],m,n):h.fillText(g[y],m,n),m+=h.measureText(g[y]).width+_+a;return}let u=r;const f=Ot.graphemeSegmenter(t);let d=h.measureText(t).width,p=0;for(let g=0;g<f.length;++g){const m=f[g];o?h.strokeText(m,u,n):h.fillText(m,u,n);let _="";for(let y=g+1;y<f.length;++y)_+=f[y];p=h.measureText(_).width,u+=d-p+l,m===" "&&(u+=a),d=p}}}const fe=new Ad,Vi=class ee extends ft{constructor(t={}){super(),this.uid=J("textStyle"),this._tick=0,this._cachedFontString=null,Sd(t),t instanceof ee&&(t=t._toObject());const r={...ee.defaultTextStyle,...t};for(const n in r){const o=n;this[o]=r[n]}this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ee.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ee.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._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&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._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({...te.defaultFillStyle,...t},()=>{this._fill=se({...this._originalFill},te.defaultFillStyle)})),this._fill=se(t===0?"black":t,te.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...te.defaultStrokeStyle,...t},()=>{this._stroke=bs({...this._originalStroke},te.defaultStrokeStyle)})),this._stroke=bs(t,te.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const t=ee.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(t){for(const e in t){const i=e;this[i]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=ki(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,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?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new ee(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){var i,r,n,o;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const a=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(i=this._fill)!=null&&i.texture&&this._fill.texture.destroy(a),(r=this._originalFill)!=null&&r.texture&&this._originalFill.texture.destroy(a),(n=this._stroke)!=null&&n.texture&&this._stroke.texture.destroy(a),(o=this._originalStroke)!=null&&o.texture&&this._originalStroke.texture.destroy(a)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,r,n)=>(i[r]===n||(i[r]=n,e==null||e(r,n),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(q.isColorLike(t)||t instanceof Ft||t instanceof Is)}};Vi.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Vi.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let As=Vi;function Sd(s){const t=s;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=As.defaultDropShadow;s.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){X(_t,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(q.isColorLike(e))i.color=e;else if(e instanceof Ft||e instanceof Is)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");s.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(X(_t,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&Y("The number of fill colors must match the number of fill gradient stops.");const e=new Ft({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),i=t.fillGradientStops.slice(),r=t.fill.map(n=>q.shared.setValue(n).toNumber());i.forEach((n,o)=>{e.addColorStop(n,r[o])}),s.fill={fill:e}}}function Cd(s,t){const{texture:e,bounds:i}=s,r=t._style._getFinalPadding();vn(i,t._anchor,e);const n=t._anchor._x*r*2,o=t._anchor._y*r*2;i.minX-=r-n,i.minY-=r-o,i.maxX-=r-n,i.maxY-=r-o}class Td{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}destroy(){this.reset()}}class Pd extends Td{}class jo{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Po({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e!=null&&e._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i?!0:t._didTextUpdate}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const r=t._autoResolution?this._renderer.resolution:t.resolution;(i.currentKey!==t.styleKey||t._resolution!==r)&&this._updateGpuText(t),t._didTextUpdate=!1,Cd(i,t)}this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Pd;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:i}=this._renderer;i.getReferenceCount(e.currentKey)>0?i.decreaseReferenceCount(e.currentKey):e.texture&&i.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}jo.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"text"};class Yo{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,i,r){typeof t=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof As||(t.style=new As(t.style)),t.textureStyle instanceof ye||(t.textureStyle=new ye(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());const{text:n,style:o,textureStyle:a,autoGenerateMipmaps:h}=t,l=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:u}=fe.getCanvasAndContext({text:n,style:o,resolution:l}),f=Ku(u.canvas,c.width,c.height,l,h);if(a&&(f.source.style=a),o.trim&&(c.pad(o.padding),f.frame.copyFrom(c),f.frame.scale(1/l),f.updateUvs()),o.filters){const d=this._applyFilters(f,o.filters);return this.returnTexture(f),fe.returnCanvasAndContext(u),d}return this._renderer.texture.initSource(f._source),this._retainCanvasContext||fe.returnCanvasAndContext(u),f}returnTexture(t){const e=t.source,i=e.resource;if(this._retainCanvasContext&&(i!=null&&i.getContext)){const r=i.getContext("2d");r&&fe.returnCanvasAndContext({canvas:i,context:r})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Ts.returnTexture(t,!0)}renderTextToCanvas(){X("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const i=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:i,usageCount:1},i}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){var e;return((e=this._activeTextures[t])==null?void 0:e.usageCount)??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const i=this._renderer.renderTarget.renderTarget,r=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(i,!1),r}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class Xo extends Yo{constructor(t){super(t,!0)}}Xo.extension={type:[I.CanvasSystem],name:"canvasText"};class qo extends Yo{constructor(t){super(t,!1)}}qo.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"canvasText"};K.add(Xo);K.add(qo);K.add(jo);class Md extends Qu{constructor(...t){const e=Zu(t,"Text");super(e,As),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof ye?e.textureStyle:new ye(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??St.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let i=0,r=0;if(this._style.trim){const{frame:n,canvasAndContext:o}=fe.getCanvasAndContext({text:this.text,style:this._style,resolution:1});fe.returnCanvasAndContext(o),i=n.width,r=n.height}else{const n=Ot.measureText(this._text,this._style);i=n.width,r=n.height}t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*r,t.maxY=t.minY+r}}K.add(ha,la);let Ko;function kd(s){return Ko=s,s}function Xe(){return Ko}class Ei{static setParamValue(t,e){if(t.setValueAtTime){const i=Xe().context;t.setValueAtTime(e,i.audioContext.currentTime)}else t.value=e;return e}}class Ed extends ft{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}let Id=0;const Ii=class extends ft{constructor(s){super(),this.id=Id++,this.init(s)}set(s,t){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const t=this._source=s.source.cloneNode(!1);t.src=s.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=s.volume*(s.muted?0:1),i=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*i,this._source.playbackRate=this._speed*s.speed*t.speed}refreshPaused(){const s=this._media.context,t=this._media.parent,e=this._paused||t.paused||s.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(s){const{start:t,end:e,speed:i,loop:r,volume:n,muted:o}=s;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!r,this._muted=o,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Ii.PADDING),this._end=Math.min(this._end+Ii.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let Qo=Ii;Qo.PADDING=.1;class Rd extends ft{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new Qo(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h)},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;const r=()=>{a(),i.isLoaded=!0;const h=i.autoPlayStart();t&&t(null,i,h)},n=()=>{a(),t&&t(new Error("Sound loading has been aborted"))},o=()=>{a();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},a=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",o)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",o,!1),e.load()}}class Ld{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const Ss=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Bd=["audio/mpeg","audio/ogg"],Cs={};function Fd(s){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"'},e=document.createElement("audio"),i={},r=/^no$/;Ss.forEach(n=>{const o=e.canPlayType(`audio/${n}`).replace(r,""),a=t[n]?e.canPlayType(t[n]).replace(r,""):"";i[n]=!!o||!!a}),Object.assign(Cs,i)}Fd();let Gd=0;class Dd extends ft{constructor(t){super(),this.id=Gd++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(i=>i).forEach(i=>i.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const i=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);Ei.setParamValue(this._gain.gain,n*r*i),Ei.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(i=>{e.connect(i.destination),e=i}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i))}play(t){const{start:e,end:i,speed:r,loop:n,volume:o,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=r,this._volume=o,this._loop=!!n,this._muted=a,this._filters=h,this.refresh();const u=this._source.buffer.duration;this._duration=u,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),i=e-this._lastUpdate;if(i>0||t){const r=this._source.playbackRate.value;this._elapsed+=i*r,this._lastUpdate=e;const n=this._duration;let o;if(this._source.loopStart){const a=this._source.loopEnd-this._source.loopStart;o=(this._source.loopStart+this._elapsed%a)/n}else o=this._elapsed%n/n;this._progress=o,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class Zo{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const Jo=class extends Zo{constructor(s){const t=s.audioContext,e=t.createBufferSource(),i=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(i),i.connect(s.destination),super(r,i),this.context=s,this.bufferSource=e,this.gain=i,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Jo.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const s=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=s.buffer,Ei.setParamValue(t.playbackRate,s.playbackRate.value),t.loop=s.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let ta=Jo;ta.BUFFER_SIZE=0;class Od{init(t){this.parent=t,this._nodes=new ta(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new Dd(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,i=await z.get().fetch(e);this._decode(await i.arrayBuffer(),t)}_decode(t,e){const i=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const o=this.parent.autoPlayStart();e&&e(null,this.parent,o)}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i)}}const ce=class{static from(s){let t={};typeof s=="string"?t.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?t.source=s:Array.isArray(s)?t.url=s:t=s,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=Xe().useLegacy?new Rd:new Od;return new ce(e,t)}constructor(s,t){this.media=s,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(s){const[t]=s.map(e=>({url:e,ext:at.extname(e).slice(1)})).filter(({ext:e})=>Cs[e]).sort((e,i)=>Ss.indexOf(e.ext)-Ss.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Xe().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,t){if(typeof s=="object"){const i={};for(const r in s)i[r]=this.addSprites(r,s[r]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const e=new Ld(this,t);return this._sprites[s]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const t=this._sprites[s];t!==void 0&&(t.destroy(),delete this._sprites[s])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,t){let e;if(typeof s=="string"?e={sprite:s,loop:this.loop,complete:t}:typeof s=="function"?(e={},e.complete=s):e=s,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((o,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,o?n(o):(e.loaded&&e.loaded(o,a,h),r(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(e),i}refresh(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refresh()}refreshPaused(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const t=this._instances.indexOf(s);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(ce._pool.length>0){const s=ce._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),ce._pool.indexOf(s)<0&&ce._pool.push(s)}};let qe=ce;qe._pool=[];class Ke extends Zo{constructor(){const t=window,e=new Ke.AudioContext,i=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(i),i.connect(e.destination),super(r,i),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Ke.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=r,this.events=new ft,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const i=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},i);r&&r.catch(i)}}class Wd{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Ke),this._htmlAudioContext=new Ed,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Ke.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const o in t){const a=this._getOptions(t[o],e);n[o]=this.add(o,a)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof qe)return this._sounds[t]=e,e;const i=this._getOptions(e),r=qe.from(i);return this._sounds[t]=r,r}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){const i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const dn=s=>{var i;const t=s.src;let e=(i=s==null?void 0:s.alias)==null?void 0:i[0];return(!e||s.src===e)&&(e=at.basename(t,at.extname(t))),e},Ud={extension:I.Asset,detection:{test:async()=>!0,add:async s=>[...s,...Ss.filter(t=>Cs[t])],remove:async s=>s.filter(t=>s.includes(t))},loader:{name:"sound",extension:{type:[I.LoadParser],priority:Gt.High},test(s){const t=at.extname(s).slice(1);return!!Cs[t]||Bd.some(e=>s.startsWith(`data:${e}`))},async load(s,t){const e=await new Promise((i,r)=>qe.from({...t.data,url:s,preload:!0,loaded(n,o){var a,h;n?r(n):i(o),(h=(a=t.data)==null?void 0:a.loaded)==null||h.call(a,n,o)}}));return Xe().add(dn(t),e),e},async unload(s,t){Xe().remove(dn(t))}}};K.add(Ud);const j=kd(new Wd);class fn{constructor(t,e){G(this,"font");G(this,"difficulty");G(this,"game");G(this,"currentPlayerLives");G(this,"updatePlayerLives",!0);G(this,"updateEnemyLives",!0);G(this,"playerLives");G(this,"enemyLives");G(this,"outcome",null);this.font="",this.difficulty=t,this.game=e,this.currentPlayerLives=3,this.playerLives=[],this.enemyLives=[]}render(){this.updatePlayerLives&&(this.drawLives(this.game.playerLives),this.updatePlayerLives=!1,this.drawEnemyLives())}drawLives(t){let e=0;for(;e<t;){const i=yt.from("life");i.anchor=.5,i.x=10+15*e,i.y=10,i.width=12.5,i.height=12.5,i.label=`life${e+1}`,this.playerLives.push(i),this.game.app.stage.addChild(i),e++}}removeLife(){const t=this.game.app.stage.getChildByLabel("life1"),e=this.game.app.stage.getChildByLabel("life2"),i=this.game.app.stage.getChildByLabel("life3");i!==null&&!i.destroyed?i.destroy():e!==null&&!e.destroyed?e.destroy():t!==null&&t.destroy()}removeEnemyLife(){const t=this.game.app.stage.getChildByLabel("enemyLife1"),e=this.game.app.stage.getChildByLabel("enemyLife2"),i=this.game.app.stage.getChildByLabel("enemyLife3");i!==null&&!i.destroyed?i.destroy():e!==null&&!e.destroyed?e.destroy():t!==null&&t.destroy()}drawEnemyLives(){let t=0;for(;t<3;){const e=yt.from("wave");e.anchor=.5,e.x=this.game.app.screen.width-(10+t*15),e.y=10,e.width=12.5,e.height=12.5,e.label=`enemyLife${t+1}`,this.enemyLives.push(e),this.game.app.stage.addChild(e),t++}}shakeLives(t){if(this.game.framesRendered%30==0){const e=this.playerLives.filter(r=>!r.destroyed);this.playerLives.forEach(r=>{e.length==1&&(r.rotation==0?r.rotation=.5*1*t.deltaTime:r.rotation>0?r.rotation=.5*-1*t.deltaTime:r.rotation<0&&(r.rotation=.5*1*t.deltaTime))});const i=this.enemyLives.filter(r=>r.destroyed).length;this.enemyLives.forEach(r=>{i===2&&!r.destroyed&&r.label==="enemyLife1"&&(r.y==10||r.y>10?r.y=r.y-2*t.deltaTime:r.y<10&&(r.y=r.y+2*t.deltaTime))})}}renderOutcome(t,e,i){if(!this.game.app.stage.getChildByLabel("outcome")){const r=new Md({text:t,style:{fill:"#ffffff",fontSize:36,fontFamily:"silkscreen"},anchor:.5});return r.x=e,r.y=i,r.label="outcome",this.game.app.stage.addChild(r),r}}update(t){this.shakeLives(t)}}class we{constructor(t,e,i,r,n){G(this,"type");G(this,"texture");G(this,"sound");G(this,"speed");G(this,"yDirection");G(this,"behavior");G(this,"sprite");G(this,"entity");G(this,"stats");G(this,"game");G(this,"scattered",!1);G(this,"scatterSpeed",.25);this.stats=this.getStats(e),this.game=t.game,this.entity=t,this.type=e,this.texture=this.stats.texture,this.behavior=this.stats.behavior,this.speed=this.stats.speed,this.sound=this.stats.sound,this.yDirection=i,this.sprite=this.spawn(r,n),this.scatterSpeed=.25}spawn(t,e){const i=yt.from(this.texture);return i.x=t,i.y=e,i.anchor.set(.5),i.scale.set(.075),this.game.app.stage.addChild(i),j.play(this.sound,{volume:.45}),i}update(t){if(this.sprite.destroyed){this.entity.bullets=this.entity.bullets.filter(i=>!i.sprite.destroyed);return}const e=this.sprite.getBounds();if(e.y<-(this.sprite.height+5)||e.y>this.game.app.screen.height+this.sprite.height)this.sprite.destroy(),this.entity.bullets=this.entity.bullets.filter(i=>!i.sprite.destroyed);else{switch(this.type){case 1:this.entity.constructor.name=="Enemy"&&(console.log(this.entity.constructor.name),this.sprite.tint="#ff1362");break;case 2:this.sprite.width+=.2*t.deltaTime,this.sprite.height+=.2*t.deltaTime;break;case 3:this.sprite.y>this.game.app.screen.height/2-20&&!this.scattered&&this.sprite.label!=="left"&&this.sprite.label!=="right"&&this.scatter(this),this.sprite.rotation+=.5*t.deltaTime;break}this.sprite.y+=this.stats.speed*this.yDirection*.2*t.deltaTime,this.sprite.label=="left"?this.sprite.x-=this.scatterSpeed*t.deltaTime:this.sprite.label=="right"&&(this.sprite.x+=this.scatterSpeed*t.deltaTime)}}scatter(t){let e=t.sprite.x-t.sprite.width/2;const i=t.sprite.y,r=new we(t.entity,t.type,t.yDirection,e,i);r.sprite.label="left",r.sprite.alpha=.5,this.entity.bullets.push(r),e=t.sprite.x+t.sprite.width/2;const n=new we(t.entity,t.type,t.yDirection,e,i);n.sprite.label="right",n.sprite.alpha=.5,t.scattered=!0,this.entity.bullets.push(n)}getStats(t){return{1:{texture:"bullet1",behavior:"normal",speed:9,sound:"enemyShoot1"},2:{texture:"bullet2",behavior:"grow",speed:6,sound:"shoot1"},3:{texture:"bullet3",behavior:"scatter",speed:10-.75,sound:"enemyShoot"}}[t]}}class ea{constructor(t,e,i){G(this,"health");G(this,"texture");G(this,"fireRate");G(this,"bulletType");G(this,"sprite");G(this,"game");G(this,"shootCooldown",250);G(this,"shootOnCooldown",!1);G(this,"bullets",[]);this.health=e,this.texture="",this.fireRate=0,this.bulletType=t,this.sprite=yt.from(""),this.game=i}takeDamage(){this.health--,this.health<=0?(this.destroy(),this.game.removeLife(this)):j.play("hit")}collided(t){if(this.sprite.destroyed||t.destroyed)return!1;const e=this.sprite.getBounds(),i=t.getBounds();return e.x<i.x+i.width&&e.x+e.width>i.x&&e.y<i.y+i.height&&e.y+e.height>i.y}shoot(){if(!this.sprite)return;const t=this.sprite.x,e=this.sprite.y;new we(this,this.bulletType,1,t,e)}update(t){this.bullets.forEach(e=>{e.update(t)})}destroy(){const t=de.cache.get("explosion").animations,e=new ws(t.explosion),i=this.sprite.getBounds();e.animationSpeed=.16,e.loop=!1,e.position.set(i.x,i.y),e.play(),j.play("explosion2"),this.game.app.stage.addChild(e),this.sprite.destroy(),setTimeout(()=>{e.destroy()},500)}}class ri extends ea{constructor(t,e){super(1,t,e),this.texture="player"}spawn(){const t=yt.from(this.texture);return t.anchor.set(.5),t.scale.set(.05),t.position.set(this.game.app.screen.width/2,this.game.app.screen.height-t.height),t.label="player",this.game.app.stage.addChild(t),this.sprite=t,this.game.app.stage.on("pointermove",this.move.bind(this)),t}shoot(){if(!this.sprite||this.shootOnCooldown)return;const t=this.sprite.x,e=this.sprite.y,i=new we(this,this.bulletType,-1,t,e);this.sprite&&this.bullets.push(i),this.cooldown()}cooldown(){this.shootOnCooldown=!0,setTimeout(()=>{this.shootOnCooldown=!1},this.shootCooldown)}move(t){if(!this.sprite.destroyed){const e=this.sprite.width/2,i=this.sprite.height/2,r=t.global;r.x<=this.game.app.screen.width-e&&r.x>=e&&(this.sprite.x=r.x),r.y<=this.game.app.screen.height-i&&r.y>=i&&(this.sprite.y=r.y)}}takeDamage(){if(this.health--,this.game.playerDamageTaken++,this.game.removeLife(this),this.health<=0){this.game.music.stop(),this.destroy();const t=Math.floor(Math.random()*2)+1;setTimeout(()=>{j.play(`player_death_${t}`,{complete:()=>{this.game.end(!1)}})},400)}else j.play(`player_hit_0${this.game.playerDamageTaken}`)}update(t){super.update(t),this.game.enemies.forEach(e=>{e.bullets.forEach(i=>{this.collided(i.sprite)&&(i.sprite.destroy(),this.takeDamage())})})}}class pn extends ea{constructor(e,i){super(e,0,i);G(this,"direction",1);G(this,"stats");this.stats=this.getStats(e),this.health=this.stats.health,this.texture=this.stats.texture,this.fireRate=this.stats.fireRate,this.sprite=this.spawn(),this.shootCooldown=this.stats.fireRate}spawn(){const e=yt.from(this.texture);return e.anchor=.5,e.scale.set(.075),e.x=Math.floor(Math.random()*this.game.app.stage.width),e.y=-e.height,e.rotation=Math.PI,this.game.app.stage.addChild(e),e}update(e){this.sprite.destroyed?this.sprite.destroyed&&this.bullets.length===0&&(this.game.enemies=[]):(this.move(),this.shoot()),this.bullets.forEach(i=>{i.update(e)}),this.game.player.bullets.forEach(i=>{this.collided(i.sprite)&&(i.sprite.destroy(),this.takeDamage())})}shoot(){if(!this.sprite||this.shootOnCooldown||this.game.player.sprite.destroyed)return;const e=this.sprite.x,i=this.sprite.y,r=new we(this,this.bulletType,1,e,i);this.sprite&&this.bullets.push(r),this.cooldown()}move(){if(this.sprite.y<25)this.sprite.y+=1;else{const e=this.direction;let i=e;Math.floor(Math.random()*500)===1?i=-i:(this.sprite.x>=this.game.app.screen.width-this.sprite.width/2&&e==1||this.sprite.x>=this.game.app.screen.width&&e==-1?i=-1:(this.sprite.x<=this.game.app.screen.width&&e==1||this.sprite.x<=15&&e==-1)&&(i=1),this.sprite.x+=i),this.direction=i}}cooldown(){this.shootOnCooldown=!0,setTimeout(()=>{this.shootOnCooldown=!1},this.shootCooldown)}getStats(e){return{1:{texture:"enemy1",health:1,fireRate:750},2:{texture:"enemy2",health:4,fireRate:800},3:{texture:"enemy3",health:6,fireRate:750}}[e]}}const zd=240,Hd=160;class Nd{constructor(){G(this,"app");G(this,"ready",!1);G(this,"width",zd);G(this,"height",Hd);G(this,"difficulty",0);G(this,"playerLives",3);G(this,"playerKills",0);G(this,"playerDamageTaken",0);G(this,"music");G(this,"player");G(this,"ui");G(this,"state","loading");G(this,"enemies",[]);G(this,"framesRendered");this.app=new go,this.music=qe.from({url:"assets/sounds/bgm.wav",preload:!0,loop:!0,volume:.25}),this.ui=new fn(this.difficulty,this),this.framesRendered=0,this.player=new ri(3,this)}listen(){window.addEventListener("message",t=>{switch(t.data.op){case"start":t.data.difficulty!==void 0&&t.data.difficulty!==null&&(this.difficulty=t.data.difficulty),this.restart(),window.parent.postMessage({op:"started",verb:"shoot!"});break;default:console.log(`shoot! - received unknown event: ${t}`);break}}),this.ready=!0,this.music.play(),window.parent.postMessage({op:"ready"})}async preload(){const t=[{alias:"background",src:"/games/sunshoes/assets/sprites/bg.png"},{alias:"player",src:"/games/sunshoes/assets/sprites/player.png"},{alias:"bullet1",src:"/games/sunshoes/assets/sprites/bullet1.png"},{alias:"bullet2",src:"/games/sunshoes/assets/sprites/bullet2.png"},{alias:"bullet3",src:"/games/sunshoes/assets/sprites/bullet3.png"},{alias:"enemy1",src:"/games/sunshoes/assets/sprites/enemy1.png"},{alias:"enemy2",src:"/games/sunshoes/assets/sprites/enemy2.png"},{alias:"enemy3",src:"/games/sunshoes/assets/sprites/enemy3.png"},{alias:"life",src:"/games/sunshoes/assets/sprites/mrgreen.png"},{alias:"wave",src:"/games/sunshoes/assets/sprites/mrred.png"},{alias:"explosion",src:"/games/sunshoes/assets/animations/explosion.json"},{alias:"silkscreen",src:"/games/sunshoes/assets/ui/silkscreen_regular.ttf",data:{family:"silkscreen"}},{alias:"bungeespice",src:"/games/sunshoes/assets/ui/bungeespice.ttf",data:{family:"bungeespice"}}];j.add("bgm","/games/sunshoes/assets/sounds/bgm.wav"),j.add("shoot","/games/sunshoes/assets/sounds/shoot.wav"),j.add("shoot1","/games/sunshoes/assets/sounds/shoot1.wav"),j.add("enemyShoot","/games/sunshoes/assets/sounds/enemyShoot.wav"),j.add("enemyShoot1","/games/sunshoes/assets/sounds/enemyShoot1.wav"),j.add("hit","/games/sunshoes/assets/sounds/hit.wav"),j.add("success","/games/sunshoes/assets/sounds/success.wav"),j.add("failure","/games/sunshoes/assets/sounds/failure.wav"),j.add("explosion2","/games/sunshoes/assets/sounds/explosion2.wav"),j.add("player_hit_01","/games/sunshoes/assets/sounds/pain_jack_01.wav"),j.add("player_hit_02","/games/sunshoes/assets/sounds/pain_jack_02.wav"),j.add("player_hit_03","/games/sunshoes/assets/sounds/pain_jack_03.wav"),j.add("player_death_1","/games/sunshoes/assets/sounds/death_jack_01.wav"),j.add("player_death_2","/games/sunshoes/assets/sounds/death_jack_02.wav"),j.disableAutoPause=!0,await de.load(t)}setup(){(this.player.sprite.texture==null||this.player.sprite.texture.label==="EMPTY")&&(this.player=new ri(this.playerLives,this),this.player.spawn()),this.drawUI(),this.app.stage.onclick=()=>{this.player.sprite.destroyed||this.player.shoot()}}async initialize(){await this.app.init({width:this.width,height:this.height,background:"#1e1e1f"}),document.getElementById("container").appendChild(this.app.canvas);const t=yt.from("background");this.app.stage.addChild(t),this.app.stage.interactive=!0,this.app.renderer.events.cursorStyles.default="none",this.setup(),this.state="playing"}drawUI(){this.ui.outcome!==null&&this.ui.outcome!==void 0&&this.ui.outcome.destroy(),this.ui.render()}removeLife(t){t instanceof ri?this.ui.removeLife():t instanceof pn&&(this.ui.removeEnemyLife(),this.playerKills++)}update(t){if(this.framesRendered+=1,this.ui.update(t),this.player.update(t),this.enemies.length>0)this.enemies.forEach(e=>{e.update(t)});else if(this.playerKills<3){const e=new pn(this.playerKills+1,this);this.enemies.push(e)}this.playerKills===3&&this.state!=="ended"?this.end(!0):this.playerDamageTaken===this.playerLives&&this.state}end(t){this.ready=!1;const e=this.width/2,i=this.height/2,r=t?"YOU WIN!":"YOU LOSE!",n=t?"success":"failure";!j.find(n).isPlaying&&this.state!=="ended"&&(this.ui.outcome=this.ui.renderOutcome(r,e,i),this.app.stage.onclick=null,j.stopAll(),this.music.stop(),this.state="ended",setTimeout(()=>{j.play(n,{volume:.25,complete:()=>{for(;this.playerKills>0;)this.ui.removeEnemyLife(),this.playerKills--;for(;this.playerLives>0;)this.ui.removeLife(),this.playerLives--;this.app.stop(),window.parent.postMessage({op:"done",win:t})}})},500))}restart(){for(this.music.stop(),j.stopAll(),this.state="loading",this.player.bullets.forEach(t=>{t.sprite.destroyed||t.sprite.destroy()}),this.enemies.forEach(t=>{t.sprite.destroyed||t.sprite.destroy()}),this.enemies=[],this.teardown();this.playerKills>0;)this.ui.removeEnemyLife(),this.playerKills--;for(;this.playerLives>0;)this.ui.removeLife(),this.playerLives--;this.playerLives=3,this.playerKills=0,this.playerDamageTaken=0,this.app.stage.removeChild(this.player.sprite),this.player.sprite.destroy(),this.ui=new fn(this.difficulty,this),this.ui.updatePlayerLives=!0,this.setup(),this.listen(),this.app.start()}teardown(){var e,i;this.ui.outcome&&(this.app.stage.removeChild(this.ui.outcome),(e=this.ui.outcome)==null||e.destroy(),(i=this.app.stage.getChildByLabel("outcome"))==null||i.destroy());const t=this.app.stage.getChildByLabel("outcome");t!==null&&t.destroy()}triggerRestart(t=10){window.postMessage({op:"start",difficulty:t})}}(async()=>{const s=new Nd;await s.preload(),await s.initialize(),s.listen();const t=s.app;window.restart=()=>{s.restart()},window.triggerRestart=()=>{s.triggerRestart()},t.ticker.add(e=>{s.update(e)})})();export{fi as $,At as A,je as B,Ot as C,ko as D,ft as E,K as F,Ms as G,Ro as H,be as I,te as J,$ as K,fs as L,Mn as M,W as N,Es as O,Bc as P,Yu as Q,tt as R,Fi as S,U as T,Nc as U,Ln as V,Ft as W,Is as X,Un as Y,z as Z,lo as _,Kn as a,dt as a0,ze as a1,lt as a2,Fa as a3,Ut as a4,Ol as a5,Tr as a6,ps as a7,Bi as a8,oo as a9,gc as aA,yc as aB,Cc as aC,Ac as aD,Tc as aE,Ku as aF,St as aa,to as ab,mc as ac,_c as ad,Sc as ae,wc as af,wa as ag,Pc as ah,Tn as ai,vt as aj,Ts as ak,ar as al,yt as am,Td as an,Za as ao,lr as ap,Hs as aq,cr as ar,th as as,kn as at,co as au,Qe as av,sl as aw,Qh as ax,Ql as ay,Vl as az,ye as b,Mi as c,X as d,q as e,ki as f,ds as g,As as h,Ho as i,No as j,wt as k,Yd as l,md as m,sd as n,nt as o,O as p,wh as q,zl as r,pt as s,J as t,Ih as u,_t as v,Y as w,Po as x,Rn as y,I as z};