UNPKG

@bimdata/2d-engine

Version:

An object oriented 2D viewer to load thousands of objects that you can select, highlight, hide, move with high performances

2 lines 398 kB
var zt=(e=>(e[e.WEBGL_LEGACY=0]="WEBGL_LEGACY",e[e.WEBGL=1]="WEBGL",e[e.WEBGL2=2]="WEBGL2",e))(zt||{}),Fn=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.WEBGL=1]="WEBGL",e[e.CANVAS=2]="CANVAS",e))(Fn||{}),Si=(e=>(e[e.COLOR=16384]="COLOR",e[e.DEPTH=256]="DEPTH",e[e.STENCIL=1024]="STENCIL",e))(Si||{}),O=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ADD=1]="ADD",e[e.MULTIPLY=2]="MULTIPLY",e[e.SCREEN=3]="SCREEN",e[e.OVERLAY=4]="OVERLAY",e[e.DARKEN=5]="DARKEN",e[e.LIGHTEN=6]="LIGHTEN",e[e.COLOR_DODGE=7]="COLOR_DODGE",e[e.COLOR_BURN=8]="COLOR_BURN",e[e.HARD_LIGHT=9]="HARD_LIGHT",e[e.SOFT_LIGHT=10]="SOFT_LIGHT",e[e.DIFFERENCE=11]="DIFFERENCE",e[e.EXCLUSION=12]="EXCLUSION",e[e.HUE=13]="HUE",e[e.SATURATION=14]="SATURATION",e[e.COLOR=15]="COLOR",e[e.LUMINOSITY=16]="LUMINOSITY",e[e.NORMAL_NPM=17]="NORMAL_NPM",e[e.ADD_NPM=18]="ADD_NPM",e[e.SCREEN_NPM=19]="SCREEN_NPM",e[e.NONE=20]="NONE",e[e.SRC_OVER=0]="SRC_OVER",e[e.SRC_IN=21]="SRC_IN",e[e.SRC_OUT=22]="SRC_OUT",e[e.SRC_ATOP=23]="SRC_ATOP",e[e.DST_OVER=24]="DST_OVER",e[e.DST_IN=25]="DST_IN",e[e.DST_OUT=26]="DST_OUT",e[e.DST_ATOP=27]="DST_ATOP",e[e.ERASE=26]="ERASE",e[e.SUBTRACT=28]="SUBTRACT",e[e.XOR=29]="XOR",e))(O||{}),vt=(e=>(e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e))(vt||{}),R=(e=>(e[e.RGBA=6408]="RGBA",e[e.RGB=6407]="RGB",e[e.RG=33319]="RG",e[e.RED=6403]="RED",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.ALPHA=6406]="ALPHA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e))(R||{}),le=(e=>(e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e))(le||{}),B=(e=>(e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.BYTE=5120]="BYTE",e[e.SHORT=5122]="SHORT",e[e.INT=5124]="INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.HALF_FLOAT=36193]="HALF_FLOAT",e))(B||{}),Ii=(e=>(e[e.FLOAT=0]="FLOAT",e[e.INT=1]="INT",e[e.UINT=2]="UINT",e))(Ii||{}),Rt=(e=>(e[e.NEAREST=0]="NEAREST",e[e.LINEAR=1]="LINEAR",e))(Rt||{}),qt=(e=>(e[e.CLAMP=33071]="CLAMP",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e))(qt||{}),jt=(e=>(e[e.OFF=0]="OFF",e[e.POW2=1]="POW2",e[e.ON=2]="ON",e[e.ON_MANUAL=3]="ON_MANUAL",e))(jt||{}),kt=(e=>(e[e.NPM=0]="NPM",e[e.UNPACK=1]="UNPACK",e[e.PMA=2]="PMA",e[e.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",e[e.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",e[e.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",e))(kt||{}),$t=(e=>(e[e.NO=0]="NO",e[e.YES=1]="YES",e[e.AUTO=2]="AUTO",e[e.BLEND=0]="BLEND",e[e.CLEAR=1]="CLEAR",e[e.BLIT=2]="BLIT",e))($t||{}),ki=(e=>(e[e.AUTO=0]="AUTO",e[e.MANUAL=1]="MANUAL",e))(ki||{}),wt=(e=>(e.LOW="lowp",e.MEDIUM="mediump",e.HIGH="highp",e))(wt||{}),at=(e=>(e[e.NONE=0]="NONE",e[e.SCISSOR=1]="SCISSOR",e[e.STENCIL=2]="STENCIL",e[e.SPRITE=3]="SPRITE",e[e.COLOR=4]="COLOR",e))(at||{}),kn=(e=>(e[e.RED=1]="RED",e[e.GREEN=2]="GREEN",e[e.BLUE=4]="BLUE",e[e.ALPHA=8]="ALPHA",e))(kn||{}),et=(e=>(e[e.NONE=0]="NONE",e[e.LOW=2]="LOW",e[e.MEDIUM=4]="MEDIUM",e[e.HIGH=8]="HIGH",e))(et||{}),Ct=(e=>(e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e))(Ct||{});const ce=2*Math.PI,Bn=180/Math.PI,Un=Math.PI/180;var X=(e=>(e[e.POLY=0]="POLY",e[e.RECT=1]="RECT",e[e.CIRC=2]="CIRC",e[e.ELIP=3]="ELIP",e[e.RREC=4]="RREC",e))(X||{});class J{constructor(t=0,i=0){this.x=0,this.y=0,this.x=t,this.y=i}clone(){return new J(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,i=t){return this.x=t,this.y=i,this}toString(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`}}const ii=[new J,new J,new J,new J];class H{constructor(t=0,i=0,s=0,r=0){this.x=Number(t),this.y=Number(i),this.width=Number(s),this.height=Number(r),this.type=X.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new H(0,0,0,0)}clone(){return new H(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,i){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&i>=this.y&&i<this.y+this.height)}intersects(t,i){if(!i){const w=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=w)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const s=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=s||o<=n)return!1;const a=ii[0].set(t.left,t.top),l=ii[1].set(t.left,t.bottom),h=ii[2].set(t.right,t.top),c=ii[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(i.a*i.d-i.b*i.c);if(0===u||(i.apply(a,a),i.apply(l,l),i.apply(h,h),i.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=s||Math.min(a.x,l.x,h.x,c.x)>=r||Math.max(a.y,l.y,h.y,c.y)<=n||Math.min(a.y,l.y,h.y,c.y)>=o))return!1;const d=u*(l.y-a.y),p=u*(a.x-l.x),f=d*s+p*n,m=d*r+p*n,y=d*s+p*o,x=d*r+p*o;if(Math.max(f,m,y,x)<=d*a.x+p*a.y||Math.min(f,m,y,x)>=d*c.x+p*c.y)return!1;const b=u*(a.y-h.y),g=u*(h.x-a.x),_=b*s+g*n,v=b*r+g*n,S=b*s+g*o,T=b*r+g*o;return!(Math.max(_,v,S,T)<=b*a.x+g*a.y||Math.min(_,v,S,T)>=b*c.x+g*c.y)}pad(t=0,i=t){return this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i,this}fit(t){const i=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(s-i,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,i=.001){const s=Math.ceil((this.x+this.width-i)*t)/t,r=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const i=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=s-i,this.y=r,this.height=n-r,this}toString(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class Je{constructor(t=0,i=0,s=0){this.x=t,this.y=i,this.radius=s,this.type=X.CIRC}clone(){return new Je(this.x,this.y,this.radius)}contains(t,i){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-i;return r*=r,n*=n,r+n<=s}getBounds(){return new H(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}toString(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class Ke{constructor(t=0,i=0,s=0,r=0){this.x=t,this.y=i,this.width=s,this.height=r,this.type=X.ELIP}clone(){return new Ke(this.x,this.y,this.width,this.height)}contains(t,i){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(i-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new H(this.x-this.width,this.y-this.height,this.width,this.height)}toString(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class Ft{constructor(...t){let i=Array.isArray(t[0])?t[0]:t;if("number"!=typeof i[0]){const s=[];for(let r=0,n=i.length;r<n;r++)s.push(i[r].x,i[r].y);i=s}this.points=i,this.type=X.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),i=new Ft(t);return i.closeStroke=this.closeStroke,i}contains(t,i){let s=!1;const r=this.points.length/2;for(let n=0,o=r-1;n<r;o=n++){const a=this.points[2*n],l=this.points[2*n+1],h=this.points[2*o],c=this.points[2*o+1];l>i!=c>i&&t<(i-l)/(c-l)*(h-a)+a&&(s=!s)}return s}toString(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce(((t,i)=>`${t}, ${i}`),"")}]`}}class Qe{constructor(t=0,i=0,s=0,r=0,n=20){this.x=t,this.y=i,this.width=s,this.height=r,this.radius=n,this.type=X.RREC}clone(){return new Qe(this.x,this.y,this.width,this.height,this.radius)}contains(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+s&&i<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=i-(this.y+s);const o=s*s;if(r*r+n*n<=o||(r=t-(this.x+this.width-s),r*r+n*n<=o)||(n=i-(this.y+this.height-s),r*r+n*n<=o)||(r=t-(this.x+s),r*r+n*n<=o))return!0}return!1}toString(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}class Yt{constructor(t,i,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=i}clone(t=this.cb,i=this.scope){return new Yt(t,i,this._x,this._y)}set(t=0,i=t){return(this._x!==t||this._y!==i)&&(this._x=t,this._y=i,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[@pixi/math:ObservablePoint x=0 y=0 scope=${this.scope}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}class U{constructor(t=1,i=0,s=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=i,this.c=s,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,i,s,r,n,o){return this.a=t,this.b=i,this.c=s,this.d=r,this.tx=n,this.ty=o,this}toArray(t,i){this.array||(this.array=new Float32Array(9));const s=i||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,i){i=i||new J;const s=t.x,r=t.y;return i.x=this.a*s+this.c*r+this.tx,i.y=this.b*s+this.d*r+this.ty,i}applyInverse(t,i){i=i||new J;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return i.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,i.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,i}translate(t,i){return this.tx+=t,this.ty+=i,this}scale(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this}rotate(t){const i=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*i-this.b*s,this.b=r*s+this.b*i,this.c=n*i-this.d*s,this.d=n*s+this.d*i,this.tx=o*i-this.ty*s,this.ty=o*s+this.ty*i,this}append(t){const i=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*i+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*i+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*i+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,i,s,r,n,o,a,l,h){return this.a=Math.cos(a+h)*n,this.b=Math.sin(a+h)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(s*this.a+r*this.c),this.ty=i-(s*this.b+r*this.d),this}prepend(t){const i=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this}decompose(t){const i=this.a,s=this.b,r=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-r,n),l=Math.atan2(s,i),h=Math.abs(a+l);return h<1e-5||Math.abs(ce-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(i*i+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*i+o.y*r),t.position.y=this.ty+(o.x*s+o.y*n),t}invert(){const t=this.a,i=this.b,s=this.c,r=this.d,n=this.tx,o=t*r-i*s;return this.a=r/o,this.b=-i/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-r*n)/o,this.ty=-(t*this.ty-i*n)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new U;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}toString(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return new U}static get TEMP_MATRIX(){return new U}}const ee=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ie=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],se=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],re=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ys=[],Dn=[],si=Math.sign;!function(){for(let e=0;e<16;e++){const t=[];ys.push(t);for(let i=0;i<16;i++){const s=si(ee[e]*ee[i]+se[e]*ie[i]),r=si(ie[e]*ee[i]+re[e]*ie[i]),n=si(ee[e]*se[i]+se[e]*re[i]),o=si(ie[e]*se[i]+re[e]*re[i]);for(let a=0;a<16;a++)if(ee[a]===s&&ie[a]===r&&se[a]===n&&re[a]===o){t.push(a);break}}}for(let e=0;e<16;e++){const t=new U;t.set(ee[e],ie[e],se[e],re[e],0,0),Dn.push(t)}}();const Q={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:e=>ee[e],uY:e=>ie[e],vX:e=>se[e],vY:e=>re[e],inv:e=>8&e?15&e:7&-e,add:(e,t)=>ys[e][t],sub:(e,t)=>ys[e][Q.inv(t)],rotate180:e=>4^e,isVertical:e=>2==(3&e),byDirection:(e,t)=>2*Math.abs(e)<=Math.abs(t)?t>=0?Q.S:Q.N:2*Math.abs(t)<=Math.abs(e)?e>0?Q.E:Q.W:t>0?e>0?Q.SE:Q.SW:e>0?Q.NE:Q.NW,matrixAppendRotationInv:(e,t,i=0,s=0)=>{const r=Dn[Q.inv(t)];r.tx=i,r.ty=s,e.append(r)}},jn=class{constructor(){this.worldTransform=new U,this.localTransform=new U,this.position=new Yt(this.onChange,this,0,0),this.scale=new Yt(this.onChange,this,1,1),this.pivot=new Yt(this.onChange,this,0,0),this.skew=new Yt(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}toString(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`}updateLocalTransform(){const e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(e){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){const i=e.worldTransform,s=this.worldTransform;s.a=t.a*i.a+t.b*i.c,s.b=t.a*i.b+t.b*i.d,s.c=t.c*i.a+t.d*i.c,s.d=t.c*i.b+t.d*i.d,s.tx=t.tx*i.a+t.ty*i.c+i.tx,s.ty=t.tx*i.b+t.ty*i.d+i.ty,this._parentID=e._worldID,this._worldID++}}setFromMatrix(e){e.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())}};let Te=jn;Te.IDENTITY=new jn;class Tt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,i,s,r,n,o,a,l){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,i,s,r,n,o,a,l);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const i=this.items.indexOf(t);return-1!==i&&(this.ensureNonAliasedItems(),this.items.splice(i,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(Tt.prototype,{dispatch:{value:Tt.prototype.emit},run:{value:Tt.prototype.emit}});const Gn={createCanvas:(e,t)=>{const i=document.createElement("canvas");return i.width=e,i.height=t,i},getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>(new DOMParser).parseFromString(e,"text/xml")};var Wi=/iPhone/i,Fr=/iPod/i,kr=/iPad/i,Br=/\biOS-universal(?:.+)Mac\b/i,qi=/\bAndroid(?:.+)Mobile\b/i,Ur=/Android/i,pe=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ri=/Silk/i,Ut=/Windows Phone/i,Dr=/\bWindows(?:.+)ARM\b/i,jr=/BlackBerry/i,Gr=/BB10/i,Xr=/Opera Mini/i,zr=/\b(CriOS|Chrome)(?:.+)Mobile/i,Hr=/Mobile(?:.+)Firefox\b/i,$r=function(e){return typeof e<"u"&&"MacIntel"===e.platform&&"number"==typeof e.maxTouchPoints&&e.maxTouchPoints>1&&typeof MSStream>"u"};const Vt=function(e){var t={userAgent:"",platform:"",maxTouchPoints:0};!e&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:"string"==typeof e?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var i=t.userAgent,s=i.split("[FBAN");typeof s[1]<"u"&&(i=s[0]),typeof(s=i.split("Twitter"))[1]<"u"&&(i=s[0]);var r=function(e){return function(t){return t.test(e)}}(i),n={apple:{phone:r(Wi)&&!r(Ut),ipod:r(Fr),tablet:!r(Wi)&&(r(kr)||$r(t))&&!r(Ut),universal:r(Br),device:(r(Wi)||r(Fr)||r(kr)||r(Br)||$r(t))&&!r(Ut)},amazon:{phone:r(pe),tablet:!r(pe)&&r(ri),device:r(pe)||r(ri)},android:{phone:!r(Ut)&&r(pe)||!r(Ut)&&r(qi),tablet:!r(Ut)&&!r(pe)&&!r(qi)&&(r(ri)||r(Ur)),device:!r(Ut)&&(r(pe)||r(ri)||r(qi)||r(Ur))||r(/\bokhttp\b/i)},windows:{phone:r(Ut),tablet:r(Dr),device:r(Ut)||r(Dr)},other:{blackberry:r(jr),blackberry10:r(Gr),opera:r(Xr),firefox:r(Hr),chrome:r(zr),device:r(jr)||r(Gr)||r(Xr)||r(Hr)||r(zr)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}(globalThis.navigator);const C={ADAPTER:Gn,MIPMAP_TEXTURES:jt.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:et.NONE,SPRITE_MAX_TEXTURES:function(e){let t=!0;if(Vt.tablet||Vt.phone){if(Vt.apple.device){const i=navigator.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Vt.android.device){const i=navigator.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?e:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,premultipliedAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1,hello:!1},GC_MODE:ki.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:qt.CLAMP,SCALE_MODE:Rt.LINEAR,PRECISION_VERTEX:wt.HIGH,PRECISION_FRAGMENT:Vt.apple.device?wt.HIGH:wt.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!Vt.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1,TARGET_FPMS:.06};var De=(e=>(e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(De||{});class Zi{constructor(t,i=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=i,this.priority=s,this.once=r}match(t,i=null){return this.fn===t&&this.context===i}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const i=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),i}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const i=this.next;return this.next=t?null:i,this.previous=null,i}}class ut{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Zi(null,null,1/0),this.deltaMS=1/C.TARGET_FPMS,this.elapsedMS=1/C.TARGET_FPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,i,s=De.NORMAL){return this._addListener(new Zi(t,i,s))}addOnce(t,i,s=De.NORMAL){return this._addListener(new Zi(t,i,s,!0))}_addListener(t){let i=this._head.next,s=this._head;if(i){for(;i;){if(t.priority>i.priority){t.connect(s);break}s=i,i=i.next}t.previous||t.connect(s)}else t.connect(s);return this._startIfPossible(),this}remove(t,i){let s=this._head.next;for(;s;)s=s.match(t,i)?s.destroy():s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,i=this._head;for(;i=i.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let i;if(t>this.lastTime){if(i=this.elapsedMS=t-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*C.TARGET_FPMS;const s=this._head;let r=s.next;for(;r;)r=r.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const i=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,i)/1e3,C.TARGET_FPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(0===t)this._minElapsedMS=0;else{const i=Math.max(this.minFPS,t);this._minElapsedMS=1/(i/1e3)}}static get shared(){if(!ut._shared){const t=ut._shared=new ut;t.autoStart=!0,t._protected=!0}return ut._shared}static get system(){if(!ut._system){const t=ut._system=new ut;t.autoStart=!0,t._protected=!0}return ut._system}}var j=(e=>(e.Renderer="renderer",e.Application="application",e.RendererSystem="renderer-webgl-system",e.RendererPlugin="renderer-webgl-plugin",e.CanvasRendererSystem="renderer-canvas-system",e.CanvasRendererPlugin="renderer-canvas-plugin",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e))(j||{});const gs=e=>{if("function"==typeof e||"object"==typeof e&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={..."object"!=typeof e.extension?{type:e.extension}:e.extension,ref:e}}if("object"!=typeof e)throw new Error("Invalid extension type");return"string"==typeof(e={...e}).type&&(e.type=[e.type]),e},Yr=(e,t)=>gs(e).priority??t,$={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(gs).forEach((t=>{t.type.forEach((i=>{var s,r;return null==(r=(s=this._removeHandlers)[i])?void 0:r.call(s,t)}))})),this},add(...e){return e.map(gs).forEach((t=>{t.type.forEach((i=>{const s=this._addHandlers,r=this._queue;s[i]?s[i](t):(r[i]=r[i]||[],r[i].push(t))}))})),this},handle(e,t,i){const s=this._addHandlers,r=this._removeHandlers;if(s[e]||r[e])throw new Error(`Extension type ${e} already has a handler`);s[e]=t,r[e]=i;const n=this._queue;return n[e]&&(n[e].forEach((o=>t(o))),delete n[e]),this},handleByMap(e,t){return this.handle(e,(i=>{t[i.name]=i.ref}),(i=>{delete t[i.name]}))},handleByList(e,t,i=-1){return this.handle(e,(s=>{t.includes(s.ref)||(t.push(s.ref),t.sort(((r,n)=>Yr(n,i)-Yr(r,i))))}),(s=>{const r=t.indexOf(s.ref);-1!==r&&t.splice(r,1)}))}};class Ds{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(i){this._ticker&&this._ticker.remove(this.render,this),this._ticker=i,i&&i.add(this.render,this,De.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ut.shared:new ut,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Ds.extension=j.Application,$.add(Ds);var Ji=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zn={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(l,h,c){this.fn=l,this.context=h,this.once=c||!1}function n(l,h,c,u,d){if("function"!=typeof c)throw new TypeError("The listener must be a function");var p=new r(c,u||l,d),f=i?i+h:h;return l._events[f]?l._events[f].fn?l._events[f]=[l._events[f],p]:l._events[f].push(p):(l._events[f]=p,l._eventsCount++),l}function o(l,h){0==--l._eventsCount?l._events=new s:delete l._events[h]}function a(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),a.prototype.eventNames=function(){var c,u,h=[];if(0===this._eventsCount)return h;for(u in c=this._events)t.call(c,u)&&h.push(i?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},a.prototype.listeners=function(h){var c=i?i+h:h,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,p=u.length,f=new Array(p);d<p;d++)f[d]=u[d].fn;return f},a.prototype.listenerCount=function(h){var c=i?i+h:h,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(h,c,u,d,p,f){var m=i?i+h:h;if(!this._events[m])return!1;var b,g,y=this._events[m],x=arguments.length;if(y.fn){switch(y.once&&this.removeListener(h,y.fn,void 0,!0),x){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,c),!0;case 3:return y.fn.call(y.context,c,u),!0;case 4:return y.fn.call(y.context,c,u,d),!0;case 5:return y.fn.call(y.context,c,u,d,p),!0;case 6:return y.fn.call(y.context,c,u,d,p,f),!0}for(g=1,b=new Array(x-1);g<x;g++)b[g-1]=arguments[g];y.fn.apply(y.context,b)}else{var v,_=y.length;for(g=0;g<_;g++)switch(y[g].once&&this.removeListener(h,y[g].fn,void 0,!0),x){case 1:y[g].fn.call(y[g].context);break;case 2:y[g].fn.call(y[g].context,c);break;case 3:y[g].fn.call(y[g].context,c,u);break;case 4:y[g].fn.call(y[g].context,c,u,d);break;default:if(!b)for(v=1,b=new Array(x-1);v<x;v++)b[v-1]=arguments[v];y[g].fn.apply(y[g].context,b)}}return!0},a.prototype.on=function(h,c,u){return n(this,h,c,u,!1)},a.prototype.once=function(h,c,u){return n(this,h,c,u,!0)},a.prototype.removeListener=function(h,c,u,d){var p=i?i+h:h;if(!this._events[p])return this;if(!c)return o(this,p),this;var f=this._events[p];if(f.fn)f.fn===c&&(!d||f.once)&&(!u||f.context===u)&&o(this,p);else{for(var m=0,y=[],x=f.length;m<x;m++)(f[m].fn!==c||d&&!f[m].once||u&&f[m].context!==u)&&y.push(f[m]);y.length?this._events[p]=1===y.length?y[0]:y:o(this,p)}return this},a.prototype.removeAllListeners=function(h){var c;return h?(c=i?i+h:h,this._events[c]&&o(this,c)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}(zn);const ti=Xn(zn.exports);var js={exports:{}};function Bi(e,t,i){i=i||2;var a,l,h,c,u,d,p,s=t&&t.length,r=s?t[0]*i:e.length,n=Hn(e,0,r,i,!0),o=[];if(!n||n.next===n.prev)return o;if(s&&(n=function(e,t,i,s){var n,o,a,l,h,r=[];for(n=0,o=t.length;n<o;n++)a=t[n]*s,l=n<o-1?t[n+1]*s:e.length,(h=Hn(e,a,l,s,!1))===h.next&&(h.steiner=!0),r.push(Oa(h));for(r.sort(Ra),n=0;n<r.length;n++)i=Ca(r[n],i);return i}(e,t,n,i)),e.length>80*i){a=h=e[0],l=c=e[1];for(var f=i;f<r;f+=i)(u=e[f])<a&&(a=u),(d=e[f+1])<l&&(l=d),u>h&&(h=u),d>c&&(c=d);p=0!==(p=Math.max(h-a,c-l))?32767/p:0}return je(n,o,i,a,l,p,0),o}function Hn(e,t,i,s,r){var n,o;if(r===_s(e,t,i,s)>0)for(n=t;n<i;n+=s)o=Vr(n,e[n],e[n+1],o);else for(n=i-s;n>=t;n-=s)o=Vr(n,e[n],e[n+1],o);return o&&Ui(o,o.next)&&(Xe(o),o=o.next),o}function ue(e,t){if(!e)return e;t||(t=e);var s,i=e;do{if(s=!1,i.steiner||!Ui(i,i.next)&&0!==tt(i.prev,i,i.next))i=i.next;else{if(Xe(i),(i=t=i.prev)===i.next)break;s=!0}}while(s||i!==t);return t}function je(e,t,i,s,r,n,o){if(e){!o&&n&&function(e,t,i,s){var r=e;do{0===r.z&&(r.z=xs(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,n,o,a,l,h=1;do{for(i=e,e=null,n=null,o=0;i;){for(o++,s=i,a=0,t=0;t<h&&(a++,s=s.nextZ);t++);for(l=h;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),n?n.nextZ=r:e=r,r.prevZ=n,n=r;i=s}n.nextZ=null,h*=2}while(o>1)}(r)}(e,s,r,n);for(var l,h,a=e;e.prev!==e.next;)if(l=e.prev,h=e.next,n?Ea(e,s,r,n):Ta(e))t.push(l.i/i|0),t.push(e.i/i|0),t.push(h.i/i|0),Xe(e),e=h.next,a=h.next;else if((e=h)===a){o?1===o?je(e=Sa(ue(e),t,i),t,i,s,r,n,2):2===o&&Ia(e,t,i,s,r,n):je(ue(e),t,i,s,r,n,1);break}}}function Ta(e){var t=e.prev,i=e,s=e.next;if(tt(t,i,s)>=0)return!1;for(var r=t.x,n=i.x,o=s.x,a=t.y,l=i.y,h=s.y,c=r<n?r<o?r:o:n<o?n:o,u=a<l?a<h?a:h:l<h?l:h,d=r>n?r>o?r:o:n>o?n:o,p=a>l?a>h?a:h:l>h?l:h,f=s.next;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=p&&be(r,a,n,l,o,h,f.x,f.y)&&tt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Ea(e,t,i,s){var r=e.prev,n=e,o=e.next;if(tt(r,n,o)>=0)return!1;for(var a=r.x,l=n.x,h=o.x,c=r.y,u=n.y,d=o.y,p=a<l?a<h?a:h:l<h?l:h,f=c<u?c<d?c:d:u<d?u:d,m=a>l?a>h?a:h:l>h?l:h,y=c>u?c>d?c:d:u>d?u:d,x=xs(p,f,t,i,s),b=xs(m,y,t,i,s),g=e.prevZ,_=e.nextZ;g&&g.z>=x&&_&&_.z<=b;){if(g.x>=p&&g.x<=m&&g.y>=f&&g.y<=y&&g!==r&&g!==o&&be(a,c,l,u,h,d,g.x,g.y)&&tt(g.prev,g,g.next)>=0||(g=g.prevZ,_.x>=p&&_.x<=m&&_.y>=f&&_.y<=y&&_!==r&&_!==o&&be(a,c,l,u,h,d,_.x,_.y)&&tt(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;g&&g.z>=x;){if(g.x>=p&&g.x<=m&&g.y>=f&&g.y<=y&&g!==r&&g!==o&&be(a,c,l,u,h,d,g.x,g.y)&&tt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;_&&_.z<=b;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=y&&_!==r&&_!==o&&be(a,c,l,u,h,d,_.x,_.y)&&tt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Sa(e,t,i){var s=e;do{var r=s.prev,n=s.next.next;!Ui(r,n)&&$n(r,s,s.next,n)&&Ge(r,n)&&Ge(n,r)&&(t.push(r.i/i|0),t.push(s.i/i|0),t.push(n.i/i|0),Xe(s),Xe(s.next),s=e=n),s=s.next}while(s!==e);return ue(s)}function Ia(e,t,i,s,r,n){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Fa(o,a)){var l=Yn(o,a);return o=ue(o,o.next),l=ue(l,l.next),je(o,t,i,s,r,n,0),void je(l,t,i,s,r,n,0)}a=a.next}o=o.next}while(o!==e)}function Ra(e,t){return e.x-t.x}function Ca(e,t){var i=function(e,t){var o,i=t,s=e.x,r=e.y,n=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){var a=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=s&&a>n&&(n=a,o=i.x<i.next.x?i:i.next,a===s))return o}i=i.next}while(i!==t);if(!o)return null;var d,l=o,h=o.x,c=o.y,u=1/0;i=o;do{s>=i.x&&i.x>=h&&s!==i.x&&be(r<c?s:n,r,h,c,r<c?n:s,r,i.x,i.y)&&(d=Math.abs(r-i.y)/(s-i.x),Ge(i,e)&&(d<u||d===u&&(i.x>o.x||i.x===o.x&&Na(o,i)))&&(o=i,u=d)),i=i.next}while(i!==l);return o}(e,t);if(!i)return t;var s=Yn(i,e);return ue(s,s.next),ue(i,i.next)}function Na(e,t){return tt(e.prev,e,t.prev)<0&&tt(t.next,e,e.next)<0}function xs(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Oa(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function be(e,t,i,s,r,n,o,a){return(r-o)*(t-a)>=(e-o)*(n-a)&&(e-o)*(s-a)>=(i-o)*(t-a)&&(i-o)*(n-a)>=(r-o)*(s-a)}function Fa(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&$n(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Ge(e,t)&&Ge(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,n=(e.y+t.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(tt(e.prev,e,t.prev)||tt(e,t.prev,t))||Ui(e,t)&&tt(e.prev,e,e.next)>0&&tt(t.prev,t,t.next)>0)}function tt(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Ui(e,t){return e.x===t.x&&e.y===t.y}function $n(e,t,i,s){var r=oi(tt(e,t,i)),n=oi(tt(e,t,s)),o=oi(tt(i,s,e)),a=oi(tt(i,s,t));return!!(r!==n&&o!==a||0===r&&ni(e,i,t)||0===n&&ni(e,s,t)||0===o&&ni(i,e,s)||0===a&&ni(i,t,s))}function ni(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function oi(e){return e>0?1:e<0?-1:0}function Ge(e,t){return tt(e.prev,e,e.next)<0?tt(e,t,e.next)>=0&&tt(e,e.prev,t)>=0:tt(e,t,e.prev)<0||tt(e,e.next,t)<0}function Yn(e,t){var i=new bs(e.i,e.x,e.y),s=new bs(t.i,t.x,t.y),r=e.next,n=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function Vr(e,t,i,s){var r=new bs(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function Xe(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function bs(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _s(e,t,i,s){for(var r=0,n=t,o=i-s;n<i;n+=s)r+=(e[o]-e[n])*(e[n+1]+e[o+1]),o=n;return r}js.exports=Bi,js.exports.default=Bi,Bi.deviation=function(e,t,i,s){var r=t&&t.length,n=r?t[0]*i:e.length,o=Math.abs(_s(e,0,n,i));if(r)for(var a=0,l=t.length;a<l;a++){var h=t[a]*i,c=a<l-1?t[a+1]*i:e.length;o-=Math.abs(_s(e,h,c,i))}var u=0;for(a=0;a<s.length;a+=3){var d=s[a]*i,p=s[a+1]*i,f=s[a+2]*i;u+=Math.abs((e[d]-e[f])*(e[p+1]-e[d+1])-(e[d]-e[p])*(e[f+1]-e[d+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},Bi.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},s=0,r=0;r<e.length;r++){for(var n=0;n<e[r].length;n++)for(var o=0;o<t;o++)i.vertices.push(e[r][n][o]);r>0&&(s+=e[r-1].length,i.holes.push(s))}return i};const Gs=Xn(js.exports);var e,t,Ai={exports:{}}; /*! https://mths.be/punycode v1.3.2 by @mathias */e=Ai,t=Ai.exports,function(i){var s=t&&!t.nodeType&&t,r=e&&!e.nodeType&&e,n="object"==typeof Ji&&Ji;(n.global===n||n.window===n||n.self===n)&&(i=n);var o,T,a=2147483647,l=36,h=1,c=26,u=38,d=700,p=72,f=128,m="-",y=/^xn--/,x=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=l-h,v=Math.floor,S=String.fromCharCode;function w(N){throw RangeError(g[N])}function E(N,F){for(var G=N.length,V=[];G--;)V[G]=F(N[G]);return V}function P(N,F){var G=N.split("@"),V="";return G.length>1&&(V=G[0]+"@",N=G[1]),V+E((N=N.replace(b,".")).split("."),F).join(".")}function D(N){for(var W,ht,F=[],G=0,V=N.length;G<V;)(W=N.charCodeAt(G++))>=55296&&W<=56319&&G<V?56320==(64512&(ht=N.charCodeAt(G++)))?F.push(((1023&W)<<10)+(1023&ht)+65536):(F.push(W),G--):F.push(W);return F}function z(N){return E(N,(function(F){var G="";return F>65535&&(G+=S((F-=65536)>>>10&1023|55296),F=56320|1023&F),G+=S(F)})).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:l}function M(N,F){return N+22+75*(N<26)-((0!=F)<<5)}function q(N,F,G){var V=0;for(N=G?v(N/d):N>>1,N+=v(N/F);N>_*c>>1;V+=l)N=v(N/_);return v(V+(_+1)*N/(N+u))}function rt(N){var V,ct,pt,xt,ft,K,ot,lt,Mt,Lt,F=[],G=N.length,W=0,ht=f,nt=p;for((ct=N.lastIndexOf(m))<0&&(ct=0),pt=0;pt<ct;++pt)N.charCodeAt(pt)>=128&&w("not-basic"),F.push(N.charCodeAt(pt));for(xt=ct>0?ct+1:0;xt<G;){for(ft=W,K=1,ot=l;xt>=G&&w("invalid-input"),((lt=A(N.charCodeAt(xt++)))>=l||lt>v((a-W)/K))&&w("overflow"),W+=lt*K,!(lt<(Mt=ot<=nt?h:ot>=nt+c?c:ot-nt));ot+=l)K>v(a/(Lt=l-Mt))&&w("overflow"),K*=Lt;nt=q(W-ft,V=F.length+1,0==ft),v(W/V)>a-ht&&w("overflow"),ht+=v(W/V),W%=V,F.splice(W++,0,ht)}return z(F)}function Y(N){var F,G,V,W,ht,nt,ct,pt,xt,ft,K,lt,Mt,Lt,Ce,ot=[];for(lt=(N=D(N)).length,F=f,G=0,ht=p,nt=0;nt<lt;++nt)(K=N[nt])<128&&ot.push(S(K));for(V=W=ot.length,W&&ot.push(m);V<lt;){for(ct=a,nt=0;nt<lt;++nt)(K=N[nt])>=F&&K<ct&&(ct=K);for(ct-F>v((a-G)/(Mt=V+1))&&w("overflow"),G+=(ct-F)*Mt,F=ct,nt=0;nt<lt;++nt)if((K=N[nt])<F&&++G>a&&w("overflow"),K==F){for(pt=G,xt=l;!(pt<(ft=xt<=ht?h:xt>=ht+c?c:xt-ht));xt+=l)Ce=pt-ft,Lt=l-ft,ot.push(S(M(ft+Ce%Lt,0))),pt=v(Ce/Lt);ot.push(S(M(pt,0))),ht=q(G,Mt,V==W),G=0,++V}++G,++F}return ot.join("")}if(o={version:"1.3.2",ucs2:{decode:D,encode:z},decode:rt,encode:Y,toASCII:function(N){return P(N,(function(F){return x.test(F)?"xn--"+Y(F):F}))},toUnicode:function(N){return P(N,(function(F){return y.test(F)?rt(F.slice(4).toLowerCase()):F}))}},s&&r)if(e.exports==s)r.exports=o;else for(T in o)o.hasOwnProperty(T)&&(s[T]=o[T]);else i.punycode=o}(Ji);var Da=Ai.exports,ze={};function Ga(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Pe=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};ze.decode=ze.parse=function(e,t,i,s){t=t||"&",i=i||"=";var r={};if("string"!=typeof e||0===e.length)return r;var n=/\+/g;e=e.split(t);var o=1e3;s&&"number"==typeof s.maxKeys&&(o=s.maxKeys);var a=e.length;o>0&&a>o&&(a=o);for(var l=0;l<a;++l){var u,d,p,f,h=e[l].replace(n,"%20"),c=h.indexOf(i);c>=0?(u=h.substr(0,c),d=h.substr(c+1)):(u=h,d=""),p=decodeURIComponent(u),f=decodeURIComponent(d),Ga(r,p)?Array.isArray(r[p])?r[p].push(f):r[p]=[r[p],f]:r[p]=f}return r},ze.encode=ze.stringify=function(e,t,i,s){return t=t||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(r){var n=encodeURIComponent(Pe(r))+i;return Array.isArray(e[r])?e[r].map((function(o){return n+encodeURIComponent(Pe(o))})).join(t):n+encodeURIComponent(Pe(e[r]))})).join(t):s?encodeURIComponent(Pe(s))+i+encodeURIComponent(Pe(e)):""};var Ha=Da,Ot={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}},$a=Di,Ya=function(e,t){return Di(e,!1,!0).resolve(t)},Va=function(e){return Ot.isString(e)&&(e=Di(e)),e instanceof Pt?e.format():Pt.prototype.format.call(e)};function Pt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Wa=/^([a-z0-9.+-]+:)/i,qa=/:[0-9]*$/,Za=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ka=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),vs=["'"].concat(Ka),Wr=["%","/","?",";","#"].concat(vs),qr=["/","?","#"],Zr=/^[+a-z0-9A-Z_-]{0,63}$/,tl=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,el={javascript:!0,"javascript:":!0},ws={javascript:!0,"javascript:":!0},ve={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ts=ze;function Di(e,t,i){if(e&&Ot.isObject(e)&&e instanceof Pt)return e;var s=new Pt;return s.parse(e,t,i),s}Pt.prototype.parse=function(e,t,i){if(!Ot.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),r=-1!==s&&s<e.indexOf("#")?"?":"#",n=e.split(r);n[0]=n[0].replace(/\\/g,"/");var a=e=n.join(r);if(a=a.trim(),!i&&1===e.split("#").length){var l=Za.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],this.query=t?Ts.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=Wa.exec(a);if(h){var c=(h=h[0]).toLowerCase();this.protocol=c,a=a.substr(h.length)}if(i||h||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var u="//"===a.substr(0,2);u&&(!h||!ws[h])&&(a=a.substr(2),this.slashes=!0)}if(!ws[h]&&(u||h&&!ve[h])){for(var d=-1,p=0;p<qr.length;p++){-1!==(f=a.indexOf(qr[p]))&&(-1===d||f<d)&&(d=f)}var m,y;-1!==(y=-1===d?a.lastIndexOf("@"):a.lastIndexOf("@",d))&&(m=a.slice(0,y),a=a.slice(y+1),this.auth=decodeURIComponent(m)),d=-1;for(p=0;p<Wr.length;p++){var f;-1!==(f=a.indexOf(Wr[p]))&&(-1===d||f<d)&&(d=f)}-1===d&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var b=this.hostname.split(/\./),g=(p=0,b.length);p<g;p++){var _=b[p];if(_&&!_.match(Zr)){for(var v="",S=0,T=_.length;S<T;S++)_.charCodeAt(S)>127?v+="x":v+=_[S];if(!v.match(Zr)){var w=b.slice(0,p),E=b.slice(p+1),P=_.match(tl);P&&(w.push(P[1]),E.unshift(P[2])),E.length&&(a="/"+E.join(".")+a),this.hostname=w.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=Ha.toASCII(this.hostname));var D=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+D,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!el[c])for(p=0,g=vs.length;p<g;p++){var A=vs[p];if(-1!==a.indexOf(A)){var M=encodeURIComponent(A);M===A&&(M=escape(A)),a=a.split(A).join(M)}}var q=a.indexOf("#");-1!==q&&(this.hash=a.substr(q),a=a.slice(0,q));var rt=a.indexOf("?");if(-1!==rt?(this.search=a.substr(rt),this.query=a.substr(rt+1),t&&(this.query=Ts.parse(this.query)),a=a.slice(0,rt)):t&&(this.search="",this.query={}),a&&(this.pathname=a),ve[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){D=this.pathname||"";var Y=this.search||"";this.path=D+Y}return this.href=this.format(),this},Pt.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",i=this.pathname||"",s=this.hash||"",r=!1,n="";this.host?r=e+this.host:this.hostname&&(r=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&Ot.isObject(this.query)&&Object.keys(this.query).length&&(n=Ts.stringify(this.query));var o=this.search||n&&"?"+n||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||ve[t])&&!1!==r?(r="//"+(r||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):r||(r=""),s&&"#"!==s.charAt(0)&&(s="#"+s),o&&"?"!==o.charAt(0)&&(o="?"+o),t+r+(i=i.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(o=o.replace("#","%23"))+s},Pt.prototype.resolve=function(e){return this.resolveObject(Di(e,!1,!0)).format()},Pt.prototype.resolveObject=function(e){if(Ot.isString(e)){var t=new Pt;t.parse(e,!1,!0),e=t}for(var i=new Pt,s=Object.keys(this),r=0;r<s.length;r++){var n=s[r];i[n]=this[n]}if(i.hash=e.hash,""===e.href)return i.href=i.format(),i;if(e.slashes&&!e.protocol){for(var o=Object.keys(e),a=0;a<o.length;a++){var l=o[a];"protocol"!==l&&(i[l]=e[l])}return ve[i.protocol]&&i.hostname&&!i.pathname&&(i.path=i.pathname="/"),i.href=i.format(),i}if(e.protocol&&e.protocol!==i.protocol){if(!ve[e.protocol]){for(var h=Object.keys(e),c=0;c<h.length;c++){var u=h[c];i[u]=e[u]}return i.href=i.format(),i}if(i.protocol=e.protocol,e.host||ws[e.protocol])i.pathname=e.pathname;else{for(var g=(e.pathname||"").split("/");g.length&&!(e.host=g.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==g[0]&&g.unshift(""),g.length<2&&g.unshift(""),i.pathname=g.join("/")}if(i.search=e.search,i.query=e.query,i.host=e.host||"",i.auth=e.auth,i.hostname=e.hostname||e.host,i.port=e.port,i.pathname||i.search){var d=i.pathname||"",p=i.search||"";i.path=d+p}return i.slashes=i.slashes||e.slashes,i.href=i.format(),i}var f=i.pathname&&"/"===i.pathname.charAt(0),m=e.host||e.pathname&&"/"===e.pathname.charAt(0),y=m||f||i.host&&e.pathname,x=y,b=i.pathname&&i.pathname.split("/")||[],_=(g=e.pathname&&e.pathname.split("/")||[],i.protocol&&!ve[i.protocol]);if(_&&(i.hostname="",i.port=null,i.host&&(""===b[0]?b[0]=i.host:b.unshift(i.host)),i.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===g[0]?g[0]=e.host:g.unshift(e.host)),e.host=null),y=y&&(""===g[0]||""===b[0])),m)i.host=e.host||""===e.host?e.host:i.host,i.hostname=e.hostname||""===e.hostname?e.hostname:i.hostname,i.search=e.search,i.query=e.query,b=g;else if(g.length)b||(b=[]),b.pop(),b=b.concat(g),i.search=e.search,i.query=e.query;else if(!Ot.isNullOrUndefined(e.search)){if(_)i.hostname=i.host=b.shift(),(v=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=v.shift(),i.host=i.hostname=v.shift());return i.search=e.search,i.query=e.query,(!Ot.isNull(i.pathname)||!Ot.isNull(i.search))&&(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!b.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var S=b.slice(-1)[0],T=(i.host||e.host||b.length>1)&&("."===S||".."===S)||""===S,w=0,E=b.length;E>=0;E--)"."===(S=b[E])?b.splice(E,1):".."===S?(b.splice(E,1),w++):w&&(b.splice(E,1),w--);if(!y&&!x)for(;w--;w)b.unshift("..");y&&""!==b[0]&&(!b[0]||"/"!==b[0].charAt(0))&&b.unshift(""),T&&"/"!==b.join("/").substr(-1)&&b.push("");var v,P=""===b[0]||b[0]&&"/"===b[0].charAt(0);_&&(i.hostname=i.host=P?"":b.length?b.shift():"",(v=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=v.shift(),i.host=i.hostname=v.shift()));return(y=y||i.host&&b.length)&&!P&&b.unshift(""),b.length?i.pathname=b.join("/"):(i.pathname=null,i.path=null),(!Ot.isNull(i.pathname)||!Ot.isNull(i.search))&&(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},Pt.prototype.parseHost=function(){var e=this.host,t=qa.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};const Vn={parse:$a,format:Va,resolve:Ya};function At(e){if("string"!=typeof e)throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Jr(e){return e.split("?")[0].split("#")[0]}const Wn={toPosix:e=>function(e,t,i){return e.replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),i)}(e,"\\","/"),isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl:e=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e),hasProtocol(e){return/^[^/:]+:\//.test(this.toPosix(e))},getProtocol(e){At(e),e=this.toPosix(e);let t="";const i=/^file:\/\/\//.exec(e),s=/^[^/:]+:\/\//.exec(e),r=/^[^/:]+:\//.exec(e);if(i||s||r){const n=(null==i?void 0:i[0])||(null==s?void 0:s[0])||(null==r?void 0:r[0]);t=n,e=e.slice(n.length)}return t},toAbsolute(e,t,i){if(this.isDataUrl(e))return e;const s=Jr(this.toPosix(t??C.ADAPTER.getBaseUrl())),r=Jr(this.toPosix(i??this.rootname(s)));return At(e),(e=this.toPosix(e)).startsWith("/")?Wn.join(r,e.slice(1)):this.isAbsolute(e)?e:this.join(s,e)},normalize(e){if(At(e=this.toPosix(e)),0===e.length)return".";let t="";const i=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));const s=e.endsWith("/");return e=function(e,t){let o,i="",s=0,r=-1,n=0;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(47===o)break;o=47}if(47===o){if(r!==a-1&&1!==n)if(r!==a-1&&2===n){if(i.length<2||2!==s||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){const l=i.lastIndexOf("/");if(l!==i.length-1){-1===l?(i="",s=0):(i=i.slice(0,l),s=i.length-1-i.lastIndexOf("/")),r=a,n=0;continue}}else if(2===i.length||1===i.length){i="",s=0,r=a,n=0;continue}t&&(i.length>0?i+="/..":i="..",s=2)}else i.length>0?i+=`/${e.slice(r+1,a)}`:i=e.slice(r+1,a),s=a-r-1;r=a,n=0}else 46===o&&-1!==n?++n:n=-1}return i}(e,!1),e.length>0&&s&&(e+="/"),i?`/${e}`:t+e},isAbsolute(e){return At(e),e=this.toPosix(e),!!this.hasProtocol(e)||e.startsWith("/")},join(...e){if(0===e.length)return".";let t;for(let i=0;i<e.length;++i){const s=e[i];if(At(s),s.length>0)if(void 0===t)t=s;else{const r=e[i-1]??"";this.extname(r)?t+=`/../${s}`:t+=`/${s}`}}return void 0===t?".":this.normalize(t)},dirname(e){if(At(e),0===e.length)return".";let t=(e=this.toPosix(e)).charCodeAt(0);const i=47===t;let s=-1,r=!0;const n=this.getProtocol(e),o=e;for(let a=(e=e.slice(n.length)).length-1;a>=1;--a)if(t=e.charCodeAt(a),47===t){if(!r){s=a;break}}else r=!1;return-1===s?i?"/":this.isUrl(o)?n+e:n:i&&1===s?"//":n+e.slice(0,s)},rootname(e){At(e);let t="";if(t=(e=this.toPosix(e)).startsWith("/")?"/":this.getProtocol(e),this.isUrl(e)){const i=e.indexOf("/",t.length);t=-1!==i?e.sl