From abbdfddb52b6e87a7631e696511675600f903625 Mon Sep 17 00:00:00 2001 From: remarkablemark Date: Sat, 18 May 2024 21:52:46 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20remarkab?= =?UTF-8?q?legames/water-pipe@ec099556b9219571c8ab1e283ad232acc2850547=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/{index-7l_p17U0.js => index-LQMS6_sb.js} | 8 ++++---- index.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename assets/{index-7l_p17U0.js => index-LQMS6_sb.js} (87%) diff --git a/assets/index-7l_p17U0.js b/assets/index-LQMS6_sb.js similarity index 87% rename from assets/index-7l_p17U0.js rename to assets/index-LQMS6_sb.js index ffdc32d..c2f0323 100644 --- a/assets/index-7l_p17U0.js +++ b/assets/index-LQMS6_sb.js @@ -1,4 +1,4 @@ -var no=Object.defineProperty;var oo=(r,e,n)=>e in r?no(r,e,{enumerable:true,configurable:true,writable:true,value:n}):r[e]=n;var E=(r,e,n)=>{oo(r,typeof e!=="symbol"?e+"":e,n);return n};(function r(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload")){return}for(const f of document.querySelectorAll('link[rel="modulepreload"]')){l(f)}new MutationObserver(f=>{for(const p of f){if(p.type!=="childList"){continue}for(const T of p.addedNodes){if(T.tagName==="LINK"&&T.rel==="modulepreload")l(T)}}}).observe(document,{childList:true,subtree:true});function n(f){const p={};if(f.integrity)p.integrity=f.integrity;if(f.referrerPolicy)p.referrerPolicy=f.referrerPolicy;if(f.crossOrigin==="use-credentials")p.credentials="include";else if(f.crossOrigin==="anonymous")p.credentials="omit";else p.credentials="same-origin";return p}function l(f){if(f.ep)return;f.ep=true;const p=n(f);fetch(f.href,p)}})();var ao=Object.defineProperty;var o=(r,e)=>ao(r,"name",{value:e,configurable:true});var ho=(()=>{for(var r=new Uint8Array(128),e=0;e<64;e++)r[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return n=>{for(var l=n.length,f=new Uint8Array((l-(n[l-1]=="=")-(n[l-2]=="="))*3/4|0),p=0,T=0;p>4,f[T++]=L<<4|v>>2,f[T++]=v<<6|X}return f}})();function Ge(r){return r*Math.PI/180}o(Ge,"deg2rad");function Ct(r){return r*180/Math.PI}o(Ct,"rad2deg");function je(r,e,n){return e>n?je(r,n,e):Math.min(Math.max(r,e),n)}o(je,"clamp");function Qe(r,e,n){if(typeof r=="number"&&typeof e=="number")return r+(e-r)*n;if(r instanceof b&&e instanceof b)return r.lerp(e,n);if(r instanceof te&&e instanceof te)return r.lerp(e,n);throw new Error(`Bad value for lerp(): ${r}, ${e}. Only number, Vec2 and Color is supported.`)}o(Qe,"lerp");function $e(r,e,n,l,f){return l+(r-e)/(n-e)*(f-l)}o($e,"map");function cn(r,e,n,l,f){return je($e(r,e,n,l,f),l,f)}o(cn,"mapc");var ae;var b=(ae=class{constructor(e=0,n=e){E(this,"x",0);E(this,"y",0);this.x=e,this.y=n}static fromAngle(e){let n=Ge(e);return new ae(Math.cos(n),Math.sin(n))}clone(){return new ae(this.x,this.y)}add(...e){let n=B(...e);return new ae(this.x+n.x,this.y+n.y)}sub(...e){let n=B(...e);return new ae(this.x-n.x,this.y-n.y)}scale(...e){let n=B(...e);return new ae(this.x*n.x,this.y*n.y)}dist(...e){let n=B(...e);return this.sub(n).len()}sdist(...e){let n=B(...e);return this.sub(n).slen()}len(){return Math.sqrt(this.dot(this))}slen(){return this.dot(this)}unit(){let e=this.len();return e===0?new ae(0):this.scale(1/e)}normal(){return new ae(this.y,-this.x)}reflect(e){return this.sub(e.scale(2*this.dot(e)))}project(e){return e.scale(e.dot(this)/e.len())}reject(e){return this.sub(this.project(e))}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(...e){let n=B(...e);return Ct(Math.atan2(this.y-n.y,this.x-n.x))}angleBetween(...e){let n=B(...e);return Ct(Math.atan2(this.cross(n),this.dot(n)))}lerp(e,n){return new ae(Qe(this.x,e.x,n),Qe(this.y,e.y,n))}slerp(e,n){let l=this.dot(e),f=this.cross(e),p=Math.atan2(f,l);return this.scale(Math.sin((1-n)*p)).add(e.scale(Math.sin(n*p))).scale(1/f)}isZero(){return this.x===0&&this.y===0}toFixed(e){return new ae(Number(this.x.toFixed(e)),Number(this.y.toFixed(e)))}transform(e){return e.multVec2(this)}eq(e){return this.x===e.x&&this.y===e.y}bbox(){return new Ee(this,0,0)}toString(){return`vec2(${this.x.toFixed(2)}, ${this.y.toFixed(2)})`}},o(ae,"Vec2"),E(ae,"LEFT",new ae(-1,0)),E(ae,"RIGHT",new ae(1,0)),E(ae,"UP",new ae(0,-1)),E(ae,"DOWN",new ae(0,1)),ae);function B(...r){if(r.length===1){if(r[0]instanceof b)return new b(r[0].x,r[0].y);if(Array.isArray(r[0])&&r[0].length===2)return new b(...r[0])}return new b(...r)}o(B,"vec2");var J;var te=(J=class{constructor(e,n,l){E(this,"r",255);E(this,"g",255);E(this,"b",255);this.r=je(e,0,255),this.g=je(n,0,255),this.b=je(l,0,255)}static fromArray(e){return new J(e[0],e[1],e[2])}static fromHex(e){if(typeof e=="number")return new J(e>>16&255,e>>8&255,e>>0&255);if(typeof e=="string"){let n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return new J(parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16))}else throw new Error("Invalid hex color format")}static fromHSL(e,n,l){if(n==0)return new J(255*l,255*l,255*l);let f=o((X,S,Q)=>(Q<0&&(Q+=1),Q>1&&(Q-=1),Q<1/6?X+(S-X)*6*Q:Q<1/2?S:Q<2/3?X+(S-X)*(2/3-Q)*6:X),"hue2rgb"),p=l<.5?l*(1+n):l+n-l*n,T=2*l-p,D=f(T,p,e+1/3),L=f(T,p,e),v=f(T,p,e-1/3);return new J(Math.round(D*255),Math.round(L*255),Math.round(v*255))}clone(){return new J(this.r,this.g,this.b)}lighten(e){return new J(this.r+e,this.g+e,this.b+e)}darken(e){return this.lighten(-e)}invert(){return new J(255-this.r,255-this.g,255-this.b)}mult(e){return new J(this.r*e.r/255,this.g*e.g/255,this.b*e.b/255)}lerp(e,n){return new J(Qe(this.r,e.r,n),Qe(this.g,e.g,n),Qe(this.b,e.b,n))}toHSL(){let e=this.r/255,n=this.g/255,l=this.b/255,f=Math.max(e,n,l),p=Math.min(e,n,l),T=(f+p)/2,D=T,L=T;if(f==p)T=D=0;else{let v=f-p;switch(D=L>.5?v/(2-f-p):v/(f+p),f){case e:T=(n-l)/v+(nte.fromHSL(r,e,n),"hsl2rgb");var ct;var me=(ct=class{constructor(e,n,l,f){E(this,"x",0);E(this,"y",0);E(this,"w",1);E(this,"h",1);this.x=e,this.y=n,this.w=l,this.h=f}scale(e){return new ct(this.x+this.w*e.x,this.y+this.h*e.y,this.w*e.w,this.h*e.h)}pos(){return new b(this.x,this.y)}clone(){return new ct(this.x,this.y,this.w,this.h)}eq(e){return this.x===e.x&&this.y===e.y&&this.w===e.w&&this.h===e.h}toString(){return`quad(${this.x}, ${this.y}, ${this.w}, ${this.h})`}},o(ct,"Quad"),ct);function le(r,e,n,l){return new me(r,e,n,l)}o(le,"quad");var Be;var Le=(Be=class{constructor(e){E(this,"m",[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);e&&(this.m=e)}static translate(e){return new Be([1,0,0,0,0,1,0,0,0,0,1,0,e.x,e.y,0,1])}static scale(e){return new Be([e.x,0,0,0,0,e.y,0,0,0,0,1,0,0,0,0,1])}static rotateX(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e);return new Be([1,0,0,0,0,n,-l,0,0,l,n,0,0,0,0,1])}static rotateY(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e);return new Be([n,0,l,0,0,1,0,0,-l,0,n,0,0,0,0,1])}static rotateZ(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e);return new Be([n,-l,0,0,l,n,0,0,0,0,1,0,0,0,0,1])}translate(e){return this.m[12]+=this.m[0]*e.x+this.m[4]*e.y,this.m[13]+=this.m[1]*e.x+this.m[5]*e.y,this.m[14]+=this.m[2]*e.x+this.m[6]*e.y,this.m[15]+=this.m[3]*e.x+this.m[7]*e.y,this}scale(e){return this.m[0]*=e.x,this.m[4]*=e.y,this.m[1]*=e.x,this.m[5]*=e.y,this.m[2]*=e.x,this.m[6]*=e.y,this.m[3]*=e.x,this.m[7]*=e.y,this}rotate(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e),f=this.m[0],p=this.m[1],T=this.m[4],D=this.m[5];return this.m[0]=f*n+p*l,this.m[1]=-f*l+p*n,this.m[4]=T*n+D*l,this.m[5]=-T*l+D*n,this}mult(e){let n=[];for(let l=0;l<4;l++)for(let f=0;f<4;f++)n[l*4+f]=this.m[0*4+f]*e.m[l*4+0]+this.m[1*4+f]*e.m[l*4+1]+this.m[2*4+f]*e.m[l*4+2]+this.m[3*4+f]*e.m[l*4+3];return new Be(n)}multVec2(e){return new b(e.x*this.m[0]+e.y*this.m[4]+this.m[12],e.x*this.m[1]+e.y*this.m[5]+this.m[13])}getTranslation(){return new b(this.m[12],this.m[13])}getScale(){if(this.m[0]!=0||this.m[1]!=0){let e=this.m[0]*this.m[5]-this.m[1]*this.m[4],n=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return new b(n,e/n)}else if(this.m[4]!=0||this.m[5]!=0){let e=this.m[0]*this.m[5]-this.m[1]*this.m[4],n=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return new b(e/n,n)}else return new b(0,0)}getRotation(){if(this.m[0]!=0||this.m[1]!=0){let e=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return Ct(this.m[1]>0?Math.acos(this.m[0]/e):-Math.acos(this.m[0]/e))}else if(this.m[4]!=0||this.m[5]!=0){let e=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return Ct(Math.PI/2-(this.m[5]>0?Math.acos(-this.m[4]/e):-Math.acos(this.m[4]/e)))}else return 0}getSkew(){if(this.m[0]!=0||this.m[1]!=0){let e=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return new b(Math.atan(this.m[0]*this.m[4]+this.m[1]*this.m[5])/(e*e),0)}else if(this.m[4]!=0||this.m[5]!=0){let e=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return new b(0,Math.atan(this.m[0]*this.m[4]+this.m[1]*this.m[5])/(e*e))}else return new b(0,0)}invert(){let e=[],n=this.m[10]*this.m[15]-this.m[14]*this.m[11],l=this.m[9]*this.m[15]-this.m[13]*this.m[11],f=this.m[9]*this.m[14]-this.m[13]*this.m[10],p=this.m[8]*this.m[15]-this.m[12]*this.m[11],T=this.m[8]*this.m[14]-this.m[12]*this.m[10],D=this.m[8]*this.m[13]-this.m[12]*this.m[9],L=this.m[6]*this.m[15]-this.m[14]*this.m[7],v=this.m[5]*this.m[15]-this.m[13]*this.m[7],X=this.m[5]*this.m[14]-this.m[13]*this.m[6],S=this.m[4]*this.m[15]-this.m[12]*this.m[7],Q=this.m[4]*this.m[14]-this.m[12]*this.m[6],x=this.m[5]*this.m[15]-this.m[13]*this.m[7],W=this.m[4]*this.m[13]-this.m[12]*this.m[5],we=this.m[6]*this.m[11]-this.m[10]*this.m[7],re=this.m[5]*this.m[11]-this.m[9]*this.m[7],G=this.m[5]*this.m[10]-this.m[9]*this.m[6],pe=this.m[4]*this.m[11]-this.m[8]*this.m[7],R=this.m[4]*this.m[10]-this.m[8]*this.m[6],Pe=this.m[4]*this.m[9]-this.m[8]*this.m[5];e[0]=this.m[5]*n-this.m[6]*l+this.m[7]*f,e[4]=-(this.m[4]*n-this.m[6]*p+this.m[7]*T),e[8]=this.m[4]*l-this.m[5]*p+this.m[7]*D,e[12]=-(this.m[4]*f-this.m[5]*T+this.m[6]*D),e[1]=-(this.m[1]*n-this.m[2]*l+this.m[3]*f),e[5]=this.m[0]*n-this.m[2]*p+this.m[3]*T,e[9]=-(this.m[0]*l-this.m[1]*p+this.m[3]*D),e[13]=this.m[0]*f-this.m[1]*T+this.m[2]*D,e[2]=this.m[1]*L-this.m[2]*v+this.m[3]*X,e[6]=-(this.m[0]*L-this.m[2]*S+this.m[3]*Q),e[10]=this.m[0]*x-this.m[1]*S+this.m[3]*W,e[14]=-(this.m[0]*X-this.m[1]*Q+this.m[2]*W),e[3]=-(this.m[1]*we-this.m[2]*re+this.m[3]*G),e[7]=this.m[0]*we-this.m[2]*pe+this.m[3]*R,e[11]=-(this.m[0]*re-this.m[1]*pe+this.m[3]*Pe),e[15]=this.m[0]*G-this.m[1]*R+this.m[2]*Pe;let Y=this.m[0]*e[0]+this.m[1]*e[4]+this.m[2]*e[8]+this.m[3]*e[12];for(let be=0;be<4;be++)for(let Ae=0;Ae<4;Ae++)e[be*4+Ae]*=1/Y;return new Be(e)}clone(){return new Be([...this.m])}toString(){return this.m.toString()}},o(Be,"Mat4"),Be);function Si(r,e,n,l=f=>-Math.cos(f)){return r+(l(n)+1)/2*(e-r)}o(Si,"wave");var uo=1103515245;var co=12345;var zs=2147483648;var gr;var dn=(gr=class{constructor(e){E(this,"seed");this.seed=e}gen(){return this.seed=(uo*this.seed+co)%zs,this.seed/zs}genNumber(e,n){return e+this.gen()*(n-e)}genVec2(e,n){return new b(this.genNumber(e.x,n.x),this.genNumber(e.y,n.y))}genColor(e,n){return new te(this.genNumber(e.r,n.r),this.genNumber(e.g,n.g),this.genNumber(e.b,n.b))}genAny(...e){if(e.length===0)return this.gen();if(e.length===1){if(typeof e[0]=="number")return this.genNumber(0,e[0]);if(e[0]instanceof b)return this.genVec2(B(0,0),e[0]);if(e[0]instanceof te)return this.genColor(Z(0,0,0),e[0])}else if(e.length===2){if(typeof e[0]=="number"&&typeof e[1]=="number")return this.genNumber(e[0],e[1]);if(e[0]instanceof b&&e[1]instanceof b)return this.genVec2(e[0],e[1]);if(e[0]instanceof te&&e[1]instanceof te)return this.genColor(e[0],e[1])}}},o(gr,"RNG"),gr);var Ri=new dn(Date.now());function fn(r){return r!=null&&(Ri.seed=r),Ri.seed}o(fn,"randSeed");function fr(...r){return Ri.genAny(...r)}o(fr,"rand");function Pi(...r){return Math.floor(fr(...r))}o(Pi,"randi");function pn(r){return fr()<=r}o(pn,"chance");function gn(r){return r[Pi(r.length)]}o(gn,"choose");function mn(r,e){return r.pos.x+r.width>e.pos.x&&r.pos.xe.pos.y&&r.pos.y1||f<0||f>1?null:l}o(wn,"testLineLineT");function Ft(r,e){let n=wn(r,e);return n?B(r.p1.x+n*(r.p2.x-r.p1.x),r.p1.y+n*(r.p2.y-r.p1.y)):null}o(Ft,"testLineLine");function An(r,e){if(pr(r,e.p1)||pr(r,e.p2))return true;let n=r.points();return!!Ft(e,new It(n[0],n[1]))||!!Ft(e,new It(n[1],n[2]))||!!Ft(e,new It(n[2],n[3]))||!!Ft(e,new It(n[3],n[0]))}o(An,"testRectLine");function pr(r,e){return e.x>r.pos.x&&e.xr.pos.y&&e.yNumber.EPSILON)return false;let f=n.dot(l)/l.dot(l);return f>=0&&f<=1}o(Vn,"testLinePoint");function Fi(r,e){let n=r.p2.sub(r.p1),l=n.dot(n),f=r.p1.sub(e.center),p=2*n.dot(f),T=f.dot(f)-e.radius*e.radius,D=p*p-4*l*T;if(l<=Number.EPSILON||D<0)return false;if(D==0){let L=-p/(2*l);if(L>=0&&L<=1)return true}else{let L=(-p+Math.sqrt(D))/(2*l),v=(-p-Math.sqrt(D))/(2*l);if(L>=0&&L<=1||v>=0&&v<=1)return true}return Ii(e,r.p1)}o(Fi,"testLineCircle");function Ii(r,e){return r.center.sdist(e)e.y!=l[p].y>e.y&&e.x<(l[p].x-l[f].x)*(e.y-l[f].y)/(l[p].y-l[f].y)+l[f].x&&(n=!n);return n}o(ki,"testPolygonPoint");var dt;var It=(dt=class{constructor(e,n){E(this,"p1");E(this,"p2");this.p1=e.clone(),this.p2=n.clone()}transform(e){return new dt(e.multVec2(this.p1),e.multVec2(this.p2))}bbox(){return Ee.fromPoints(this.p1,this.p2)}area(){return this.p1.dist(this.p2)}clone(){return new dt(this.p1,this.p2)}},o(dt,"Line"),dt);var ft;var Ee=(ft=class{constructor(e,n,l){E(this,"pos");E(this,"width");E(this,"height");this.pos=e.clone(),this.width=n,this.height=l}static fromPoints(e,n){return new ft(e.clone(),n.x-e.x,n.y-e.y)}center(){return new b(this.pos.x+this.width/2,this.pos.y+this.height/2)}points(){return[this.pos,this.pos.add(this.width,0),this.pos.add(this.width,this.height),this.pos.add(0,this.height)]}transform(e){return new lr(this.points().map(n=>e.multVec2(n)))}bbox(){return this.clone()}area(){return this.width*this.height}clone(){return new ft(this.pos.clone(),this.width,this.height)}distToPoint(e){return Math.sqrt(this.sdistToPoint(e))}sdistToPoint(e){let n=this.pos,l=this.pos.add(this.width,this.height),f=Math.max(n.x-e.x,0,e.x-l.x),p=Math.max(n.y-e.y,0,e.y-l.y);return f*f+p*p}},o(ft,"Rect"),ft);var Nt;var Js=(Nt=class{constructor(e,n){E(this,"center");E(this,"radius");this.center=e.clone(),this.radius=n}transform(e){return new fo(this.center,this.radius,this.radius).transform(e)}bbox(){return Ee.fromPoints(this.center.sub(B(this.radius)),this.center.add(B(this.radius)))}area(){return this.radius*this.radius*Math.PI}clone(){return new Nt(this.center,this.radius)}},o(Nt,"Circle"),Nt);var pt;var fo=(pt=class{constructor(e,n,l){E(this,"center");E(this,"radiusX");E(this,"radiusY");this.center=e.clone(),this.radiusX=n,this.radiusY=l}transform(e){return new pt(e.multVec2(this.center),e.m[0]*this.radiusX,e.m[5]*this.radiusY)}bbox(){return Ee.fromPoints(this.center.sub(B(this.radiusX,this.radiusY)),this.center.add(B(this.radiusX,this.radiusY)))}area(){return this.radiusX*this.radiusY*Math.PI}clone(){return new pt(this.center,this.radiusX,this.radiusY)}},o(pt,"Ellipse"),pt);var gt;var lr=(gt=class{constructor(e){E(this,"pts");if(e.length<3)throw new Error("Polygons should have at least 3 vertices");this.pts=e}transform(e){return new gt(this.pts.map(n=>e.multVec2(n)))}bbox(){let e=B(Number.MAX_VALUE),n=B(-Number.MAX_VALUE);for(let l of this.pts)e.x=Math.min(e.x,l.x),n.x=Math.max(n.x,l.x),e.y=Math.min(e.y,l.y),n.y=Math.max(n.y,l.y);return Ee.fromPoints(e,n)}area(){let e=0,n=this.pts.length;for(let l=0;le.clone()))}},o(gt,"Polygon"),gt);function yn(r,e){let n=Number.MAX_VALUE,l=B(0);for(let f of[r,e])for(let p=0;pthis.delete(l)}},o(mr,"Registry"),mr);var Ut;var Pt=(Ut=class{constructor(e){E(this,"paused",false);E(this,"cancel");this.cancel=e}static join(e){let n=new Ut(()=>e.forEach(l=>l.cancel()));return Object.defineProperty(n,"paused",{get:()=>e[0].paused,set:l=>e.forEach(f=>f.paused=l)}),n.paused=false,n}},o(Ut,"EventController"),Ut);var wr;var De=(wr=class{constructor(){E(this,"handlers",new xn)}add(e){let n=this.handlers.pushd((...f)=>{l.paused||e(...f)}),l=new Pt(n);return l}addOnce(e){let n=this.add((...l)=>{n.cancel(),e(...l)});return n}next(){return new Promise(e=>this.addOnce(e))}trigger(...e){this.handlers.forEach(n=>n(...e))}numListeners(){return this.handlers.size}clear(){this.handlers.clear()}},o(wr,"Event"),wr);var Ar;var ur=(Ar=class{constructor(){E(this,"handlers",{})}on(e,n){return this.handlers[e]||(this.handlers[e]=new De),this.handlers[e].add(n)}onOnce(e,n){let l=this.on(e,(...f)=>{l.cancel(),n(...f)});return l}next(e){return new Promise(n=>{this.onOnce(e,(...l)=>n(l[0]))})}trigger(e,...n){this.handlers[e]&&this.handlers[e].trigger(...n)}remove(e){delete this.handlers[e]}clear(){this.handlers={}}numListeners(e){var n;return((n=this.handlers[e])==null?void 0:n.numListeners())??0}},o(Ar,"EventHandler"),Ar);function Wr(r,e){if(r===e)return true;let n=typeof r,l=typeof e;if(n!==l)return false;if(n==="object"&&l==="object"&&r!==null&&e!==null){if(Array.isArray(r)!==Array.isArray(e))return false;let f=Object.keys(r),p=Object.keys(e);if(f.length!==p.length)return false;for(let T of f){let D=r[T],L=e[T];if(!Wr(D,L))return false}return true}return false}o(Wr,"deepEq");function En(r){let e=window.atob(r),n=e.length,l=new Uint8Array(n);for(let f=0;fr.match(/^data:\w+\/\w+;base64,.+/),"isDataURL");var po=o(r=>r.split(".").slice(0,-1).join("."),"getFileName");function Te(r,e){return(...n)=>{let l=n.length;if(l===r.length)return r(...n);if(l===e.length)return e(...n)}}o(Te,"overload2");var mo=(()=>{let r=0;return()=>r++})();var wo=o(r=>r instanceof Error?r.message:String(r),"getErrorMessage");var Vr;var Ao=(Vr=class{constructor(e=(n,l)=>n0;){let n=Math.floor((e-1)/2);if(!this._compareFn(this._items[e],this._items[n])&&this._items[e]>=this._items[n])break;this.swap(e,n),e=n}}moveDown(e){for(;e=e&&r<=n}o(et,"betweenInclusive");var Ws={"Joy-Con L+R (STANDARD GAMEPAD Vendor: 057e Product: 200e)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home","17":"capture"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}},"Joy-Con (L) (STANDARD GAMEPAD Vendor: 057e Product: 2006)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","9":"select","10":"lstick","16":"start"},sticks:{left:{x:0,y:1}}},"Joy-Con (R) (STANDARD GAMEPAD Vendor: 057e Product: 2007)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","9":"start","10":"lstick","16":"select"},sticks:{left:{x:0,y:1}}},"Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home","17":"capture"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}},default:{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}}};var vr;var zr=(vr=class{constructor(){E(this,"pressed",new Set([]));E(this,"pressedRepeat",new Set([]));E(this,"released",new Set([]));E(this,"down",new Set([]))}update(){this.pressed.clear(),this.released.clear(),this.pressedRepeat.clear()}press(e){this.pressed.add(e),this.pressedRepeat.add(e),this.down.add(e)}pressRepeat(e){this.pressedRepeat.add(e)}release(e){this.down.delete(e),this.pressed.delete(e),this.released.add(e)}},o(vr,"ButtonState"),vr);var yr;var vo=(yr=class{constructor(){E(this,"buttonState",new zr);E(this,"stickState",new Map)}},o(yr,"GamepadState"),yr);var xr;var yo=(xr=class{constructor(){E(this,"dts",[]);E(this,"timer",0);E(this,"fps",0)}tick(e){this.dts.push(e),this.timer+=e,this.timer>=1&&(this.timer=0,this.fps=Math.round(1/(this.dts.reduce((n,l)=>n+l)/this.dts.length)),this.dts=[])}},o(xr,"FPSCounter"),xr);var xo=o(r=>{if(!r.canvas)throw new Error("Please provide a canvas");let e={canvas:r.canvas,loopID:null,stopped:false,dt:0,time:0,realTime:0,fpsCounter:new yo,timeScale:1,skipTime:false,numFrames:0,mousePos:new b(0),mouseDeltaPos:new b(0),keyState:new zr,mouseState:new zr,mergedGamepadState:new vo,gamepadStates:new Map,gamepads:[],charInputted:[],isMouseMoved:false,lastWidth:r.canvas.offsetWidth,lastHeight:r.canvas.offsetHeight,events:new ur};function n(){return e.dt*e.timeScale}o(n,"dt");function l(){return e.time}o(l,"time");function f(){return e.fpsCounter.fps}o(f,"fps");function p(){return e.numFrames}o(p,"numFrames");function T(){return e.canvas.toDataURL()}o(T,"screenshot");function D(d){e.canvas.style.cursor=d}o(D,"setCursor");function L(){return e.canvas.style.cursor}o(L,"getCursor");function v(d){if(d)try{let y=e.canvas.requestPointerLock();y.catch&&y.catch(M=>console.error(M))}catch(y){console.error(y)}else document.exitPointerLock()}o(v,"setCursorLocked");function X(){return!!document.pointerLockElement}o(X,"isCursorLocked");function S(d){d.requestFullscreen?d.requestFullscreen():d.webkitRequestFullscreen&&d.webkitRequestFullscreen()}o(S,"enterFullscreen");function Q(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen()}o(Q,"exitFullscreen");function x(){return document.fullscreenElement||document.webkitFullscreenElement}o(x,"getFullscreenElement");function W(d=true){d?S(e.canvas):Q()}o(W,"setFullscreen");function we(){return!!x()}o(we,"isFullscreen");function re(){e.stopped=true;for(let d in se)e.canvas.removeEventListener(d,se[d]);for(let d in ue)document.removeEventListener(d,ue[d]);for(let d in he)window.removeEventListener(d,he[d]);ve.disconnect()}o(re,"quit");function G(d){e.loopID!==null&&cancelAnimationFrame(e.loopID);let y=0,M=o(H=>{if(e.stopped)return;if(document.visibilityState!=="visible"){e.loopID=requestAnimationFrame(M);return}let z=H/1e3,de=z-e.realTime,Se=r.maxFPS?1/r.maxFPS:0;e.realTime=z,y+=de,y>Se&&(e.skipTime||(e.dt=y,e.time+=n(),e.fpsCounter.tick(e.dt)),y=0,e.skipTime=false,e.numFrames++,nt(),d(),_t()),e.loopID=requestAnimationFrame(M)},"frame");M(0)}o(G,"run");function pe(){return"ontouchstart"in window||navigator.maxTouchPoints>0}o(pe,"isTouchscreen");function R(){return e.mousePos.clone()}o(R,"mousePos");function Pe(){return e.mouseDeltaPos.clone()}o(Pe,"mouseDeltaPos");function Y(d="left"){return e.mouseState.pressed.has(d)}o(Y,"isMousePressed");function be(d="left"){return e.mouseState.down.has(d)}o(be,"isMouseDown");function Ae(d="left"){return e.mouseState.released.has(d)}o(Ae,"isMouseReleased");function Ve(){return e.isMouseMoved}o(Ve,"isMouseMoved");function ze(d){return d===void 0?e.keyState.pressed.size>0:e.keyState.pressed.has(d)}o(ze,"isKeyPressed");function Ot(d){return d===void 0?e.keyState.pressedRepeat.size>0:e.keyState.pressedRepeat.has(d)}o(Ot,"isKeyPressedRepeat");function mt(d){return d===void 0?e.keyState.down.size>0:e.keyState.down.has(d)}o(mt,"isKeyDown");function wt(d){return d===void 0?e.keyState.released.size>0:e.keyState.released.has(d)}o(wt,"isKeyReleased");function At(d){return d===void 0?e.mergedGamepadState.buttonState.pressed.size>0:e.mergedGamepadState.buttonState.pressed.has(d)}o(At,"isGamepadButtonPressed");function Oe(d){return d===void 0?e.mergedGamepadState.buttonState.down.size>0:e.mergedGamepadState.buttonState.down.has(d)}o(Oe,"isGamepadButtonDown");function qt(d){return d===void 0?e.mergedGamepadState.buttonState.released.size>0:e.mergedGamepadState.buttonState.released.has(d)}o(qt,"isGamepadButtonReleased");function Ht(d){return e.events.on("resize",d)}o(Ht,"onResize");let Br=Te(d=>e.events.on("keyDown",d),(d,y)=>e.events.on("keyDown",M=>M===d&&y(d))),Tr=Te(d=>e.events.on("keyPress",d),(d,y)=>e.events.on("keyPress",M=>M===d&&y(d))),Pr=Te(d=>e.events.on("keyPressRepeat",d),(d,y)=>e.events.on("keyPressRepeat",M=>M===d&&y(d))),Fr=Te(d=>e.events.on("keyRelease",d),(d,y)=>e.events.on("keyRelease",M=>M===d&&y(d))),Yt=Te(d=>e.events.on("mouseDown",y=>d(y)),(d,y)=>e.events.on("mouseDown",M=>M===d&&y(M))),Kt=Te(d=>e.events.on("mousePress",y=>d(y)),(d,y)=>e.events.on("mousePress",M=>M===d&&y(M))),jt=Te(d=>e.events.on("mouseRelease",y=>d(y)),(d,y)=>e.events.on("mouseRelease",M=>M===d&&y(M)));function Vt(d){return e.events.on("mouseMove",()=>d(R(),Pe()))}o(Vt,"onMouseMove");function vt(d){return e.events.on("charInput",d)}o(vt,"onCharInput");function Qt(d){return e.events.on("touchStart",d)}o(Qt,"onTouchStart");function tt(d){return e.events.on("touchMove",d)}o(tt,"onTouchMove");function zt(d){return e.events.on("touchEnd",d)}o(zt,"onTouchEnd");function Jt(d){return e.events.on("scroll",d)}o(Jt,"onScroll");function yt(d){return e.events.on("hide",d)}o(yt,"onHide");function Xt(d){return e.events.on("show",d)}o(Xt,"onShow");function xt(d,y){if(typeof d=="function")return e.events.on("gamepadButtonDown",d);if(typeof d=="string"&&typeof y=="function")return e.events.on("gamepadButtonDown",M=>M===d&&y(d))}o(xt,"onGamepadButtonDown");function Et(d,y){if(typeof d=="function")return e.events.on("gamepadButtonPress",d);if(typeof d=="string"&&typeof y=="function")return e.events.on("gamepadButtonPress",M=>M===d&&y(d))}o(Et,"onGamepadButtonPress");function Wt(d,y){if(typeof d=="function")return e.events.on("gamepadButtonRelease",d);if(typeof d=="string"&&typeof y=="function")return e.events.on("gamepadButtonRelease",M=>M===d&&y(d))}o(Wt,"onGamepadButtonRelease");function rt(d,y){return e.events.on("gamepadStick",(M,H)=>M===d&&y(H))}o(rt,"onGamepadStick");function Zt(d){e.events.on("gamepadConnect",d)}o(Zt,"onGamepadConnect");function it(d){e.events.on("gamepadDisconnect",d)}o(it,"onGamepadDisconnect");function Fe(d){return e.mergedGamepadState.stickState.get(d)||new b(0)}o(Fe,"getGamepadStick");function st(){return[...e.charInputted]}o(st,"charInputted");function bt(){return[...e.gamepads]}o(bt,"getGamepads");function nt(){e.events.trigger("input"),e.keyState.down.forEach(d=>e.events.trigger("keyDown",d)),e.mouseState.down.forEach(d=>e.events.trigger("mouseDown",d)),Ne()}o(nt,"processInput");function _t(){e.keyState.update(),e.mouseState.update(),e.mergedGamepadState.buttonState.update(),e.mergedGamepadState.stickState.forEach((d,y)=>{e.mergedGamepadState.stickState.set(y,new b(0))}),e.charInputted=[],e.isMouseMoved=false,e.gamepadStates.forEach(d=>{d.buttonState.update(),d.stickState.forEach((y,M)=>{d.stickState.set(M,new b(0))})})}o(_t,"resetInput");function St(d){let y={index:d.index,isPressed:M=>e.gamepadStates.get(d.index).buttonState.pressed.has(M),isDown:M=>e.gamepadStates.get(d.index).buttonState.down.has(M),isReleased:M=>e.gamepadStates.get(d.index).buttonState.released.has(M),getStick:M=>e.gamepadStates.get(d.index).stickState.get(M)};return e.gamepads.push(y),e.gamepadStates.set(d.index,{buttonState:new zr,stickState:new Map([["left",new b(0)],["right",new b(0)]])}),y}o(St,"registerGamepad");function $(d){e.gamepads=e.gamepads.filter(y=>y.index!==d.index),e.gamepadStates.delete(d.index)}o($,"removeGamepad");function Ne(){for(let d of navigator.getGamepads())d&&!e.gamepadStates.has(d.index)&&St(d);for(let d of e.gamepads){let y=navigator.getGamepads()[d.index],M=(r.gamepads??{})[y.id]??Ws[y.id]??Ws.default,H=e.gamepadStates.get(d.index);for(let z=0;z{let y=new b(d.offsetX,d.offsetY),M=new b(d.movementX,d.movementY);if(we()){let H=e.canvas.width/Ue,z=e.canvas.height/Ue,de=window.innerWidth,Se=window.innerHeight,$t=de/Se,er=H/z;if($t>er){let ke=Se/z,Re=(de-H*ke)/2;y.x=$e(d.offsetX-Re,0,H*ke,0,H),y.y=$e(d.offsetY,0,z*ke,0,z)}else{let ke=de/H,Re=(Se-z*ke)/2;y.x=$e(d.offsetX,0,H*ke,0,H),y.y=$e(d.offsetY-Re,0,z*ke,0,z)}}e.events.onOnce("input",()=>{e.isMouseMoved=true,e.mousePos=y,e.mouseDeltaPos=M,e.events.trigger("mouseMove")})};let Je=["left","middle","right","back","forward"];se.mousedown=d=>{e.events.onOnce("input",()=>{let y=Je[d.button];y&&(e.mouseState.press(y),e.events.trigger("mousePress",y))})},se.mouseup=d=>{e.events.onOnce("input",()=>{let y=Je[d.button];y&&(e.mouseState.release(y),e.events.trigger("mouseRelease",y))})};let Ir=new Set([" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab"]),qe={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"," ":"space"};se.keydown=d=>{Ir.has(d.key)&&d.preventDefault(),e.events.onOnce("input",()=>{let y=qe[d.key]||d.key.toLowerCase();y.length===1?(e.events.trigger("charInput",y),e.charInputted.push(y)):y==="space"&&(e.events.trigger("charInput"," "),e.charInputted.push(" ")),d.repeat?(e.keyState.pressRepeat(y),e.events.trigger("keyPressRepeat",y)):(e.keyState.press(y),e.events.trigger("keyPressRepeat",y),e.events.trigger("keyPress",y))})},se.keyup=d=>{e.events.onOnce("input",()=>{let y=qe[d.key]||d.key.toLowerCase();e.keyState.release(y),e.events.trigger("keyRelease",y)})},se.touchstart=d=>{d.preventDefault(),e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.mouseState.press("left"),e.events.trigger("mousePress","left")),y.forEach(H=>{e.events.trigger("touchStart",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.touchmove=d=>{d.preventDefault(),e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.events.trigger("mouseMove")),y.forEach(H=>{e.events.trigger("touchMove",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.touchend=d=>{e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.mouseState.release("left"),e.events.trigger("mouseRelease","left")),y.forEach(H=>{e.events.trigger("touchEnd",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.touchcancel=d=>{e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.mouseState.release("left"),e.events.trigger("mouseRelease","left")),y.forEach(H=>{e.events.trigger("touchEnd",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.wheel=d=>{d.preventDefault(),e.events.onOnce("input",()=>{e.events.trigger("scroll",new b(d.deltaX,d.deltaY))})},se.contextmenu=d=>d.preventDefault(),ue.visibilitychange=()=>{document.visibilityState==="visible"?(e.skipTime=true,e.events.trigger("show")):e.events.trigger("hide")},he.gamepadconnected=d=>{let y=St(d.gamepad);e.events.onOnce("input",()=>{e.events.trigger("gamepadConnect",y)})},he.gamepaddisconnected=d=>{let y=bt().filter(M=>M.index===d.gamepad.index)[0];$(d.gamepad),e.events.onOnce("input",()=>{e.events.trigger("gamepadDisconnect",y)})};for(let d in se)e.canvas.addEventListener(d,se[d]);for(let d in ue)document.addEventListener(d,ue[d]);for(let d in he)window.addEventListener(d,he[d]);let ve=new ResizeObserver(d=>{for(let y of d)if(y.target===e.canvas){if(e.lastWidth===e.canvas.offsetWidth&&e.lastHeight===e.canvas.offsetHeight)return;e.lastWidth=e.canvas.offsetWidth,e.lastHeight=e.canvas.offsetHeight,e.events.onOnce("input",()=>{e.events.trigger("resize")})}});return ve.observe(e.canvas),{dt:n,time:l,run:G,canvas:e.canvas,fps:f,numFrames:p,quit:re,setFullscreen:W,isFullscreen:we,setCursor:D,screenshot:T,getGamepads:bt,getCursor:L,setCursorLocked:v,isCursorLocked:X,isTouchscreen:pe,mousePos:R,mouseDeltaPos:Pe,isKeyDown:mt,isKeyPressed:ze,isKeyPressedRepeat:Ot,isKeyReleased:wt,isMouseDown:be,isMousePressed:Y,isMouseReleased:Ae,isMouseMoved:Ve,isGamepadButtonPressed:At,isGamepadButtonDown:Oe,isGamepadButtonReleased:qt,getGamepadStick:Fe,charInputted:st,onResize:Ht,onKeyDown:Br,onKeyPress:Tr,onKeyPressRepeat:Pr,onKeyRelease:Fr,onMouseDown:Yt,onMousePress:Kt,onMouseRelease:jt,onMouseMove:Vt,onCharInput:vt,onTouchStart:Qt,onTouchMove:tt,onTouchEnd:zt,onScroll:Jt,onHide:yt,onShow:Xt,onGamepadButtonDown:xt,onGamepadButtonPress:Et,onGamepadButtonRelease:Wt,onGamepadStick:rt,onGamepadConnect:Zt,onGamepadDisconnect:it,events:e.events}},"default");var Lt;var ut=(Lt=class{constructor(e,n,l,f={}){E(this,"ctx");E(this,"src",null);E(this,"glTex");E(this,"width");E(this,"height");this.ctx=e;let p=e.gl;this.glTex=e.gl.createTexture(),e.onDestroy(()=>this.free()),this.width=n,this.height=l;let T={linear:p.LINEAR,nearest:p.NEAREST}[f.filter??e.opts.texFilter]??p.NEAREST,D={repeat:p.REPEAT,clampToEadge:p.CLAMP_TO_EDGE}[f.wrap]??p.CLAMP_TO_EDGE;this.bind(),n&&l&&p.texImage2D(p.TEXTURE_2D,0,p.RGBA,n,l,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,T),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,T),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,D),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,D),this.unbind()}static fromImage(e,n,l={}){let f=new Lt(e,n.width,n.height,l);return f.update(n),f.src=n,f}update(e,n=0,l=0){let f=this.ctx.gl;this.bind(),f.texSubImage2D(f.TEXTURE_2D,0,n,l,f.RGBA,f.UNSIGNED_BYTE,e),this.unbind()}bind(){this.ctx.pushTexture2D(this.glTex)}unbind(){this.ctx.popTexture2D()}free(){this.ctx.gl.deleteTexture(this.glTex)}},o(Lt,"Texture"),Lt);var Er;var Or=(Er=class{constructor(e,n,l,f={}){E(this,"ctx");E(this,"tex");E(this,"glFramebuffer");E(this,"glRenderbuffer");this.ctx=e;let p=e.gl;e.onDestroy(()=>this.free()),this.tex=new ut(e,n,l,f),this.glFramebuffer=p.createFramebuffer(),this.glRenderbuffer=p.createRenderbuffer(),this.bind(),p.renderbufferStorage(p.RENDERBUFFER,p.DEPTH_STENCIL,n,l),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,this.tex.glTex,0),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.DEPTH_STENCIL_ATTACHMENT,p.RENDERBUFFER,this.glRenderbuffer),this.unbind()}get width(){return this.tex.width}get height(){return this.tex.height}toImageData(){let e=this.ctx.gl,n=new Uint8ClampedArray(this.width*this.height*4);this.bind(),e.readPixels(0,0,this.width,this.height,e.RGBA,e.UNSIGNED_BYTE,n),this.unbind();let l=this.width*4,f=new Uint8Array(l);for(let p=0;p<(this.height/2|0);p++){let T=p*l,D=(this.height-p-1)*l;f.set(n.subarray(T,T+l)),n.copyWithin(T,D,D+l),n.set(f,D)}return new ImageData(n,this.width,this.height)}toDataURL(){let e=document.createElement("canvas"),n=e.getContext("2d");return e.width=this.width,e.height=this.height,n.putImageData(this.toImageData(),0,0),e.toDataURL()}draw(e){this.bind(),e(),this.unbind()}bind(){this.ctx.pushFramebuffer(this.glFramebuffer),this.ctx.pushRenderbuffer(this.glRenderbuffer),this.ctx.pushViewport({x:0,y:0,w:this.width,h:this.height})}unbind(){this.ctx.popFramebuffer(),this.ctx.popRenderbuffer(),this.ctx.popViewport()}free(){let e=this.ctx.gl;e.deleteFramebuffer(this.glFramebuffer),e.deleteRenderbuffer(this.glRenderbuffer),this.tex.free()}},o(Er,"FrameBuffer"),Er);var br;var Eo=(br=class{constructor(e,n,l,f){E(this,"ctx");E(this,"glProgram");this.ctx=e,e.onDestroy(()=>this.free());let p=e.gl,T=p.createShader(p.VERTEX_SHADER),D=p.createShader(p.FRAGMENT_SHADER);p.shaderSource(T,n),p.shaderSource(D,l),p.compileShader(T),p.compileShader(D);let L=p.createProgram();if(this.glProgram=L,p.attachShader(L,T),p.attachShader(L,D),f.forEach((v,X)=>p.bindAttribLocation(L,X,v)),p.linkProgram(L),!p.getProgramParameter(L,p.LINK_STATUS)){let v=p.getShaderInfoLog(T);if(v)throw new Error("VERTEX SHADER "+v);let X=p.getShaderInfoLog(D);if(X)throw new Error("FRAGMENT SHADER "+X)}p.deleteShader(T),p.deleteShader(D)}bind(){this.ctx.pushProgram(this.glProgram)}unbind(){this.ctx.popProgram()}send(e){let n=this.ctx.gl;for(let l in e){let f=e[l],p=n.getUniformLocation(this.glProgram,l);typeof f=="number"?n.uniform1f(p,f):f instanceof Le?n.uniformMatrix4fv(p,false,new Float32Array(f.m)):f instanceof te?n.uniform3f(p,f.r,f.g,f.b):f instanceof b&&n.uniform2f(p,f.x,f.y)}}free(){this.ctx.gl.deleteProgram(this.glProgram)}},o(br,"Shader"),br);var Sr;var bo=(Sr=class{constructor(e,n,l,f){E(this,"ctx");E(this,"glVBuf");E(this,"glIBuf");E(this,"vqueue",[]);E(this,"iqueue",[]);E(this,"stride");E(this,"maxVertices");E(this,"maxIndices");E(this,"vertexFormat");E(this,"numDraws",0);E(this,"curPrimitive",null);E(this,"curTex",null);E(this,"curShader",null);E(this,"curUniform",{});let p=e.gl;this.vertexFormat=n,this.ctx=e,this.stride=n.reduce((T,D)=>T+D.size,0),this.maxVertices=l,this.maxIndices=f,this.glVBuf=p.createBuffer(),e.pushArrayBuffer(this.glVBuf),p.bufferData(p.ARRAY_BUFFER,l*4,p.DYNAMIC_DRAW),e.popArrayBuffer(),this.glIBuf=p.createBuffer(),e.pushElementArrayBuffer(this.glIBuf),p.bufferData(p.ELEMENT_ARRAY_BUFFER,f*4,p.DYNAMIC_DRAW),e.popElementArrayBuffer()}push(e,n,l,f,p=null,T={}){(e!==this.curPrimitive||p!==this.curTex||f!==this.curShader||!Wr(this.curUniform,T)||this.vqueue.length+n.length*this.stride>this.maxVertices||this.iqueue.length+l.length>this.maxIndices)&&this.flush();let D=this.vqueue.length/this.stride;for(let L of n)this.vqueue.push(L);for(let L of l)this.iqueue.push(L+D);this.curPrimitive=e,this.curShader=f,this.curTex=p,this.curUniform=T}flush(){var n,l;if(!this.curPrimitive||!this.curShader||this.vqueue.length===0||this.iqueue.length===0)return;let e=this.ctx.gl;this.ctx.pushArrayBuffer(this.glVBuf),e.bufferSubData(e.ARRAY_BUFFER,0,new Float32Array(this.vqueue)),this.ctx.pushElementArrayBuffer(this.glIBuf),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,new Uint16Array(this.iqueue)),this.ctx.setVertexFormat(this.vertexFormat),this.curShader.bind(),this.curShader.send(this.curUniform),(n=this.curTex)==null?void 0:n.bind(),e.drawElements(this.curPrimitive,this.iqueue.length,e.UNSIGNED_SHORT,0),(l=this.curTex)==null?void 0:l.unbind(),this.curShader.unbind(),this.ctx.popArrayBuffer(),this.ctx.popElementArrayBuffer(),this.vqueue=[],this.iqueue=[],this.numDraws++}free(){let e=this.ctx.gl;e.deleteBuffer(this.glVBuf),e.deleteBuffer(this.glIBuf)}},o(Sr,"BatchRenderer"),Sr);function _e(r){let e=[],n=o(p=>{e.push(p),r(p)},"push"),l=o(()=>{e.pop(),r(f()??null)},"pop"),f=o(()=>e[e.length-1],"cur");return[n,l,f]}o(_e,"genStack");function Nn(r,e={}){let n=[];function l(Y){n.push(Y)}o(l,"onDestroy");function f(){n.forEach(Y=>Y()),r.getExtension("WEBGL_lose_context").loseContext()}o(f,"destroy");let p=null;function T(Y){if(Wr(Y,p))return;p=Y;let be=Y.reduce((Ae,Ve)=>Ae+Ve.size,0);Y.reduce((Ae,Ve,ze)=>(r.vertexAttribPointer(ze,Ve.size,r.FLOAT,false,be*4,Ae),r.enableVertexAttribArray(ze),Ae+Ve.size*4),0)}o(T,"setVertexFormat");let[D,L]=_e(Y=>r.bindTexture(r.TEXTURE_2D,Y)),[v,X]=_e(Y=>r.bindBuffer(r.ARRAY_BUFFER,Y)),[S,Q]=_e(Y=>r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,Y)),[x,W]=_e(Y=>r.bindFramebuffer(r.FRAMEBUFFER,Y)),[we,re]=_e(Y=>r.bindRenderbuffer(r.RENDERBUFFER,Y)),[G,pe]=_e(({x:Y,y:be,w:Ae,h:Ve})=>{r.viewport(Y,be,Ae,Ve)}),[R,Pe]=_e(Y=>r.useProgram(Y));return G({x:0,y:0,w:r.drawingBufferWidth,h:r.drawingBufferHeight}),{gl:r,opts:e,onDestroy:l,destroy:f,pushTexture2D:D,popTexture2D:L,pushArrayBuffer:v,popArrayBuffer:X,pushElementArrayBuffer:S,popElementArrayBuffer:Q,pushFramebuffer:x,popFramebuffer:W,pushRenderbuffer:we,popRenderbuffer:re,pushViewport:G,popViewport:pe,pushProgram:R,popProgram:Pe,setVertexFormat:T}}o(Nn,"initGfx");var Gt;var Ie=(Gt=class{constructor(e){E(this,"loaded",false);E(this,"data",null);E(this,"error",null);E(this,"onLoadEvents",new De);E(this,"onErrorEvents",new De);E(this,"onFinishEvents",new De);e.then(n=>{this.data=n,this.onLoadEvents.trigger(n)}).catch(n=>{if(this.error=n,this.onErrorEvents.numListeners()>0)this.onErrorEvents.trigger(n);else throw n}).finally(()=>{this.onFinishEvents.trigger(),this.loaded=true})}static loaded(e){let n=new Gt(Promise.resolve(e));return n.data=e,n.loaded=true,n}onLoad(e){return this.loaded&&this.data?e(this.data):this.onLoadEvents.add(e),this}onError(e){return this.loaded&&this.error?e(this.error):this.onErrorEvents.add(e),this}onFinish(e){return this.loaded?e():this.onFinishEvents.add(e),this}then(e){return this.onLoad(e)}catch(e){return this.onError(e)}finally(e){return this.onFinish(e)}},o(Gt,"Asset"),Gt);var Rr;var Tt=(Rr=class{constructor(){E(this,"assets",new Map);E(this,"lastUID",0)}add(e,n){let l=e??this.lastUID+++"",f=new Ie(n);return this.assets.set(l,f),f}addLoaded(e,n){let l=e??this.lastUID+++"",f=Ie.loaded(n);return this.assets.set(l,f),f}get(e){return this.assets.get(e)}progress(){if(this.assets.size===0)return 1;let e=0;return this.assets.forEach(n=>{n.loaded&&e++}),e/this.assets.size}},o(Rr,"AssetBucket"),Rr);function $r(r){return fetch(r).then(e=>{if(!e.ok)throw new Error(`Failed to fetch "${r}"`);return e})}o($r,"fetchURL");function cr(r){return $r(r).then(e=>e.json())}o(cr,"fetchJSON");function Un(r){return $r(r).then(e=>e.text())}o(Un,"fetchText");function Ln(r){return $r(r).then(e=>e.arrayBuffer())}o(Ln,"fetchArrayBuffer");function dr(r){let e=new Image;return e.crossOrigin="anonymous",e.src=r,new Promise((n,l)=>{e.onload=()=>n(e),e.onerror=()=>l(new Error(`Failed to load image from "${r}"`))})}o(dr,"loadImg");var qr=2.5949095;var Zs=1.70158+1;var _s=2*Math.PI/3;var $s=2*Math.PI/4.5;var Jr={linear:r=>r,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInQuad:r=>r*r,easeOutQuad:r=>1-(1-r)*(1-r),easeInOutQuad:r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>Zs*r*r*r-1.70158*r*r,easeOutBack:r=>1+Zs*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>r<.5?Math.pow(2*r,2)*((qr+1)*2*r-qr)/2:(Math.pow(2*r-2,2)*((qr+1)*(r*2-2)+qr)+2)/2,easeInElastic:r=>r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*_s),easeOutElastic:r=>r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*_s)+1,easeInOutElastic:r=>r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*$s))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*$s)/2+1,easeInBounce:r=>1-Jr.easeOutBounce(1-r),easeOutBounce:r=>r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375,easeInOutBounce:r=>r<.5?(1-Jr.easeOutBounce(1-2*r))/2:(1+Jr.easeOutBounce(2*r-1))/2};var Hr=Jr;var Mr;var So=(Mr=class{constructor(e,n,l){E(this,"textures",[]);E(this,"canvas");E(this,"c2d");E(this,"x",0);E(this,"y",0);E(this,"curHeight",0);E(this,"gfx");this.gfx=e,this.canvas=document.createElement("canvas"),this.canvas.width=n,this.canvas.height=l,this.textures=[ut.fromImage(e,this.canvas)],this.c2d=this.canvas.getContext("2d")}add(e){if(e.width>this.canvas.width||e.height>this.canvas.height)throw new Error(`Texture size (${e.width} x ${e.height}) exceeds limit (${this.canvas.width} x ${this.canvas.height})`);this.x+e.width>this.canvas.width&&(this.x=0,this.y+=this.curHeight,this.curHeight=0),this.y+e.height>this.canvas.height&&(this.c2d.clearRect(0,0,this.canvas.width,this.canvas.height),this.textures.push(ut.fromImage(this.gfx,this.canvas)),this.x=0,this.y=0,this.curHeight=0);let n=this.textures[this.textures.length-1],l=new b(this.x,this.y);return this.x+=e.width,e.height>this.curHeight&&(this.curHeight=e.height),e instanceof ImageData?this.c2d.putImageData(e,l.x,l.y):this.c2d.drawImage(e,l.x,l.y),n.update(this.canvas),[n,new me(l.x/this.canvas.width,l.y/this.canvas.height,e.width/this.canvas.width,e.height/this.canvas.height)]}free(){for(let e of this.textures)e.free()}},o(Mr,"TexPacker"),Mr);var Ro="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAA1CAYAAADyMeOEAAAAAXNSR0IArs4c6QAAAoVJREFUaIHdm7txwkAQhheGAqACiCHzOKQDQrqgILpwSAeEDBnEUAF0gCMxZ7G72qce/mec2Lpf9+3unaS78wgSNZ8uX5729+d1FNWXUuGmXlBOUUEIMckEpeQJgBu6C+BSFngztBR2vd+ovY+7g+p6LbgaWgJrAeUkDYIUXgXdBBwNi6kpABJwMTQH3AZsXRR8GHTfgEth8E3gjdAUcNewpbTgY85sCMCUuOokozE0YM0YRzM9NGAAXd8+omAF5h4lnmBRvpSnZHyLoLEbaN+aKB9KWv/KWw0tAbbANnlG+UvB2dm77NxxdwgBpjrF/d7rW9cbmpvio2A5z8iAYpVU8pGZlo6/2+MSco2lHfd3rv9jAP038e1xef9o2mjvYb2OqpqKE81028/jeietlSEVO5FRWsxWsJit1G3aFpW8iWe5RwpiCZAk25QvV6nz6fIlynRGuTd5WqpJ4guAlDfVKBK87hXljflgv1ON6fV+4+5gVlA17SfeG0heKqQd4l4jI/wrmaA9N9R4ar+wpHJDZyrrfcH0nB66PqAzPi76pn+faSyJk/vzOorYhGurQrzj/P68jtBMawHaHBIR9xoD5O34dy0qQOSYHvqExq2TpT2nf76+w7y251OYF0CRaU+J920TwLUa6inx6OxE6g80lu2ux7Y2eJLF/rCXE6zEPdnenk9o+4ih9AEdnW2q81HXl5LuU6OTl2fXUhqganbXAGq3g6jJOWV/OnoesO6YqqEB/GdNsjf7uHtwj2DzmRNpp7iOZfm6D9oAxB6Yi1gC4oIYeo4MIPdopEQRB+cAko5J1tW386HpB2Kz1eop4Epdwls/kgZ1sh8gZsEjdcWkr//D8Qu3Z3l5Nl1NtAAAAABJRU5ErkJggg==";var Mo=ho("SUQzBAAAAAAAI1RTU0U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J5qQb1me1gLMJLKM93wY9cVETYiGkphmg+RETFhJljY2LHICQB/uchI1AXxwlRMxAfwgrYVtUHvxwk1OoiaAL8MjJ2ICtOEip1q6APnJEBS6VwiRzp4vtM5YBvf3m/EeI8DyvUZK33z4+v1bqsZ7dN+3n2W6zwgMO44hY0X1vIqkXh419x7lXh9ds8oyviFyRqmcXrxf2FUtF89ymFkG6nI2p7WZB4FGvUWfLcVt4ahsdy+TR7ifz6lc0F5v0GfalmXldpE3esrr6PrTR84sjNjS4kpQhQhaUi4lD6KR1xK9DHupfoKoR02vSFDy9FWNoKVivv1/lG7OfZkqR043OZUbWgmtFaomaGl51ZTHCnFv5bqNnFGjZvRtEFUEHSHmI1ZHWgVBXZ5+sxvX7ANlPChpjKsknSllKaPlRU4nZo0Yjq6wiIJGFPMML2mj3M8ZRRe4QkzF6FhCJEFbBn4i0iKswn11yenZiLLKeMRqQdWiZSmlkqrcV9d0gPfksAcqBW+2ZqAoq5gZGSrnTtGwlVmCIqUepxWxerj7iIyNZ7SgiKmJhJw7NJpRgiKmLuHl3KnReA4UIaU+y+WkcbzHQ1DEzMGQ9aJH0BDK6RE0y9wlTDp2HuppERQxc0FFBaZGUMTMB5UlQG/fHyk1odJEaBUUMXWh4oSoFRQxtaHyxMi2uBseQwUKciUoYuaAShTlkaCImQcqUph7QREzF/8DSS/2GZ2/N/sAAAAASUVORK5CYII=";var Po="3000.1.17";var en=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";var Yr="topleft";var tn=64;var Fo="monospace";var Kr="monospace";var Io=36;var jr=64;var Qr=256;var rn=2048;var sn=2048;var nn=2048;var on=2048;var an=.1;var ko=64;var xi="linear";var Co=8;var Do=4;var Ti=[{name:"a_pos",size:2},{name:"a_uv",size:2},{name:"a_color",size:4}];var No=Ti.reduce((r,e)=>r+e.size,0);var Gn=2048;var Uo=Gn*4*No;var Lo=Gn*6;var Go=` +var no=Object.defineProperty;var oo=(r,e,n)=>e in r?no(r,e,{enumerable:true,configurable:true,writable:true,value:n}):r[e]=n;var E=(r,e,n)=>{oo(r,typeof e!=="symbol"?e+"":e,n);return n};(function r(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload")){return}for(const f of document.querySelectorAll('link[rel="modulepreload"]')){l(f)}new MutationObserver(f=>{for(const p of f){if(p.type!=="childList"){continue}for(const T of p.addedNodes){if(T.tagName==="LINK"&&T.rel==="modulepreload")l(T)}}}).observe(document,{childList:true,subtree:true});function n(f){const p={};if(f.integrity)p.integrity=f.integrity;if(f.referrerPolicy)p.referrerPolicy=f.referrerPolicy;if(f.crossOrigin==="use-credentials")p.credentials="include";else if(f.crossOrigin==="anonymous")p.credentials="omit";else p.credentials="same-origin";return p}function l(f){if(f.ep)return;f.ep=true;const p=n(f);fetch(f.href,p)}})();var ao=Object.defineProperty;var o=(r,e)=>ao(r,"name",{value:e,configurable:true});var ho=(()=>{for(var r=new Uint8Array(128),e=0;e<64;e++)r[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return n=>{for(var l=n.length,f=new Uint8Array((l-(n[l-1]=="=")-(n[l-2]=="="))*3/4|0),p=0,T=0;p>4,f[T++]=L<<4|v>>2,f[T++]=v<<6|X}return f}})();function Ge(r){return r*Math.PI/180}o(Ge,"deg2rad");function Ct(r){return r*180/Math.PI}o(Ct,"rad2deg");function je(r,e,n){return e>n?je(r,n,e):Math.min(Math.max(r,e),n)}o(je,"clamp");function Qe(r,e,n){if(typeof r=="number"&&typeof e=="number")return r+(e-r)*n;if(r instanceof b&&e instanceof b)return r.lerp(e,n);if(r instanceof te&&e instanceof te)return r.lerp(e,n);throw new Error(`Bad value for lerp(): ${r}, ${e}. Only number, Vec2 and Color is supported.`)}o(Qe,"lerp");function $e(r,e,n,l,f){return l+(r-e)/(n-e)*(f-l)}o($e,"map");function dn(r,e,n,l,f){return je($e(r,e,n,l,f),l,f)}o(dn,"mapc");var ae;var b=(ae=class{constructor(e=0,n=e){E(this,"x",0);E(this,"y",0);this.x=e,this.y=n}static fromAngle(e){let n=Ge(e);return new ae(Math.cos(n),Math.sin(n))}clone(){return new ae(this.x,this.y)}add(...e){let n=B(...e);return new ae(this.x+n.x,this.y+n.y)}sub(...e){let n=B(...e);return new ae(this.x-n.x,this.y-n.y)}scale(...e){let n=B(...e);return new ae(this.x*n.x,this.y*n.y)}dist(...e){let n=B(...e);return this.sub(n).len()}sdist(...e){let n=B(...e);return this.sub(n).slen()}len(){return Math.sqrt(this.dot(this))}slen(){return this.dot(this)}unit(){let e=this.len();return e===0?new ae(0):this.scale(1/e)}normal(){return new ae(this.y,-this.x)}reflect(e){return this.sub(e.scale(2*this.dot(e)))}project(e){return e.scale(e.dot(this)/e.len())}reject(e){return this.sub(this.project(e))}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(...e){let n=B(...e);return Ct(Math.atan2(this.y-n.y,this.x-n.x))}angleBetween(...e){let n=B(...e);return Ct(Math.atan2(this.cross(n),this.dot(n)))}lerp(e,n){return new ae(Qe(this.x,e.x,n),Qe(this.y,e.y,n))}slerp(e,n){let l=this.dot(e),f=this.cross(e),p=Math.atan2(f,l);return this.scale(Math.sin((1-n)*p)).add(e.scale(Math.sin(n*p))).scale(1/f)}isZero(){return this.x===0&&this.y===0}toFixed(e){return new ae(Number(this.x.toFixed(e)),Number(this.y.toFixed(e)))}transform(e){return e.multVec2(this)}eq(e){return this.x===e.x&&this.y===e.y}bbox(){return new Ee(this,0,0)}toString(){return`vec2(${this.x.toFixed(2)}, ${this.y.toFixed(2)})`}},o(ae,"Vec2"),E(ae,"LEFT",new ae(-1,0)),E(ae,"RIGHT",new ae(1,0)),E(ae,"UP",new ae(0,-1)),E(ae,"DOWN",new ae(0,1)),ae);function B(...r){if(r.length===1){if(r[0]instanceof b)return new b(r[0].x,r[0].y);if(Array.isArray(r[0])&&r[0].length===2)return new b(...r[0])}return new b(...r)}o(B,"vec2");var J;var te=(J=class{constructor(e,n,l){E(this,"r",255);E(this,"g",255);E(this,"b",255);this.r=je(e,0,255),this.g=je(n,0,255),this.b=je(l,0,255)}static fromArray(e){return new J(e[0],e[1],e[2])}static fromHex(e){if(typeof e=="number")return new J(e>>16&255,e>>8&255,e>>0&255);if(typeof e=="string"){let n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return new J(parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16))}else throw new Error("Invalid hex color format")}static fromHSL(e,n,l){if(n==0)return new J(255*l,255*l,255*l);let f=o((X,S,Q)=>(Q<0&&(Q+=1),Q>1&&(Q-=1),Q<1/6?X+(S-X)*6*Q:Q<1/2?S:Q<2/3?X+(S-X)*(2/3-Q)*6:X),"hue2rgb"),p=l<.5?l*(1+n):l+n-l*n,T=2*l-p,D=f(T,p,e+1/3),L=f(T,p,e),v=f(T,p,e-1/3);return new J(Math.round(D*255),Math.round(L*255),Math.round(v*255))}clone(){return new J(this.r,this.g,this.b)}lighten(e){return new J(this.r+e,this.g+e,this.b+e)}darken(e){return this.lighten(-e)}invert(){return new J(255-this.r,255-this.g,255-this.b)}mult(e){return new J(this.r*e.r/255,this.g*e.g/255,this.b*e.b/255)}lerp(e,n){return new J(Qe(this.r,e.r,n),Qe(this.g,e.g,n),Qe(this.b,e.b,n))}toHSL(){let e=this.r/255,n=this.g/255,l=this.b/255,f=Math.max(e,n,l),p=Math.min(e,n,l),T=(f+p)/2,D=T,L=T;if(f==p)T=D=0;else{let v=f-p;switch(D=L>.5?v/(2-f-p):v/(f+p),f){case e:T=(n-l)/v+(nte.fromHSL(r,e,n),"hsl2rgb");var ct;var me=(ct=class{constructor(e,n,l,f){E(this,"x",0);E(this,"y",0);E(this,"w",1);E(this,"h",1);this.x=e,this.y=n,this.w=l,this.h=f}scale(e){return new ct(this.x+this.w*e.x,this.y+this.h*e.y,this.w*e.w,this.h*e.h)}pos(){return new b(this.x,this.y)}clone(){return new ct(this.x,this.y,this.w,this.h)}eq(e){return this.x===e.x&&this.y===e.y&&this.w===e.w&&this.h===e.h}toString(){return`quad(${this.x}, ${this.y}, ${this.w}, ${this.h})`}},o(ct,"Quad"),ct);function le(r,e,n,l){return new me(r,e,n,l)}o(le,"quad");var Be;var Le=(Be=class{constructor(e){E(this,"m",[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);e&&(this.m=e)}static translate(e){return new Be([1,0,0,0,0,1,0,0,0,0,1,0,e.x,e.y,0,1])}static scale(e){return new Be([e.x,0,0,0,0,e.y,0,0,0,0,1,0,0,0,0,1])}static rotateX(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e);return new Be([1,0,0,0,0,n,-l,0,0,l,n,0,0,0,0,1])}static rotateY(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e);return new Be([n,0,l,0,0,1,0,0,-l,0,n,0,0,0,0,1])}static rotateZ(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e);return new Be([n,-l,0,0,l,n,0,0,0,0,1,0,0,0,0,1])}translate(e){return this.m[12]+=this.m[0]*e.x+this.m[4]*e.y,this.m[13]+=this.m[1]*e.x+this.m[5]*e.y,this.m[14]+=this.m[2]*e.x+this.m[6]*e.y,this.m[15]+=this.m[3]*e.x+this.m[7]*e.y,this}scale(e){return this.m[0]*=e.x,this.m[4]*=e.y,this.m[1]*=e.x,this.m[5]*=e.y,this.m[2]*=e.x,this.m[6]*=e.y,this.m[3]*=e.x,this.m[7]*=e.y,this}rotate(e){e=Ge(-e);let n=Math.cos(e),l=Math.sin(e),f=this.m[0],p=this.m[1],T=this.m[4],D=this.m[5];return this.m[0]=f*n+p*l,this.m[1]=-f*l+p*n,this.m[4]=T*n+D*l,this.m[5]=-T*l+D*n,this}mult(e){let n=[];for(let l=0;l<4;l++)for(let f=0;f<4;f++)n[l*4+f]=this.m[0*4+f]*e.m[l*4+0]+this.m[1*4+f]*e.m[l*4+1]+this.m[2*4+f]*e.m[l*4+2]+this.m[3*4+f]*e.m[l*4+3];return new Be(n)}multVec2(e){return new b(e.x*this.m[0]+e.y*this.m[4]+this.m[12],e.x*this.m[1]+e.y*this.m[5]+this.m[13])}getTranslation(){return new b(this.m[12],this.m[13])}getScale(){if(this.m[0]!=0||this.m[1]!=0){let e=this.m[0]*this.m[5]-this.m[1]*this.m[4],n=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return new b(n,e/n)}else if(this.m[4]!=0||this.m[5]!=0){let e=this.m[0]*this.m[5]-this.m[1]*this.m[4],n=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return new b(e/n,n)}else return new b(0,0)}getRotation(){if(this.m[0]!=0||this.m[1]!=0){let e=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return Ct(this.m[1]>0?Math.acos(this.m[0]/e):-Math.acos(this.m[0]/e))}else if(this.m[4]!=0||this.m[5]!=0){let e=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return Ct(Math.PI/2-(this.m[5]>0?Math.acos(-this.m[4]/e):-Math.acos(this.m[4]/e)))}else return 0}getSkew(){if(this.m[0]!=0||this.m[1]!=0){let e=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return new b(Math.atan(this.m[0]*this.m[4]+this.m[1]*this.m[5])/(e*e),0)}else if(this.m[4]!=0||this.m[5]!=0){let e=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return new b(0,Math.atan(this.m[0]*this.m[4]+this.m[1]*this.m[5])/(e*e))}else return new b(0,0)}invert(){let e=[],n=this.m[10]*this.m[15]-this.m[14]*this.m[11],l=this.m[9]*this.m[15]-this.m[13]*this.m[11],f=this.m[9]*this.m[14]-this.m[13]*this.m[10],p=this.m[8]*this.m[15]-this.m[12]*this.m[11],T=this.m[8]*this.m[14]-this.m[12]*this.m[10],D=this.m[8]*this.m[13]-this.m[12]*this.m[9],L=this.m[6]*this.m[15]-this.m[14]*this.m[7],v=this.m[5]*this.m[15]-this.m[13]*this.m[7],X=this.m[5]*this.m[14]-this.m[13]*this.m[6],S=this.m[4]*this.m[15]-this.m[12]*this.m[7],Q=this.m[4]*this.m[14]-this.m[12]*this.m[6],x=this.m[5]*this.m[15]-this.m[13]*this.m[7],W=this.m[4]*this.m[13]-this.m[12]*this.m[5],we=this.m[6]*this.m[11]-this.m[10]*this.m[7],re=this.m[5]*this.m[11]-this.m[9]*this.m[7],G=this.m[5]*this.m[10]-this.m[9]*this.m[6],pe=this.m[4]*this.m[11]-this.m[8]*this.m[7],R=this.m[4]*this.m[10]-this.m[8]*this.m[6],Pe=this.m[4]*this.m[9]-this.m[8]*this.m[5];e[0]=this.m[5]*n-this.m[6]*l+this.m[7]*f,e[4]=-(this.m[4]*n-this.m[6]*p+this.m[7]*T),e[8]=this.m[4]*l-this.m[5]*p+this.m[7]*D,e[12]=-(this.m[4]*f-this.m[5]*T+this.m[6]*D),e[1]=-(this.m[1]*n-this.m[2]*l+this.m[3]*f),e[5]=this.m[0]*n-this.m[2]*p+this.m[3]*T,e[9]=-(this.m[0]*l-this.m[1]*p+this.m[3]*D),e[13]=this.m[0]*f-this.m[1]*T+this.m[2]*D,e[2]=this.m[1]*L-this.m[2]*v+this.m[3]*X,e[6]=-(this.m[0]*L-this.m[2]*S+this.m[3]*Q),e[10]=this.m[0]*x-this.m[1]*S+this.m[3]*W,e[14]=-(this.m[0]*X-this.m[1]*Q+this.m[2]*W),e[3]=-(this.m[1]*we-this.m[2]*re+this.m[3]*G),e[7]=this.m[0]*we-this.m[2]*pe+this.m[3]*R,e[11]=-(this.m[0]*re-this.m[1]*pe+this.m[3]*Pe),e[15]=this.m[0]*G-this.m[1]*R+this.m[2]*Pe;let Y=this.m[0]*e[0]+this.m[1]*e[4]+this.m[2]*e[8]+this.m[3]*e[12];for(let be=0;be<4;be++)for(let Ae=0;Ae<4;Ae++)e[be*4+Ae]*=1/Y;return new Be(e)}clone(){return new Be([...this.m])}toString(){return this.m.toString()}},o(Be,"Mat4"),Be);function Si(r,e,n,l=f=>-Math.cos(f)){return r+(l(n)+1)/2*(e-r)}o(Si,"wave");var uo=1103515245;var co=12345;var Js=2147483648;var gr;var fn=(gr=class{constructor(e){E(this,"seed");this.seed=e}gen(){return this.seed=(uo*this.seed+co)%Js,this.seed/Js}genNumber(e,n){return e+this.gen()*(n-e)}genVec2(e,n){return new b(this.genNumber(e.x,n.x),this.genNumber(e.y,n.y))}genColor(e,n){return new te(this.genNumber(e.r,n.r),this.genNumber(e.g,n.g),this.genNumber(e.b,n.b))}genAny(...e){if(e.length===0)return this.gen();if(e.length===1){if(typeof e[0]=="number")return this.genNumber(0,e[0]);if(e[0]instanceof b)return this.genVec2(B(0,0),e[0]);if(e[0]instanceof te)return this.genColor(Z(0,0,0),e[0])}else if(e.length===2){if(typeof e[0]=="number"&&typeof e[1]=="number")return this.genNumber(e[0],e[1]);if(e[0]instanceof b&&e[1]instanceof b)return this.genVec2(e[0],e[1]);if(e[0]instanceof te&&e[1]instanceof te)return this.genColor(e[0],e[1])}}},o(gr,"RNG"),gr);var Ri=new fn(Date.now());function pn(r){return r!=null&&(Ri.seed=r),Ri.seed}o(pn,"randSeed");function fr(...r){return Ri.genAny(...r)}o(fr,"rand");function Pi(...r){return Math.floor(fr(...r))}o(Pi,"randi");function gn(r){return fr()<=r}o(gn,"chance");function mn(r){return r[Pi(r.length)]}o(mn,"choose");function wn(r,e){return r.pos.x+r.width>e.pos.x&&r.pos.xe.pos.y&&r.pos.y1||f<0||f>1?null:l}o(An,"testLineLineT");function Ft(r,e){let n=An(r,e);return n?B(r.p1.x+n*(r.p2.x-r.p1.x),r.p1.y+n*(r.p2.y-r.p1.y)):null}o(Ft,"testLineLine");function Vn(r,e){if(pr(r,e.p1)||pr(r,e.p2))return true;let n=r.points();return!!Ft(e,new It(n[0],n[1]))||!!Ft(e,new It(n[1],n[2]))||!!Ft(e,new It(n[2],n[3]))||!!Ft(e,new It(n[3],n[0]))}o(Vn,"testRectLine");function pr(r,e){return e.x>r.pos.x&&e.xr.pos.y&&e.yNumber.EPSILON)return false;let f=n.dot(l)/l.dot(l);return f>=0&&f<=1}o(vn,"testLinePoint");function Fi(r,e){let n=r.p2.sub(r.p1),l=n.dot(n),f=r.p1.sub(e.center),p=2*n.dot(f),T=f.dot(f)-e.radius*e.radius,D=p*p-4*l*T;if(l<=Number.EPSILON||D<0)return false;if(D==0){let L=-p/(2*l);if(L>=0&&L<=1)return true}else{let L=(-p+Math.sqrt(D))/(2*l),v=(-p-Math.sqrt(D))/(2*l);if(L>=0&&L<=1||v>=0&&v<=1)return true}return Ii(e,r.p1)}o(Fi,"testLineCircle");function Ii(r,e){return r.center.sdist(e)e.y!=l[p].y>e.y&&e.x<(l[p].x-l[f].x)*(e.y-l[f].y)/(l[p].y-l[f].y)+l[f].x&&(n=!n);return n}o(ki,"testPolygonPoint");var dt;var It=(dt=class{constructor(e,n){E(this,"p1");E(this,"p2");this.p1=e.clone(),this.p2=n.clone()}transform(e){return new dt(e.multVec2(this.p1),e.multVec2(this.p2))}bbox(){return Ee.fromPoints(this.p1,this.p2)}area(){return this.p1.dist(this.p2)}clone(){return new dt(this.p1,this.p2)}},o(dt,"Line"),dt);var ft;var Ee=(ft=class{constructor(e,n,l){E(this,"pos");E(this,"width");E(this,"height");this.pos=e.clone(),this.width=n,this.height=l}static fromPoints(e,n){return new ft(e.clone(),n.x-e.x,n.y-e.y)}center(){return new b(this.pos.x+this.width/2,this.pos.y+this.height/2)}points(){return[this.pos,this.pos.add(this.width,0),this.pos.add(this.width,this.height),this.pos.add(0,this.height)]}transform(e){return new lr(this.points().map(n=>e.multVec2(n)))}bbox(){return this.clone()}area(){return this.width*this.height}clone(){return new ft(this.pos.clone(),this.width,this.height)}distToPoint(e){return Math.sqrt(this.sdistToPoint(e))}sdistToPoint(e){let n=this.pos,l=this.pos.add(this.width,this.height),f=Math.max(n.x-e.x,0,e.x-l.x),p=Math.max(n.y-e.y,0,e.y-l.y);return f*f+p*p}},o(ft,"Rect"),ft);var Nt;var Xs=(Nt=class{constructor(e,n){E(this,"center");E(this,"radius");this.center=e.clone(),this.radius=n}transform(e){return new fo(this.center,this.radius,this.radius).transform(e)}bbox(){return Ee.fromPoints(this.center.sub(B(this.radius)),this.center.add(B(this.radius)))}area(){return this.radius*this.radius*Math.PI}clone(){return new Nt(this.center,this.radius)}},o(Nt,"Circle"),Nt);var pt;var fo=(pt=class{constructor(e,n,l){E(this,"center");E(this,"radiusX");E(this,"radiusY");this.center=e.clone(),this.radiusX=n,this.radiusY=l}transform(e){return new pt(e.multVec2(this.center),e.m[0]*this.radiusX,e.m[5]*this.radiusY)}bbox(){return Ee.fromPoints(this.center.sub(B(this.radiusX,this.radiusY)),this.center.add(B(this.radiusX,this.radiusY)))}area(){return this.radiusX*this.radiusY*Math.PI}clone(){return new pt(this.center,this.radiusX,this.radiusY)}},o(pt,"Ellipse"),pt);var gt;var lr=(gt=class{constructor(e){E(this,"pts");if(e.length<3)throw new Error("Polygons should have at least 3 vertices");this.pts=e}transform(e){return new gt(this.pts.map(n=>e.multVec2(n)))}bbox(){let e=B(Number.MAX_VALUE),n=B(-Number.MAX_VALUE);for(let l of this.pts)e.x=Math.min(e.x,l.x),n.x=Math.max(n.x,l.x),e.y=Math.min(e.y,l.y),n.y=Math.max(n.y,l.y);return Ee.fromPoints(e,n)}area(){let e=0,n=this.pts.length;for(let l=0;le.clone()))}},o(gt,"Polygon"),gt);function xn(r,e){let n=Number.MAX_VALUE,l=B(0);for(let f of[r,e])for(let p=0;pthis.delete(l)}},o(mr,"Registry"),mr);var Ut;var Pt=(Ut=class{constructor(e){E(this,"paused",false);E(this,"cancel");this.cancel=e}static join(e){let n=new Ut(()=>e.forEach(l=>l.cancel()));return Object.defineProperty(n,"paused",{get:()=>e[0].paused,set:l=>e.forEach(f=>f.paused=l)}),n.paused=false,n}},o(Ut,"EventController"),Ut);var wr;var De=(wr=class{constructor(){E(this,"handlers",new En)}add(e){let n=this.handlers.pushd((...f)=>{l.paused||e(...f)}),l=new Pt(n);return l}addOnce(e){let n=this.add((...l)=>{n.cancel(),e(...l)});return n}next(){return new Promise(e=>this.addOnce(e))}trigger(...e){this.handlers.forEach(n=>n(...e))}numListeners(){return this.handlers.size}clear(){this.handlers.clear()}},o(wr,"Event"),wr);var Ar;var ur=(Ar=class{constructor(){E(this,"handlers",{})}on(e,n){return this.handlers[e]||(this.handlers[e]=new De),this.handlers[e].add(n)}onOnce(e,n){let l=this.on(e,(...f)=>{l.cancel(),n(...f)});return l}next(e){return new Promise(n=>{this.onOnce(e,(...l)=>n(l[0]))})}trigger(e,...n){this.handlers[e]&&this.handlers[e].trigger(...n)}remove(e){delete this.handlers[e]}clear(){this.handlers={}}numListeners(e){var n;return((n=this.handlers[e])==null?void 0:n.numListeners())??0}},o(Ar,"EventHandler"),Ar);function Wr(r,e){if(r===e)return true;let n=typeof r,l=typeof e;if(n!==l)return false;if(n==="object"&&l==="object"&&r!==null&&e!==null){if(Array.isArray(r)!==Array.isArray(e))return false;let f=Object.keys(r),p=Object.keys(e);if(f.length!==p.length)return false;for(let T of f){let D=r[T],L=e[T];if(!Wr(D,L))return false}return true}return false}o(Wr,"deepEq");function bn(r){let e=window.atob(r),n=e.length,l=new Uint8Array(n);for(let f=0;fr.match(/^data:\w+\/\w+;base64,.+/),"isDataURL");var po=o(r=>r.split(".").slice(0,-1).join("."),"getFileName");function Te(r,e){return(...n)=>{let l=n.length;if(l===r.length)return r(...n);if(l===e.length)return e(...n)}}o(Te,"overload2");var mo=(()=>{let r=0;return()=>r++})();var wo=o(r=>r instanceof Error?r.message:String(r),"getErrorMessage");var Vr;var Ao=(Vr=class{constructor(e=(n,l)=>n0;){let n=Math.floor((e-1)/2);if(!this._compareFn(this._items[e],this._items[n])&&this._items[e]>=this._items[n])break;this.swap(e,n),e=n}}moveDown(e){for(;e=e&&r<=n}o(et,"betweenInclusive");var Zs={"Joy-Con L+R (STANDARD GAMEPAD Vendor: 057e Product: 200e)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home","17":"capture"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}},"Joy-Con (L) (STANDARD GAMEPAD Vendor: 057e Product: 2006)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","9":"select","10":"lstick","16":"start"},sticks:{left:{x:0,y:1}}},"Joy-Con (R) (STANDARD GAMEPAD Vendor: 057e Product: 2007)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","9":"start","10":"lstick","16":"select"},sticks:{left:{x:0,y:1}}},"Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home","17":"capture"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}},default:{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}}};var vr;var zr=(vr=class{constructor(){E(this,"pressed",new Set([]));E(this,"pressedRepeat",new Set([]));E(this,"released",new Set([]));E(this,"down",new Set([]))}update(){this.pressed.clear(),this.released.clear(),this.pressedRepeat.clear()}press(e){this.pressed.add(e),this.pressedRepeat.add(e),this.down.add(e)}pressRepeat(e){this.pressedRepeat.add(e)}release(e){this.down.delete(e),this.pressed.delete(e),this.released.add(e)}},o(vr,"ButtonState"),vr);var yr;var vo=(yr=class{constructor(){E(this,"buttonState",new zr);E(this,"stickState",new Map)}},o(yr,"GamepadState"),yr);var xr;var yo=(xr=class{constructor(){E(this,"dts",[]);E(this,"timer",0);E(this,"fps",0)}tick(e){this.dts.push(e),this.timer+=e,this.timer>=1&&(this.timer=0,this.fps=Math.round(1/(this.dts.reduce((n,l)=>n+l)/this.dts.length)),this.dts=[])}},o(xr,"FPSCounter"),xr);var xo=o(r=>{if(!r.canvas)throw new Error("Please provide a canvas");let e={canvas:r.canvas,loopID:null,stopped:false,dt:0,time:0,realTime:0,fpsCounter:new yo,timeScale:1,skipTime:false,numFrames:0,mousePos:new b(0),mouseDeltaPos:new b(0),keyState:new zr,mouseState:new zr,mergedGamepadState:new vo,gamepadStates:new Map,gamepads:[],charInputted:[],isMouseMoved:false,lastWidth:r.canvas.offsetWidth,lastHeight:r.canvas.offsetHeight,events:new ur};function n(){return e.dt*e.timeScale}o(n,"dt");function l(){return e.time}o(l,"time");function f(){return e.fpsCounter.fps}o(f,"fps");function p(){return e.numFrames}o(p,"numFrames");function T(){return e.canvas.toDataURL()}o(T,"screenshot");function D(d){e.canvas.style.cursor=d}o(D,"setCursor");function L(){return e.canvas.style.cursor}o(L,"getCursor");function v(d){if(d)try{let y=e.canvas.requestPointerLock();y.catch&&y.catch(M=>console.error(M))}catch(y){console.error(y)}else document.exitPointerLock()}o(v,"setCursorLocked");function X(){return!!document.pointerLockElement}o(X,"isCursorLocked");function S(d){d.requestFullscreen?d.requestFullscreen():d.webkitRequestFullscreen&&d.webkitRequestFullscreen()}o(S,"enterFullscreen");function Q(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen()}o(Q,"exitFullscreen");function x(){return document.fullscreenElement||document.webkitFullscreenElement}o(x,"getFullscreenElement");function W(d=true){d?S(e.canvas):Q()}o(W,"setFullscreen");function we(){return!!x()}o(we,"isFullscreen");function re(){e.stopped=true;for(let d in se)e.canvas.removeEventListener(d,se[d]);for(let d in ue)document.removeEventListener(d,ue[d]);for(let d in he)window.removeEventListener(d,he[d]);ve.disconnect()}o(re,"quit");function G(d){e.loopID!==null&&cancelAnimationFrame(e.loopID);let y=0,M=o(H=>{if(e.stopped)return;if(document.visibilityState!=="visible"){e.loopID=requestAnimationFrame(M);return}let z=H/1e3,de=z-e.realTime,Se=r.maxFPS?1/r.maxFPS:0;e.realTime=z,y+=de,y>Se&&(e.skipTime||(e.dt=y,e.time+=n(),e.fpsCounter.tick(e.dt)),y=0,e.skipTime=false,e.numFrames++,nt(),d(),_t()),e.loopID=requestAnimationFrame(M)},"frame");M(0)}o(G,"run");function pe(){return"ontouchstart"in window||navigator.maxTouchPoints>0}o(pe,"isTouchscreen");function R(){return e.mousePos.clone()}o(R,"mousePos");function Pe(){return e.mouseDeltaPos.clone()}o(Pe,"mouseDeltaPos");function Y(d="left"){return e.mouseState.pressed.has(d)}o(Y,"isMousePressed");function be(d="left"){return e.mouseState.down.has(d)}o(be,"isMouseDown");function Ae(d="left"){return e.mouseState.released.has(d)}o(Ae,"isMouseReleased");function Ve(){return e.isMouseMoved}o(Ve,"isMouseMoved");function ze(d){return d===void 0?e.keyState.pressed.size>0:e.keyState.pressed.has(d)}o(ze,"isKeyPressed");function Ot(d){return d===void 0?e.keyState.pressedRepeat.size>0:e.keyState.pressedRepeat.has(d)}o(Ot,"isKeyPressedRepeat");function mt(d){return d===void 0?e.keyState.down.size>0:e.keyState.down.has(d)}o(mt,"isKeyDown");function wt(d){return d===void 0?e.keyState.released.size>0:e.keyState.released.has(d)}o(wt,"isKeyReleased");function At(d){return d===void 0?e.mergedGamepadState.buttonState.pressed.size>0:e.mergedGamepadState.buttonState.pressed.has(d)}o(At,"isGamepadButtonPressed");function Oe(d){return d===void 0?e.mergedGamepadState.buttonState.down.size>0:e.mergedGamepadState.buttonState.down.has(d)}o(Oe,"isGamepadButtonDown");function qt(d){return d===void 0?e.mergedGamepadState.buttonState.released.size>0:e.mergedGamepadState.buttonState.released.has(d)}o(qt,"isGamepadButtonReleased");function Ht(d){return e.events.on("resize",d)}o(Ht,"onResize");let Br=Te(d=>e.events.on("keyDown",d),(d,y)=>e.events.on("keyDown",M=>M===d&&y(d))),Tr=Te(d=>e.events.on("keyPress",d),(d,y)=>e.events.on("keyPress",M=>M===d&&y(d))),Pr=Te(d=>e.events.on("keyPressRepeat",d),(d,y)=>e.events.on("keyPressRepeat",M=>M===d&&y(d))),Fr=Te(d=>e.events.on("keyRelease",d),(d,y)=>e.events.on("keyRelease",M=>M===d&&y(d))),Yt=Te(d=>e.events.on("mouseDown",y=>d(y)),(d,y)=>e.events.on("mouseDown",M=>M===d&&y(M))),Kt=Te(d=>e.events.on("mousePress",y=>d(y)),(d,y)=>e.events.on("mousePress",M=>M===d&&y(M))),jt=Te(d=>e.events.on("mouseRelease",y=>d(y)),(d,y)=>e.events.on("mouseRelease",M=>M===d&&y(M)));function Vt(d){return e.events.on("mouseMove",()=>d(R(),Pe()))}o(Vt,"onMouseMove");function vt(d){return e.events.on("charInput",d)}o(vt,"onCharInput");function Qt(d){return e.events.on("touchStart",d)}o(Qt,"onTouchStart");function tt(d){return e.events.on("touchMove",d)}o(tt,"onTouchMove");function zt(d){return e.events.on("touchEnd",d)}o(zt,"onTouchEnd");function Jt(d){return e.events.on("scroll",d)}o(Jt,"onScroll");function yt(d){return e.events.on("hide",d)}o(yt,"onHide");function Xt(d){return e.events.on("show",d)}o(Xt,"onShow");function xt(d,y){if(typeof d=="function")return e.events.on("gamepadButtonDown",d);if(typeof d=="string"&&typeof y=="function")return e.events.on("gamepadButtonDown",M=>M===d&&y(d))}o(xt,"onGamepadButtonDown");function Et(d,y){if(typeof d=="function")return e.events.on("gamepadButtonPress",d);if(typeof d=="string"&&typeof y=="function")return e.events.on("gamepadButtonPress",M=>M===d&&y(d))}o(Et,"onGamepadButtonPress");function Wt(d,y){if(typeof d=="function")return e.events.on("gamepadButtonRelease",d);if(typeof d=="string"&&typeof y=="function")return e.events.on("gamepadButtonRelease",M=>M===d&&y(d))}o(Wt,"onGamepadButtonRelease");function rt(d,y){return e.events.on("gamepadStick",(M,H)=>M===d&&y(H))}o(rt,"onGamepadStick");function Zt(d){e.events.on("gamepadConnect",d)}o(Zt,"onGamepadConnect");function it(d){e.events.on("gamepadDisconnect",d)}o(it,"onGamepadDisconnect");function Fe(d){return e.mergedGamepadState.stickState.get(d)||new b(0)}o(Fe,"getGamepadStick");function st(){return[...e.charInputted]}o(st,"charInputted");function bt(){return[...e.gamepads]}o(bt,"getGamepads");function nt(){e.events.trigger("input"),e.keyState.down.forEach(d=>e.events.trigger("keyDown",d)),e.mouseState.down.forEach(d=>e.events.trigger("mouseDown",d)),Ne()}o(nt,"processInput");function _t(){e.keyState.update(),e.mouseState.update(),e.mergedGamepadState.buttonState.update(),e.mergedGamepadState.stickState.forEach((d,y)=>{e.mergedGamepadState.stickState.set(y,new b(0))}),e.charInputted=[],e.isMouseMoved=false,e.gamepadStates.forEach(d=>{d.buttonState.update(),d.stickState.forEach((y,M)=>{d.stickState.set(M,new b(0))})})}o(_t,"resetInput");function St(d){let y={index:d.index,isPressed:M=>e.gamepadStates.get(d.index).buttonState.pressed.has(M),isDown:M=>e.gamepadStates.get(d.index).buttonState.down.has(M),isReleased:M=>e.gamepadStates.get(d.index).buttonState.released.has(M),getStick:M=>e.gamepadStates.get(d.index).stickState.get(M)};return e.gamepads.push(y),e.gamepadStates.set(d.index,{buttonState:new zr,stickState:new Map([["left",new b(0)],["right",new b(0)]])}),y}o(St,"registerGamepad");function $(d){e.gamepads=e.gamepads.filter(y=>y.index!==d.index),e.gamepadStates.delete(d.index)}o($,"removeGamepad");function Ne(){for(let d of navigator.getGamepads())d&&!e.gamepadStates.has(d.index)&&St(d);for(let d of e.gamepads){let y=navigator.getGamepads()[d.index],M=(r.gamepads??{})[y.id]??Zs[y.id]??Zs.default,H=e.gamepadStates.get(d.index);for(let z=0;z{let y=new b(d.offsetX,d.offsetY),M=new b(d.movementX,d.movementY);if(we()){let H=e.canvas.width/Ue,z=e.canvas.height/Ue,de=window.innerWidth,Se=window.innerHeight,$t=de/Se,er=H/z;if($t>er){let ke=Se/z,Re=(de-H*ke)/2;y.x=$e(d.offsetX-Re,0,H*ke,0,H),y.y=$e(d.offsetY,0,z*ke,0,z)}else{let ke=de/H,Re=(Se-z*ke)/2;y.x=$e(d.offsetX,0,H*ke,0,H),y.y=$e(d.offsetY-Re,0,z*ke,0,z)}}e.events.onOnce("input",()=>{e.isMouseMoved=true,e.mousePos=y,e.mouseDeltaPos=M,e.events.trigger("mouseMove")})};let Je=["left","middle","right","back","forward"];se.mousedown=d=>{e.events.onOnce("input",()=>{let y=Je[d.button];y&&(e.mouseState.press(y),e.events.trigger("mousePress",y))})},se.mouseup=d=>{e.events.onOnce("input",()=>{let y=Je[d.button];y&&(e.mouseState.release(y),e.events.trigger("mouseRelease",y))})};let Ir=new Set([" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab"]),qe={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"," ":"space"};se.keydown=d=>{Ir.has(d.key)&&d.preventDefault(),e.events.onOnce("input",()=>{let y=qe[d.key]||d.key.toLowerCase();y.length===1?(e.events.trigger("charInput",y),e.charInputted.push(y)):y==="space"&&(e.events.trigger("charInput"," "),e.charInputted.push(" ")),d.repeat?(e.keyState.pressRepeat(y),e.events.trigger("keyPressRepeat",y)):(e.keyState.press(y),e.events.trigger("keyPressRepeat",y),e.events.trigger("keyPress",y))})},se.keyup=d=>{e.events.onOnce("input",()=>{let y=qe[d.key]||d.key.toLowerCase();e.keyState.release(y),e.events.trigger("keyRelease",y)})},se.touchstart=d=>{d.preventDefault(),e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.mouseState.press("left"),e.events.trigger("mousePress","left")),y.forEach(H=>{e.events.trigger("touchStart",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.touchmove=d=>{d.preventDefault(),e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.events.trigger("mouseMove")),y.forEach(H=>{e.events.trigger("touchMove",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.touchend=d=>{e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.mouseState.release("left"),e.events.trigger("mouseRelease","left")),y.forEach(H=>{e.events.trigger("touchEnd",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.touchcancel=d=>{e.events.onOnce("input",()=>{let y=[...d.changedTouches],M=e.canvas.getBoundingClientRect();r.touchToMouse!==false&&(e.mousePos=new b(y[0].clientX-M.x,y[0].clientY-M.y),e.mouseState.release("left"),e.events.trigger("mouseRelease","left")),y.forEach(H=>{e.events.trigger("touchEnd",new b(H.clientX-M.x,H.clientY-M.y),H)})})},se.wheel=d=>{d.preventDefault(),e.events.onOnce("input",()=>{e.events.trigger("scroll",new b(d.deltaX,d.deltaY))})},se.contextmenu=d=>d.preventDefault(),ue.visibilitychange=()=>{document.visibilityState==="visible"?(e.skipTime=true,e.events.trigger("show")):e.events.trigger("hide")},he.gamepadconnected=d=>{let y=St(d.gamepad);e.events.onOnce("input",()=>{e.events.trigger("gamepadConnect",y)})},he.gamepaddisconnected=d=>{let y=bt().filter(M=>M.index===d.gamepad.index)[0];$(d.gamepad),e.events.onOnce("input",()=>{e.events.trigger("gamepadDisconnect",y)})};for(let d in se)e.canvas.addEventListener(d,se[d]);for(let d in ue)document.addEventListener(d,ue[d]);for(let d in he)window.addEventListener(d,he[d]);let ve=new ResizeObserver(d=>{for(let y of d)if(y.target===e.canvas){if(e.lastWidth===e.canvas.offsetWidth&&e.lastHeight===e.canvas.offsetHeight)return;e.lastWidth=e.canvas.offsetWidth,e.lastHeight=e.canvas.offsetHeight,e.events.onOnce("input",()=>{e.events.trigger("resize")})}});return ve.observe(e.canvas),{dt:n,time:l,run:G,canvas:e.canvas,fps:f,numFrames:p,quit:re,setFullscreen:W,isFullscreen:we,setCursor:D,screenshot:T,getGamepads:bt,getCursor:L,setCursorLocked:v,isCursorLocked:X,isTouchscreen:pe,mousePos:R,mouseDeltaPos:Pe,isKeyDown:mt,isKeyPressed:ze,isKeyPressedRepeat:Ot,isKeyReleased:wt,isMouseDown:be,isMousePressed:Y,isMouseReleased:Ae,isMouseMoved:Ve,isGamepadButtonPressed:At,isGamepadButtonDown:Oe,isGamepadButtonReleased:qt,getGamepadStick:Fe,charInputted:st,onResize:Ht,onKeyDown:Br,onKeyPress:Tr,onKeyPressRepeat:Pr,onKeyRelease:Fr,onMouseDown:Yt,onMousePress:Kt,onMouseRelease:jt,onMouseMove:Vt,onCharInput:vt,onTouchStart:Qt,onTouchMove:tt,onTouchEnd:zt,onScroll:Jt,onHide:yt,onShow:Xt,onGamepadButtonDown:xt,onGamepadButtonPress:Et,onGamepadButtonRelease:Wt,onGamepadStick:rt,onGamepadConnect:Zt,onGamepadDisconnect:it,events:e.events}},"default");var Lt;var ut=(Lt=class{constructor(e,n,l,f={}){E(this,"ctx");E(this,"src",null);E(this,"glTex");E(this,"width");E(this,"height");this.ctx=e;let p=e.gl;this.glTex=e.gl.createTexture(),e.onDestroy(()=>this.free()),this.width=n,this.height=l;let T={linear:p.LINEAR,nearest:p.NEAREST}[f.filter??e.opts.texFilter]??p.NEAREST,D={repeat:p.REPEAT,clampToEadge:p.CLAMP_TO_EDGE}[f.wrap]??p.CLAMP_TO_EDGE;this.bind(),n&&l&&p.texImage2D(p.TEXTURE_2D,0,p.RGBA,n,l,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,T),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,T),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,D),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,D),this.unbind()}static fromImage(e,n,l={}){let f=new Lt(e,n.width,n.height,l);return f.update(n),f.src=n,f}update(e,n=0,l=0){let f=this.ctx.gl;this.bind(),f.texSubImage2D(f.TEXTURE_2D,0,n,l,f.RGBA,f.UNSIGNED_BYTE,e),this.unbind()}bind(){this.ctx.pushTexture2D(this.glTex)}unbind(){this.ctx.popTexture2D()}free(){this.ctx.gl.deleteTexture(this.glTex)}},o(Lt,"Texture"),Lt);var Er;var Or=(Er=class{constructor(e,n,l,f={}){E(this,"ctx");E(this,"tex");E(this,"glFramebuffer");E(this,"glRenderbuffer");this.ctx=e;let p=e.gl;e.onDestroy(()=>this.free()),this.tex=new ut(e,n,l,f),this.glFramebuffer=p.createFramebuffer(),this.glRenderbuffer=p.createRenderbuffer(),this.bind(),p.renderbufferStorage(p.RENDERBUFFER,p.DEPTH_STENCIL,n,l),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,this.tex.glTex,0),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.DEPTH_STENCIL_ATTACHMENT,p.RENDERBUFFER,this.glRenderbuffer),this.unbind()}get width(){return this.tex.width}get height(){return this.tex.height}toImageData(){let e=this.ctx.gl,n=new Uint8ClampedArray(this.width*this.height*4);this.bind(),e.readPixels(0,0,this.width,this.height,e.RGBA,e.UNSIGNED_BYTE,n),this.unbind();let l=this.width*4,f=new Uint8Array(l);for(let p=0;p<(this.height/2|0);p++){let T=p*l,D=(this.height-p-1)*l;f.set(n.subarray(T,T+l)),n.copyWithin(T,D,D+l),n.set(f,D)}return new ImageData(n,this.width,this.height)}toDataURL(){let e=document.createElement("canvas"),n=e.getContext("2d");return e.width=this.width,e.height=this.height,n.putImageData(this.toImageData(),0,0),e.toDataURL()}draw(e){this.bind(),e(),this.unbind()}bind(){this.ctx.pushFramebuffer(this.glFramebuffer),this.ctx.pushRenderbuffer(this.glRenderbuffer),this.ctx.pushViewport({x:0,y:0,w:this.width,h:this.height})}unbind(){this.ctx.popFramebuffer(),this.ctx.popRenderbuffer(),this.ctx.popViewport()}free(){let e=this.ctx.gl;e.deleteFramebuffer(this.glFramebuffer),e.deleteRenderbuffer(this.glRenderbuffer),this.tex.free()}},o(Er,"FrameBuffer"),Er);var br;var Eo=(br=class{constructor(e,n,l,f){E(this,"ctx");E(this,"glProgram");this.ctx=e,e.onDestroy(()=>this.free());let p=e.gl,T=p.createShader(p.VERTEX_SHADER),D=p.createShader(p.FRAGMENT_SHADER);p.shaderSource(T,n),p.shaderSource(D,l),p.compileShader(T),p.compileShader(D);let L=p.createProgram();if(this.glProgram=L,p.attachShader(L,T),p.attachShader(L,D),f.forEach((v,X)=>p.bindAttribLocation(L,X,v)),p.linkProgram(L),!p.getProgramParameter(L,p.LINK_STATUS)){let v=p.getShaderInfoLog(T);if(v)throw new Error("VERTEX SHADER "+v);let X=p.getShaderInfoLog(D);if(X)throw new Error("FRAGMENT SHADER "+X)}p.deleteShader(T),p.deleteShader(D)}bind(){this.ctx.pushProgram(this.glProgram)}unbind(){this.ctx.popProgram()}send(e){let n=this.ctx.gl;for(let l in e){let f=e[l],p=n.getUniformLocation(this.glProgram,l);typeof f=="number"?n.uniform1f(p,f):f instanceof Le?n.uniformMatrix4fv(p,false,new Float32Array(f.m)):f instanceof te?n.uniform3f(p,f.r,f.g,f.b):f instanceof b&&n.uniform2f(p,f.x,f.y)}}free(){this.ctx.gl.deleteProgram(this.glProgram)}},o(br,"Shader"),br);var Sr;var bo=(Sr=class{constructor(e,n,l,f){E(this,"ctx");E(this,"glVBuf");E(this,"glIBuf");E(this,"vqueue",[]);E(this,"iqueue",[]);E(this,"stride");E(this,"maxVertices");E(this,"maxIndices");E(this,"vertexFormat");E(this,"numDraws",0);E(this,"curPrimitive",null);E(this,"curTex",null);E(this,"curShader",null);E(this,"curUniform",{});let p=e.gl;this.vertexFormat=n,this.ctx=e,this.stride=n.reduce((T,D)=>T+D.size,0),this.maxVertices=l,this.maxIndices=f,this.glVBuf=p.createBuffer(),e.pushArrayBuffer(this.glVBuf),p.bufferData(p.ARRAY_BUFFER,l*4,p.DYNAMIC_DRAW),e.popArrayBuffer(),this.glIBuf=p.createBuffer(),e.pushElementArrayBuffer(this.glIBuf),p.bufferData(p.ELEMENT_ARRAY_BUFFER,f*4,p.DYNAMIC_DRAW),e.popElementArrayBuffer()}push(e,n,l,f,p=null,T={}){(e!==this.curPrimitive||p!==this.curTex||f!==this.curShader||!Wr(this.curUniform,T)||this.vqueue.length+n.length*this.stride>this.maxVertices||this.iqueue.length+l.length>this.maxIndices)&&this.flush();let D=this.vqueue.length/this.stride;for(let L of n)this.vqueue.push(L);for(let L of l)this.iqueue.push(L+D);this.curPrimitive=e,this.curShader=f,this.curTex=p,this.curUniform=T}flush(){var n,l;if(!this.curPrimitive||!this.curShader||this.vqueue.length===0||this.iqueue.length===0)return;let e=this.ctx.gl;this.ctx.pushArrayBuffer(this.glVBuf),e.bufferSubData(e.ARRAY_BUFFER,0,new Float32Array(this.vqueue)),this.ctx.pushElementArrayBuffer(this.glIBuf),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,new Uint16Array(this.iqueue)),this.ctx.setVertexFormat(this.vertexFormat),this.curShader.bind(),this.curShader.send(this.curUniform),(n=this.curTex)==null?void 0:n.bind(),e.drawElements(this.curPrimitive,this.iqueue.length,e.UNSIGNED_SHORT,0),(l=this.curTex)==null?void 0:l.unbind(),this.curShader.unbind(),this.ctx.popArrayBuffer(),this.ctx.popElementArrayBuffer(),this.vqueue=[],this.iqueue=[],this.numDraws++}free(){let e=this.ctx.gl;e.deleteBuffer(this.glVBuf),e.deleteBuffer(this.glIBuf)}},o(Sr,"BatchRenderer"),Sr);function _e(r){let e=[],n=o(p=>{e.push(p),r(p)},"push"),l=o(()=>{e.pop(),r(f()??null)},"pop"),f=o(()=>e[e.length-1],"cur");return[n,l,f]}o(_e,"genStack");function Un(r,e={}){let n=[];function l(Y){n.push(Y)}o(l,"onDestroy");function f(){n.forEach(Y=>Y()),r.getExtension("WEBGL_lose_context").loseContext()}o(f,"destroy");let p=null;function T(Y){if(Wr(Y,p))return;p=Y;let be=Y.reduce((Ae,Ve)=>Ae+Ve.size,0);Y.reduce((Ae,Ve,ze)=>(r.vertexAttribPointer(ze,Ve.size,r.FLOAT,false,be*4,Ae),r.enableVertexAttribArray(ze),Ae+Ve.size*4),0)}o(T,"setVertexFormat");let[D,L]=_e(Y=>r.bindTexture(r.TEXTURE_2D,Y)),[v,X]=_e(Y=>r.bindBuffer(r.ARRAY_BUFFER,Y)),[S,Q]=_e(Y=>r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,Y)),[x,W]=_e(Y=>r.bindFramebuffer(r.FRAMEBUFFER,Y)),[we,re]=_e(Y=>r.bindRenderbuffer(r.RENDERBUFFER,Y)),[G,pe]=_e(({x:Y,y:be,w:Ae,h:Ve})=>{r.viewport(Y,be,Ae,Ve)}),[R,Pe]=_e(Y=>r.useProgram(Y));return G({x:0,y:0,w:r.drawingBufferWidth,h:r.drawingBufferHeight}),{gl:r,opts:e,onDestroy:l,destroy:f,pushTexture2D:D,popTexture2D:L,pushArrayBuffer:v,popArrayBuffer:X,pushElementArrayBuffer:S,popElementArrayBuffer:Q,pushFramebuffer:x,popFramebuffer:W,pushRenderbuffer:we,popRenderbuffer:re,pushViewport:G,popViewport:pe,pushProgram:R,popProgram:Pe,setVertexFormat:T}}o(Un,"initGfx");var Gt;var Ie=(Gt=class{constructor(e){E(this,"loaded",false);E(this,"data",null);E(this,"error",null);E(this,"onLoadEvents",new De);E(this,"onErrorEvents",new De);E(this,"onFinishEvents",new De);e.then(n=>{this.data=n,this.onLoadEvents.trigger(n)}).catch(n=>{if(this.error=n,this.onErrorEvents.numListeners()>0)this.onErrorEvents.trigger(n);else throw n}).finally(()=>{this.onFinishEvents.trigger(),this.loaded=true})}static loaded(e){let n=new Gt(Promise.resolve(e));return n.data=e,n.loaded=true,n}onLoad(e){return this.loaded&&this.data?e(this.data):this.onLoadEvents.add(e),this}onError(e){return this.loaded&&this.error?e(this.error):this.onErrorEvents.add(e),this}onFinish(e){return this.loaded?e():this.onFinishEvents.add(e),this}then(e){return this.onLoad(e)}catch(e){return this.onError(e)}finally(e){return this.onFinish(e)}},o(Gt,"Asset"),Gt);var Rr;var Tt=(Rr=class{constructor(){E(this,"assets",new Map);E(this,"lastUID",0)}add(e,n){let l=e??this.lastUID+++"",f=new Ie(n);return this.assets.set(l,f),f}addLoaded(e,n){let l=e??this.lastUID+++"",f=Ie.loaded(n);return this.assets.set(l,f),f}get(e){return this.assets.get(e)}progress(){if(this.assets.size===0)return 1;let e=0;return this.assets.forEach(n=>{n.loaded&&e++}),e/this.assets.size}},o(Rr,"AssetBucket"),Rr);function $r(r){return fetch(r).then(e=>{if(!e.ok)throw new Error(`Failed to fetch "${r}"`);return e})}o($r,"fetchURL");function cr(r){return $r(r).then(e=>e.json())}o(cr,"fetchJSON");function Ln(r){return $r(r).then(e=>e.text())}o(Ln,"fetchText");function Gn(r){return $r(r).then(e=>e.arrayBuffer())}o(Gn,"fetchArrayBuffer");function dr(r){let e=new Image;return e.crossOrigin="anonymous",e.src=r,new Promise((n,l)=>{e.onload=()=>n(e),e.onerror=()=>l(new Error(`Failed to load image from "${r}"`))})}o(dr,"loadImg");var qr=2.5949095;var _s=1.70158+1;var $s=2*Math.PI/3;var en=2*Math.PI/4.5;var Jr={linear:r=>r,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInQuad:r=>r*r,easeOutQuad:r=>1-(1-r)*(1-r),easeInOutQuad:r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>_s*r*r*r-1.70158*r*r,easeOutBack:r=>1+_s*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>r<.5?Math.pow(2*r,2)*((qr+1)*2*r-qr)/2:(Math.pow(2*r-2,2)*((qr+1)*(r*2-2)+qr)+2)/2,easeInElastic:r=>r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*$s),easeOutElastic:r=>r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*$s)+1,easeInOutElastic:r=>r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*en))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*en)/2+1,easeInBounce:r=>1-Jr.easeOutBounce(1-r),easeOutBounce:r=>r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375,easeInOutBounce:r=>r<.5?(1-Jr.easeOutBounce(1-2*r))/2:(1+Jr.easeOutBounce(2*r-1))/2};var Hr=Jr;var Mr;var So=(Mr=class{constructor(e,n,l){E(this,"textures",[]);E(this,"canvas");E(this,"c2d");E(this,"x",0);E(this,"y",0);E(this,"curHeight",0);E(this,"gfx");this.gfx=e,this.canvas=document.createElement("canvas"),this.canvas.width=n,this.canvas.height=l,this.textures=[ut.fromImage(e,this.canvas)],this.c2d=this.canvas.getContext("2d")}add(e){if(e.width>this.canvas.width||e.height>this.canvas.height)throw new Error(`Texture size (${e.width} x ${e.height}) exceeds limit (${this.canvas.width} x ${this.canvas.height})`);this.x+e.width>this.canvas.width&&(this.x=0,this.y+=this.curHeight,this.curHeight=0),this.y+e.height>this.canvas.height&&(this.c2d.clearRect(0,0,this.canvas.width,this.canvas.height),this.textures.push(ut.fromImage(this.gfx,this.canvas)),this.x=0,this.y=0,this.curHeight=0);let n=this.textures[this.textures.length-1],l=new b(this.x,this.y);return this.x+=e.width,e.height>this.curHeight&&(this.curHeight=e.height),e instanceof ImageData?this.c2d.putImageData(e,l.x,l.y):this.c2d.drawImage(e,l.x,l.y),n.update(this.canvas),[n,new me(l.x/this.canvas.width,l.y/this.canvas.height,e.width/this.canvas.width,e.height/this.canvas.height)]}free(){for(let e of this.textures)e.free()}},o(Mr,"TexPacker"),Mr);var Ro="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAA1CAYAAADyMeOEAAAAAXNSR0IArs4c6QAAAoVJREFUaIHdm7txwkAQhheGAqACiCHzOKQDQrqgILpwSAeEDBnEUAF0gCMxZ7G72qce/mec2Lpf9+3unaS78wgSNZ8uX5729+d1FNWXUuGmXlBOUUEIMckEpeQJgBu6C+BSFngztBR2vd+ovY+7g+p6LbgaWgJrAeUkDYIUXgXdBBwNi6kpABJwMTQH3AZsXRR8GHTfgEth8E3gjdAUcNewpbTgY85sCMCUuOokozE0YM0YRzM9NGAAXd8+omAF5h4lnmBRvpSnZHyLoLEbaN+aKB9KWv/KWw0tAbbANnlG+UvB2dm77NxxdwgBpjrF/d7rW9cbmpvio2A5z8iAYpVU8pGZlo6/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ZGSrnTtGwlVmCIqUepxWxerj7iIyNZ7SgiKmJhJw7NJpRgiKmLuHl3KnReA4UIaU+y+WkcbzHQ1DEzMGQ9aJH0BDK6RE0y9wlTDp2HuppERQxc0FFBaZGUMTMB5UlQG/fHyk1odJEaBUUMXWh4oSoFRQxtaHyxMi2uBseQwUKciUoYuaAShTlkaCImQcqUph7QREzF/8DSS/2GZ2/N/sAAAAASUVORK5CYII=";var Po="3000.1.17";var tn=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";var Yr="topleft";var rn=64;var Fo="monospace";var Kr="monospace";var Io=36;var jr=64;var Qr=256;var sn=2048;var nn=2048;var on=2048;var an=2048;var hn=.1;var ko=64;var xi="linear";var Co=8;var Do=4;var Ti=[{name:"a_pos",size:2},{name:"a_uv",size:2},{name:"a_color",size:4}];var No=Ti.reduce((r,e)=>r+e.size,0);var On=2048;var Uo=On*4*No;var Lo=On*6;var Go=` attribute vec2 a_pos; attribute vec2 a_uv; attribute vec4 a_color; @@ -49,7 +49,7 @@ vec4 vert(vec2 pos, vec2 uv, vec4 color) { vec4 frag(vec2 pos, vec2 uv, vec4 color, sampler2D tex) { return def_frag(); } -`;var qo=new Set(["id","require"]);var Ho=new Set(["add","update","draw","destroy","inspect","drawInspect"]);function lt(r){switch(r){case"topleft":return new b(-1,-1);case"top":return new b(0,-1);case"topright":return new b(1,-1);case"left":return new b(-1,0);case"center":return new b(0,0);case"right":return new b(1,0);case"botleft":return new b(-1,1);case"bot":return new b(0,1);case"botright":return new b(1,1);default:return r}}o(lt,"anchorPt");function On(r){switch(r){case"left":return 0;case"center":return .5;case"right":return 1;default:return 0}}o(On,"alignPt");function qn(r){return r.createBuffer(1,1,44100)}o(qn,"createEmptyAudioBuffer");var Yo=o((r={})=>{let e=r.root??document.body;e===document.body&&(document.body.style.width="100%",document.body.style.height="100%",document.body.style.margin="0px",document.documentElement.style.width="100%",document.documentElement.style.height="100%");let n=r.canvas??(()=>{let t=document.createElement("canvas");return e.appendChild(t),t})(),l=r.scale??1,f=r.width&&r.height&&!r.stretch&&!r.letterbox;f?(n.width=r.width*l,n.height=r.height*l):(n.width=n.parentElement.offsetWidth,n.height=n.parentElement.offsetHeight);let p=["outline: none","cursor: default"];if(f){let t=n.width,i=n.height;p.push(`width: ${t}px`),p.push(`height: ${i}px`)}else p.push("width: 100%"),p.push("height: 100%");r.crisp&&(p.push("image-rendering: pixelated"),p.push("image-rendering: crisp-edges")),n.style.cssText=p.join(";");let T=r.pixelDensity||window.devicePixelRatio;n.width*=T,n.height*=T,n.tabIndex=0;let D=document.createElement("canvas");D.width=Qr,D.height=Qr;let L=D.getContext("2d",{willReadFrequently:true}),v=xo({canvas:n,touchToMouse:r.touchToMouse,gamepads:r.gamepads,pixelDensity:r.pixelDensity,maxFPS:r.maxFPS}),X=[],S=v.canvas.getContext("webgl",{antialias:true,depth:true,stencil:true,alpha:true,preserveDrawingBuffer:true}),Q=Nn(S,{texFilter:r.texFilter}),x=(()=>{let t=rt(Ei,bi),i=ut.fromImage(Q,new ImageData(new Uint8ClampedArray([255,255,255,255]),1,1)),s=r.width&&r.height?new Or(Q,r.width*T*l,r.height*T*l):new Or(Q,S.drawingBufferWidth,S.drawingBufferHeight),a=null,h=1;r.background&&(a=Z(r.background),h=Array.isArray(r.background)?r.background[3]:1,S.clearColor(a.r/255,a.g/255,a.b/255,h??1)),S.enable(S.BLEND),S.blendFuncSeparate(S.SRC_ALPHA,S.ONE_MINUS_SRC_ALPHA,S.ONE,S.ONE_MINUS_SRC_ALPHA);let u=new bo(Q,Ti,Uo,Lo),g=ut.fromImage(Q,new ImageData(new Uint8ClampedArray([128,128,128,255,190,190,190,255,190,190,190,255,128,128,128,255]),2,2),{wrap:"repeat",filter:"nearest"});return{lastDrawCalls:0,defShader:t,defTex:i,frameBuffer:s,postShader:null,postShaderUniform:null,renderer:u,transform:new Le,transformStack:[],bgTex:g,bgColor:a,bgAlpha:h,width:r.width??S.drawingBufferWidth/T/l,height:r.height??S.drawingBufferHeight/T/l,viewport:{x:0,y:0,width:S.drawingBufferWidth,height:S.drawingBufferHeight},fixed:false}})();const at=class at{constructor(i,s,a={},h=null){E(this,"tex");E(this,"frames",[new me(0,0,1,1)]);E(this,"anims",{});E(this,"slice9",null);this.tex=i,s&&(this.frames=s),this.anims=a,this.slice9=h}get width(){return this.tex.width*this.frames[0].w}get height(){return this.tex.height*this.frames[0].h}static from(i,s={}){return typeof i=="string"?at.fromURL(i,s):Promise.resolve(at.fromImage(i,s))}static fromImage(i,s={}){let[a,h]=G.packer.add(i),u=s.frames?s.frames.map(g=>new me(h.x+g.x*h.w,h.y+g.y*h.h,g.w*h.w,g.h*h.h)):mt(s.sliceX||1,s.sliceY||1,h.x,h.y,h.w,h.h);return new at(a,u,s.anims,s.slice9)}static fromURL(i,s={}){return dr(i).then(a=>at.fromImage(a,s))}};o(at,"SpriteData");let W=at;const Bt=class Bt{constructor(i){E(this,"buf");this.buf=i}static fromArrayBuffer(i){return new Promise((s,a)=>re.ctx.decodeAudioData(i,s,a)).then(s=>new Bt(s))}static fromURL(i){return Xs(i)?Bt.fromArrayBuffer(bn(i)):Ln(i).then(s=>Bt.fromArrayBuffer(s))}};o(Bt,"SoundData");let we=Bt;let re=(()=>{let t=new(window.AudioContext||window.webkitAudioContext),i=t.createGain();i.connect(t.destination);let s=new we(qn(t));return t.decodeAudioData(Mo.buffer.slice(0)).then(a=>{s.buf=a}).catch(a=>{console.error("Failed to load burp: ",a)}),{ctx:t,masterNode:i,burpSnd:s}})(),G={urlPrefix:"",sprites:new Tt,fonts:new Tt,bitmapFonts:new Tt,sounds:new Tt,shaders:new Tt,custom:new Tt,packer:new So(Q,nn,on),loaded:false};function pe(t){return typeof t!="string"||Xs(t)?t:G.urlPrefix+t}o(pe,"fixURL");let R={events:new ur,objEvents:new ur,root:kr([]),gravity:0,scenes:{},logs:[],cam:{pos:null,scale:new b(1),angle:0,shake:0,transform:new Le}};R.root.use(Nr());function Pe(t){return G.custom.add(null,t)}o(Pe,"load");function Y(){let t=[G.sprites,G.sounds,G.shaders,G.fonts,G.bitmapFonts,G.custom];return t.reduce((i,s)=>i+s.progress(),0)/t.length}o(Y,"loadProgress");function be(t){return t!==void 0&&(G.urlPrefix=t),G.urlPrefix}o(be,"loadRoot");function Ae(t,i){return G.custom.add(t,cr(i))}o(Ae,"loadJSON");const Ai=class Ai{constructor(i,s={}){E(this,"fontface");E(this,"filter",xi);E(this,"outline",null);E(this,"size",jr);if(this.fontface=i,this.filter=s.filter??xi,this.size=s.size??jr,this.size>Qr)throw new Error(`Max font size: ${Qr}`);s.outline&&(this.outline={width:1,color:Z(0,0,0)},typeof s.outline=="number"?this.outline.width=s.outline:typeof s.outline=="object"&&(s.outline.width&&(this.outline.width=s.outline.width),s.outline.color&&(this.outline.color=s.outline.color)))}};o(Ai,"FontData");let Ve=Ai;function ze(t,i,s={}){let a=new FontFace(t,typeof i=="string"?`url(${i})`:i);return document.fonts.add(a),G.fonts.add(t,a.load().catch(h=>{throw new Error(`Failed to load font from "${i}": ${h}`)}).then(h=>new Ve(h,s)))}o(ze,"loadFont");function Ot(t,i,s,a,h={}){return G.bitmapFonts.add(t,dr(i).then(u=>Zt(ut.fromImage(Q,u,h),s,a,h.chars??en)))}o(Ot,"loadBitmapFont");function mt(t=1,i=1,s=0,a=0,h=1,u=1){let g=[],V=h/t,m=u/i;for(let c=0;c{cr(i).then(h=>{wt(t,h).then(s).catch(a)})}):W.from(t).then(s=>{let a={};for(let h in i){let u=i[h],g=s.frames[0],V=nn*g.w,m=on*g.h,c=u.frames?u.frames.map(P=>new me(g.x+(u.x+P.x)/V*g.w,g.y+(u.y+P.y)/m*g.h,P.w/V*g.w,P.h/m*g.h)):mt(u.sliceX||1,u.sliceY||1,g.x+u.x/V*g.w,g.y+u.y/m*g.h,u.width/V*g.w,u.height/m*g.h),w=new W(s.tex,c,u.anims);G.sprites.addLoaded(h,w),a[h]=w}return a}))}o(wt,"loadSpriteAtlas");function At(t,i={}){let s=document.createElement("canvas"),a=t[0].width,h=t[0].height;s.width=a*t.length,s.height=h;let u=s.getContext("2d");t.forEach((V,m)=>{V instanceof ImageData?u.putImageData(V,m*a,0):u.drawImage(V,m*a,0)});let g=u.getImageData(0,0,t.length*a,h);return W.fromImage(g,{...i,sliceX:t.length,sliceY:1})}o(At,"createSpriteSheet");function Oe(t,i,s={sliceX:1,sliceY:1,anims:{}}){return i=pe(i),Array.isArray(i)?i.some(a=>typeof a=="string")?G.sprites.add(t,Promise.all(i.map(a=>typeof a=="string"?dr(a):Promise.resolve(a))).then(a=>At(a,s))):G.sprites.addLoaded(t,At(i,s)):typeof i=="string"?G.sprites.add(t,W.from(i,s)):G.sprites.addLoaded(t,W.fromImage(i,s))}o(Oe,"loadSprite");function qt(t,i){return i=pe(i),G.sprites.add(t,new Promise(async s=>{let a=typeof i=="string"?await cr(i):i,h=await Promise.all(a.frames.map(dr)),u=document.createElement("canvas");u.width=a.width,u.height=a.height*a.frames.length;let g=u.getContext("2d");h.forEach((m,c)=>{g.drawImage(m,0,c*a.height)});let V=await Oe(null,u,{sliceY:a.frames.length,anims:a.anims});s(V)}))}o(qt,"loadPedit");function Ht(t,i,s){i=pe(i),s=pe(s),typeof i=="string"&&!s&&(s=po(i)+".json");let a=typeof s=="string"?cr(s):Promise.resolve(s);return G.sprites.add(t,a.then(h=>{let u=h.meta.size,g=h.frames.map(m=>new me(m.frame.x/u.w,m.frame.y/u.h,m.frame.w/u.w,m.frame.h/u.h)),V={};for(let m of h.meta.frameTags)m.from===m.to?V[m.name]=m.from:V[m.name]={from:m.from,to:m.to,speed:10,loop:true,pingpong:m.direction==="pingpong"};return W.from(i,{frames:g,anims:V})}))}o(Ht,"loadAseprite");function Br(t,i,s){return G.shaders.addLoaded(t,rt(i,s))}o(Br,"loadShader");function Tr(t,i,s){i=pe(i),s=pe(s);let a=o(u=>u?Un(u):Promise.resolve(null),"resolveUrl"),h=Promise.all([a(i),a(s)]).then(([u,g])=>rt(u,g));return G.shaders.add(t,h)}o(Tr,"loadShaderURL");function Pr(t,i){return i=pe(i),G.sounds.add(t,typeof i=="string"?we.fromURL(i):we.fromArrayBuffer(i))}o(Pr,"loadSound");function Fr(t="bean"){return Oe(t,Ro)}o(Fr,"loadBean");function Yt(t){return G.sprites.get(t)}o(Yt,"getSprite");function Kt(t){return G.sounds.get(t)}o(Kt,"getSound");function jt(t){return G.fonts.get(t)}o(jt,"getFont");function Vt(t){return G.bitmapFonts.get(t)}o(Vt,"getBitmapFont");function vt(t){return G.shaders.get(t)}o(vt,"getShader");function Qt(t){return G.custom.get(t)}o(Qt,"getAsset");function tt(t){if(typeof t=="string"){let i=Yt(t);if(i)return i;if(Y()<1)return null;throw new Error(`Sprite not found: ${t}`)}else{if(t instanceof W)return Ie.loaded(t);if(t instanceof Ie)return t;throw new Error(`Invalid sprite: ${t}`)}}o(tt,"resolveSprite");function zt(t){if(typeof t=="string"){let i=Kt(t);if(i)return i;if(Y()<1)return null;throw new Error(`Sound not found: ${t}`)}else{if(t instanceof we)return Ie.loaded(t);if(t instanceof Ie)return t;throw new Error(`Invalid sound: ${t}`)}}o(zt,"resolveSound");function Jt(t){if(!t)return x.defShader;if(typeof t=="string"){let i=vt(t);if(i)return i.data??i;if(Y()<1)return null;throw new Error(`Shader not found: ${t}`)}else if(t instanceof Ie)return t.data?t.data:t;return t}o(Jt,"resolveShader");function yt(t){if(!t)return yt(r.font??Fo);if(typeof t=="string"){let i=Vt(t),s=jt(t);if(i)return i.data??i;if(s)return s.data??s;if(document.fonts.check(`${jr}px ${t}`))return t;if(Y()<1)return null;throw new Error(`Font not found: ${t}`)}else if(t instanceof Ie)return t.data?t.data:t;return t}o(yt,"resolveFont");function Xt(t){return t!==void 0&&(re.masterNode.gain.value=t),re.masterNode.gain.value}o(Xt,"volume");function xt(t,i={}){let s=re.ctx,a=i.paused??false,h=s.createBufferSource(),u=new De,g=s.createGain(),V=i.seek??0,m=0,c=0,w=false;h.loop=!!i.loop,h.detune.value=i.detune??0,h.playbackRate.value=i.speed??1,h.connect(g),h.onended=()=>{var I;O()>=((I=h.buffer)==null?void 0:I.duration)&&u.trigger()},g.connect(re.masterNode),g.gain.value=i.volume??1;let P=o(I=>{h.buffer=I.buf,a||(m=s.currentTime,h.start(0,V),w=true)},"start"),C=zt(t);C instanceof Ie&&C.onLoad(P);let O=o(()=>{if(!h.buffer)return 0;let I=a?c-m:s.currentTime-m,U=h.buffer.duration;return h.loop?I%U:Math.min(I,U)},"getTime"),q=o(I=>{let U=s.createBufferSource();return U.buffer=I.buffer,U.loop=I.loop,U.playbackRate.value=I.playbackRate.value,U.detune.value=I.detune.value,U.onended=I.onended,U.connect(g),U},"cloneNode");return{stop(){this.paused=true,this.seek(0)},set paused(I){if(a!==I)if(a=I,I)w&&(h.stop(),w=false),c=s.currentTime;else{h=q(h);let U=c-m;h.start(0,U),w=true,m=s.currentTime-U,c=0}},get paused(){return a},play(I=0){this.seek(I),this.paused=false},seek(I){var U;((U=h.buffer)==null?void 0:U.duration)&&(I>h.buffer.duration||(a?(h=q(h),m=c-I):(h.stop(),h=q(h),m=s.currentTime-I,h.start(0,I),w=true,c=0)))},set speed(I){h.playbackRate.value=I},get speed(){return h.playbackRate.value},set detune(I){h.detune.value=I},get detune(){return h.detune.value},set volume(I){g.gain.value=Math.max(I,0)},get volume(){return g.gain.value},set loop(I){h.loop=I},get loop(){return h.loop},duration(){var I;return((I=h.buffer)==null?void 0:I.duration)??0},time(){return O()%this.duration()},onEnd(I){return u.add(I)},then(I){return this.onEnd(I)}}}o(xt,"play");function Et(t){return xt(re.burpSnd,t)}o(Et,"burp");function Wt(t,i){return new Or(Q,t,i)}o(Wt,"makeCanvas");function rt(t=Ei,i=bi){let s=Go.replace("{{user}}",t??Ei),a=Oo.replace("{{user}}",i??bi);try{return new Eo(Q,s,a,Ti.map(h=>h.name))}catch(h){let u=/(?^\w+) SHADER ERROR: 0:(?\d+): (?.+)/,g=wo(h).match(u),V=Number(g.groups.line)-14,m=g.groups.msg.trim(),c=g.groups.type.toLowerCase();throw new Error(`${c} shader line ${V}: ${m}`)}}o(rt,"makeShader");function Zt(t,i,s,a){let h=t.width/i,u={},g=a.split("").entries();for(let[V,m]of g)u[m]=new me(V%h*i,Math.floor(V/h)*s,i,s);return{tex:t,map:u,size:s}}o(Zt,"makeFont");function it(t,i,s,a=x.defTex,h=x.defShader,u={}){let g=Jt(h);if(!g||g instanceof Ie)return;let V=x.fixed||s?x.transform:R.cam.transform.mult(x.transform),m=[];for(let c of t){let w=_t(V.multVec2(c.pos));m.push(w.x,w.y,c.uv.x,c.uv.y,c.color.r/255,c.color.g/255,c.color.b/255,c.opacity)}x.renderer.push(S.TRIANGLES,m,i,g,a,u)}o(it,"drawRaw");function Fe(){x.renderer.flush()}o(Fe,"flush");function st(){S.clear(S.COLOR_BUFFER_BIT),x.frameBuffer.bind(),S.clear(S.COLOR_BUFFER_BIT),x.bgColor||Re(()=>{Ue({width:ye(),height:xe(),quad:new me(0,0,ye()/tn,xe()/tn),tex:x.bgTex,fixed:true})}),x.renderer.numDraws=0,x.fixed=false,x.transformStack.length=0,x.transform=new Le}o(st,"frameStart");function bt(t,i){x.postShader=t,x.postShaderUniform=i??null}o(bt,"usePostEffect");function nt(){Fe(),x.lastDrawCalls=x.renderer.numDraws,x.frameBuffer.unbind(),S.viewport(0,0,S.drawingBufferWidth,S.drawingBufferHeight);let t=x.width,i=x.height;x.width=S.drawingBufferWidth/T,x.height=S.drawingBufferHeight/T,Je({flipY:true,tex:x.frameBuffer.tex,pos:new b(x.viewport.x,x.viewport.y),width:x.viewport.width,height:x.viewport.height,shader:x.postShader,uniform:typeof x.postShaderUniform=="function"?x.postShaderUniform():x.postShaderUniform,fixed:true}),Fe(),x.width=t,x.height=i}o(nt,"frameEnd");function _t(t){return new b(t.x/ye()*2-1,-t.y/xe()*2+1)}o(_t,"screen2ndc");function St(t){x.transform=t.clone()}o(St,"pushMatrix");function $(...t){if(t[0]===void 0)return;let i=B(...t);i.x===0&&i.y===0||x.transform.translate(i)}o($,"pushTranslate");function Ne(...t){if(t[0]===void 0)return;let i=B(...t);i.x===1&&i.y===1||x.transform.scale(i)}o(Ne,"pushScale");function se(t){t&&x.transform.rotate(t)}o(se,"pushRotate");function ue(){x.transformStack.push(x.transform.clone())}o(ue,"pushTransform");function he(){x.transformStack.length>0&&(x.transform=x.transformStack.pop())}o(he,"popTransform");function Ue(t){if(t.width===void 0||t.height===void 0)throw new Error('drawUVQuad() requires property "width" and "height".');if(t.width<=0||t.height<=0)return;let i=t.width,s=t.height,a=lt(t.anchor||Yr).scale(new b(i,s).scale(-.5)),h=t.quad||new me(0,0,1,1),u=t.color||Z(255,255,255),g=t.opacity??1,V=t.tex?an/t.tex.width:0,m=t.tex?an/t.tex.height:0,c=h.x+V,w=h.y+m,P=h.w-V*2,C=h.h-m*2;ue(),$(t.pos),se(t.angle),Ne(t.scale),$(a),it([{pos:new b(-i/2,s/2),uv:new b(t.flipX?c+P:c,t.flipY?w:w+C),color:u,opacity:g},{pos:new b(-i/2,-s/2),uv:new b(t.flipX?c+P:c,t.flipY?w+C:w),color:u,opacity:g},{pos:new b(i/2,-s/2),uv:new b(t.flipX?c:c+P,t.flipY?w+C:w),color:u,opacity:g},{pos:new b(i/2,s/2),uv:new b(t.flipX?c:c+P,t.flipY?w:w+C),color:u,opacity:g}],[0,1,3,1,2,3],t.fixed,t.tex,t.shader,t.uniform),he()}o(Ue,"drawUVQuad");function Je(t){if(!t.tex)throw new Error('drawTexture() requires property "tex".');let i=t.quad??new me(0,0,1,1),s=t.tex.width*i.w,a=t.tex.height*i.h,h=new b(1);if(t.tiled){let u=Math.ceil((t.width||s)/s),g=Math.ceil((t.height||a)/a),V=lt(t.anchor||Yr).add(new b(1,1)).scale(.5).scale(u*s,g*a);for(let m=0;m({pos:new b(g.x,g.y),uv:new b(0),color:t.color??te.WHITE,opacity:t.opacity??1}));it(u,[0,1,3,1,2,3],t.fixed,x.defTex,t.shader,t.uniform)}o(d,"drawLine");function y(t){let i=t.pts;if(!i)throw new Error('drawLines() requires property "pts".');if(!(i.length<2))if(t.radius&&i.length>=3){let s=i[0].sdist(i[1]);for(let a=1;a=360&&t.outline){t.fill!==false&&de(Object.assign(u,{outline:null})),de(Object.assign(u,{pts:h.slice(1),fill:false}));return}de(u)}o(z,"drawEllipse");function de(t){if(!t.pts)throw new Error('drawPolygon() requires property "pts".');let i=t.pts.length;if(!(i<3)){if(ue(),$(t.pos),Ne(t.scale),se(t.angle),$(t.offset),t.fill!==false){let s=t.color??te.WHITE,a=t.pts.map((u,g)=>({pos:new b(u.x,u.y),uv:new b(0,0),color:t.colors&&t.colors[g]?t.colors[g].mult(s):s,opacity:t.opacity??1})),h=[...Array(i-2).keys()].map(u=>[0,u+1,u+2]).flat();it(a,t.indices??h,t.fixed,x.defTex,t.shader,t.uniform)}t.outline&&y({pts:[...t.pts,t.pts[0]],radius:t.radius,width:t.outline.width,color:t.outline.color,join:t.outline.join,uniform:t.uniform,fixed:t.fixed,opacity:t.opacity}),he()}}o(de,"drawPolygon");function Se(t,i,s){Fe(),S.clear(S.STENCIL_BUFFER_BIT),S.enable(S.STENCIL_TEST),S.stencilFunc(S.NEVER,1,255),S.stencilOp(S.REPLACE,S.REPLACE,S.REPLACE),i(),Fe(),S.stencilFunc(s,1,255),S.stencilOp(S.KEEP,S.KEEP,S.KEEP),t(),Fe(),S.disable(S.STENCIL_TEST)}o(Se,"drawStenciled");function $t(t,i){Se(t,i,S.EQUAL)}o($t,"drawMasked");function er(t,i){Se(t,i,S.NOTEQUAL)}o(er,"drawSubtracted");function ke(){return(x.viewport.width+x.viewport.height)/(x.width+x.height)}o(ke,"getViewportScale");function Re(t){Fe();let i=x.width,s=x.height;x.width=x.viewport.width,x.height=x.viewport.height,t(),Fe(),x.width=i,x.height=s}o(Re,"drawUnscaled");function ei(t,i){i.pos&&(t.pos=t.pos.add(i.pos)),i.scale&&(t.scale=t.scale.scale(B(i.scale))),i.angle&&(t.angle+=i.angle),i.color&&t.ch.length===1&&(t.color=t.color.mult(i.color)),i.opacity&&(t.opacity*=i.opacity)}o(ei,"applyCharTransform");let Di=/\[(?Water Pipe | remarkablegamesWater Pipe | remarkablegames