@esotericsoftware/spine-webgl 4.3.4 → 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var Xn=class{array=[];add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},ls=class{entries={};size=0;add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let s=0,i=e.length;s<i;s++)this.add(e[s]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},it=class Qt{constructor(t=0,s=0,i=0,n=0){this.r=t,this.g=s,this.b=i,this.a=n}static WHITE=new Qt(1,1,1,1);static RED=new Qt(1,0,0,1);static GREEN=new Qt(0,1,0,1);static BLUE=new Qt(0,0,1,1);static MAGENTA=new Qt(1,0,1,1);set(t,s,i,n){return this.r=t,this.g=s,this.b=i,this.a=n,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)==="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,n){return this.r+=t,this.g+=s,this.b+=i,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,s=new Qt){return s.setFromString(t)}},B=class Mt{static epsilon=1e-5;static epsilon2=Mt.epsilon*Mt.epsilon;static PI=3.1415927;static PI2=Mt.PI*2;static invPI2=1/Mt.PI2;static radiansToDegrees=180/Mt.PI;static radDeg=Mt.radiansToDegrees;static degreesToRadians=Mt.PI/180;static degRad=Mt.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*Mt.degRad)}static sinDeg(t){return Math.sin(t*Mt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*Mt.radDeg}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return Mt.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){const n=Math.random(),r=s-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):s-Math.sqrt((1-n)*r*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ue=class he{static linear=new class extends he{applyInternal(t){return t}};static smooth=new class extends he{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends he{applyInternal(t){return t*t}};static fastSlow=new class extends he{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends he{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,s,i){return s===void 0||i===void 0?this.applyInternal(t):t+(s-t)*this.applyInternal(i)}},Ri=class extends ue{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2===0?-2:2)+1}},kn=class extends Ri{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},O=class de{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,n,r){for(let o=s,h=n;o<s+r;o++,h++)i[h]=t[o]}static arrayFill(t,s,i,n){for(let r=s;r<i;r++)t[r]=n}static setArraySize(t,s,i=0){const n=t.length;if(n===s)return t;if(t.length=s,n<s)for(let r=n;r<s;r++)t[r]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:de.setArraySize(t,s,i)}static newArray(t,s){const i=[];for(let n=0;n<t;n++)i[n]=s;return i}static newFloatArray(t){if(de.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{const s=[];for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(de.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{const s=[];for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return de.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return de.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,s,i=!0){for(let n=0;n<t.length;n++)if(t[n]===s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Vn=class{static logBones(e){for(let t=0;t<e.bones.length;t++){const s=e.bones[t].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},me=class{items=[];instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset?.(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Ee=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}},cs=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Bn=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},hs=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ye=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Ye||{}),Li=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Li||{}),Pi=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},On=class extends hs{setFilters(e,t){}setWraps(e,t){}dispose(){}},ds=class{pages=[];regions=[];constructor(e){const t=new Un(e),s=new Array(4),i={};i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.format=()=>{},i.filter=a=>{a.minFilter=O.enumValue(Ye,s[1]),a.magFilter=O.enumValue(Ye,s[2])},i.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},i.pma=a=>{a.pma=s[1]==="true"};var n={};n.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},n.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},n.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},n.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},n.rotate=a=>{const c=s[1];c==="true"?a.degrees=90:c!=="false"&&(a.degrees=parseInt(c))},n.index=a=>{a.index=parseInt(s[1])};let r=t.readLine();for(;r&&r.trim().length===0;)r=t.readLine();for(;!(!r||r.trim().length===0||t.readEntry(s,r)===0);)r=t.readLine();let o=null,h=null,l=null;for(;r!==null;)if(r.trim().length===0)o=null,r=t.readLine();else if(o){const a=new fs(o,r);for(;;){const c=t.readEntry(s,r=t.readLine());if(c===0)break;const d=n[s[0]];if(d)d(a);else{h||(h=[]),l||(l=[]),h.push(s[0]);const u=[];for(let f=0;f<c;f++)u.push(parseInt(s[f+1]));l.push(u)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),h&&h.length>0&&l&&l.length>0&&(a.names=h,a.values=l,h=null,l=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees===90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new Xi(r.trim());t.readEntry(s,r=t.readLine())!==0;){const a=i[s[0]];a&&a(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name===e)return this.regions[t];return null}setTextures(e,t=""){for(const s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Un=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const s=t.indexOf(":");if(s===-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,n=s+1;;i++){const r=t.indexOf(",",n);if(r===-1)return e[i]=t.substr(n).trim(),i;if(e[i]=t.substr(n,r-n).trim(),n=r+1,i===4)return 4}}},Xi=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}},fs=class extends Pi{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},us=class bn{static empty=[];name;timelineAttachment;timelineSlots=bn.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,s,i){let n=t[s];if(n.bone.isActive()){const r=(i?n.getAppliedPose():n.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,o=this.timelineSlots.length;r<o;r++){if(n=t[this.timelineSlots[r]],!n.bone.isActive())continue;const h=(i?n.getAppliedPose():n.getPose()).getAttachment();if(h!=null&&h.timelineAttachment===this)return!0}return!1}},Dt=class wn extends us{static nextID=0;id=wn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,s,i,n,r,o,h){n=o+(n>>1)*h;const l=s.appliedPose.deform;let a=this.vertices;const c=this.bones;if(!c){l.length>0&&(a=l);const m=s.bone.appliedPose,p=m.worldX,g=m.worldY,x=m.a,b=m.b,w=m.c,v=m.d;for(let y=i,T=o;T<n;y+=2,T+=h){const A=a[y],S=a[y+1];r[T]=A*x+S*b+p,r[T+1]=A*w+S*v+g}return}let d=0,u=0;for(let m=0;m<i;m+=2){const p=c[d];d+=p+1,u+=p}const f=t.bones;if(l.length===0)for(let m=o,p=u*3;m<n;m+=h){let g=0,x=0,b=c[d++];for(b+=d;d<b;d++,p+=3){const w=f[c[d]].appliedPose,v=a[p],y=a[p+1],T=a[p+2];g+=(v*w.a+y*w.b+w.worldX)*T,x+=(v*w.c+y*w.d+w.worldY)*T}r[m]=g,r[m+1]=x}else{const m=l;for(let p=o,g=u*3,x=u<<1;p<n;p+=h){let b=0,w=0,v=c[d++];for(v+=d;d<v;d++,g+=3,x+=2){const y=f[c[d]].appliedPose,T=a[g]+m[x],A=a[g+1]+m[x+1],S=a[g+2];b+=(T*y.a+A*y.b+y.worldX)*S,w+=(T*y.c+A*y.d+y.worldY)*S}r[p]=b,r[p+1]=w}}}copyTo(t){this.bones?(t.bones=[],O.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=O.newFloatArray(this.vertices.length),O.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},Ut=class Ci extends Dt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new it(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new it(0,0,0,0);constructor(t,s){super(t),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Ci(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],O.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],O.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],O.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new Ci(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,s,i){if(!t)throw new Error("Region not set.");const n=i.length;let r=t.u,o=t.v,h=0,l=0;if(t instanceof fs){const a=t.page,c=a.width,d=a.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/c,o-=(t.originalWidth-t.offsetX-t.width)/d,h=t.originalHeight/c,l=t.originalWidth/d;for(let u=0;u<n;u+=2)i[u]=r+s[u+1]*h,i[u+1]=o+(1-s[u])*l;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/c,o-=t.offsetY/d,h=t.originalWidth/c,l=t.originalHeight/d;for(let u=0;u<n;u+=2)i[u]=r+(1-s[u])*h,i[u+1]=o+(1-s[u+1])*l;return;case 270:r-=t.offsetY/c,o-=t.offsetX/d,h=t.originalHeight/c,l=t.originalWidth/d;for(let u=0;u<n;u+=2)i[u]=r+(1-s[u+1])*h,i[u+1]=o+s[u]*l;return;default:r-=t.offsetX/c,o-=(t.originalHeight-t.offsetY-t.height)/d,h=t.originalWidth/c,l=t.originalHeight/d}}else t?(h=t.u2-r,l=t.v2-o):(r=o=0,h=l=1);for(let a=0;a<n;a+=2)i[a]=r+s[a]*h,i[a+1]=o+s[a+1]*l}},zt=class yn extends us{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new it(1,1,1,1);tempColor=new it(1,1,1,1);constructor(t,s){super(t),this.sequence=s}copy(){const t=new yn(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,s,i,n,r){const o=t.bone.appliedPose,h=o.worldX,l=o.worldY,a=o.a,c=o.b,d=o.c,u=o.d;let f=s[0],m=s[1];i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l,n+=r,f=s[2],m=s[3],i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l,n+=r,f=s[4],m=s[5],i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l,n+=r,f=s[6],m=s[7],i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,s,i,n,r,o,h,l,a,c){if(!t)throw new Error("Region not set.");const d=h/t.originalWidth*n,u=l/t.originalHeight*r,f=-h/2*n+t.offsetX*d,m=-l/2*r+t.offsetY*u,p=f+t.width*d,g=m+t.height*u,x=o*B.degRad,b=Math.cos(x),w=Math.sin(x),v=f*b+s,y=f*w,T=m*b+i,A=m*w,S=p*b+s,C=p*w,I=g*b+i,Y=g*w;a[0]=v-A,a[1]=T+y,a[2]=v-Y,a[3]=I+y,a[4]=S-Y,a[5]=I+C,a[6]=S-A,a[7]=T+C,t==null?(c[0]=0,c[1]=0,c[2]=0,c[3]=1,c[4]=1,c[5]=1,c[6]=1,c[7]=0):(c[1]=t.v2,c[2]=t.u,c[5]=t.v,c[6]=t.u2,t.degrees===90?(c[0]=t.u2,c[3]=t.v2,c[4]=t.u,c[7]=t.v):(c[0]=t.u,c[3]=t.v,c[4]=t.u2,c[7]=t.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},ge=class rs{static _nextID=0;id=rs.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(t,s){this.regions=new Array(t),this.pathSuffix=s}copy(){const t=this.regions.length,s=new rs(t,this.pathSuffix);if(O.arrayCopy(this.regions,0,s.regions,0,t),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const i=this.uvs[0].length;s.uvs=[];for(let n=0;n<t;n++)s.uvs[n]=O.newFloatArray(i),O.arrayCopy(this.uvs[n],0,s.uvs[n],0,i)}if(this.offsets!=null){s.offsets=[];for(let i=0;i<t;i++)s.offsets[i]=[],O.arrayCopy(this.offsets[i],0,s.offsets[i],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof zt){this.uvs=[],this.offsets=[];for(let i=0;i<s;i++)this.uvs[i]=O.newFloatArray(8),this.offsets[i]=[],zt.computeUVs(this.regions[i],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[i],this.uvs[i])}else if(t instanceof Ut){const i=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let n=0;n<s;n++)this.uvs[n]=O.newFloatArray(i.length),Ut.computeUVs(this.regions[n],i,this.uvs[n])}}resolveIndex(t){let s=t.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,s){if(!this.pathSuffix)return t;let i=t;const n=(this.start+s).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return rs._nextID++}},ms=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(ms||{}),gs=[0,1,2,3,4,5,6],Fe=class{name;timelines=[];timelineIds;bones;color=new it(1,1,1,1);duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=s,this.timelineIds=new ls,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,i=e;for(let n=0;n<t;n++){const r=i[n];this.timelineIds.addAll(r.propertyIds),Bi(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,n,r,o,h,l,a){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!==0&&(s%=this.duration,t>0&&(t%=this.duration));const c=this.timelines;for(let d=0,u=c.length;d<u;d++)c[d].apply(e,t,s,n,r,o,h,l,a)}},ki=(e=>(e[e.rotate=0]="rotate",e[e.x=1]="x",e[e.y=2]="y",e[e.scaleX=3]="scaleX",e[e.scaleY=4]="scaleY",e[e.shearX=5]="shearX",e[e.shearY=6]="shearY",e[e.inherit=7]="inherit",e[e.rgb=8]="rgb",e[e.alpha=9]="alpha",e[e.rgb2=10]="rgb2",e[e.attachment=11]="attachment",e[e.deform=12]="deform",e[e.event=13]="event",e[e.drawOrder=14]="drawOrder",e[e.ikConstraint=15]="ikConstraint",e[e.transformConstraint=16]="transformConstraint",e[e.pathConstraintPosition=17]="pathConstraintPosition",e[e.pathConstraintSpacing=18]="pathConstraintSpacing",e[e.pathConstraintMix=19]="pathConstraintMix",e[e.physicsConstraintInertia=20]="physicsConstraintInertia",e[e.physicsConstraintStrength=21]="physicsConstraintStrength",e[e.physicsConstraintDamping=22]="physicsConstraintDamping",e[e.physicsConstraintMass=23]="physicsConstraintMass",e[e.physicsConstraintWind=24]="physicsConstraintWind",e[e.physicsConstraintGravity=25]="physicsConstraintGravity",e[e.physicsConstraintMix=26]="physicsConstraintMix",e[e.physicsConstraintReset=27]="physicsConstraintReset",e[e.sequence=28]="sequence",e[e.sliderTime=29]="sliderTime",e[e.sliderMix=30]="sliderMix",e))(ki||{}),gt=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=O.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(e,t,s=1){const i=e.length;for(let n=s;n<i;n+=s)if(e[n]>t)return n-s;return i-s}};function Vi(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var qt=class extends gt{curves;constructor(e,t,...s){super(e,...s),this.curves=O.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=O.newFloatArray(t);O.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,n,r,o,h,l,a,c){const d=this.curves;let u=this.getFrameCount()+e*18;s===0&&(d[t]=2+u);const f=(i-r*2+h)*.03,m=(n-o*2+l)*.03,p=((r-h)*3-i+a)*.006,g=((o-l)*3-n+c)*.006;let x=f*2+p,b=m*2+g,w=(r-i)*.3+f+p*.16666667,v=(o-n)*.3+m+g*.16666667,y=i+w,T=n+v;for(let A=u+18;u<A;u+=2)d[u]=y,d[u+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getBezierValue(e,t,s,i){const n=this.curves;if(n[i]>e){const l=this.frames[t],a=this.frames[t+s];return a+(e-l)/(n[i]-l)*(n[i+1]-a)}const r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=e){const l=n[i-2],a=n[i-1];return a+(e-l)/(n[i]-l)*(n[i+1]-a)}t+=this.getFrameEntries();const o=n[r-2],h=n[r-1];return h+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-h)}},pe=class extends qt{constructor(e,t,s){super(e,t,s)}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){const t=this.frames;let s=t.length-2;for(let n=2;n<=s;n+=2)if(t[n]>e){s=n-2;break}const i=this.curves[s>>1];switch(i){case 0:{const n=t[s],r=t[s+1];return r+(e-n)/(t[s+2]-n)*(t[s+2+1]-r)}case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,n,r){if(e<this.frames[0])return s?r:n;const o=this.getCurveValue(e);return s?r+o*t:n+(i?o:o+r-n)*t}getAbsoluteValue(e,t,s,i,n,r,o){return o===void 0?this.getAbsoluteValue1(e,t,s,i,n,r):this.getAbsoluteValue2(e,t,s,i,n,r,o)}getAbsoluteValue1(e,t,s,i,n,r){if(e<this.frames[0])return s?r:n;const o=this.getCurveValue(e);return s?r+(i?o:o-r)*t:n+(i?o:o-n)*t}getAbsoluteValue2(e,t,s,i,n,r,o){return e<this.frames[0]?s?r:n:s?r+(i?o:o-r)*t:n+(i?o:o-n)*t}getScaleValue(e,t,s,i,n,r,o){if(e<this.frames[0])return s?o:r;const h=this.getCurveValue(e)*o;if(t===1&&!i)return h;let l=s?o:r;return i?l+(h-o)*t:n?l+(Math.abs(h)*Math.sign(l)-l)*t:(l=Math.abs(l)*Math.sign(h),l+(h-l)*t)}};function Bi(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var Wt=class extends pe{boneIndex;constructor(e,t,s,i){super(e,t,`${i}|${s}`),this.boneIndex=s,this.additive=!0}apply(e,t,s,i,n,r,o,h,l){const a=e.bones[this.boneIndex];a.active&&this.apply1(l?a.appliedPose:a.pose,a.data.setupPose,s,n,r,o,h)}},Re=class extends qt{boneIndex;constructor(e,t,s,i,n){super(e,t,`${i}|${s}`,`${n}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}apply(e,t,s,i,n,r,o,h,l){const a=e.bones[this.boneIndex];a.active&&this.apply1(l?a.appliedPose:a.pose,a.data.setupPose,s,n,r,o,h)}},xe=class extends Wt{constructor(e,t,s){super(e,t,s,0)}apply1(e,t,s,i,n,r,o){e.rotation=this.getRelativeValue(s,i,n,r,e.rotation,t.rotation)}},ps=class extends Re{constructor(e,t,s){super(e,t,s,1,2)}apply1(e,t,s,i,n,r,o){const h=this.frames;if(s<h[0]){n&&(e.x=t.x,e.y=t.y);return}let l=0,a=0;const c=gt.search(h,s,3),d=this.curves[c/3];switch(d){case 0:{const u=h[c];l=h[c+1],a=h[c+2];const f=(s-u)/(h[c+3]-u);l+=(h[c+3+1]-l)*f,a+=(h[c+3+2]-a)*f;break}case 1:l=h[c+1],a=h[c+2];break;default:l=this.getBezierValue(s,c,1,d-2),a=this.getBezierValue(s,c,2,d+18-2)}n?(e.x=t.x+l*i,e.y=t.y+a*i):r?(e.x+=l*i,e.y+=a*i):(e.x+=(t.x+l-e.x)*i,e.y+=(t.y+a-e.y)*i)}},xs=class extends Wt{constructor(e,t,s){super(e,t,s,1)}apply1(e,t,s,i,n,r,o){e.x=this.getRelativeValue(s,i,n,r,e.x,t.x)}},bs=class extends Wt{constructor(e,t,s){super(e,t,s,2)}apply1(e,t,s,i,n,r,o){e.y=this.getRelativeValue(s,i,n,r,e.y,t.y)}},ws=class extends Re{constructor(e,t,s){super(e,t,s,3,4)}apply1(e,t,s,i,n,r,o){const h=this.frames;if(s<h[0]){n&&(e.scaleX=t.scaleX,e.scaleY=t.scaleY);return}let l,a;const c=gt.search(h,s,3),d=this.curves[c/3];switch(d){case 0:{const u=h[c];l=h[c+1],a=h[c+2];const f=(s-u)/(h[c+3]-u);l+=(h[c+3+1]-l)*f,a+=(h[c+3+2]-a)*f;break}case 1:l=h[c+1],a=h[c+2];break;default:l=this.getBezierValue(s,c,1,d-2),a=this.getBezierValue(s,c,2,d+18-2)}if(l*=t.scaleX,a*=t.scaleY,i===1&&!r)e.scaleX=l,e.scaleY=a;else{let u=0,f=0;n?(u=t.scaleX,f=t.scaleY):(u=e.scaleX,f=e.scaleY),r?(e.scaleX=u+(l-t.scaleX)*i,e.scaleY=f+(a-t.scaleY)*i):o?(e.scaleX=u+(Math.abs(l)*Math.sign(u)-u)*i,e.scaleY=f+(Math.abs(a)*Math.sign(f)-f)*i):(u=Math.abs(u)*Math.sign(l),f=Math.abs(f)*Math.sign(a),e.scaleX=u+(l-u)*i,e.scaleY=f+(a-f)*i)}}},ys=class extends Wt{constructor(e,t,s){super(e,t,s,3)}apply1(e,t,s,i,n,r,o){e.scaleX=this.getScaleValue(s,i,n,r,o,e.scaleX,t.scaleX)}},vs=class extends Wt{constructor(e,t,s){super(e,t,s,4)}apply1(e,t,s,i,n,r,o){e.scaleY=this.getScaleValue(s,i,n,r,o,e.scaleY,t.scaleY)}},Ts=class extends Re{constructor(e,t,s){super(e,t,s,5,6)}apply1(e,t,s,i,n,r,o){const h=this.frames;if(s<h[0]){n&&(e.shearX=t.shearX,e.shearY=t.shearY);return}let l=0,a=0;const c=gt.search(h,s,3),d=this.curves[c/3];switch(d){case 0:{const u=h[c];l=h[c+1],a=h[c+2];const f=(s-u)/(h[c+3]-u);l+=(h[c+3+1]-l)*f,a+=(h[c+3+2]-a)*f;break}case 1:l=h[c+1],a=h[c+2];break;default:l=this.getBezierValue(s,c,1,d-2),a=this.getBezierValue(s,c,2,d+18-2)}n?(e.shearX=t.shearX+l*i,e.shearY=t.shearY+a*i):r?(e.shearX+=l*i,e.shearY+=a*i):(e.shearX+=(t.shearX+l-e.shearX)*i,e.shearY+=(t.shearY+a-e.shearY)*i)}},As=class extends Wt{constructor(e,t,s){super(e,t,s,5)}apply1(e,t,s,i,n,r,o){e.shearX=this.getRelativeValue(s,i,n,r,e.shearX,t.shearX)}},Ss=class extends Wt{constructor(e,t,s){super(e,t,s,6)}apply1(e,t,s,i,n,r,o){e.shearY=this.getRelativeValue(s,i,n,r,e.shearY,t.shearY)}},Cs=class extends gt{boneIndex;constructor(e,t){super(e,`7|${t}`),this.boneIndex=t,this.instant=!0}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,n,r,o,h,l){const a=e.bones[this.boneIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose;if(h)r&&(c.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(c.inherit=a.data.setupPose.inherit):c.inherit=this.frames[gt.search(d,s,2)+1]}}},be=class extends qt{slotIndex;constructor(e,t,s,...i){super(e,t,...i),this.slotIndex=s}apply(e,t,s,i,n,r,o,h,l){const a=e.slots[this.slotIndex];a.bone.active&&this.apply1(a,l?a.appliedPose:a.pose,s,n,r,o)}},Is=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(e,t,s,i,n,r){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r}apply1(e,t,s,i,n,r){const o=t.color,h=this.frames;if(s<h[0]){n&&o.setFromColor(e.data.setupPose.color);return}let l=0,a=0,c=0,d=0;const u=gt.search(h,s,5),f=this.curves[u/5];switch(f){case 0:{const m=h[u];l=h[u+1],a=h[u+2],c=h[u+3],d=h[u+4];const p=(s-m)/(h[u+5]-m);l+=(h[u+5+1]-l)*p,a+=(h[u+5+2]-a)*p,c+=(h[u+5+3]-c)*p,d+=(h[u+5+4]-d)*p;break}case 1:l=h[u+1],a=h[u+2],c=h[u+3],d=h[u+4];break;default:l=this.getBezierValue(s,u,1,f-2),a=this.getBezierValue(s,u,2,f+18-2),c=this.getBezierValue(s,u,3,f+18*2-2),d=this.getBezierValue(s,u,4,f+18*3-2)}if(i===1)o.set(l,a,c,d);else if(n){const m=e.data.setupPose.color;o.set(m.r+(l-m.r)*i,m.g+(a-m.g)*i,m.b+(c-m.b)*i,m.a+(d-m.a)*i)}else o.add((l-o.r)*i,(a-o.g)*i,(c-o.b)*i,(d-o.a)*i)}},Ms=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(e,t,s,i,n){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n}apply1(e,t,s,i,n,r){const o=t.color;let h=0,l=0,a=0;const c=this.frames;if(s<c[0]){if(n){const f=e.data.setupPose.color;o.r=f.r,o.g=f.g,o.b=f.b}return}const d=gt.search(c,s,4),u=this.curves[d>>2];switch(u){case 0:{const f=c[d];h=c[d+1],l=c[d+2],a=c[d+3];const m=(s-f)/(c[d+4]-f);h+=(c[d+4+1]-h)*m,l+=(c[d+4+2]-l)*m,a+=(c[d+4+3]-a)*m;break}case 1:h=c[d+1],l=c[d+2],a=c[d+3];break;default:h=this.getBezierValue(s,d,1,u-2),l=this.getBezierValue(s,d,2,u+18-2),a=this.getBezierValue(s,d,3,u+18*2-2)}if(i!==1)if(n){const f=e.data.setupPose.color;h=f.r+(h-f.r)*i,l=f.g+(l-f.g)*i,a=f.b+(a-f.b)*i}else h=o.r+(h-o.r)*i,l=o.g+(l-o.g)*i,a=o.b+(a-o.b)*i;o.r=h<0?0:h>1?1:h,o.g=l<0?0:l>1?1:l,o.b=a<0?0:a>1?1:a}},Es=class extends pe{slotIndex=0;constructor(e,t,s){super(e,t,`9|${s}`),this.slotIndex=s}apply(e,t,s,i,n,r,o,h,l){const a=e.slots[this.slotIndex];if(!a.bone.active)return;const c=(l?a.appliedPose:a.pose).color;let d=0;const u=this.frames;if(s<u[0]){r&&(c.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),n!==1)if(r){const f=a.data.setupPose.color;d=f.a+(d-f.a)*n}else d=c.a+(d-c.a)*n;c.a=d<0?0:d>1?1:d}},Ys=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,i,n,r,o,h,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r,this.frames[e+5]=o,this.frames[e+6]=h,this.frames[e+7]=l}apply1(e,t,s,i,n,r){const o=t.color,h=t.darkColor;let l=0,a=0,c=0;const d=this.frames;if(s<d[0]){if(n){const b=e.data.setupPose;o.setFromColor(b.color);const w=b.darkColor;h.r=w.r,h.g=w.g,h.b=w.b}return}let u=0,f=0,m=0,p=0;const g=gt.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];u=d[g+1],f=d[g+2],m=d[g+3],p=d[g+4],l=d[g+5],a=d[g+6],c=d[g+7];const w=(s-b)/(d[g+8]-b);u+=(d[g+8+1]-u)*w,f+=(d[g+8+2]-f)*w,m+=(d[g+8+3]-m)*w,p+=(d[g+8+4]-p)*w,l+=(d[g+8+5]-l)*w,a+=(d[g+8+6]-a)*w,c+=(d[g+8+7]-c)*w;break}case 1:u=d[g+1],f=d[g+2],m=d[g+3],p=d[g+4],l=d[g+5],a=d[g+6],c=d[g+7];break;default:u=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),l=this.getBezierValue(s,g,5,x+18*4-2),a=this.getBezierValue(s,g,6,x+18*5-2),c=this.getBezierValue(s,g,7,x+18*6-2)}if(i===1)o.set(u,f,m,p);else if(n){const b=e.data.setupPose;let w=b.color;o.set(w.r+(u-w.r)*i,w.g+(f-w.g)*i,w.b+(m-w.b)*i,w.a+(p-w.a)*i),w=b.darkColor,l=w.r+(l-w.r)*i,a=w.g+(a-w.g)*i,c=w.b+(c-w.b)*i}else o.add((u-o.r)*i,(f-o.g)*i,(m-o.b)*i,(p-o.a)*i),l=h.r+(l-h.r)*i,a=h.g+(a-h.g)*i,c=h.b+(c-h.b)*i;h.r=l<0?0:l>1?1:l,h.g=a<0?0:a>1?1:a,h.b=c<0?0:c>1?1:c}},Fs=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,i,n,r,o,h){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r,this.frames[e+5]=o,this.frames[e+6]=h}apply1(e,t,s,i,n,r){const o=t.color,h=t.darkColor;let l=0,a=0,c=0,d=0,u=0,f=0;const m=this.frames;if(s<m[0]){if(n){const x=e.data.setupPose,b=x.color,w=x.darkColor;o.r=b.r,o.g=b.g,o.b=b.b,h.r=w.r,h.g=w.g,h.b=w.b}return}const p=gt.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];l=m[p+1],a=m[p+2],c=m[p+3],d=m[p+4],u=m[p+5],f=m[p+6];const b=(s-x)/(m[p+7]-x);l+=(m[p+7+1]-l)*b,a+=(m[p+7+2]-a)*b,c+=(m[p+7+3]-c)*b,d+=(m[p+7+4]-d)*b,u+=(m[p+7+5]-u)*b,f+=(m[p+7+6]-f)*b;break}case 1:l=m[p+1],a=m[p+2],c=m[p+3],d=m[p+4],u=m[p+5],f=m[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),c=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),u=this.getBezierValue(s,p,5,g+18*4-2),f=this.getBezierValue(s,p,6,g+18*5-2)}if(i!==1)if(n){const x=e.data.setupPose;let b=x.color;l=b.r+(l-b.r)*i,a=b.g+(a-b.g)*i,c=b.b+(c-b.b)*i,b=x.darkColor,d=b.r+(d-b.r)*i,u=b.g+(u-b.g)*i,f=b.b+(f-b.b)*i}else l=o.r+(l-o.r)*i,a=o.g+(a-o.g)*i,c=o.b+(c-o.b)*i,d=h.r+(d-h.r)*i,u=h.g+(u-h.g)*i,f=h.b+(f-h.b)*i;o.r=l<0?0:l>1?1:l,o.g=a<0?0:a>1?1:a,o.b=c<0?0:c>1?1:c,h.r=d<0?0:d>1?1:d,h.g=u<0?0:u>1?1:u,h.b=f<0?0:f>1?1:f}},ie=class extends gt{slotIndex=0;attachmentNames;constructor(e,t){super(e,`11|${t}`),this.slotIndex=t,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,n,r,o,h,l){const a=e.slots[this.slotIndex];if(!a.bone.active)return;const c=l?a.appliedPose:a.pose;h||s<this.frames[0]?r&&this.setAttachment(e,c,a.data.attachmentName):this.setAttachment(e,c,this.attachmentNames[gt.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Rs=class extends qt{slotIndex;attachment;vertices;constructor(e,t,s,i){super(e,t,`12|${s}|${i.id}`),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,n,r,o,h,l,a,c){const d=this.curves;let u=this.getFrameCount()+e*18;s===0&&(d[t]=2+u);const f=(i-r*2+h)*.03,m=l*.03-o*.06,p=((r-h)*3-i+a)*.006,g=(o-l+.33333333)*.018;let x=f*2+p,b=m*2+g,w=(r-i)*.3+f+p*.16666667,v=o*.3+m+g*.16666667,y=i+w,T=v;for(let A=u+18;u<A;u+=2)d[u]=y,d[u+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getCurvePercent(e,t){const s=this.curves;let i=s[t];switch(i){case 0:{const h=this.frames[t];return(e-h)/(this.frames[t+this.getFrameEntries()]-h)}case 1:return 0}if(i-=2,s[i]>e){const h=this.frames[t];return s[i+1]*(e-h)/(s[i]-h)}const n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=e){const h=s[i-2],l=s[i-1];return l+(e-h)/(s[i]-h)*(s[i+1]-l)}const r=s[n-2],o=s[n-1];return o+(1-o)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,i,n,r,o,h,l){const a=e.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,l))return;const c=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],l,r);for(const g of c)this.applyBeforeFirst(a[g],l,r);return}let u,f,m;if(s>=d[d.length-1])m=0,u=this.vertices[d.length-1],f=null;else{const g=gt.search(d,s);m=this.getCurvePercent(s,g),u=this.vertices[g],f=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],l,u,f,m,p,n,r,o);for(const g of c)this.applyToSlot(a[g],l,u,f,m,p,n,r,o)}applyToSlot(e,t,s,i,n,r,o,h,l){if(!e.bone.active)return;const a=t?e.appliedPose:e.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const c=a.attachment,d=a.deform;if(d.length===0&&(h=!0),d.length=r,i===null)if(o===1)if(l&&!h)if(c.bones)for(let u=0;u<r;u++)d[u]+=s[u];else{const u=c.vertices;for(let f=0;f<r;f++)d[f]+=s[f]-u[f]}else O.arrayCopy(s,0,d,0,r);else if(h)if(c.bones)for(let u=0;u<r;u++)d[u]=s[u]*o;else{const u=c.vertices;for(let f=0;f<r;f++){const m=u[f];d[f]=m+(s[f]-m)*o}}else if(l)if(c.bones)for(let u=0;u<r;u++)d[u]+=s[u]*o;else{const u=c.vertices;for(let f=0;f<r;f++)d[f]+=(s[f]-u[f])*o}else for(let u=0;u<r;u++)d[u]+=(s[u]-d[u])*o;else if(o===1)if(l&&!h)if(c.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=f+(i[u]-f)*n}else{const u=c.vertices;for(let f=0;f<r;f++){const m=s[f];d[f]+=m+(i[f]-m)*n-u[f]}}else if(n===0)O.arrayCopy(s,0,d,0,r);else for(let u=0;u<r;u++){const f=s[u];d[u]=f+(i[u]-f)*n}else if(h)if(c.bones)for(let u=0;u<r;u++){const f=s[u];d[u]=(f+(i[u]-f)*n)*o}else{const u=c.vertices;for(let f=0;f<r;f++){const m=s[f],p=u[f];d[f]=p+(m+(i[f]-m)*n-p)*o}}else if(l)if(c.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(i[u]-f)*n)*o}else{const u=c.vertices;for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(i[f]-m)*n-u[f])*o}}else for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(i[u]-f)*n-d[u])*o}}applyBeforeFirst(e,t,s){if(!e.bone.active)return;const i=t?e.appliedPose:e.pose;i.attachment==null||i.attachment.timelineAttachment!==this.attachment||(i.deform.length===0&&(s=!0),s&&(i.deform.length=0))}},Ls=class Ht extends gt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,`28|${s}|${i.sequence.id}`),this.slotIndex=s,this.attachment=i,this.instant=!0}getFrameEntries(){return Ht.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,n,r){const o=this.frames;t*=Ht.ENTRIES,o[t]=s,o[t+Ht.MODE]=i|n<<4,o[t+Ht.DELAY]=r}apply(t,s,i,n,r,o,h,l,a){const c=t.slots;if(!this.attachment.isTimelineActive(c,this.slotIndex,a))return;const d=this.attachment.timelineSlots,u=this.frames;if(l||i<u[0]){if(o){this.setupPose(c[this.slotIndex],a);for(const x of d)this.setupPose(c[x],a)}return}const f=gt.search(u,i,Ht.ENTRIES),m=u[f],p=u[f+Ht.MODE],g=u[f+Ht.DELAY];this.applyToSlot(c[this.slotIndex],a,i,m,p,g);for(const x of d)this.applyToSlot(c[x],a,i,m,p,g)}setupPose(t,s){if(!t.bone.active)return;const i=s?t.appliedPose:t.pose;i.attachment===null||i.attachment.timelineAttachment!==this.attachment||(i.sequenceIndex=-1)}applyToSlot(t,s,i,n,r,o){if(!t.bone.active)return;const h=s?t.appliedPose:t.pose;if(h.attachment===null||h.attachment.timelineAttachment!==this.attachment)return;let l=r>>4,a=h.attachment.sequence.regions.length;const c=gs[r&15];if(c!==0)switch(l+=(i-n)/o+1e-5|0,c){case 1:l=Math.min(a-1,l);break;case 2:l%=a;break;case 3:{const d=(a<<1)-2;l=d===0?0:l%d,l>=a&&(l=d-l);break}case 4:l=Math.max(a-1-l,0);break;case 5:l=a-1-l%a;break;case 6:{const d=(a<<1)-2;l=d===0?0:(l+a-1)%d,l>=a&&(l=d-l)}}h.sequenceIndex=l}},Le=class vn extends gt{static propertyIds=["13"];events;constructor(t){super(t,...vn.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,n,r,o,h,l,a){if(!n)return;const c=this.frames,d=this.frames.length;if(s>i)this.apply(null,s,Number.MAX_VALUE,n,0,!1,!1,!1,!1),s=-1;else if(s>=c[d-1])return;if(i<c[0])return;let u=0;if(s<c[0])u=0;else{u=gt.search(c,s)+1;const f=c[u];for(;u>0&&c[u-1]===f;)u--}for(;u<d&&i>=c[u];u++)n.push(this.events[u])}},jt=class Ii extends gt{static propertyID="14";static propertyIds=[Ii.propertyID];drawOrders;constructor(t){super(t,...Ii.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,n,r,o,h,l,a){const c=a?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||i<this.frames[0]){o&&O.arrayCopy(d,0,c,0,t.slots.length);return}const u=this.drawOrders[gt.search(this.frames,i)];if(!u)O.arrayCopy(d,0,c,0,t.slots.length);else for(let f=0,m=u.length;f<m;f++)c[f]=d[u[f]]}},we=class Tn extends gt{slots;inFolder;drawOrders;constructor(t,s,i){super(t,...Tn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(t),this.inFolder=new Array(i);for(const n of s)this.inFolder[n]=!0;this.instant=!0}static propertyIds(t){const s=t.length,i=new Array(s);for(let n=0;n<s;n++)i[n]=`d${t[n]}`;return i}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,n,r,o,h,l,a){const c=a?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||i<this.frames[0])o&&this.setup(c,d);else{const u=this.drawOrders[gt.search(this.frames,i)];if(!u)this.setup(c,d);else{const f=this.inFolder,m=this.slots;for(let p=0,g=0,x=m.length;!(f[c[p].data.index]&&(c[p]=d[m[u[g]]],++g===x));p++);}}}setup(t,s){const{inFolder:i,slots:n}=this;for(let r=0,o=0,h=n.length;!(i[t[r].data.index]&&(t[r]=s[n[o]],++o===h));r++);}};function Oi(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var Ps=class extends qt{constraintIndex=0;constructor(e,t,s){super(e,t,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,n,r,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.data.setupPose;c.mix=x.mix,c.softness=x.softness,c.bendDirection=x.bendDirection,c.compress=x.compress,c.stretch=x.stretch}return}let u=0,f=0;const m=gt.search(d,s,6),p=this.curves[m/6];switch(p){case 0:{const x=d[m];u=d[m+1],f=d[m+2];const b=(s-x)/(d[m+6]-x);u+=(d[m+6+1]-u)*b,f+=(d[m+6+2]-f)*b;break}case 1:u=d[m+1],f=d[m+2];break;default:u=this.getBezierValue(s,m,1,p-2),f=this.getBezierValue(s,m,2,p+18-2)}const g=r?a.data.setupPose:c;c.mix=g.mix+(u-g.mix)*n,c.softness=g.softness+(f-g.softness)*n,h?r&&(c.bendDirection=g.bendDirection,c.compress=g.compress,c.stretch=g.stretch):(c.bendDirection=d[m+3],c.compress=d[m+4]!==0,c.stretch=d[m+5]!==0)}},Xs=class extends qt{constraintIndex=0;constructor(e,t,s){super(e,t,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(e,t,s,i,n,r,o,h){const l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=n,l[e+4]=r,l[e+5]=o,l[e+6]=h}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.data.setupPose;c.mixRotate=y.mixRotate,c.mixX=y.mixX,c.mixY=y.mixY,c.mixScaleX=y.mixScaleX,c.mixScaleY=y.mixScaleY,c.mixShearY=y.mixShearY}return}let u,f,m,p,g,x;const b=gt.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];u=d[b+1],f=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const T=(s-y)/(d[b+7]-y);u+=(d[b+7+1]-u)*T,f+=(d[b+7+2]-f)*T,m+=(d[b+7+3]-m)*T,p+=(d[b+7+4]-p)*T,g+=(d[b+7+5]-g)*T,x+=(d[b+7+6]-x)*T;break}case 1:u=d[b+1],f=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:u=this.getBezierValue(s,b,1,w-2),f=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+18*2-2),p=this.getBezierValue(s,b,4,w+18*3-2),g=this.getBezierValue(s,b,5,w+18*4-2),x=this.getBezierValue(s,b,6,w+18*5-2)}const v=r?a.data.setupPose:c;o?(c.mixRotate=v.mixRotate+u*n,c.mixX=v.mixX+f*n,c.mixY=v.mixY+m*n,c.mixScaleX=v.mixScaleX+p*n,c.mixScaleY=v.mixScaleY+g*n,c.mixShearY=v.mixShearY+x*n):(c.mixRotate=v.mixRotate+(u-v.mixRotate)*n,c.mixX=v.mixX+(f-v.mixX)*n,c.mixY=v.mixY+(m-v.mixY)*n,c.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*n,c.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*n,c.mixShearY=v.mixShearY+(x-v.mixShearY)*n)}},ne=class extends pe{constraintIndex;constructor(e,t,s,i){super(e,t,`${i}|${s}`),this.constraintIndex=s}},ks=class extends ne{constructor(e,t,s){super(e,t,s,17),this.additive=!0}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.position=this.getAbsoluteValue(s,n,r,o,c.position,a.data.setupPose.position)}}},Vs=class extends ne{constructor(e,t,s){super(e,t,s,18)}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.spacing=this.getAbsoluteValue(s,n,r,!1,c.spacing,a.data.setupPose.spacing)}}},Bs=class extends qt{constraintIndex;constructor(e,t,s){super(e,t,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,n){const r=this.frames;e<<=2,r[e]=t,r[e+1]=s,r[e+2]=i,r[e+3]=n}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;c.mixRotate=b.mixRotate,c.mixX=b.mixX,c.mixY=b.mixY}return}let u,f,m;const p=gt.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];u=d[p+1],f=d[p+2],m=d[p+3];const w=(s-b)/(d[p+4]-b);u+=(d[p+4+1]-u)*w,f+=(d[p+4+2]-f)*w,m+=(d[p+4+3]-m)*w;break}case 1:u=d[p+1],f=d[p+2],m=d[p+3];break;default:u=this.getBezierValue(s,p,1,g-2),f=this.getBezierValue(s,p,2,g+18-2),m=this.getBezierValue(s,p,3,g+18*2-2)}const x=r?a.data.setupPose:c;o?(c.mixRotate=x.mixRotate+u*n,c.mixX=x.mixX+f*n,c.mixY=x.mixY+m*n):(c.mixRotate=x.mixRotate+(u-x.mixRotate)*n,c.mixX=x.mixX+(f-x.mixX)*n,c.mixY=x.mixY+(m-x.mixY)*n)}},Nt=class extends ne{constructor(e,t,s,i){super(e,t,s,i)}apply(e,t,s,i,n,r,o,h,l){if(o&&!this.additive&&(o=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,c=e.physics;for(const d of c)if(d.active&&this.global(d.data)){const u=l?d.appliedPose:d.pose;this.set(u,this.getAbsoluteValue(s,n,r,o,this.get(u),this.get(d.data.setupPose),a))}}else{const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;this.set(c,this.getAbsoluteValue(s,n,r,o,this.get(c),this.get(a.data.setupPose)))}}}},Os=class extends Nt{constructor(e,t,s){super(e,t,s,20)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Us=class extends Nt{constructor(e,t,s){super(e,t,s,21)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ns=class extends Nt{constructor(e,t,s){super(e,t,s,22)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Ds=class extends Nt{constructor(e,t,s){super(e,t,s,23)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},zs=class extends Nt{constructor(e,t,s){super(e,t,s,24),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},qs=class extends Nt{constructor(e,t,s){super(e,t,s,25),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Ws=class extends Nt{constructor(e,t,s){super(e,t,s,26)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},_s=class An extends gt{static propertyIds=["27"];constraintIndex;constructor(t,s){super(t,...An.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,n,r,o,h,l,a){let c;if(this.constraintIndex!==-1&&(c=t.constraints[this.constraintIndex],!c.active))return;const d=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],r,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(i<d[0])&&(s<d[0]||i>=d[gt.search(d,s)+1]))if(c!=null)c.reset(t);else for(const u of t.physics)u.active&&u.reset(t)}},Gs=class extends ne{constructor(e,t,s){super(e,t,s,29)}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.time=this.getAbsoluteValue(s,n,r,o,c.time,a.data.setupPose.time)}}},Hs=class extends ne{constructor(e,t,s){super(e,t,s,30),this.additive=!0}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.mix=this.getAbsoluteValue(s,n,r,o,c.mix,a.data.setupPose.mix)}}},Nn=class Mi{static emptyAnimation=new Fe("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Ni(this);propertyIds=new ls;animationsChanged=!1;trackEntryPool=new me(()=>new Ui);constructor(t){this.data=t}update(t){t*=this.timeScale;const s=this.tracks;for(let i=0,n=s.length;i<n;i++){const r=s[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=t*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let h=r.next;if(h){const l=r.trackLast-h.delay;if(l>=0){for(h.delay=0,h.trackTime+=r.timeScale===0?0:(l/r.timeScale+t)*h.timeScale,r.trackTime+=o,this.setTrack(i,h,!0);h.mixingFrom;)h.mixTime+=t,h=h.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[i]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let l=r.mixingFrom;for(r.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){const i=t.mixingFrom;if(!i)return!0;const n=this.updateMixingFrom(i,s);if(i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(i.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),i.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(i)}return n}return i.trackTime+=s*i.timeScale,t.mixTime+=s,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,i=this.tracks;let n=!1;for(let h=0,l=i.length;h<l;h++){const a=i[h];if(!a||a.delay>0)continue;n=!0;let c=a.alpha;a.mixingFrom?c*=this.applyMixingFrom(a,t):a.trackTime>=a.trackEnd&&!a.next&&(c=0);let d=a.animationLast,u=a.getAnimationTime(),f=u,m=s;a.reverse&&(f=a.animation.duration-f,m=null);const p=a.animation.timelines,g=p.length;if(h===0&&c===1)for(let x=0;x<g;x++){O.webkit602BugfixHelper(c);const b=p[x];b instanceof ie?this.applyAttachmentTimeline(b,t,f,!0,!0):b.apply(t,d,f,m,c,!0,!1,!1,!1)}else{const x=a.timelineMode,b=c>=a.alphaAttachmentThreshold,w=a.additive,v=w||a.shortestRotation,y=!v&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const A=p[T],S=(x[T]&ye)!==0;!v&&A instanceof xe?this.applyRotateTimeline(A,t,f,c,S,a.timelinesRotation,T<<1,y):A instanceof ie?this.applyAttachmentTimeline(A,t,f,S,b):(O.webkit602BugfixHelper(c),A.apply(t,d,f,m,c,S,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,u),this.queueEvents(a,u),s.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+js,o=t.slots;for(let h=0,l=t.slots.length;h<l;h++){const a=o[h];if(a.attachmentState===r){const c=a.data.attachmentName;a.pose.setAttachment(c?t.getAttachment(a.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(t,s){const i=t.mixingFrom,n=i.mixingFrom!==null?this.applyMixingFrom(i,s):1,r=t.mix(),o=i.alpha*n,h=1-r*t.alpha,l=o*(1-r),a=h>0?l/h:o,c=i.animation.timelines,d=c.length,u=i.timelineMode,f=i.timelineHoldMix,m=r<i.mixAttachmentThreshold,p=r<i.mixDrawOrderThreshold,g=i.additive,x=g||i.shortestRotation,b=!x&&i.timelinesRotation.length!==d<<1;b&&(i.timelinesRotation.length=d<<1);const w=i.timelinesRotation;let v=i.animationLast,y=i.getAnimationTime(),T=y,A=null;i.reverse?T=i.animation.duration-T:r<i.eventThreshold&&(A=this.events),i.totalAlpha=0;for(let S=0;S<d;S++){const C=c[S],I=u[S];let Y=0;if((I&ve)!==0){const k=f[S];Y=k==null?a:a*(1-k.mix())}else{if(!p&&C instanceof jt)continue;Y=l}i.totalAlpha+=Y;const R=(I&ye)!==0;if(!x&&C instanceof xe)this.applyRotateTimeline(C,s,T,Y,R,w,S<<1,b);else if(C instanceof ie)this.applyAttachmentTimeline(C,s,T,R,m&&Y>=i.alphaAttachmentThreshold);else{const k=!p||!(C instanceof jt)||!R;C.apply(s,v,T,A,Y,R,g,k,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,v,y),t.mixDuration>0&&this.queueEvents(i,y),this.events.length=0,i.nextAnimationLast=y,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(t,s,i,n,r){const o=s.slots[t.slotIndex];if(!o.bone.active||!r&&o.attachmentState===this.unkeyedState+Zs)return;let h=i<t.frames[0],l=null;if(h||(l=t.attachmentNames[gt.search(t.frames,i)],h=!r&&l==null),h){if(!n)return;l=o.data.attachmentName}o.pose.setAttachment(l==null?null:s.getAttachment(o.data.index,l)),r?o.attachmentState=this.unkeyedState+Zs:h||(o.attachmentState=this.unkeyedState+js)}applyRotateTimeline(t,s,i,n,r,o,h,l){if(l&&(o[h]=0),n===1){t.apply(s,0,i,null,1,r,!1,!1,!1);return}const a=s.bones[t.boneIndex];if(!a.active)return;const c=a.pose,d=a.data.setupPose,u=t.frames;if(i<u[0]){r&&(c.rotation=d.rotation);return}const f=r?d.rotation:c.rotation,m=d.rotation+t.getCurveValue(i);let p=0,g=m-f;if(g-=Math.ceil(g/360-.5)*360,g===0)p=o[h];else{let x=0,b=0;l?(x=0,b=g):(x=o[h],b=o[h+1]);const w=x-x%360;p=g+w;let v=g>=0,y=x>=0;Math.abs(b)<=90&&B.signum(b)!==B.signum(g)&&(Math.abs(x-w)>180?(p+=360*B.signum(x),y=v):w!==0?p-=360*B.signum(x):y=v),y!==v&&(p+=360*B.signum(x)),o[h]=p}o[h+1]=g,c.rotation=f+p*n}queueEvents(t,s){const i=t.animationStart,n=t.animationEnd,r=n-i,o=t.reverse;let h=t.trackLast%r;o&&(h=r-h);const l=this.events;let a=0,c=l.length;for(;a<c;a++){const u=l[a];if(u.time<h!==o)break;u.time>=i&&u.time<=n&&this.queue.event(t,u)}let d=!1;if(t.loop)if(r===0)d=!0;else{const u=Math.floor(t.trackTime/r);d=u>0&&u>Math.floor(t.trackLast/r)}else d=s>=n&&t.animationLast<n;for(d&&this.queue.complete(t);a<c;a++){const u=l[a];u.time>=i&&u.time<=n&&this.queue.event(t,u)}}eventsReverse(t,s,i){const n=t.animation.duration,r=n-s,o=n-i,h=t.animation.timelines;for(let l=0,a=t.animation.timelines.length;l<a;l++){const c=h[l];if(!(c instanceof Le))continue;const d=c.events,u=c.frames,f=u.length;if(r>=o){for(let m=0;m<f;m++)if(!(u[m]<o)){if(u[m]>=r)break;this.events.push(d[m])}}else{for(let p=0;p<f&&!(u[p]>=r);p++)this.events.push(d[p]);let m=0;for(;m<f&&!(u[m]>=o);m++);for(;m<f;m++)this.events.push(d[m])}}}clearTracks(){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;const s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){const n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(t,s,i){const n=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,n&&(n.next=null,i&&this.queue.interrupt(n),s.mixingFrom=n,n.mixingTo=s,s.mixTime=0,n.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){return typeof s=="string"?this.setAnimation1(t,s,i):this.setAnimation2(t,s,i)}setAnimation1(t,s,i=!1){const n=this.data.skeletonData.findAnimation(s);if(!n)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(t,n,i)}setAnimation2(t,s,i=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));const o=this.trackEntry(t,s,i,r);return this.setTrack(t,o,n),this.queue.drain(),o}addAnimation(t,s,i=!1,n=0){return typeof s=="string"?this.addAnimation1(t,s,i,n):this.addAnimation2(t,s,i,n)}addAnimation1(t,s,i=!1,n=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(t,r,i,n)}addAnimation2(t,s,i=!1,n=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const o=this.trackEntry(t,s,i,r);return r?(r.next=o,o.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-o.mixDuration,0))):(this.setTrack(t,o,!0),this.queue.drain(),n<0&&(n=0)),o.delay=n,o}setEmptyAnimation(t,s=0){const i=this.setAnimation(t,Mi.emptyAnimation,!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){const n=this.addAnimation(t,Mi.emptyAnimation,!1,i);return i<=0&&(n.delay=Math.max(n.delay+n.mixDuration-s,0)),n.mixDuration=s,n.trackEnd=s,n}setEmptyAnimations(t=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,n=this.tracks.length;i<n;i++){const r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(O.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,n){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=s,r.loop=i,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;const t=this.tracks;for(let s=0,i=t.length;s<i;s++){let n=t[s];if(n){for(;n.mixingFrom;)n=n.mixingFrom;do this.computeHold(n),n=n.mixingTo;while(n)}}this.propertyIds.clear()}computeHold(t){const s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;const r=t.timelineHoldMix;r.length=0;const o=this.propertyIds,h=t.additive,l=t.keepHold,a=t.mixingTo;t:for(let c=0;c<i;c++){const d=s[c],u=d.propertyIds,f=o.addAll(u)&&!(d instanceof we&&o.contains(jt.propertyID));if(h&&d.additive){n[c]=f?ye:Pe;continue}for(let p=t.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(u)){n[c]=Pe;continue t}let m;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(u))m=f?ye:Pe;else{m=f?zi:ve;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(u)){p.mixDuration>0&&(r[c]=p);break}}l&&(m=m&~ve|n[c]&ve),n[c]=m}}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ui=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=ue.linear;setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===ue.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=ue.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const e=this.animationEnd-this.animationStart;if(e!==0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Ni=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let e=0;e<this.objects.length;e+=2){const t=this.objects,s=t[e],i=t[e+1],n=this.animState.listeners.slice();switch(s){case 0:i.listener?.start&&i.listener.start(i);for(let r=0;r<n.length;r++){const o=n[r];o.start&&o.start(i)}break;case 1:i.listener?.interrupt&&i.listener.interrupt(i);for(let r=0;r<n.length;r++){const o=n[r];o.interrupt&&o.interrupt(i)}break;case 2:i.listener?.end&&i.listener.end(i);for(let r=0;r<n.length;r++){const o=n[r];o.end&&o.end(i)}case 3:i.listener?.dispose&&i.listener.dispose(i);for(let r=0;r<n.length;r++){const o=n[r];o.dispose&&o.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener?.complete&&i.listener.complete(i);for(let r=0;r<n.length;r++){const o=n[r];o.complete&&o.complete(i)}break;case 5:{const r=t[e+++2];i.listener?.event&&i.listener.event(i,r);for(let o=0;o<n.length;o++){const h=n[o];h.event&&h.event(i,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Di=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Di||{}),Dn=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Pe=0,ye=1,ve=2,zi=3,js=1,Zs=2,zn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){return typeof e=="string"?this.setMix1(e,t,s):this.setMix2(e,t,s)}setMix1(e,t,s){const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);this.setMix2(i,n,s)}setMix2(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");const i=`${e.name}.${t.name}`;this.animationToMixTime[i]=s}getMix(e,t){const s=`${e.name}.${t.name}`,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},qi=class{constructor(e,t="",s=new $s,i=new Wi){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{const i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,n)=>{this.downloader.downloadBinary(e,r=>{this.success(t,e,r),i(r)},(r,o)=>{const h=`Couldn't load binary ${e}: status ${r}, ${o}`;this.error(s,e,h),n(h)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,n)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${n}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,n)=>{this.downloader.downloadJson(e,r=>{this.success(t,e,r),i(r)},(r,o)=>{const h=`Couldn't load JSON ${e}: status ${r}, ${o}`;this.error(s,e,h),n(h)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.getAsset(e),n=i!==void 0;return n&&(this.cache.assetsLoaded[e]=i.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(t,e,r),r)).catch(r=>{this.error(s,e,r)})),n}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),this.reuseAssets(e,t,s))return;const i=this.texturePmaInfo[e];this.cache.assetsLoaded[e]=new Promise((n,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(l=>{if(l.ok)return l.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(l=>l?createImageBitmap(l,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(l=>{if(l){const a=this.createTexture(e,i,l);this.success(t,e,a),n(a)}});else{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{const a=this.createTexture(e,i,l);this.success(t,e,a),n(a)},l.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),l.src=e}})}loadTextureAtlas(e,t=()=>{},s=()=>{},i){const n=e.lastIndexOf("/"),r=n>=0?e.substring(0,n+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,h)=>{this.downloader.downloadText(e,l=>{try{const a=this.createTextureAtlas(l,r,e,i);let c=a.pages.length,d=!1;if(c===0){this.success(t,e,a),o(a);return}for(const u of a.pages)this.loadTexture(this.texturePath(r,u.name,i),(f,m)=>{d||(u.setTexture(m),--c===0&&(this.success(t,e,a),o(a)))},(f,m)=>{if(!d){const p=`Couldn't load texture ${e} page image: ${f}`;this.error(s,e,p),h(p)}d=!0})}catch(a){const c=`Couldn't parse texture atlas ${e}: ${a.message}`;this.error(s,e,c),h(c)}},(l,a)=>{const c=`Couldn't load texture atlas ${e}: status ${l}, ${a}`;this.error(s,e,c),h(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{}){const i=e.lastIndexOf("/"),n=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,o)=>{this.downloader.downloadText(e,h=>{try{const l=this.createTextureAtlas(h,n,e);this.success(t,e,l),r(l)}catch(l){const a=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,a),o(a)}},(h,l)=>{const a=`Couldn't load texture atlas ${e}: status ${h}, ${l}`;this.error(s,e,a),o(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,n)=>t(n),(i,n)=>s(n))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;const t=this.cache.assets[e];if(t)return t;const s=this.errors[e];throw Error(`Asset not found: ${e}${s?`
|
|
2
|
-
${s}`:""}`)}remove(e){e=this.pathPrefix+e;const t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(const e in this.cache.assets){const t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof ds){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t,s,i){const n=new ds(e);n.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of n.pages)r.texture?.dispose()}};for(const r of n.pages){const o=this.texturePath(t,r.name,i);this.texturePmaInfo[this.pathPrefix+o]=r.pma}return n}createTexture(e,t,s){const i=this.textureLoader(s,t),n=i.dispose.bind(i);return i.dispose=()=>{this.disposeAssetInternal(e)&&n()},i}texturePath(e,t,s){return s?s[t]:e+t}},Wi=class as{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=as.AVAILABLE_CACHES.get(t);if(s)return s;const i=new as;return as.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){return this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=s,s}getAsset(t){return this.assetsLoaded[t]}},$s=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!==-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){var t=window.atob(e),s=t.length,i=new Uint8Array(s);for(let n=0;n<s;n++)i[n]=t.charCodeAt(n);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t===-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}const n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",i||e,!0);const r=()=>{this.finish(e,n.status,n.responseText)};n.onload=r,n.onerror=r,n.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}const n=new XMLHttpRequest;n.open("GET",i||e,!0),n.responseType="arraybuffer";const r=()=>{this.finish(e,n.status,n.response)};n.onload=()=>{n.status===200||n.status===0?this.finish(e,200,new Uint8Array(n.response)):r()},n.onerror=r,n.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){const i=this.callbacks[e];if(delete this.callbacks[e],t===200||t===0)for(let n=0,r=i.length;n<r;n+=2)i[n](s);else for(let n=1,r=i.length;n<r;n+=2)i[n](t,s)}},Ks=class Sn extends Dt{color=new it(1,1,1,1);constructor(t){super(t)}copy(){const t=new Sn(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Zt=class Cn extends Dt{endSlot=null;convex=!1;inverse=!1;color=new it(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){const t=new Cn(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}},Te=class In extends Dt{lengths=[];closed=!1;constantSpeed=!1;color=new it(1,1,1,1);constructor(t){super(t)}copy(){const t=new In(this.name);return this.copyTo(t),t.lengths=[],O.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},_i=class Mn extends Dt{x=0;y=0;rotation=0;color=new it(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*B.degRad,i=Math.cos(s),n=Math.sin(s),r=i*t.a+n*t.b,o=i*t.c+n*t.d;return B.atan2Deg(o,r)}copy(){const t=new Mn(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},qn=class{atlas;allowMissingRegions;constructor(e,t=!1){this.atlas=e,this.allowMissingRegions=t}findRegions(e,t,s){const i=s.regions;for(let n=0,r=i.length;n<r;n++)i[n]=this.findRegion(e,s.getPath(t,n))}findRegion(e,t){const s=this.atlas.findRegion(t);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${t} (attachment: ${e})`);return s}newRegionAttachment(e,t,s,i,n){return this.findRegions(s,i,n),new zt(s,n)}newMeshAttachment(e,t,s,i,n){return this.findRegions(s,i,n),new Ut(s,n)}newBoundingBoxAttachment(e,t,s){return new Ks(s)}newPathAttachment(e,t,s){return new Te(s)}newPointAttachment(e,t,s){return new _i(s)}newClippingAttachment(e,t,s){return new Zt(s)}},Xe=class{name;setupPose;skinRequired=!1;constructor(e,t){if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}},Js=class En extends Xe{index=0;parent=null;length=0;color=new it;icon;iconSize=1;iconRotation=0;visible=!1;constructor(t,s,i){if(super(s,new Ve),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=t,this.parent=i}copy(t){const s=new En(this.index,this.name,t);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ke=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(ke||{}),Ve=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(e){if(e==null)throw new Error("pose cannot be null.");this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,s=this.scaleX,i=this.scaleY,n=this.shearX,r=this.shearY;if(!this.bone.parent){const d=e.scaleX,u=e.scaleY,f=(t+n)*B.degRad,m=(t+90+r)*B.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(m)*i*d,this.c=Math.sin(f)*s*u,this.d=Math.sin(m)*i*u,this.worldX=this.x*d+e.x,this.worldY=this.y*u+e.y;return}const o=this.bone.parent.appliedPose;let h=o.a,l=o.b,a=o.c,c=o.d;switch(this.worldX=h*this.x+l*this.y+o.worldX,this.worldY=a*this.x+c*this.y+o.worldY,this.inherit){case 0:{const d=(t+n)*B.degRad,u=(t+90+r)*B.degRad,f=Math.cos(d)*s,m=Math.cos(u)*i,p=Math.sin(d)*s,g=Math.sin(u)*i;this.a=h*f+l*p,this.b=h*m+l*g,this.c=a*f+c*p,this.d=a*m+c*g;return}case 1:{const d=e.scaleX,u=e.scaleY,f=(t+n)*B.degRad,m=(t+90+r)*B.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(m)*i*d,this.c=Math.sin(f)*s*u,this.d=Math.sin(m)*i*u;break}case 2:{const d=e.scaleX,u=e.scaleY,f=1/d,m=1/u;h*=f,a*=m;let p=h*h+a*a,g=0;p>B.epsilon2?(p=Math.abs(h*c*m-l*f*a)/p,l=a*p,c=h*p,g=t-B.atan2Deg(a,h)):(h=0,a=0,g=t-90+B.atan2Deg(c,l));const x=(g+n)*B.degRad,b=(g+r+90)*B.degRad,w=Math.cos(x)*s,v=Math.cos(b)*i,y=Math.sin(x)*s,T=Math.sin(b)*i;this.a=(h*w-l*y)*d,this.b=(h*v-l*T)*d,this.c=(a*w+c*y)*u,this.d=(a*v+c*T)*u;break}case 3:case 4:{const d=e.scaleX,u=e.scaleY,f=1/d,m=1/u,p=t*B.degRad,g=Math.cos(p),x=Math.sin(p);let b=(h*g+l*x)*f,w=(a*g+c*x)*m;const v=1/Math.sqrt(b*b+w*w);b*=v,w*=v;let y=-w,T=b;this.inherit===3&&h*c-l*a<0!=(d<0!=u<0)&&(y=-y,T=-T);const A=n*B.degRad,S=(90+r)*B.degRad,C=Math.cos(A)*s,I=Math.cos(S)*i,Y=Math.sin(A)*s,R=Math.sin(S)*i;this.a=(b*C+y*Y)*d,this.b=(b*I+y*R)*d,this.c=(w*C+T*Y)*u,this.d=(w*I+T*R)*u;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,s=e.scaleY;if(!this.bone.parent){const g=1/t,x=1/s;this.x=(this.worldX-e.x)*g,this.y=(this.worldY-e.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const i=this.bone.parent.appliedPose;let n=i.a,r=i.b,o=i.c,h=i.d;const l=n*h-r*o,a=1/(n*h-r*o),c=h*a,d=r*a,u=o*a,f=n*a,m=this.worldX-i.worldX,p=this.worldY-i.worldY;switch(this.x=m*c-p*d,this.y=p*f-m*u,this.inherit){case 0:this.set5(c*this.a-d*this.c,c*this.b-d*this.d,f*this.c-u*this.a,f*this.d-u*this.b,0);break;case 1:{const g=1/t,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/t,x=1/s;n*=g,o*=x;const b=this.a*g,w=this.b*g,v=this.c*x,y=this.d*x,T=1/(n*n+o*o),A=1/Math.abs(l*g*x);this.set5((n*b+o*v)*T,(n*w+o*y)*T,(n*v-o*b)*A,(n*y-o*w)*A,B.atan2Deg(o,n));break}case 3:case 4:{const g=1/t,x=1/s,b=this.a*g,w=this.b*g,v=this.c*x,y=this.d*x;let T=h*this.a-r*this.c,A=n*this.c-o*this.a;l<0&&(T=-T,A=-A);let S=B.atan2Deg(A,T);this.rotation=S,S*=B.degRad;const C=Math.cos(S),I=Math.sin(S);let Y=(n*C+r*I)*g,R=(o*C+h*I)*x;const k=1/Math.sqrt(Y*Y+R*R);Y*=k,R*=k;const X=this.inherit===3&&l<0!=(t<0!=s<0)?-1:1;this.set4(Y*b+R*v,Y*w+R*y,(Y*v-R*b)*X,(Y*y-R*w)*X)}}}set4(e,t,s,i){const n=e*e+s*s,r=t*t+i*i;n>B.epsilon2?(this.shearX=B.atan2Deg(s,e),this.scaleX=Math.sqrt(n)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>B.epsilon2?(this.shearY=B.atan2Deg(i,t),e*i-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,s,i,n){this.shearX=0;const r=e*e+s*s,o=t*t+i*i;if(r>B.epsilon2){const h=B.atan2Deg(s,e);this.rotation=h+n,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(o),o>B.epsilon2?(this.shearY=B.atan2Deg(i,t),e*i-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-h):this.shearY-=90+h,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(o),this.shearY=0,this.rotation=o>B.epsilon2?B.atan2Deg(i,t)-90+n:n}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e._update)}modifyWorld(e){this.local=e,this.world=e,this.resetWorld(e)}resetWorld(e){const t=this.bone.children;for(let s=0,i=t.length;s<i;s++){const n=t[s].appliedPose;n.world===e&&(n.world=0,n.local=0,n.resetWorld(e))}}getWorldRotationX(){return B.atan2Deg(this.c,this.a)}getWorldRotationY(){return B.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,s=e.x-this.worldX,i=e.y-this.worldY;return e.x=(s*this.d-i*this.b)/t,e.y=(i*this.a-s*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e);return B.atan2Deg(this.a*t-this.c*s,this.d*s-this.b*t)+this.rotation-this.shearX}localToWorldRotation(e){e=(e-this.rotation-this.shearX)*B.degRad;const t=Math.sin(e),s=Math.cos(e);return B.atan2Deg(s*this.c+t*this.d,s*this.a+t*this.b)}rotateWorld(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,n=this.b;this.a=s*i-t*this.c,this.b=s*n-t*this.d,this.c=t*i+s*this.c,this.d=t*n+s*this.d}},Qs=class{data;pose;constrainedPose;appliedPose;constructor(e,t,s){if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=s,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},ti=class extends Qs{active=!1;constructor(e,t,s){super(e,t,s),this.setupPose()}isActive(){return this.active}},Be=class Yn extends ti{parent=null;children=[];sorted=!1;constructor(t,s){super(t,new Ve,new Ve),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const s=new Yn(this.data,t);return s.pose.set(this.pose),s}},re=class extends ti{constructor(e,t,s){super(e,t,s)}isSourceActive(){return!0}},Gi=class{_setupPose;pose;constrainedPose;appliedPose;constructor(e){this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,O.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,O.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},ae=class extends Xe{constructor(e,t){super(e,t)}},Oe=(e=>(e[e.None=0]="None",e[e.Uniform=1]="Uniform",e[e.Volume=2]="Volume",e))(Oe||{}),Ue=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},ei=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}setupPose=new Ue(-1,this);constructor(e){this.name=e}},Ne=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}},Hi=class te extends re{bones;target;constructor(t,s){if(super(t,new Ne,new Ne),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of t.bones)this.bones.push(s.bones[i.index].constrainedPose);this.target=s.bones[t.target.index]}copy(t){var s=new te(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mix===0)return;const n=this.target.appliedPose,r=this.bones;switch(r.length){case 1:te.apply(t,r[0],n.worldX,n.worldY,i.compress,i.stretch,this.data.scaleYMode,i.mix);break;case 2:te.apply(t,r[0],r[1],n.worldX,n.worldY,i.bendDirection,i.stretch,this.data.scaleYMode,i.softness,i.mix);break}}sort(t){t.sortBone(this.target);const s=this.bones[0].bone;t.sortBone(s),t._updateCache.push(this),s.sorted=!1,t.sortReset(s.children),t.constrained(s),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,s,i,n,r,o,h,l,a,c){typeof i=="number"?te.apply1(t,s,i,n,r,o,h,l):te.apply2(t,s,i,n,r,o,h,l,a,c)}static apply1(t,s,i,n,r,o,h,l){s.modifyLocal(t);const a=s.bone.parent.appliedPose;let c=a.a,d=a.b,u=a.c,f=a.d,m=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(i-s.worldX)*B.signum(t.scaleX),g=(n-s.worldY)*B.signum(t.scaleY);break;case 2:{const x=Math.abs(c*f-d*u)/Math.max(B.epsilon,c*c+u*u),b=c/t.scaleX,w=u/t.scaleY;d=-w*x*t.scaleX,f=b*x*t.scaleY,m+=B.atan2Deg(w,b)}default:{const x=i-a.worldX,b=n-a.worldY,w=c*f-d*u;Math.abs(w)<=B.epsilon?(p=0,g=0):(p=(x*f-b*d)/w-s.x,g=(b*c-x*u)/w-s.y)}}if(m+=B.atan2Deg(g,p),s.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),s.rotation+=m*l,r||o){switch(s.inherit){case 3:case 4:p=i-s.worldX,g=n-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>B.epsilon){const b=p*p+g*g;if(r&&b<x*x||o&&b>x*x){const w=(Math.sqrt(b)/x-1)*l+1;switch(s.scaleX*=w,h){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(t,s,i,n,r,o,h,l,a,c){if(s.inherit!==0||i.inherit!==0)return;s.modifyLocal(t),i.modifyLocal(t);let d=s.x,u=s.y,f=s.scaleX,m=s.scaleY,p=i.scaleX,g=0,x=0,b=0;f<0?(f=-f,g=180,b=-1):(g=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,x=180):x=0;let w=0,v=0,y=s.a,T=s.b,A=s.c,S=s.d;const C=Math.abs(f-m)<=B.epsilon;!C||h?(i.y=0,w=y*i.x+s.worldX,v=A*i.x+s.worldY):(w=y*i.x+T*i.y+s.worldX,v=A*i.x+S*i.y+s.worldY);const I=s.bone.parent.appliedPose;y=I.a,T=I.b,A=I.c,S=I.d;let Y=y*S-T*A,R=w-I.worldX,k=v-I.worldY;Y=Math.abs(Y)<=B.epsilon?0:1/Y;const X=(R*S-k*T)*Y-d,F=(k*y-R*A)*Y-u;let V=Math.sqrt(X*X+F*F),q=i.bone.data.length*p,U,P;if(V<B.epsilon){te.apply(t,s,n,r,!1,h,0,c),i.rotation=0;return}R=n-I.worldX,k=r-I.worldY;let L=(R*S-k*T)*Y-d,z=(k*y-R*A)*Y-u,D=L*L+z*z;if(a!==0){a*=f*(p+1)*.5;const N=Math.sqrt(D),lt=N-V-q*f+a;if(lt>0){let W=Math.min(1,lt/(a*2))-1;W=(lt-a*(1-W*W))/N,L-=W*L,z-=W*z,D=L*L+z*z}}t:if(C){q*=f;let N=(D-V*V-q*q)/(2*V*q);if(N<-1)N=-1,P=Math.PI*o;else if(N>1){if(N=1,P=0,h)switch(y=(Math.sqrt(D)/(V+q)-1)*c+1,s.scaleX*=y,l){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else P=Math.acos(N)*o;y=V+q*N,T=q*Math.sin(P),U=Math.atan2(z*y-L*T,L*y+z*T)}else{y=f*q,T=m*q;const N=y*y,lt=T*T,W=Math.atan2(z,L);A=lt*V*V+N*D-N*lt;const ut=-2*lt*V,bt=lt-N;if(S=ut*ut-4*bt*A,S>=0){let kt=Math.sqrt(S);ut<0&&(kt=-kt),kt=-(ut+kt)*.5;let Ot=kt/bt,fe=A/kt;const Me=Math.abs(Ot)<Math.abs(fe)?Ot:fe;if(Ot=D-Me*Me,Ot>=0){k=Math.sqrt(Ot)*o,U=W-Math.atan2(k,Me),P=Math.atan2(k/m,(Me-V)/f);break t}}let mt=B.PI,wt=V-y,vt=wt*wt,yt=0,Ft=0,At=V+y,St=At*At,Rt=0;A=-y*V/(N-lt),A>=-1&&A<=1&&(A=Math.acos(A),R=y*Math.cos(A)+V,k=T*Math.sin(A),S=R*R+k*k,S<vt&&(mt=A,vt=S,wt=R,yt=k),S>St&&(Ft=A,St=S,At=R,Rt=k)),D<=(vt+St)*.5?(U=W-Math.atan2(yt*o,wt),P=mt*o):(U=W-Math.atan2(Rt*o,At),P=Ft*o)}const ct=Math.atan2(i.y,i.x)*b;U=(U-ct)*B.radDeg+g-s.rotation,U>180?U-=360:U<=-180&&(U+=360),s.rotation+=U*c,P=((P+ct)*B.radDeg-i.shearX)*b+x-i.rotation,P>180?P-=360:P<=-180&&(P+=360),i.rotation+=P*c}},Ae=class extends ae{bones=[];_target=null;set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(e){super(e,new Ne)}create(e){return new Hi(this,e)}},De=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}},Se=class extends ae{bones=[];set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(e){super(e,new De)}create(e){return new ji(this,e)}},si=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(si||{}),ii=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ii||{}),ni=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(ni||{}),ji=class ee extends re{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,s){if(super(t,new De,new De),!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const i of this.data.bones)this.bones.push(s.bones[i.index].constrainedPose);this.slot=s.slots[t.slot.index]}copy(t){var s=new ee(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.slot.appliedPose.attachment;if(!(i instanceof Te))return;const n=this.appliedPose,r=n.mixRotate,o=n.mixX,h=n.mixY;if(r===0&&o===0&&h===0)return;const l=this.data,a=l.rotateMode===0,c=l.rotateMode===2,d=this.bones,u=d.length,f=a?u:u+1,m=O.setArraySize(this.spaces,f),p=c?this.lengths=O.setArraySize(this.lengths,u):[],g=n.spacing;switch(l.spacingMode){case 2:if(c)for(let T=0,A=f-1;T<A;T++){const S=d[T],C=S.bone.data.length,I=C*S.a,Y=C*S.c;p[T]=Math.sqrt(I*I+Y*Y)}O.arrayFill(m,1,f,g);break;case 3:{let T=0;for(let A=0,S=f-1;A<S;){const C=d[A],I=C.bone.data.length;if(I<B.epsilon)c&&(p[A]=0),m[++A]=g;else{const Y=I*C.a,R=I*C.c,k=Math.sqrt(Y*Y+R*R);c&&(p[A]=k),m[++A]=k,T+=k}}if(T>0){T=f/T*g;for(let A=1;A<f;A++)m[A]*=T}break}default:{const T=l.spacingMode===0;for(let A=0,S=f-1;A<S;){const C=d[A],I=C.bone.data.length;if(I<B.epsilon)c&&(p[A]=0),m[++A]=g;else{const Y=I*C.a,R=I*C.c,k=Math.sqrt(Y*Y+R*R);c&&(p[A]=k),m[++A]=(T?Math.max(0,I+g):g)*k/I}}}}const x=this.computeWorldPositions(t,i,f,a);let b=x[0],w=x[1],v=l.offsetRotation,y=!1;if(v===0)y=l.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?B.degRad:-B.degRad}for(let T=0,A=3,S=t._update;T<u;T++,A+=3){const C=d[T];C.worldX+=(b-C.worldX)*o,C.worldY+=(w-C.worldY)*h;const I=x[A],Y=x[A+1],R=I-b,k=Y-w;if(c){const X=p[T];if(X!==0){const F=(Math.sqrt(R*R+k*k)/X-1)*r+1;C.a*=F,C.c*=F}}if(b=I,w=Y,r>0){let X=C.a,F=C.b,V=C.c,q=C.d,U=0,P=0,L=0;if(a?U=x[A-1]:m[T+1]===0?U=x[A+2]:U=Math.atan2(k,R),U-=Math.atan2(V,X),y){P=Math.cos(U),L=Math.sin(U);const z=C.bone.data.length;b+=(z*(P*X-L*V)-R)*r,w+=(z*(L*X+P*V)-k)*r}else U+=v;U>B.PI?U-=B.PI2:U<-B.PI&&(U+=B.PI2),U*=r,P=Math.cos(U),L=Math.sin(U),C.a=P*X-L*V,C.b=P*F-L*q,C.c=L*X+P*V,C.d=L*F+P*q}C.modifyWorld(S)}}computeWorldPositions(t,s,i,n){const r=this.slot;let o=this.appliedPose.position,h=this.spaces,l=O.setArraySize(this.positions,i*3+2),a=this.world;const c=s.closed;let d=s.worldVerticesLength,u=d/6,f=ee.NONE;if(!s.constantSpeed){const P=s.lengths;u-=c?1:2;const L=P[u];this.data.positionMode===1&&(o*=L);let z;switch(this.data.spacingMode){case 2:z=L;break;case 3:z=L/i;break;default:z=1}a=O.setArraySize(this.world,8);for(let D=0,ct=0,N=0;D<i;D++,ct+=3){const lt=h[D]*z;o+=lt;let W=o;if(c)W%=L,W<0&&(W+=L),N=0;else if(W<0){f!==ee.BEFORE&&(f=ee.BEFORE,s.computeWorldVertices(t,r,2,4,a,0,2)),this.addBeforePosition(W,a,0,l,ct);continue}else if(W>L){f!==ee.AFTER&&(f=ee.AFTER,s.computeWorldVertices(t,r,d-6,4,a,0,2)),this.addAfterPosition(W-L,a,0,l,ct);continue}for(;;N++){const ut=P[N];if(!(W>ut)){if(N===0)W/=ut;else{const bt=P[N-1];W=(W-bt)/(ut-bt)}break}}N!==f&&(f=N,c&&N===u?(s.computeWorldVertices(t,r,d-4,4,a,0,2),s.computeWorldVertices(t,r,0,4,a,4,2)):s.computeWorldVertices(t,r,N*6+2,8,a,0,2)),this.addCurvePosition(W,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],l,ct,n||D>0&<===0)}return l}c?(d+=2,a=O.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d-4,a,0,2),s.computeWorldVertices(t,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(u--,d-=4,a=O.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d,a,0,2));const m=O.setArraySize(this.curves,u);let p=0,g=a[0],x=a[1],b=0,w=0,v=0,y=0,T=0,A=0,S=0,C=0,I=0,Y=0,R=0,k=0,X=0,F=0;for(let P=0,L=2;P<u;P++,L+=6)b=a[L],w=a[L+1],v=a[L+2],y=a[L+3],T=a[L+4],A=a[L+5],S=(g-b*2+v)*.1875,C=(x-w*2+y)*.1875,I=((b-v)*3-g+T)*.09375,Y=((w-y)*3-x+A)*.09375,R=S*2+I,k=C*2+Y,X=(b-g)*.75+S+I*.16666667,F=(w-x)*.75+C+Y*.16666667,p+=Math.sqrt(X*X+F*F),X+=R,F+=k,R+=I,k+=Y,p+=Math.sqrt(X*X+F*F),X+=R,F+=k,p+=Math.sqrt(X*X+F*F),X+=R+I,F+=k+Y,p+=Math.sqrt(X*X+F*F),m[P]=p,g=T,x=A;this.data.positionMode===1&&(o*=p);let V;switch(this.data.spacingMode){case 2:V=p;break;case 3:V=p/i;break;default:V=1}const q=this.segments;let U=0;for(let P=0,L=0,z=0,D=0;P<i;P++,L+=3){const ct=h[P]*V;o+=ct;let N=o;if(c)N%=p,N<0&&(N+=p),z=0,D=0;else if(N<0){this.addBeforePosition(N,a,0,l,L);continue}else if(N>p){this.addAfterPosition(N-p,a,d-4,l,L);continue}for(;;z++){const lt=m[z];if(!(N>lt)){if(z===0)N/=lt;else{const W=m[z-1];N=(N-W)/(lt-W)}break}}if(z!==f){f=z;let lt=z*6;for(g=a[lt],x=a[lt+1],b=a[lt+2],w=a[lt+3],v=a[lt+4],y=a[lt+5],T=a[lt+6],A=a[lt+7],S=(g-b*2+v)*.03,C=(x-w*2+y)*.03,I=((b-v)*3-g+T)*.006,Y=((w-y)*3-x+A)*.006,R=S*2+I,k=C*2+Y,X=(b-g)*.3+S+I*.16666667,F=(w-x)*.3+C+Y*.16666667,U=Math.sqrt(X*X+F*F),q[0]=U,lt=1;lt<8;lt++)X+=R,F+=k,R+=I,k+=Y,U+=Math.sqrt(X*X+F*F),q[lt]=U;X+=R,F+=k,U+=Math.sqrt(X*X+F*F),q[8]=U,X+=R+I,F+=k+Y,U+=Math.sqrt(X*X+F*F),q[9]=U,D=0}for(N*=U;;D++){const lt=q[D];if(!(N>lt)){if(D===0)N/=lt;else{const W=q[D-1];N=D+(N-W)/(lt-W)}break}}this.addCurvePosition(N*.1,g,x,b,w,v,y,T,A,l,L,n||P>0&&ct===0)}return l}addBeforePosition(t,s,i,n,r){const o=s[i],h=s[i+1],l=s[i+2]-o,a=s[i+3]-h,c=Math.atan2(a,l);n[r]=o+t*Math.cos(c),n[r+1]=h+t*Math.sin(c),n[r+2]=c}addAfterPosition(t,s,i,n,r){const o=s[i+2],h=s[i+3],l=o-s[i],a=h-s[i+1],c=Math.atan2(a,l);n[r]=o+t*Math.cos(c),n[r+1]=h+t*Math.sin(c),n[r+2]=c}addCurvePosition(t,s,i,n,r,o,h,l,a,c,d,u){if(t===0||Number.isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(r-i,n-s);return}const f=t*t,m=f*t,p=1-t,g=p*p,x=g*p,b=p*t,w=b*3,v=p*w,y=w*t,T=s*x+n*v+o*y+l*m,A=i*x+r*v+h*y+a*m;c[d]=T,c[d+1]=A,u&&(t<.001?c[d+2]=Math.atan2(r-i,n-s):c[d+2]=Math.atan2(A-(i*g+r*b*2+h*f),T-(s*g+n*b*2+o*f)))}sort(t){const s=this.slot.data.index,i=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,s,i),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,s,i),this.sortPath(t,this.slot.pose.attachment,i);const n=this.bones,r=this.bones.length;for(let o=0;o<r;o++){const h=n[o].bone;t.sortBone(h),t.constrained(h)}t._updateCache.push(this);for(let o=0;o<r;o++)t.sortReset(n[o].bone.children);for(let o=0;o<r;o++)n[o].bone.sorted=!0}sortPathSlot(t,s,i,n){const r=s.getAttachments();for(let o=0,h=r.length;o<h;o++){const l=r[o];l.slotIndex===i&&this.sortPath(t,l.attachment,n)}}sortPath(t,s,i){if(!(s instanceof Te))return;const n=s.bones;if(n==null)t.sortBone(i);else{const r=t.bones;for(let o=0,h=n.length;o<h;){let l=n[o++];for(l+=o;o<l;)t.sortBone(r[n[o++]])}}}isSourceActive(){return this.slot.bone.active}},Zi=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Zi||{}),ze=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(e){this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}},qe=class{color=new it(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof Dt)||!(this.attachment instanceof Dt)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}},$i=class Fn extends Qs{skeleton;bone;attachmentState=0;constructor(t,s){if(super(t,new qe,new qe),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new it,this.constrainedPose.darkColor=new it),this.setupPose()}copy(t,s,i){const n=new Fn(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(n.pose.darkColor=new it,n.constrainedPose.darkColor=new it),n.pose.set(t.pose),n}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},Ki=class os{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return os.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*os.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n;if(!i.parent)n=new Be(i,null);else{const r=this.bones[i.parent.index];n=new Be(i,r),r.children.push(n)}this.bones.push(n)}this.slots=[];for(const s of this.data.slots)this.slots.push(new $i(s,this));this.drawOrder=new Gi(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const i=s.create(this);i instanceof ri&&this.physics.push(i),this.constraints.push(i)}this.color=new it(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const t=this.slots;for(let o=0,h=t.length;o<h;o++)t[o].unconstrained();const s=this.bones,i=s.length;for(let o=0,h=i;o<h;o++){const l=s[o];l.sorted=l.data.skinRequired,l.active=!l.sorted,l.unconstrained()}if(this.skin){const o=this.skin.bones;for(let h=0,l=this.skin.bones.length;h<l;h++){let a=this.bones[o[h].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const n=this.constraints;let r=this.constraints.length;for(let o=0;o<r;o++)n[o].unconstrained();for(let o=0;o<r;o++){const h=n[o];h.active=h.isSourceActive()&&(!h.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(h.data)),h.active&&h.sort(this)}for(let o=0;o<i;o++)this.sortBone(s[o]);r=this._updateCache.length;for(let o=0;o<r;o++){const h=this._updateCache[o];h instanceof Be&&(this._updateCache[o]=h.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;const s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){const n=t[s];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let n=0,r=this.resetCache.length;n<r;n++)s[n].resetConstrained();const i=this._updateCache;for(let n=0,r=this._updateCache.length;n<r;n++)i[n].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const t=this.bones;for(let i=0,n=t.length;i<n;i++)t[i].setupPose();const s=this.constraints;for(let i=0,n=s.length;i<n;i++)s[i].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const t=this.slots;for(let s=0,i=t.length;s<i;s++)t[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");const s=this.bones;for(let i=0,n=s.length;i<n;i++)if(s[i].data.name===t)return s[i];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const s=this.slots;for(let i=0,n=s.length;i<n;i++)if(s[i].data.name===t)return s[i];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){const s=this.data.findSkin(t);if(!s)throw new Error(`Skin not found: ${t}`);this.setSkin(s)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{const s=this.slots;for(let i=0,n=s.length;i<n;i++){const r=s[i],o=r.data.attachmentName;if(o){const h=t.getAttachment(i,o);h&&r.pose.setAttachment(h)}}}this.skin=t,this.updateCache()}}getAttachment(t,s){return typeof t=="string"?this.getAttachmentByName(t,s):this.getAttachmentByIndex(t,s)}getAttachmentByName(t,s){const i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachmentByIndex(t,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");const i=this.findSlot(t);if(!i)throw new Error(`Slot not found: ${t}`);let n=null;if(s&&(n=this.getAttachment(i.data.index,s),!n))throw new Error(`Attachment not found: ${s}, for slot: ${t}`);i.pose.setAttachment(n)}findConstraint(t,s){if(t==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=i.length;n<r;n++){const o=i[n];if(o instanceof s&&o.data.name===t)return o}return null}getBoundsRect(t){const s=new Ee,i=new Ee;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),n=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,o=r;let h=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let d=0,u=r.length;d<u;d++){const f=o[d];if(!f.bone.active)continue;let m=0,p=null,g=null;const x=f.appliedPose.attachment;if(x){if(x instanceof zt)m=8,p=O.setArraySize(i,m,0),x.computeWorldVertices(f,x.getOffsets(f.appliedPose),p,0,2),g=os.quadTriangles;else if(x instanceof Ut)m=x.worldVerticesLength,p=O.setArraySize(i,m,0),x.computeWorldVertices(this,f,0,m,p,0,2),g=x.triangles;else if(x instanceof Zt&&n){n.clipEnd(f),n.clipStart(this,f,x);continue}if(p&&g){n?.isClipping()&&n.clipTriangles(p,g,g.length)&&(p=n.clippedVertices,m=n.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const v=p[b],y=p[b+1];h=Math.min(h,v),l=Math.min(l,y),a=Math.max(a,v),c=Math.max(c,y)}}}n&&n.clipEnd(f)}n&&n.clipEnd(),t.set(h,l),s.set(a-h,c-l)}setScale(t,s){this.scaleX=t,this.scaleY=s}setPosition(t,s){this.x=t,this.y=s}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physics;for(let n=0,r=i.length;n<r;n++)i[n].translate(t,s)}physicsRotate(t,s,i){const n=this.physics;for(let r=0,o=n.length;r<o;r++)n[r].rotate(t,s,i)}},ri=class Rn extends re{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(t,s){if(super(t,new ze,new ze),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[t.bone.index].constrainedPose}copy(t){var s=new Rn(this.data,t);return s.pose.set(this.pose),s}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,s){this.ux-=t,this.uy-=s,this.cx-=t,this.cy-=s}rotate(t,s,i){const n=i*B.degRad,r=Math.cos(n),o=Math.sin(n),h=this.cx-t,l=this.cy-s;this.translate(h*r-l*o-h,h*o+l*r-l)}update(t,s){const i=this.appliedPose,n=i.mix;if(n===0)return;const r=this.data.x>0,o=this.data.y>0,h=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,a=this.bone;let c=a.bone.data.length,d=this.data.step,u=0;switch(s){case 0:return;case 1:this.reset(t);case 2:{const f=Math.max(t.time-this.lastTime,0),m=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,b=i.inertia,w=t.data.referenceScale,v=-1,y=0,T=0,A=this.data.limit*f,S=A*Math.abs(t.scaleY);if(A*=Math.abs(t.scaleX),r||o){if(r){const C=(this.ux-p)*b;this.xOffset+=C>A?A:C<-A?-A:C,this.ux=p}if(o){const C=(this.uy-g)*b;this.yOffset+=C>S?S:C<-S?-S:C,this.uy=g}if(x>=d){const C=this.xOffset,I=this.yOffset;v=i.damping**(60*d),y=d*i.massInverse,T=i.strength;const Y=w*i.wind,R=w*i.gravity,k=(Y*t.windX+R*t.gravityX)*t.scaleX,X=(Y*t.windY+R*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(k-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),o&&(this.yVelocity-=(X+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),x-=d;while(x>=d);this.xLag=this.xOffset-C,this.yLag=this.yOffset-I}u=Math.max(0,1-x/d),r&&(a.worldX+=(this.xOffset-this.xLag*u)*n*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*u)*n*this.data.y)}if(h||l){let C=Math.atan2(a.c,a.a),I=0,Y=0,R=0,k=this.cx-a.worldX,X=this.cy-a.worldY;if(k>A?k=A:k<-A&&(k=-A),X>S?X=S:X<-S&&(X=-S),x=this.remaining,h){R=(this.data.rotate+this.data.shearX)*n,u=this.rotateLag*Math.max(0,1-m/d);let F=Math.atan2(X+this.ty,k+this.tx)-C-(this.rotateOffset-u)*R;this.rotateOffset+=(F-Math.ceil(F*B.invPI2-.5)*B.PI2)*b,F=(this.rotateOffset-u)*R+C,I=Math.cos(F),Y=Math.sin(F),l&&(F=c*a.getWorldScaleX(),F>0&&(this.scaleOffset+=(k*I+X*Y)*b/F))}else{I=Math.cos(C),Y=Math.sin(C);const F=c*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);F>0&&(this.scaleOffset+=(k*I+X*Y)*b/F)}if(x>=d){v===-1&&(v=i.damping**(60*d),y=d*i.massInverse,T=i.strength);const F=i.wind*t.windX+i.gravity*t.gravityX,V=(i.wind*t.windY+i.gravity*t.gravityY)*Ki.yDir,q=this.rotateOffset,U=this.scaleOffset,P=c/w;for(;;)if(x-=d,l&&(this.scaleVelocity+=(F*I-V*Y-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),h){if(this.rotateVelocity-=((F*Y+V*I)*P+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,x<d)break;const L=this.rotateOffset*R+C;I=Math.cos(L),Y=Math.sin(L)}else if(x<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-U}u=Math.max(0,1-x/d)}this.remaining=x}this.cx=a.worldX,this.cy=a.worldY;break}case 3:u=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*u)*n*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*u)*n*this.data.y)}if(h){let f=(this.rotateOffset-this.rotateLag*u)*n,m=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=f*this.data.rotate,m=Math.sin(x),p=Math.cos(x),g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d),x+=f*this.data.shearX,m=Math.sin(x),p=Math.cos(x),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c}else f*=this.data.rotate,m=Math.sin(f),p=Math.cos(f),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c,g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d}if(l){let f=1+(this.scaleOffset-this.scaleLag*u)*n*this.data.scaleX;switch(a.a*=f,a.c*=f,this.data.scaleYMode){case 1:a.b*=f,a.d*=f;break;case 2:f=Math.abs(f),f=f>=.7?1/f:4-3.67347*f,a.b*=f,a.d*=f}}s!==3&&(this.tx=c*a.a,this.ty=c*a.c),a.modifyWorld(t._update)}sort(t){const s=this.bone.bone;t.sortBone(s),t._updateCache.push(this),t.sortReset(s.children),t.constrained(s)}isSourceActive(){return this.bone.bone.active}},Ce=class extends ae{set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(e){if(e==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=e}constructor(e){super(e,new ze)}create(e){return new ri(this,e)}};typeof Math.fround>"u"&&(Math.fround=(e=>t=>(e[0]=t,e[0]))(new Float32Array(1)));var We=class{time=0;mix=0;set(e){this.time=e.time,this.mix=e.mix}},Ji=class Ei extends re{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,s){if(super(t,new We,new We),!s)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=s.bones[t.bone.index])}copy(t){var s=new Ei(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mix===0)return;const n=this.data,r=n.animation,o=this.bone;if(o!==null){if(!o.active)return;n.local&&o.appliedPose.validateLocalTransform(t),i.time=n.offset+(n.property.value(t,o.appliedPose,n.local,Ei.offsets)-n.property.offset)*n.scale,n.loop?i.time=r.duration+i.time%r.duration:i.time=Math.max(0,i.time)}const h=t.bones,l=r.bones;for(let a=0,c=r.bones.length;a<c;a++)h[l[a]].appliedPose.modifyLocal(t);r.apply(t,i.time,i.time,n.loop,null,i.mix,!1,n.additive,!1,!0)}sort(t){const s=this.bone,i=this.data;s&&!i.local&&t.sortBone(s),t._updateCache.push(this);const n=t.bones,r=i.animation.bones;for(let d=0,u=i.animation.bones.length;d<u;d++){const f=n[r[d]];f.sorted=!1,t.sortReset(f.children),t.constrained(f)}const o=i.animation.timelines,h=t.slots,l=t.constraints,a=t.physics,c=t.physics.length;for(let d=0,u=i.animation.timelines.length;d<u;d++){const f=o[d];if(Vi(f))t.constrained(h[f.slotIndex]);else if(f instanceof jt||f instanceof we)t.drawOrder.constrained();else if(f instanceof Nt)if(f.constraintIndex===-1)for(let m=0;m<c;m++)t.constrained(a[m]);else t.constrained(l[f.constraintIndex]);else if(Oi(f)){const m=f.constraintIndex;m!==-1&&t.constrained(l[m])}}}},_t=class extends ae{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(e){super(e,new We)}create(e){return new Ji(this,e)}},ai=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSliderAnimations(e){const t=this.constraints;for(let s=0,i=this.constraints.length;s<i;s++){const n=t[s];n instanceof _t&&n.animation!=null&&e.push(n.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const s=this.constraints;for(let i=0,n=this.constraints.length;i<n;i++){const r=s[i];if(r instanceof t&&r.name===e)return r}return null}},oi=class{slotIndex=0;placeholder;attachment;constructor(e=0,t,s){this.slotIndex=e,this.placeholder=t,this.attachment=s}},_e=class{name;attachments=[];bones=[];constraints=[];color=new it(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let s=0;s<e.bones.length;s++){const i=e.bones[s];let n=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<e.constraints.length;s++){const i=e.constraints[s];let n=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===i){n=!0;break}n||this.constraints.push(i)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const i=t[s];this.setAttachment(i.slotIndex,i.placeholder,i.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){const i=e.bones[s];let n=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<e.constraints.length;s++){const i=e.constraints[s];let n=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===i){n=!0;break}n||this.constraints.push(i)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const i=t[s];i.attachment&&(i.attachment instanceof Ut?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)))}}getAttachment(e,t){const s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){const s=this.attachments[e];s&&delete s[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new oi(t,i,n))}}return e}getAttachmentsForSlot(e,t){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new oi(e,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){const n=e.slots[i],r=n.pose.getAttachment();if(r&&s<t.attachments.length){const o=t.attachments[s];for(const h in o){const l=o[h];if(r===l){const a=this.getAttachment(s,h);a&&n.pose.setAttachment(a);break}}}s++}}},li=class extends Xe{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(super(t,new qe),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.boneData=s}},ci=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(ci||{}),Ge=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}},Qi=class Ln extends re{bones;source;constructor(t,s){if(super(t,new Ge,new Ge),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(s.bones[n.index].constrainedPose);const i=s.bones[t.source.index];if(i==null)throw new Error("source cannot be null.");this.source=i}copy(t){var s=new Ln(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mixRotate===0&&i.mixX===0&&i.mixY===0&&i.mixScaleX===0&&i.mixScaleY===0&&i.mixShearY===0)return;const n=this.data,r=n.localSource,o=n.localTarget,h=n.additive,l=n.clamp,a=n.offsets,c=this.source.appliedPose;r&&c.validateLocalTransform(t);const d=n.properties,u=n.properties.length,f=t._update,m=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=m[p];o?x.modifyLocal(t):x.modifyWorld(f);for(let b=0;b<u;b++){const w=d[b],v=w.value(t,c,r,a)-w.offset,y=w.to;for(let T=0,A=w.to.length;T<A;T++){const S=y[T];if(S.mix(i)!==0){let C=S.offset+v*S.scale;l&&(S.offset<S.max?C=B.clamp(C,S.offset,S.max):C=B.clamp(C,S.max,S.offset)),S.apply(t,i,x,C,o,h)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const s=this.bones,i=this.bones.length,n=!this.data.localTarget;if(n)for(let r=0;r<i;r++)t.sortBone(s[r].bone);t._updateCache.push(this);for(let r=0;r<i;r++){const o=s[r].bone;t.sortReset(o.children),t.constrained(o)}for(let r=0;r<i;r++)s[r].bone.sorted=n}isSourceActive(){return this.source.active}},ft=class Et extends ae{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(t){super(t,new Ge)}create(t){return new Qi(this,t)}getOffsetRotation(){return this.offsets[Et.ROTATION]}setOffsetRotation(t){this.offsets[Et.ROTATION]=t}getOffsetX(){return this.offsets[Et.X]}setOffsetX(t){this.offsets[Et.X]=t}getOffsetY(){return this.offsets[Et.Y]}setOffsetY(t){this.offsets[Et.Y]=t}getOffsetScaleX(){return this.offsets[Et.SCALEX]}setOffsetScaleX(t){this.offsets[Et.SCALEX]=t}getOffsetScaleY(){return this.offsets[Et.SCALEY]}setOffsetScaleY(t){this.offsets[Et.SCALEY]=t}getOffsetShearY(){return this.offsets[Et.SHEARY]}setOffsetShearY(t){this.offsets[Et.SHEARY]=t}},$t=class{offset=0;to=[]},Kt=class{offset=0;max=0;scale=0},He=class extends $t{value(e,t,s,i){if(s)return t.rotation+i[ft.ROTATION];const n=e.scaleX,r=e.scaleY;let o=Math.atan2(t.c/r,t.a/n)*B.radDeg+((t.a*t.d-t.b*t.c)*n*r>0?i[ft.ROTATION]:-i[ft.ROTATION]);return o<0&&(o+=360),o}},hi=class extends Kt{mix(e){return e.mixRotate}apply(e,t,s,i,n,r){if(n)s.rotation+=(r?i:i-s.rotation)*t.mixRotate;else{const o=e.scaleX,h=e.scaleY,l=1/o,a=1/h,c=s.a*l,d=s.b*l,u=s.c*a,f=s.d*a;i*=B.degRad,r||(i-=Math.atan2(u,c)),i>B.PI?i-=B.PI2:i<-B.PI&&(i+=B.PI2),i*=t.mixRotate;const m=Math.cos(i),p=Math.sin(i);s.a=(m*c-p*u)*o,s.b=(m*d-p*f)*o,s.c=(p*c+m*u)*h,s.d=(p*d+m*f)*h}}},je=class extends $t{value(e,t,s,i){return s?t.x+i[ft.X]:(i[ft.X]*t.a+i[ft.Y]*t.b+t.worldX)/e.scaleX}},di=class extends Kt{mix(e){return e.mixX}apply(e,t,s,i,n,r){n?s.x+=(r?i:i-s.x)*t.mixX:(r||(i-=s.worldX/e.scaleX),s.worldX+=i*t.mixX*e.scaleX)}},Ze=class extends $t{value(e,t,s,i){return s?t.y+i[ft.Y]:(i[ft.X]*t.c+i[ft.Y]*t.d+t.worldY)/e.scaleY}},fi=class extends Kt{mix(e){return e.mixY}apply(e,t,s,i,n,r){n?s.y+=(r?i:i-s.y)*t.mixY:(r||(i-=s.worldY/e.scaleY),s.worldY+=i*t.mixY*e.scaleY)}},$e=class extends $t{value(e,t,s,i){if(s)return t.scaleX+i[ft.SCALEX];const n=t.a/e.scaleX,r=t.c/e.scaleY;return Math.sqrt(n*n+r*r)+i[ft.SCALEX]}},ui=class extends Kt{mix(e){return e.mixScaleX}apply(e,t,s,i,n,r){if(n)r?s.scaleX*=1+(i-1)*t.mixScaleX:s.scaleX!==0&&(s.scaleX+=(i-s.scaleX)*t.mixScaleX);else if(r){const o=1+(i-1)*t.mixScaleX;s.a*=o,s.c*=o}else{let o=s.a/e.scaleX,h=s.c/e.scaleY,l=Math.sqrt(o*o+h*h);l!==0&&(l=1+(i-l)*t.mixScaleX/l,s.a*=l,s.c*=l)}}},Ke=class extends $t{value(e,t,s,i){if(s)return t.scaleY+i[ft.SCALEY];const n=t.b/e.scaleX,r=t.d/e.scaleY;return Math.sqrt(n*n+r*r)+i[ft.SCALEY]}},mi=class extends Kt{mix(e){return e.mixScaleY}apply(e,t,s,i,n,r){if(n)r?s.scaleY*=1+(i-1)*t.mixScaleY:s.scaleY!==0&&(s.scaleY+=(i-s.scaleY)*t.mixScaleY);else if(r){const o=1+(i-1)*t.mixScaleY;s.b*=o,s.d*=o}else{let o=s.b/e.scaleX,h=s.d/e.scaleY,l=Math.sqrt(o*o+h*h);l!==0&&(l=1+(i-l)*t.mixScaleY/l,s.b*=l,s.d*=l)}}},Je=class extends $t{value(e,t,s,i){if(s)return t.shearY+i[ft.SHEARY];const n=1/e.scaleX,r=1/e.scaleY;return(Math.atan2(t.d*r,t.b*n)-Math.atan2(t.c*r,t.a*n))*B.radDeg-90+i[ft.SHEARY]}},gi=class extends Kt{mix(e){return e.mixShearY}apply(e,t,s,i,n,r){if(n)r||(i-=s.shearY),s.shearY+=i*t.mixShearY;else{const o=e.scaleX,h=e.scaleY,l=s.b/o,a=s.d/h,c=Math.atan2(a,l);i=(i+90)*B.degRad,r?i-=B.PI/2:(i-=c-Math.atan2(s.c/o,s.a/h),i>B.PI?i-=B.PI2:i<-B.PI&&(i+=B.PI2)),i=c+i*t.mixShearY;const d=Math.sqrt(l*l+a*a);s.b=Math.cos(i)*d*h,s.d=Math.sin(i)*d*o}}},Wn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new ai;s.name="";const i=new tn(e),n=i.readInt32(),r=i.readInt32();s.hash=r===0&&n===0?null:r.toString(16)+n.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;const o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let h=0;h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("String in string table must not be null.");i.strings.push(m)}const l=s.bones;h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Bone name must not be null.");const p=f===0?null:l[i.readInt(!0)],g=new Js(f,m,p),x=g.setupPose;x.rotation=i.readFloat(),x.x=i.readFloat()*t,x.y=i.readFloat()*t,x.scaleX=i.readFloat(),x.scaleY=i.readFloat(),x.shearX=i.readFloat(),x.shearY=i.readFloat(),x.inherit=i.readByte(),g.length=i.readFloat()*t,g.skinRequired=i.readBoolean(),o&&(it.rgba8888ToColor(g.color,i.readInt32()),g.icon=i.readString()??void 0,g.iconSize=i.readFloat(),g.iconRotation=i.readFloat(),g.visible=i.readBoolean()),l.push(g)}h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Slot name must not be null.");const p=l[i.readInt(!0)],g=new li(f,m,p);it.rgba8888ToColor(g.setupPose.color,i.readInt32());const x=i.readInt32();x!==-1&&it.rgb888ToColor(g.setupPose.darkColor=new it,x),g.attachmentName=i.readStringRef(),g.blendMode=i.readInt(!0),o&&(g.visible=i.readBoolean()),s.slots.push(g)}const a=s.constraints,c=i.readInt(!0);for(let f=0;f<c;f++){const m=i.readString();if(!m)throw new Error("Constraint data name must not be null.");let p;switch(i.readByte()){case dr:{const g=new Ae(m);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[i.readInt(!0)]);g.target=l[i.readInt(!0)];const x=i.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=i.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?i.readFloat():1),(x&128)!==0&&(b.softness=i.readFloat()*t),a.push(g);break}case ur:{const g=new ft(m);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[i.readInt(!0)]);g.source=l[i.readInt(!0)];let x=i.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,v;w<p;w++){let y=1,T;switch(i.readByte()){case 0:T=new He;break;case 1:{y=t,T=new je;break}case 2:{y=t,T=new Ze;break}case 3:T=new $e;break;case 4:T=new Ke;break;case 5:T=new Je;break;default:T=null}if(T){T.offset=i.readFloat()*y,v=i.readByte();for(let A=0;A<v;A++){let S=1,C;switch(i.readByte()){case 0:C=new hi;break;case 1:{S=t,C=new di;break}case 2:{S=t,C=new fi;break}case 3:C=new ui;break;case 4:C=new mi;break;case 5:C=new gi;break;default:C=null}C&&(C.offset=i.readFloat()*S,C.max=i.readFloat()*S,C.scale=i.readFloat()*S/y,T.to[A]=C)}g.properties[w]=T}}x=i.readByte(),(x&1)!==0&&(g.offsets[ft.ROTATION]=i.readFloat()),(x&2)!==0&&(g.offsets[ft.X]=i.readFloat()*t),(x&4)!==0&&(g.offsets[ft.Y]=i.readFloat()*t),(x&8)!==0&&(g.offsets[ft.SCALEX]=i.readFloat()),(x&16)!==0&&(g.offsets[ft.SCALEY]=i.readFloat()),(x&32)!==0&&(g.offsets[ft.SHEARY]=i.readFloat()),x=i.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=i.readFloat()),(x&2)!==0&&(b.mixX=i.readFloat()),(x&4)!==0&&(b.mixY=i.readFloat()),(x&8)!==0&&(b.mixScaleX=i.readFloat()),(x&16)!==0&&(b.mixScaleY=i.readFloat()),(x&32)!==0&&(b.mixShearY=i.readFloat()),a.push(g);break}case fr:{const g=new Se(m);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[i.readInt(!0)]);g.slot=s.slots[i.readInt(!0)];const x=i.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=i.readFloat());const b=g.setupPose;b.position=i.readFloat(),g.positionMode===0&&(b.position*=t),b.spacing=i.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=t),b.mixRotate=i.readFloat(),b.mixX=i.readFloat(),b.mixY=i.readFloat(),a.push(g);break}case mr:{const g=new Ce(m);g.bone=l[i.readInt(!0)];let x=i.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=i.readFloat()),(x&4)!==0&&(g.y=i.readFloat()),(x&8)!==0&&(g.rotate=i.readFloat()),(x&16)!==0){let w=i.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(x&32)!==0&&(g.shearX=i.readFloat()),g.limit=((x&64)!==0?i.readFloat():5e3)*t,g.step=1/i.readUnsignedByte();const b=g.setupPose;b.inertia=i.readFloat(),b.strength=i.readFloat(),b.damping=i.readFloat(),b.massInverse=(x&128)!==0?i.readFloat():1,b.wind=i.readFloat(),b.gravity=i.readFloat(),x=i.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?i.readFloat():1,a.push(g);break}case gr:{const g=new _t(m),x=i.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0&&(g.setupPose.time=i.readFloat()),(x&16)!==0&&(g.setupPose.mix=(x&32)!==0?i.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=l[i.readInt(!0)];const b=i.readFloat();let w=1;switch(i.readByte()){case 0:g.property=new He;break;case 1:{w=t,g.property=new je;break}case 2:{w=t,g.property=new Ze;break}case 3:g.property=new $e;break;case 4:g.property=new Ke;break;case 5:g.property=new Je;break;default:continue}g.property.offset=b*w,g.offset=i.readFloat(),g.scale=i.readFloat()/w}a.push(g);break}}}const d=this.readSkin(i,s,!0,o);d&&(s.defaultSkin=d,s.skins.push(d));{let f=s.skins.length;for(O.setArraySize(s.skins,h=f+i.readInt(!0));f<h;f++){const m=this.readSkin(i,s,!1,o);if(!m)throw new Error("readSkin() should not have returned null.");s.skins[f]=m}}h=this.linkedMeshes.length;for(let f=0;f<h;f++){const m=this.linkedMeshes[f],p=s.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(m.sourceIndex,m.source);if(!g)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?g:m.mesh,m.mesh.setSourceMesh(g),m.mesh.updateSequence()}this.linkedMeshes.length=0,h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Event data name must not be null");const p=new ei(m),g=p.setupPose;g.intValue=i.readInt(!1),g.floatValue=i.readFloat(),g.stringValue=i.readString(),p._audioPath=i.readString(),p.audioPath&&(g.volume=i.readFloat(),g.balance=i.readFloat()),s.events.push(p)}const u=s.animations;h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Animation name must not be null.");u.push(this.readAnimation(i,m,s,o))}for(let f=0;f<c;f++){const m=a[f];m instanceof _t&&(m.animation=u[i.readInt(!0)])}return s}readSkin(e,t,s,i){let n=null,r=0;if(s){if(r=e.readInt(!0),r===0)return null;n=new _e("default")}else{const o=e.readString();if(!o)throw new Error("Skin name must not be null.");n=new _e(o),i&&it.rgba8888ToColor(n.color,e.readInt32());let h=e.readInt(!0),l=t.bones,a=n.bones;for(let c=0;c<h;c++)a[c]=l[e.readInt(!0)];h=e.readInt(!0),l=t.constraints,a=n.constraints;for(let c=0;c<h;c++)a[c]=l[e.readInt(!0)];r=e.readInt(!0)}for(let o=0;o<r;o++){const h=e.readInt(!0);for(let l=0,a=e.readInt(!0);l<a;l++){const c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,n,h,c,i);d&&n.setAttachment(h,c,d)}}return n}readAttachment(e,t,s,i,n,r){const o=this.scale,h=e.readByte(),l=(h&8)!==0?e.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(h&7){case 0:{let a=(h&16)!==0?e.readStringRef():null;const c=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),u=(h&128)!==0?e.readFloat():0,f=e.readFloat(),m=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),b=e.readFloat();a||(a=l);const w=this.attachmentLoader.newRegionAttachment(s,n,l,a,d);return w?(w.path=a,w.x=f*o,w.y=m*o,w.scaleX=p,w.scaleY=g,w.rotation=u,w.width=x*o,w.height=b*o,it.rgba8888ToColor(w.color,c),w.updateSequence(),w):null}case 1:{const a=this.readVertices(e,(h&16)!==0),c=r?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,n,l);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&it.rgba8888ToColor(d.color,c),d):null}case 2:{let a=(h&16)!==0?e.readStringRef():l;const c=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),u=e.readInt(!0),f=this.readVertices(e,(h&128)!==0),m=this.readFloatArray(e,f.length,1),p=this.readShortArray(e,(f.length-u-2)*3),g=e.readInt(!0);let x=null;if(g>0){x=[];for(let T=0;T<g;T++)x[T]=e.readInt(!0)}let b=[],w=0,v=0;r&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),v=e.readFloat()),a||(a=l);const y=this.attachmentLoader.newMeshAttachment(s,n,l,a,d);return y?(y.path=a,it.rgba8888ToColor(y.color,c),y.hullLength=u<<1,y.bones=f.bones,y.vertices=f.vertices,y.worldVerticesLength=f.length,y.regionUVs=m,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*o,y.height=v*o),y.updateSequence(),y):null}case 3:{const a=(h&16)!==0?e.readStringRef():l;if(a==null)throw new Error("Path of linked mesh must not be null");const c=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),u=(h&128)!==0,f=e.readInt(!0),m=e.readInt(!0),p=e.readStringRef();let g=0,x=0;r&&(g=e.readFloat(),x=e.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,n,l,a,d);return b?(b.path=a,it.rgba8888ToColor(b.color,c),r&&(b.width=g*o,b.height=x*o),this.linkedMeshes.push(new _n(b,m,i,f,p,u)),b):null}case 4:{const a=(h&16)!==0,c=(h&32)!==0,d=this.readVertices(e,(h&64)!==0),u=this.readFloatArray(e,d.length/6,o),f=r?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,n,l);return m?(m.closed=a,m.constantSpeed=c,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=u,r&&it.rgba8888ToColor(m.color,f),m):null}case 5:{const a=e.readFloat(),c=e.readFloat(),d=e.readFloat(),u=r?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,n,l);return f?(f.x=c*o,f.y=d*o,f.rotation=a,r&&it.rgba8888ToColor(f.color,u),f):null}case 6:{const a=e.readInt(!0),c=this.readVertices(e,(h&16)!==0),d=r?e.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,n,l);return u?(u.endSlot=t.slots[a],u.convex=(h&32)!==0,u.inverse=(h&64)!==0,u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,r&&it.rgba8888ToColor(u.color,d),u):null}}}readSequence(e,t){if(!t)return new ge(1,!1);const s=new ge(e.readInt(!0),!0);return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,t){const s=this.scale,n=e.readInt(!0)<<1;if(!t)return new en(null,this.readFloatArray(e,n,s),n);const r=e.readInt(!0),o=[],h=[];for(let l=0,a=0;l<r;){const c=e.readInt(!0);o[l++]=c;for(let d=0;d<c;d++,a+=3)o[l++]=e.readInt(!0),h[a]=e.readFloat()*s,h[a+1]=e.readFloat()*s,h[a+2]=e.readFloat()}return new en(o,O.toFloatArray(h),n)}readFloatArray(e,t,s){const i=[];if(s===1)for(let n=0;n<t;n++)i[n]=e.readFloat();else for(let n=0;n<t;n++)i[n]=e.readFloat()*s;return i}readShortArray(e,t){const s=[];for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s,i){e.readInt(!0);const n=[],r=this.scale;for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=b-1;switch(x){case rr:{const v=new ie(b,m);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readStringRef());n.push(v);break}case ar:{const v=e.readInt(!0),y=new Is(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let Y=0,R=0;y.setFrame(Y,T,A,S,C,I),Y!==w;Y++){const k=e.readFloat(),X=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(Y);break;case Bt:ht(e,y,R++,Y,0,T,k,A,X,1),ht(e,y,R++,Y,1,T,k,S,F,1),ht(e,y,R++,Y,2,T,k,C,V,1),ht(e,y,R++,Y,3,T,k,I,q,1)}T=k,A=X,S=F,C=V,I=q}n.push(y);break}case or:{const v=e.readInt(!0),y=new Ms(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let I=0,Y=0;y.setFrame(I,T,A,S,C),I!==w;I++){const R=e.readFloat(),k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(I);break;case Bt:ht(e,y,Y++,I,0,T,R,A,k,1),ht(e,y,Y++,I,1,T,R,S,X,1),ht(e,y,Y++,I,2,T,R,C,F,1)}T=R,A=k,S=X,C=F}n.push(y);break}case lr:{const v=e.readInt(!0),y=new Ys(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let X=0,F=0;y.setFrame(X,T,A,S,C,I,Y,R,k),X!==w;X++){const V=e.readFloat(),q=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,ct=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(X);break;case Bt:ht(e,y,F++,X,0,T,V,A,q,1),ht(e,y,F++,X,1,T,V,S,U,1),ht(e,y,F++,X,2,T,V,C,P,1),ht(e,y,F++,X,3,T,V,I,L,1),ht(e,y,F++,X,4,T,V,Y,z,1),ht(e,y,F++,X,5,T,V,R,D,1),ht(e,y,F++,X,6,T,V,k,ct,1)}T=V,A=q,S=U,C=P,I=L,Y=z,R=D,k=ct}n.push(y);break}case cr:{const v=e.readInt(!0),y=new Fs(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let k=0,X=0;y.setFrame(k,T,A,S,C,I,Y,R),k!==w;k++){const F=e.readFloat(),V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(k);break;case Bt:ht(e,y,X++,k,0,T,F,A,V,1),ht(e,y,X++,k,1,T,F,S,q,1),ht(e,y,X++,k,2,T,F,C,U,1),ht(e,y,X++,k,3,T,F,I,P,1),ht(e,y,X++,k,4,T,F,Y,L,1),ht(e,y,X++,k,5,T,F,R,z,1)}T=F,A=V,S=q,C=U,I=P,Y=L,R=z}n.push(y);break}case hr:{const v=new Es(b,e.readInt(!0),m);let y=e.readFloat(),T=e.readUnsignedByte()/255;for(let A=0,S=0;v.setFrame(A,y,T),A!==w;A++){const C=e.readFloat(),I=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:v.setStepped(A);break;case Bt:ht(e,v,S++,A,0,y,C,T,I,1)}y=C,T=I}n.push(v)}}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===nr){const v=new Cs(b,m);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readByte());n.push(v);continue}const w=e.readInt(!0);switch(x){case jn:xt(e,n,new xe(b,w,m),1);break;case Zn:xt(e,n,new ps(b,w,m),r);break;case $n:xt(e,n,new xs(b,w,m),r);break;case Kn:xt(e,n,new bs(b,w,m),r);break;case Jn:xt(e,n,new ws(b,w,m),1);break;case Qn:xt(e,n,new ys(b,w,m),1);break;case tr:xt(e,n,new vs(b,w,m),1);break;case er:xt(e,n,new Ts(b,w,m),1);break;case sr:xt(e,n,new As(b,w,m),1);break;case ir:xt(e,n,new Ss(b,w,m),1);break}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new Ps(p,e.readInt(!0),m);let b=e.readByte(),w=e.readFloat(),v=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,y=(b&4)!==0?e.readFloat()*r:0;for(let T=0,A=0;x.setFrame(T,w,v,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),T!==g;T++){b=e.readByte();const S=e.readFloat(),C=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,I=(b&4)!==0?e.readFloat()*r:0;(b&64)!==0?x.setStepped(T):(b&128)!==0&&(ht(e,x,A++,T,0,w,S,v,C,1),ht(e,x,A++,T,1,w,S,y,I,r)),w=S,v=C,y=I}n.push(x)}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new Xs(p,e.readInt(!0),m);let b=e.readFloat(),w=e.readFloat(),v=e.readFloat(),y=e.readFloat(),T=e.readFloat(),A=e.readFloat(),S=e.readFloat();for(let C=0,I=0;x.setFrame(C,b,w,v,y,T,A,S),C!==g;C++){const Y=e.readFloat(),R=e.readFloat(),k=e.readFloat(),X=e.readFloat(),F=e.readFloat(),V=e.readFloat(),q=e.readFloat();switch(e.readByte()){case Vt:x.setStepped(C);break;case Bt:ht(e,x,I++,C,0,b,Y,w,R,1),ht(e,x,I++,C,1,b,Y,v,k,1),ht(e,x,I++,C,2,b,Y,y,X,1),ht(e,x,I++,C,3,b,Y,T,F,1),ht(e,x,I++,C,4,b,Y,A,V,1),ht(e,x,I++,C,5,b,Y,S,q,1)}b=Y,w=R,v=k,y=X,T=F,A=V,S=q}n.push(x)}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0),p=s.constraints[m];for(let g=0,x=e.readInt(!0);g<x;g++){const b=e.readByte(),w=e.readInt(!0),v=e.readInt(!0);switch(b){case br:xt(e,n,new ks(w,v,m),p.positionMode===0?r:1);break;case wr:xt(e,n,new Vs(w,v,m),p.spacingMode===0||p.spacingMode===1?r:1);break;case yr:{const y=new Bs(w,v,m);let T=e.readFloat(),A=e.readFloat(),S=e.readFloat(),C=e.readFloat();for(let I=0,Y=0,R=y.getFrameCount()-1;y.setFrame(I,T,A,S,C),I!==R;I++){const k=e.readFloat(),X=e.readFloat(),F=e.readFloat(),V=e.readFloat();switch(e.readByte()){case Vt:y.setStepped(I);break;case Bt:ht(e,y,Y++,I,0,T,k,A,X,1),ht(e,y,Y++,I,1,T,k,S,F,1),ht(e,y,Y++,I,2,T,k,C,V,1)}T=k,A=X,S=F,C=V}n.push(y)}}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0)-1;for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===Er){const v=new _s(b,m);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat());n.push(v);continue}const w=e.readInt(!0);switch(x){case vr:xt(e,n,new Os(b,w,m),1);break;case Tr:xt(e,n,new Us(b,w,m),1);break;case Ar:xt(e,n,new Ns(b,w,m),1);break;case Sr:xt(e,n,new Ds(b,w,m),1);break;case Cr:xt(e,n,new zs(b,w,m),1);break;case Ir:xt(e,n,new qs(b,w,m),1);break;case Mr:xt(e,n,new Ws(b,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=e.readInt(!0);switch(x){case Yr:xt(e,n,new Gs(b,w,m),1);break;case Fr:xt(e,n,new Hs(b,w,m),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=s.skins[e.readInt(!0)];for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readInt(!0);for(let b=0,w=e.readInt(!0);b<w;b++){const v=e.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=m.getAttachment(x,v),T=e.readByte(),A=e.readInt(!0),S=A-1;switch(T){case pr:{const C=y,I=C.bones,Y=C.vertices,R=I?Y.length/3*2:Y.length,k=e.readInt(!0),X=new Rs(A,k,x,C);let F=e.readFloat();for(let V=0,q=0;;V++){let U,P=e.readInt(!0);if(P===0)U=I?O.newFloatArray(R):Y;else{U=O.newFloatArray(R);const z=e.readInt(!0);if(P+=z,r===1)for(let D=z;D<P;D++)U[D]=e.readFloat();else for(let D=z;D<P;D++)U[D]=e.readFloat()*r;if(!I)for(let D=0,ct=U.length;D<ct;D++)U[D]+=Y[D]}if(X.setFrame(V,F,U),V===S)break;const L=e.readFloat();switch(e.readByte()){case Vt:X.setStepped(V);break;case Bt:ht(e,X,q++,V,0,F,L,0,1,1)}F=L}n.push(X);break}case xr:{const C=new Ls(A,x,y);for(let I=0;I<A;I++){const Y=e.readFloat(),R=e.readInt32();C.setFrame(I,Y,gs[R&15],R>>4,e.readFloat())}n.push(C);break}}}}}const o=s.slots.length,h=e.readInt(!0);if(h>0){const u=new jt(h);for(let f=0;f<h;f++)u.setFrame(f,e.readFloat(),sn(e,o));n.push(u)}const l=e.readInt(!0);for(let u=0;u<l;u++){const f=e.readInt(!0),m=new Array(f);for(let x=0;x<f;x++)m[x]=e.readInt(!0);const p=e.readInt(!0),g=new we(p,m,o);for(let x=0;x<p;x++)g.setFrame(x,e.readFloat(),sn(e,f));n.push(g)}const a=e.readInt(!0);if(a>0){const u=new Le(a);for(let f=0;f<a;f++){const m=e.readFloat(),p=s.events[e.readInt(!0)],g=new Ue(m,p);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),u.setFrame(f,g)}n.push(u)}let c=0;for(let u=0,f=n.length;u<f;u++)c=Math.max(c,n[u].getDuration());const d=new Fe(t,n,c);return i&&it.rgba8888ToColor(d.color,e.readInt32()),d}},tn=class{constructor(e,t=[],s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){const e=this.readInt(!0);return e===0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s<e;){const i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(i),s++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}},_n=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,i,n,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.sourceIndex=i,this.source=n,this.inheritTimelines=r}},en=class{constructor(e=null,t,s=0){this.bones=e,this.vertices=t,this.length=s}};function xt(e,t,s,i){s instanceof pe?Gn(e,t,s,i):Hn(e,t,s,i)}function Gn(e,t,s,i){let n=e.readFloat(),r=e.readFloat()*i;for(let o=0,h=0,l=s.getFrameCount()-1;s.setFrame(o,n,r),o!==l;o++){const a=e.readFloat(),c=e.readFloat()*i;switch(e.readByte()){case Vt:s.setStepped(o);break;case Bt:ht(e,s,h++,o,0,n,a,r,c,i)}n=a,r=c}t.push(s)}function Hn(e,t,s,i){let n=e.readFloat(),r=e.readFloat()*i,o=e.readFloat()*i;for(let h=0,l=0,a=s.getFrameCount()-1;s.setFrame(h,n,r,o),h!==a;h++){const c=e.readFloat(),d=e.readFloat()*i,u=e.readFloat()*i;switch(e.readByte()){case Vt:s.setStepped(h);break;case Bt:ht(e,s,l++,h,0,n,c,r,d,i),ht(e,s,l++,h,1,n,c,o,u,i)}n=c,r=d,o=u}t.push(s)}function sn(e,t){const s=e.readInt(!0);if(s===0)return null;const i=new Array(t).fill(-1),n=new Array(t-s);let r=0,o=0;for(let h=0;h<s;h++){const l=e.readInt(!0);for(;r!==l;)n[o++]=r++;i[r+e.readInt(!0)]=r++}for(;r<t;)n[o++]=r++;for(let h=t-1;h>=0;h--)i[h]===-1&&(i[h]=n[--o]);return i}function ht(e,t,s,i,n,r,o,h,l,a){t.setBezier(s,i,n,r,h,e.readFloat(),e.readFloat()*a,e.readFloat(),e.readFloat()*a,o,l)}var jn=0,Zn=1,$n=2,Kn=3,Jn=4,Qn=5,tr=6,er=7,sr=8,ir=9,nr=10,rr=0,ar=1,or=2,lr=3,cr=4,hr=5,dr=0,fr=1,ur=2,mr=3,gr=4,pr=0,xr=1,br=0,wr=1,yr=2,vr=0,Tr=1,Ar=2,Sr=4,Cr=5,Ir=6,Mr=7,Er=8,Yr=0,Fr=1,Vt=1,Bt=2,nn=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new me(()=>O.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=e.slots,o=r.length;s.length=0,n.freeAll(i),i.length=0;for(let h=0;h<o;h++){const l=r[h];if(!l.bone.active)continue;const a=l.appliedPose.attachment;if(a instanceof Ks){s.push(a);let c=n.obtain();c.length!==a.worldVerticesLength&&(c=O.newFloatArray(a.worldVerticesLength)),i.push(c),a.computeWorldVertices(e,l,0,a.worldVerticesLength,c,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const n=this.polygons;for(let r=0,o=n.length;r<o;r++){const h=n[r],l=h;for(let a=0,c=h.length;a<c;a+=2){const d=l[a],u=l[a+1];e=Math.min(e,d),t=Math.min(t,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){const n=this.minX,r=this.minY,o=this.maxX,h=this.maxY;if(e<=n&&s<=n||t<=r&&i<=r||e>=o&&s>=o||t>=h&&i>=h)return!1;const l=(i-t)/(s-e);let a=l*(n-e)+t;if(a>r&&a<h||(a=l*(o-e)+t,a>r&&a<h))return!0;let c=(r-t)/l+e;return c>n&&c<o||(c=(h-t)/l+e,c>n&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){const s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){const i=e,n=e.length;let r=n-2,o=!1;for(let h=0;h<n;h+=2){const l=i[h+1],a=i[r+1];if(l<s&&a>=s||a<s&&l>=s){const c=i[h];c+(s-l)/(a-l)*(i[r]-c)<t&&(o=!o)}r=h}return o}intersectsSegment(e,t,s,i){const n=this.polygons;for(let r=0,o=n.length;r<o;r++)if(this.intersectsSegmentPolygon(n[r],e,t,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(e,t,s,i,n){const r=e,o=e.length,h=t-i,l=s-n,a=t*n-s*i;let c=r[o-2],d=r[o-1];for(let u=0;u<o;u+=2){const f=r[u],m=r[u+1],p=c*m-d*f,g=c-f,x=d-m,b=h*x-l*g,w=(a*g-h*p)/b;if((w>=c&&w<=f||w>=f&&w<=c)&&(w>=t&&w<=i||w>=i&&w<=t)){const v=(a*x-l*p)/b;if((v>=d&&v<=m||v>=m&&v<=d)&&(v>=s&&v<=n||v>=n&&v<=s))return!0}c=f,d=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");const t=this.boundingBoxes.indexOf(e);return t===-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},rn=class Ct{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new me(()=>[]);polygonIndicesPool=new me(()=>[]);triangulate(t){const s=t;let i=t.length>>1;const n=this.indicesArray;n.length=0;for(let h=0;h<i;h++)n[h]=h;const r=this.isConcaveArray;r.length=0;for(let h=0;h<i;h++)r[h]=Ct.isConcave(h,i,s,n);const o=this.triangles;for(o.length=0;i>3;){let h=i-1,l=0,a=1;for(;;){t:if(!r[l]){const u=n[h]<<1,f=n[l]<<1,m=n[a]<<1,p=s[u],g=s[u+1],x=s[f],b=s[f+1],w=s[m],v=s[m+1];for(let y=a+1<i?a+1:0;y!==h;){if(r[y]){const T=n[y]<<1,A=s[T],S=s[T+1];if(Ct.positiveArea(w,v,p,g,A,S)&&Ct.positiveArea(p,g,x,b,A,S)&&Ct.positiveArea(x,b,w,v,A,S))break t}++y===i&&(y=0)}break}if(a===0){do{if(!r[l])break;l--}while(l>0);h=l>0?l-1:i-1,a=l+1<i?l+1:0;break}h=l,l=a,++a===i&&(a=0)}o.push(n[h],n[l],n[a]),n.splice(l,1),r.splice(l,1),i--;const c=l>0?l-1:i-1,d=l<i?l:0;r[c]=Ct.isConcave(c,i,s,n),r[d]=Ct.isConcave(d,i,s,n)}return i===3&&o.push(n[2],n[0],n[1]),o}decompose(t,s){const i=t,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let h=this.polygonPool.obtain();h.length=0;let l=-1,a=0;for(let c=0,d=s.length;c<d;c+=3){const u=s[c]<<1,f=s[c+1]<<1,m=s[c+2]<<1,p=i[u],g=i[u+1],x=i[f],b=i[f+1],w=i[m],v=i[m+1];if(l===u){const y=h.length-4;if(Ct.winding(h[y],h[y+1],h[y+2],h[y+3],w,v)===a&&Ct.winding(w,v,h[0],h[1],h[2],h[3])===a){h.push(w,v),o.push(m);continue}}h.length>0&&(n.push(h),r.push(o),h=this.polygonPool.obtain(),o=this.polygonIndicesPool.obtain()),h.length=0,h.push(p,g,x,b),h.push(w,v),o.length=0,o.push(u,f,m),a=Ct.winding(p,g,x,b,w,v),l=u}h.length>0&&(n.push(h),r.push(o));for(let c=0,d=n.length;c<d;c++){if(o=r[c],o.length===0)continue;const u=o[0];let f=o[o.length-1];h=n[c];const m=h.length-4;let p=h[m],g=h[m+1],x=h[m+2],b=h[m+3];const w=h[0],v=h[1],y=h[2],T=h[3],A=Ct.winding(p,g,x,b,w,v);for(let S=0;S<d;S++){if(S===c)continue;const C=r[S];if(C.length!==3)continue;const I=C[0],Y=C[1],R=C[2],k=n[S],X=k[k.length-2],F=k[k.length-1];I!==u||Y!==f||Ct.winding(p,g,x,b,X,F)===A&&Ct.winding(X,F,w,v,y,T)===A&&(k.length=0,C.length=0,h.push(X,F),o.push(R),f=R,p=x,g=b,x=X,b=F,S=-1)}}for(let c=n.length-1;c>=0;c--)h=n[c],h.length===0?(n.splice(c,1),this.polygonPool.free(h),o=r[c],r.splice(c,1),this.polygonIndicesPool.free(o)):h.push(h[0],h[1]);return n}static isConcave(t,s,i,n){const r=n[t>0?t-1:s-1]<<1,o=n[t]<<1,h=n[t+1<s?t+1:0]<<1;return!Ct.positiveArea(i[r],i[r+1],i[o],i[o+1],i[h],i[h+1])}static positiveArea(t,s,i,n,r,o){return t*(o-n)+i*(s-o)+r*(n-s)>=0}static winding(t,s,i,n,r,o){return t*(o-n)+i*(s-o)+r*(n-s)>=0?1:-1}},pi=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(e,t,s){if(this.clipAttachment)return;const i=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const n=O.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,t,0,i,n,0,2);const r=this.clippingPolygon,o=this.makeClockwise(r);o||this.inverse||s.convex?(o||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new rn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(e){this.clipAttachment&&(e&&this.clipAttachment.endSlot!==e.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,n,r,o,h){return i&&n&&r&&typeof o=="boolean"&&typeof h=="number"?this.clipTrianglesRender(e,t,s,i,n,r,o,h):this.clipTrianglesNoRender(e,t,s)}clipTrianglesNoRender(e,t,s){const i=this.clippedVertices;i.length=0;const n=this.clippedTriangles;n.length=0;let r=0;if(this.inverse){const c=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let u=t[d]<<1;const f=e[u],m=e[u+1];u=t[d+1]<<1;const p=e[u],g=e[u+1];u=t[d+2]<<1;const x=e[u],b=e[u+1];this.clipInverse(f,m,p,g,x,b,c);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=w[v++];let A=T>>1,S=i.length;const C=O.setArraySize(i,S+T);O.arrayCopy(w,v,C,S,T),S=n.length;const I=O.setArraySize(n,S+3*(A-2));for(let Y=1;Y<A-1;Y++,S+=3)I[S]=r,I[S+1]=r+Y,I[S+2]=r+Y+1;r+=A,v+=T}}return!0}const o=this.clipOutput,h=this.clippingPolygons,l=h.length;let a=null;for(let c=0;c<s;c+=3){let d=t[c]<<1;const u=e[d],f=e[d+1];d=t[c+1]<<1;const m=e[d],p=e[d+1];d=t[c+2]<<1;const g=e[d],x=e[d+1];for(let b=0;b<l;b++){let w=i.length;if(this.clip(u,f,m,p,g,x,h[b])){a=this.clipOutput;const v=o.length;if(v===0)continue;let y=v>>1;const T=O.setArraySize(i,w+v);O.arrayCopy(a,0,T,w,v),w=n.length;const A=O.setArraySize(n,w+3*(y-2));y--;for(let S=1;S<y;S++,w+=3)A[w]=r,A[w+1]=r+S,A[w+2]=r+S+1;r+=y}else{const v=O.setArraySize(i,w+6);v[w]=u,v[w+1]=f,v[w+2]=m,v[w+3]=p,v[w+4]=g,v[w+5]=x,w=n.length;const y=O.setArraySize(n,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(e,t,s,i,n,r,o,h){const l=this.clippedVertices;l.length=0;const a=this.clippedTriangles;a.length=0;let c=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=t[g],b=t[g+1],w=t[g+2];const v=e[x*h],y=e[x*h+1],T=e[b*h],A=e[b*h+1],S=e[w*h],C=e[w*h+1];this.clipInverse(v,y,T,A,S,C,p);const I=this.inverseVertices.length;if(I===0)continue;const Y=i[x<<=1],R=i[x+1],k=i[b<<=1],X=i[b+1],F=i[w<<=1],V=i[w+1],q=A-C,U=S-T,P=v-S,L=C-y,z=1/(q*P+U*(y-C)),D=this.inverseVertices;for(let ct=0;ct<I;){const N=D[ct++],lt=N>>1;let W=l.length;const ut=O.setArraySize(l,W+lt*h);for(let mt=0;mt<N;mt+=2,W+=h){const wt=D[ct+mt],vt=D[ct+mt+1];ut[W]=wt,ut[W+1]=vt,ut[W+2]=n.r,ut[W+3]=n.g,ut[W+4]=n.b,ut[W+5]=n.a;const yt=wt-S,Ft=vt-C,At=(q*yt+U*Ft)*z,St=(L*yt+P*Ft)*z,Rt=1-At-St;ut[W+6]=Y*At+k*St+F*Rt,ut[W+7]=R*At+X*St+V*Rt,o&&(ut[W+8]=r.r,ut[W+9]=r.g,ut[W+10]=r.b,ut[W+11]=r.a)}W=a.length;const bt=O.setArraySize(a,W+3*(lt-2));for(let mt=1;mt<lt-1;mt++,W+=3)bt[W]=c,bt[W+1]=c+mt,bt[W+2]=c+mt+1;c+=lt,ct+=N}}return!0}const d=this.clipOutput,u=this.clippingPolygons,f=this.clippingPolygons.length;let m=null;for(let p=0;p<s;p+=3){let g=t[p];const x=e[g*h],b=e[g*h+1],w=i[g<<1],v=i[(g<<1)+1];g=t[p+1];const y=e[g*h],T=e[g*h+1],A=i[g<<1],S=i[(g<<1)+1];g=t[p+2];const C=e[g*h],I=e[g*h+1],Y=i[g<<1],R=i[(g<<1)+1],k=T-I,X=C-y,F=x-C,V=I-b,q=1/(k*F+X*(b-I));for(let U=0;U<f;U++){let P=l.length;if(this.clip(x,b,y,T,C,I,u[U])){m=this.clipOutput;const L=d.length;if(L===0)continue;let z=L>>1;const D=O.setArraySize(l,P+z*h);for(let N=0;N<L;N+=2,P+=h){const lt=m[N],W=m[N+1];D[P]=lt,D[P+1]=W,D[P+2]=n.r,D[P+3]=n.g,D[P+4]=n.b,D[P+5]=n.a;const ut=lt-C,bt=W-I,mt=(k*ut+X*bt)*q,wt=(V*ut+F*bt)*q,vt=1-mt-wt;D[P+6]=w*mt+A*wt+Y*vt,D[P+7]=v*mt+S*wt+R*vt,o&&(D[P+8]=r.r,D[P+9]=r.g,D[P+10]=r.b,D[P+11]=r.a)}P=a.length;const ct=O.setArraySize(a,P+3*(z-2));z--;for(let N=1;N<z;N++,P+=3)ct[P]=c,ct[P+1]=c+N,ct[P+2]=c+N+1;c+=z+1}else{const L=O.setArraySize(l,P+3*h);L[P]=x,L[P+1]=b,L[P+2]=n.r,L[P+3]=n.g,L[P+4]=n.b,L[P+5]=n.a,o?(L[P+6]=w,L[P+7]=v,L[P+8]=r.r,L[P+9]=r.g,L[P+10]=r.b,L[P+11]=r.a,L[P+12]=y,L[P+13]=T,L[P+14]=n.r,L[P+15]=n.g,L[P+16]=n.b,L[P+17]=n.a,L[P+18]=A,L[P+19]=S,L[P+20]=r.r,L[P+21]=r.g,L[P+22]=r.b,L[P+23]=r.a,L[P+24]=C,L[P+25]=I,L[P+26]=n.r,L[P+27]=n.g,L[P+28]=n.b,L[P+29]=n.a,L[P+30]=Y,L[P+31]=R,L[P+32]=r.r,L[P+33]=r.g,L[P+34]=r.b,L[P+35]=r.a):(L[P+6]=w,L[P+7]=v,L[P+8]=y,L[P+9]=T,L[P+10]=n.r,L[P+11]=n.g,L[P+12]=n.b,L[P+13]=n.a,L[P+14]=A,L[P+15]=S,L[P+16]=C,L[P+17]=I,L[P+18]=n.r,L[P+19]=n.g,L[P+20]=n.b,L[P+21]=n.a,L[P+22]=Y,L[P+23]=R),P=a.length;const z=O.setArraySize(a,P+3);z[P]=c,z[P+1]=c+1,z[P+2]=c+2,c+=3;break}}}return m!=null}clipTrianglesUnpacked(e,t,s,i,n,r=2){let o=this._clippedVerticesTyped,h=this._clippedUVsTyped,l=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const m=this.clippingPolygons[0];for(let p=0;p<i;p+=3){let g=s[p]*r;const x=e[t+g],b=e[t+g+1];let w=s[p]<<1;const v=n[w],y=n[w+1];g=s[p+1]*r;const T=e[t+g],A=e[t+g+1];w=s[p+1]<<1;const S=n[w],C=n[w+1];g=s[p+2]*r;const I=e[t+g],Y=e[t+g+1];w=s[p+2]<<1;const R=n[w],k=n[w+1];this.clipInverse(x,b,T,A,I,Y,m);const X=this.inverseVertices.length;if(X===0)continue;const F=A-Y,V=I-T,q=x-I,U=Y-b,P=1/(F*q+V*(b-Y)),L=this.inverseVertices;for(let z=0;z<X;){const D=L[z++],ct=D>>1;let N=this.clippedVerticesLength;const lt=N+ct*r,W=this.clippedUVsLength+ct*2;o.length<lt&&(this._clippedVerticesTyped=new Float32Array(lt*2),this._clippedVerticesTyped.set(o.subarray(0,N)),o=this._clippedVerticesTyped),h.length<W&&(this._clippedUVsTyped=new Float32Array(W*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped),this.clippedVerticesLength=lt,this.clippedUVsLength=W;const ut=this._clippedVerticesTyped,bt=this._clippedUVsTyped;let mt=W-ct*2;for(let yt=0;yt<D;yt+=2,N+=r,mt+=2){const Ft=L[z+yt],At=L[z+yt+1];ut[N]=Ft,ut[N+1]=At;const St=Ft-I,Rt=At-Y,kt=(F*St+V*Rt)*P,Ot=(U*St+q*Rt)*P,fe=1-kt-Ot;bt[mt]=v*kt+S*Ot+R*fe,bt[mt+1]=y*kt+C*Ot+k*fe}N=this.clippedTrianglesLength;const wt=N+3*(ct-2);l.length<wt&&(this._clippedTrianglesTyped=new Uint16Array(wt*2),this._clippedTrianglesTyped.set(l.subarray(0,N)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=wt;const vt=l;for(let yt=1;yt<ct-1;yt++,N+=3)vt[N]=a,vt[N+1]=a+yt,vt[N+2]=a+yt+1;a+=ct,z+=D}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const c=this.clipOutput,d=this.clippingPolygons,u=this.clippingPolygons.length;let f=null;for(let m=0;m<i;m+=3){let p=s[m],g=p*r;const x=e[t+g],b=e[t+g+1];let w=p<<1;const v=n[w],y=n[w+1];p=s[m+1],g=p*r;const T=e[t+g],A=e[t+g+1];w=p<<1;const S=n[w],C=n[w+1];p=s[m+2],g=p*r;const I=e[t+g],Y=e[t+g+1];w=p<<1;const R=n[w],k=n[w+1],X=A-Y,F=I-T,V=x-I,q=Y-b,U=1/(X*V+F*(b-Y));for(let P=0;P<u;P++){let L=this.clippedVerticesLength;if(this.clip(x,b,T,A,I,Y,d[P])){f=c;const z=c.length;if(z===0)continue;let D=z>>1;const ct=L+D*r;o.length<ct&&(this._clippedVerticesTyped=new Float32Array(ct*2),this._clippedVerticesTyped.set(o.subarray(0,L)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+D*2)*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),o=this._clippedVerticesTyped,h=this._clippedUVsTyped);const N=o,lt=h;this.clippedVerticesLength=ct;let W=this.clippedUVsLength;this.clippedUVsLength=W+D*2;for(let mt=0;mt<z;mt+=2,L+=r,W+=2){const wt=f[mt],vt=f[mt+1];N[L]=wt,N[L+1]=vt;const yt=wt-I,Ft=vt-Y,At=(X*yt+F*Ft)*U,St=(q*yt+V*Ft)*U,Rt=1-At-St;lt[W]=v*At+S*St+R*Rt,lt[W+1]=y*At+C*St+k*Rt}L=this.clippedTrianglesLength;const ut=L+3*(D-2);l.length<ut&&(this._clippedTrianglesTyped=new Uint16Array(ut*2),this._clippedTrianglesTyped.set(l.subarray(0,L)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=ut;const bt=l;D--;for(let mt=1;mt<D;mt++,L+=3)bt[L]=a,bt[L+1]=a+mt,bt[L+2]=a+mt+1;a+=D+1}else{let z=L+3*r;o.length<z&&(this._clippedVerticesTyped=new Float32Array(z*2),this._clippedVerticesTyped.set(o.subarray(0,L)),o=this._clippedVerticesTyped),o[L]=x,o[L+1]=b,o[L+r]=T,o[L+r+1]=A,o[L+r*2]=I,o[L+r*2+1]=Y;const D=this.clippedUVsLength+3*2;h.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped);const ct=this.clippedUVsLength;h[ct]=v,h[ct+1]=y,h[ct+2]=S,h[ct+3]=C,h[ct+4]=R,h[ct+5]=k,this.clippedVerticesLength=z,this.clippedUVsLength=D,L=this.clippedTrianglesLength,z=L+3,l.length<z&&(this._clippedTrianglesTyped=new Uint16Array(z*2),this._clippedTrianglesTyped.set(l.subarray(0,L)),l=this._clippedTrianglesTyped);const N=l;N[L]=a,N[L+1]=a+1,N[L+2]=a+2,a+=3,this.clippedTrianglesLength=z;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),f!==null}clip(e,t,s,i,n,r,o){const h=this.clipOutput;let l=!1,a,c;o.length%4>=2?(a=this.clipOutput,c=this.scratch):(a=this.scratch,c=this.clipOutput);const d=o;a.length=8;const u=a;u[0]=e,u[1]=t,u[2]=s,u[3]=i,u[4]=n,u[5]=r,u[6]=e,u[7]=t,c.length=0;const f=o.length-4;for(let m=0;;m+=2){const p=d[m],g=d[m+1],x=p-d[m+2],b=g-d[m+3],w=c.length,v=a;for(let T=0,A=a.length-2;T<A;){e=v[T],t=v[T+1],T+=2,s=v[T],i=v[T+1];const S=b*(p-s)>x*(g-i),C=b*(p-e)-x*(g-t);if(C>0)if(S)c.push(s,i);else{const I=s-e,Y=i-t,R=C/(I*b-Y*x);R>=0&&R<=1?(c.push(e+I*R,t+Y*R),l=!0):c.push(s,i)}else if(S){const I=s-e,Y=i-t,R=C/(I*b-Y*x);R>=0&&R<=1?(c.push(e+I*R,t+Y*R,s,i),l=!0):c.push(s,i)}else l=!0}if(w===c.length)return h.length=0,!0;if(c.push(c[0],c[1]),m===f)break;const y=c;c=a,c.length=0,a=y}if(h!==c){h.length=0;for(let m=0,p=c.length-2;m<p;m++)h[m]=c[m]}else h.length=h.length-2;return l}clipInverse(e,t,s,i,n,r,o){this.inverseVertices.length=0;const h=o.length-4;let l,a;o.length%4>=2?(l=this.clipOutput,a=this.scratch):(l=this.scratch,a=this.clipOutput),l.length=8;let c=o,d=l;d[0]=e,d[1]=t,d[2]=s,d[3]=i,d[4]=n,d[5]=r,d[6]=e,d[7]=t,a.length=0;for(let u=0;;u+=2){const f=c[u],m=c[u+1],p=f-c[u+2],g=m-c[u+3],x=a.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=l;for(let y=0,T=l.length-2;y<T;){e=d[y],t=d[y+1],y+=2,s=d[y],i=d[y+1];const A=g*(f-s)>p*(m-i),S=g*(f-e)-p*(m-t);if(S>0)if(A)a.push(s,i);else{const C=s-e,I=i-t,Y=S/(C*g-I*p);if(Y>=0&&Y<=1){const R=e+C*Y,k=t+I*Y;a.push(R,k),this.inverseVertices.push(R,k,s,i)}else a.push(s,i)}else if(A){const C=s-e,I=i-t,Y=S/(C*g-I*p);if(Y>=0&&Y<=1){const R=e+C*Y,k=t+I*Y;this.inverseVertices.push(R,k),a.push(R,k,s,i)}else a.push(s,i)}else this.inverseVertices.push(s,i)}const w=this.inverseVertices.length-b-1;if(w>=6?this.inverseVertices[b]=w:this.inverseVertices.length=b,x===a.length||(a.push(a[0],a[1]),u===h))break;const v=a;a=l,a.length=0,l=v}}makeClockwise(e){const t=e,s=e.length;let i=!0,n=!0,r=0,o=t[s-2],h=t[s-1],l=t[0],a=t[1];for(let d=2;d<s;d+=2){const u=t[d],f=t[d+1];r+=l*f-u*a;const m=(l-o)*(f-a)-(a-h)*(u-l);n=n&&m<=0,i=i&&m>=0,o=l,h=a,l=u,a=f}r+=l*t[1]-t[0]*a;const c=(l-o)*(t[1]-a)-(a-h)*(t[0]-l);if(n=n&&c<=0,i=i&&c>=0,r>=0){for(let d=0,u=s-2,f=s>>1;d<f;d+=2){const m=t[d],p=t[d+1],g=u-d;t[d]=t[g],t[d+1]=t[g+1],t[g]=m,t[g+1]=p}return i}return n}makeConvex(e){const t=e.length,s=e;this.clipOutput.length=t;const i=this.clipOutput;i[0]=s[0],i[1]=s[1];for(let o=2;o<t;o+=2){const h=s[o],l=s[o+1];let a=o-2;for(;a>=0&&(i[a]>h||i[a]===h&&i[a+1]>l);a-=2)i[a+2]=i[a],i[a+3]=i[a+1];i[a+2]=h,i[a+3]=l}s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3];let n=4;for(let o=4;o<t;o+=2,n+=2){const h=i[o],l=i[o+1];for(;(s[n-2]-s[n-4])*(l-s[n-3])-(s[n-1]-s[n-3])*(h-s[n-4])>=0&&(n-=2,n!==2););s[n]=h,s[n+1]=l}s[n]=i[t-4],s[n+1]=i[t-3];const r=n;n+=2;for(let o=t-6;o>=0;o-=2,n+=2){const h=i[o],l=i[o+1];for(;(s[n-2]-s[n-4])*(l-s[n-3])-(s[n-1]-s[n-3])*(h-s[n-4])>=0&&(n-=2,n!==r););s[n]=h,s[n+1]=l}e.length=n-2}},Rr=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new ai,i=typeof e=="string"?JSON.parse(e):e,n=i.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=M(n,"referenceScale",100)*t,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let r=0;r<i.bones.length;r++){const o=i.bones[r];let h=null;const l=M(o,"parent",null);l&&(h=s.findBone(l));const a=new Js(s.bones.length,o.name,h);a.length=M(o,"length",0)*t;const c=a.setupPose;c.x=M(o,"x",0)*t,c.y=M(o,"y",0)*t,c.rotation=M(o,"rotation",0),c.scaleX=M(o,"scaleX",1),c.scaleY=M(o,"scaleY",1),c.shearX=M(o,"shearX",0),c.shearY=M(o,"shearY",0),c.inherit=O.enumValue(ke,M(o,"inherit","Normal")),a.skinRequired=M(o,"skin",!1);const d=M(o,"color",null);d&&a.color.setFromString(d),a.icon=M(o,"icon",void 0),a.iconSize=M(o,"iconSize",1),a.iconRotation=M(o,"iconRotation",0),s.bones.push(a)}if(i.slots)for(let r=0;r<i.slots.length;r++){const o=i.slots[r],h=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${h}`);const a=new li(s.slots.length,h,l),c=M(o,"color",null);c&&a.setupPose.color.setFromString(c);const d=M(o,"dark",null);d&&(a.setupPose.darkColor=it.fromString(d)),a.attachmentName=M(o,"attachment",null),a.blendMode=O.enumValue(ci,M(o,"blend","normal")),a.visible=M(o,"visible",!0),s.slots.push(a)}if(i.constraints)for(const r of i.constraints){const o=r.name,h=M(r,"skin",!1);switch(M(r,"type",!1)){case"ik":{const l=new Ae(o);l.skinRequired=h;for(let f=0;f<r.bones.length;f++){const m=s.findBone(r.bones[f]);if(!m)throw new Error(`Couldn't find bone ${r.bones[f]} for IK constraint ${o}.`);l.bones.push(m)}const a=r.target,c=s.findBone(a);if(!c)throw new Error(`Couldn't find target bone ${a} for IK constraint ${o}.`);l.target=c;const d=M(r,"scaleY",null);d!=null&&(l.scaleYMode=O.enumValue(Oe,d));const u=l.setupPose;u.mix=M(r,"mix",1),u.softness=M(r,"softness",0)*t,u.bendDirection=M(r,"bendPositive",!0)?1:-1,u.compress=M(r,"compress",!1),u.stretch=M(r,"stretch",!1),s.constraints.push(l);break}case"transform":{const l=new ft(o);l.skinRequired=h;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);l.bones.push(y)}const a=r.source,c=s.findBone(a);if(!c)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);l.source=c,l.localSource=M(r,"localSource",!1),l.localTarget=M(r,"localTarget",!1),l.additive=M(r,"additive",!1),l.clamp=M(r,"clamp",!1);let d=!1,u=!1,f=!1,m=!1,p=!1,g=!1;const x=Object.entries(M(r,"properties",{}));for(const[w,v]of x){const y=this.fromProperty(w),T=this.propertyScale(w,t);y.offset=M(v,"offset",0)*T;const A=Object.entries(M(v,"to",{}));for(const[S,C]of A){let I=1,Y;switch(S){case"rotate":{d=!0,Y=new hi;break}case"x":{u=!0,Y=new di,I=t;break}case"y":{f=!0,Y=new fi,I=t;break}case"scaleX":{m=!0,Y=new ui;break}case"scaleY":{p=!0,Y=new mi;break}case"shearY":{g=!0,Y=new gi;break}default:throw new Error(`Invalid transform constraint to property: ${S}`)}Y.offset=M(C,"offset",0)*I,Y.max=M(C,"max",1)*I,Y.scale=M(C,"scale",1)*I/T,y.to.push(Y)}y.to.length>0&&l.properties.push(y)}l.offsets[ft.ROTATION]=M(r,"rotation",0),l.offsets[ft.X]=M(r,"x",0)*t,l.offsets[ft.Y]=M(r,"y",0)*t,l.offsets[ft.SCALEX]=M(r,"scaleX",0),l.offsets[ft.SCALEY]=M(r,"scaleY",0),l.offsets[ft.SHEARY]=M(r,"shearY",0);const b=l.setupPose;d&&(b.mixRotate=M(r,"mixRotate",1)),u&&(b.mixX=M(r,"mixX",1)),f&&(b.mixY=M(r,"mixY",b.mixX)),m&&(b.mixScaleX=M(r,"mixScaleX",1)),p&&(b.mixScaleY=M(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=M(r,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new Se(o);l.skinRequired=h;for(let u=0;u<r.bones.length;u++){const f=r.bones[u],m=s.findBone(f);if(!m)throw new Error(`Couldn't find bone ${f} for path constraint ${r.name}.`);l.bones.push(m)}const a=r.slot,c=s.findSlot(a);if(!c)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);l.slot=c,l.positionMode=O.enumValue(si,M(r,"positionMode","Percent")),l.spacingMode=O.enumValue(ii,M(r,"spacingMode","Length")),l.rotateMode=O.enumValue(ni,M(r,"rotateMode","Tangent")),l.offsetRotation=M(r,"rotation",0);const d=l.setupPose;d.position=M(r,"position",0),l.positionMode===0&&(d.position*=t),d.spacing=M(r,"spacing",0),(l.spacingMode===0||l.spacingMode===1)&&(d.spacing*=t),d.mixRotate=M(r,"mixRotate",1),d.mixX=M(r,"mixX",1),d.mixY=M(r,"mixY",d.mixX),s.constraints.push(l);break}case"physics":{const l=new Ce(o);l.skinRequired=h;const a=r.bone,c=s.findBone(a);if(c==null)throw new Error(`Physics bone not found: ${a}`);l.bone=c,l.x=M(r,"x",0),l.y=M(r,"y",0),l.rotate=M(r,"rotate",0),l.scaleX=M(r,"scaleX",0);const d=M(r,"scaleY",null);d!=null&&(l.scaleYMode=O.enumValue(Oe,d)),l.shearX=M(r,"shearX",0),l.limit=M(r,"limit",5e3)*t,l.step=1/M(r,"fps",60);const u=l.setupPose;u.inertia=M(r,"inertia",.5),u.strength=M(r,"strength",100),u.damping=M(r,"damping",.85),u.massInverse=1/M(r,"mass",1),u.wind=M(r,"wind",0),u.gravity=M(r,"gravity",0),u.mix=M(r,"mix",1),l.inertiaGlobal=M(r,"inertiaGlobal",!1),l.strengthGlobal=M(r,"strengthGlobal",!1),l.dampingGlobal=M(r,"dampingGlobal",!1),l.massGlobal=M(r,"massGlobal",!1),l.windGlobal=M(r,"windGlobal",!1),l.gravityGlobal=M(r,"gravityGlobal",!1),l.mixGlobal=M(r,"mixGlobal",!1),s.constraints.push(l);break}case"slider":{const l=new _t(o);l.skinRequired=h,l.additive=M(r,"additive",!1),l.loop=M(r,"loop",!1),l.setupPose.time=M(r,"time",0),l.setupPose.mix=M(r,"mix",1);const a=r.bone;if(a){if(l.bone=s.findBone(a),!l.bone)throw new Error(`Slider bone not found: ${a}`);const c=r.property;l.property=this.fromProperty(c);const d=this.propertyScale(c,t);l.property.offset=M(r,"from",0)*d,l.offset=M(r,"to",0),l.scale=M(r,"scale",1)/d,l.local=M(r,"local",!1)}s.constraints.push(l);break}}}if(i.skins)for(let r=0;r<i.skins.length;r++){const o=i.skins[r],h=new _e(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){const a=o.bones[l],c=s.findBone(a);if(!c)throw new Error(`Couldn't find bone ${a} for skin ${o.name}.`);h.bones.push(c)}if(o.ik)for(let l=0;l<o.ik.length;l++){const a=o.ik[l],c=s.findConstraint(a,Ae);if(!c)throw new Error(`Couldn't find IK constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.transform)for(let l=0;l<o.transform.length;l++){const a=o.transform[l],c=s.findConstraint(a,ft);if(!c)throw new Error(`Couldn't find transform constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.path)for(let l=0;l<o.path.length;l++){const a=o.path[l],c=s.findConstraint(a,Se);if(!c)throw new Error(`Couldn't find path constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.physics)for(let l=0;l<o.physics.length;l++){const a=o.physics[l],c=s.findConstraint(a,Ce);if(!c)throw new Error(`Couldn't find physics constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.slider)for(let l=0;l<o.slider.length;l++){const a=o.slider[l],c=s.findConstraint(a,_t);if(!c)throw new Error(`Couldn't find slider constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}for(const l in o.attachments){const a=s.findSlot(l);if(!a)throw new Error(`Couldn't find skin slot ${l} for skin ${o.name}.`);const c=o.attachments[l];for(const d in c){const u=this.readAttachment(c[d],h,a.index,d,s);u&&h.setAttachment(a.index,d,u)}}s.skins.push(h),h.name==="default"&&(s.defaultSkin=h)}for(let r=0,o=this.linkedMeshes.length;r<o;r++){const h=this.linkedMeshes[r],l=h.skin?s.findSkin(h.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);const a=l.getAttachment(h.sourceIndex,h.source);if(!a)throw new Error(`Source mesh not found: ${h.source}`);h.mesh.timelineAttachment=h.inheritTimelines?a:h.mesh,h.mesh.setSourceMesh(a),h.mesh.updateSequence();t:if(h.inheritTimelines&&h.slotIndex!==h.sourceIndex){const c=a.timelineSlots;for(const u of c)if(u===h.slotIndex)break t;const d=[...c];d[c.length]=h.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,i.events)for(const r in i.events){const o=i.events[r],h=new ei(r),l=h.setupPose;l.intValue=M(o,"int",0),l.floatValue=M(o,"float",0),l.stringValue=M(o,"string",""),h._audioPath=M(o,"audio",null),h.audioPath&&(l.volume=M(o,"volume",l.volume),l.balance=M(o,"balance",l.balance)),s.events.push(h)}if(i.animations)for(const r in i.animations){const o=i.animations[r];this.readAnimation(o,r,s)}if(i.constraints)for(const r in i.constraints){const o=i.constraints[r];if(o.type==="slider"){const h=s.findConstraint(o.name,_t),l=o.animation,a=s.findAnimation(l);if(!a)throw new Error(`Slider animation not found: ${l}`);h.animation=a}}return s}fromProperty(e){let t;switch(e){case"rotate":t=new He;break;case"x":t=new je;break;case"y":t=new Ze;break;case"scaleX":t=new $e;break;case"scaleY":t=new Ke;break;case"shearY":t=new Je;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,s,i,n){const r=this.scale,o=M(e,"name",i);switch(M(e,"type","region")){case"region":{const h=M(e,"path",o),l=this.readSequence(M(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,i,o,h,l);if(!a)return null;a.path=h,a.x=M(e,"x",0)*r,a.y=M(e,"y",0)*r,a.scaleX=M(e,"scaleX",1),a.scaleY=M(e,"scaleY",1),a.rotation=M(e,"rotation",0),a.width=e.width*r,a.height=e.height*r;const c=M(e,"color",null);return c&&a.color.setFromString(c),a.updateSequence(),a}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(t,i,o);if(!h)return null;this.readVertices(e,h,e.vertexCount<<1);const l=M(e,"color",null);return l&&h.color.setFromString(l),h}case"mesh":case"linkedmesh":{const h=M(e,"path",o),l=this.readSequence(M(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,i,o,h,l);if(!a)return null;a.path=h;const c=M(e,"color",null);c&&a.color.setFromString(c),a.width=M(e,"width",0)*r,a.height=M(e,"height",0)*r;const d=M(e,"source",null);if(d){let f=s;const m=M(e,"slot",null);if(m){const p=n.findSlot(m);if(!p)throw new Error(`Source mesh slot not found: ${m}`);f=p.index}return this.linkedMeshes.push(new Lr(a,M(e,"skin",null),s,f,d,M(e,"timelines",!0))),a}const u=e.uvs;return this.readVertices(e,a,u.length),a.triangles=e.triangles,a.regionUVs=u,a.edges=M(e,"edges",null),a.hullLength=M(e,"hull",0)*2,a.updateSequence(),a}case"path":{const h=this.attachmentLoader.newPathAttachment(t,i,o);if(!h)return null;h.closed=M(e,"closed",!1),h.constantSpeed=M(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,h,l<<1);const a=O.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)a[d]=e.lengths[d]*r;h.lengths=a;const c=M(e,"color",null);return c&&h.color.setFromString(c),h}case"point":{const h=this.attachmentLoader.newPointAttachment(t,i,o);if(!h)return null;h.x=M(e,"x",0)*r,h.y=M(e,"y",0)*r,h.rotation=M(e,"rotation",0);const l=M(e,"color",null);return l&&h.color.setFromString(l),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(t,i,o);if(!h)return null;const l=M(e,"end",null);l&&(h.endSlot=n.findSlot(l)),h.convex=M(e,"convex",!1),h.inverse=M(e,"inverse",!1);const a=e.vertexCount;this.readVertices(e,h,a<<1);const c=M(e,"color",null);return c&&h.color.setFromString(c),h}}return null}readSequence(e){if(e==null)return new ge(1,!1);const t=new ge(M(e,"count",0),!0);return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(e,"setup",0),t}readVertices(e,t,s){const i=this.scale;t.worldVerticesLength=s;const n=e.vertices;if(s===n.length){const h=O.toFloatArray(n);if(i!==1)for(let l=0,a=n.length;l<a;l++)h[l]*=i;t.vertices=h;return}const r=[],o=[];for(let h=0,l=n.length;h<l;){const a=n[h++];o.push(a);for(let c=h+a*4;h<c;h+=4)o.push(n[h]),r.push(n[h+1]*i),r.push(n[h+2]*i),r.push(n[h+3])}t.bones=o,t.vertices=O.toFloatArray(r)}readAnimation(e,t,s){const i=this.scale,n=[];if(e.slots)for(const l in e.slots){const a=e.slots[l],c=s.findSlot(l);if(!c)throw new Error(`Slot not found: ${l}`);const d=c.index;for(const u in a){const f=a[u];if(!f)continue;const m=f.length;switch(u){case"attachment":{const p=new ie(m,d);for(let g=0;g<m;g++){const x=f[g];p.setFrame(g,M(x,"time",0),M(x,"name",null))}n.push(p);break}case"rgba":{const p=new Is(m,m<<2,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=f[w+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),A=it.fromString(y.color),S=g.curve;S&&(v=dt(S,p,v,w,0,x,T,b.r,A.r,1),v=dt(S,p,v,w,1,x,T,b.g,A.g,1),v=dt(S,p,v,w,2,x,T,b.b,A.b,1),v=dt(S,p,v,w,3,x,T,b.a,A.a,1)),x=T,b=A,g=y}n.push(p);break}case"rgb":{const p=new Ms(m,m*3,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=f[w+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),A=it.fromString(y.color),S=g.curve;S&&(v=dt(S,p,v,w,0,x,T,b.r,A.r,1),v=dt(S,p,v,w,1,x,T,b.g,A.g,1),v=dt(S,p,v,w,2,x,T,b.b,A.b,1)),x=T,b=A,g=y}n.push(p);break}case"alpha":{It(n,f,new Es(m,m,d),0,1);break}case"rgba2":{const p=new Ys(m,m*7,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.light),w=it.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const A=M(T,"time",0),S=it.fromString(T.light),C=it.fromString(T.dark),I=g.curve;I&&(y=dt(I,p,y,v,0,x,A,b.r,S.r,1),y=dt(I,p,y,v,1,x,A,b.g,S.g,1),y=dt(I,p,y,v,2,x,A,b.b,S.b,1),y=dt(I,p,y,v,3,x,A,b.a,S.a,1),y=dt(I,p,y,v,4,x,A,w.r,C.r,1),y=dt(I,p,y,v,5,x,A,w.g,C.g,1),y=dt(I,p,y,v,6,x,A,w.b,C.b,1)),x=A,b=S,w=C,g=T}n.push(p);break}case"rgb2":{const p=new Fs(m,m*6,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.light),w=it.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const A=M(T,"time",0),S=it.fromString(T.light),C=it.fromString(T.dark),I=g.curve;I&&(y=dt(I,p,y,v,0,x,A,b.r,S.r,1),y=dt(I,p,y,v,1,x,A,b.g,S.g,1),y=dt(I,p,y,v,2,x,A,b.b,S.b,1),y=dt(I,p,y,v,3,x,A,w.r,C.r,1),y=dt(I,p,y,v,4,x,A,w.g,C.g,1),y=dt(I,p,y,v,5,x,A,w.b,C.b,1)),x=A,b=S,w=C,g=T}n.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${f.name} (${a.name})`)}}}if(e.bones)for(const l in e.bones){const a=e.bones[l],c=s.findBone(l);if(!c)throw new Error(`Bone not found: ${l}`);const d=c.index;for(const u in a){const f=a[u],m=f.length;if(m!==0)switch(u){case"rotate":It(n,f,new xe(m,m,d),0,1);break;case"translate":xi(n,f,new ps(m,m<<1,d),"x","y",0,i);break;case"translatex":It(n,f,new xs(m,m,d),0,i);break;case"translatey":It(n,f,new bs(m,m,d),0,i);break;case"scale":xi(n,f,new ws(m,m<<1,d),"x","y",1,1);break;case"scalex":It(n,f,new ys(m,m,d),1,1);break;case"scaley":It(n,f,new vs(m,m,d),1,1);break;case"shear":xi(n,f,new Ts(m,m<<1,d),"x","y",0,1);break;case"shearx":It(n,f,new As(m,m,d),0,1);break;case"sheary":It(n,f,new Ss(m,m,d),0,1);break;case"inherit":{const p=new Cs(m,c.index);for(let g=0;g<f.length;g++){const x=f[g];p.setFrame(g,M(x,"time",0),O.enumValue(ke,M(x,"inherit","Normal")))}n.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${f.name} (${a.name})`)}}}if(e.ik)for(const l in e.ik){const a=e.ik[l];let c=a[0];if(!c)continue;const d=s.findConstraint(l,Ae);if(!d)throw new Error(`IK Constraint not found: ${l}`);const u=new Ps(a.length,a.length<<1,s.constraints.indexOf(d));let f=M(c,"time",0),m=M(c,"mix",1),p=M(c,"softness",0)*i;for(let g=0,x=0;;g++){u.setFrame(g,f,m,p,M(c,"bendPositive",!0)?1:-1,M(c,"compress",!1),M(c,"stretch",!1));const b=a[g+1];if(!b){u.shrink(x);break}const w=M(b,"time",0),v=M(b,"mix",1),y=M(b,"softness",0)*i,T=c.curve;T&&(x=dt(T,u,x,g,0,f,w,m,v,1),x=dt(T,u,x,g,1,f,w,p,y,i)),f=w,m=v,p=y,c=b}n.push(u)}if(e.transform)for(const l in e.transform){const a=e.transform[l];let c=a[0];if(!c)continue;const d=s.findConstraint(l,ft);if(!d)throw new Error(`Transform constraint not found: ${l}`);const u=new Xs(a.length,a.length*6,s.constraints.indexOf(d));let f=M(c,"time",0),m=M(c,"mixRotate",1),p=M(c,"mixX",1),g=M(c,"mixY",p),x=M(c,"mixScaleX",1),b=M(c,"mixScaleY",1);const w=M(c,"mixShearY",1);for(let v=0,y=0;;v++){u.setFrame(v,f,m,p,g,x,b,w);const T=a[v+1];if(!T){u.shrink(y);break}const A=M(T,"time",0),S=M(T,"mixRotate",1),C=M(T,"mixX",1),I=M(T,"mixY",C),Y=M(T,"mixScaleX",1),R=M(T,"mixScaleY",1),k=M(T,"mixShearY",1),X=c.curve;X&&(y=dt(X,u,y,v,0,f,A,m,S,1),y=dt(X,u,y,v,1,f,A,p,C,1),y=dt(X,u,y,v,2,f,A,g,I,1),y=dt(X,u,y,v,3,f,A,x,Y,1),y=dt(X,u,y,v,4,f,A,b,R,1),y=dt(X,u,y,v,5,f,A,w,k,1)),f=A,m=S,p=C,g=I,x=Y,b=R,x=Y,c=T}n.push(u)}if(e.path)for(const l in e.path){const a=e.path[l],c=s.findConstraint(l,Se);if(!c)throw new Error(`Path constraint not found: ${l}`);const d=s.constraints.indexOf(c);for(const u in a){const f=a[u];let m=f[0];if(!m)continue;const p=f.length;switch(u){case"position":{const g=new ks(p,p,d);It(n,f,g,0,c.positionMode===0?i:1);break}case"spacing":{const g=new Vs(p,p,d);It(n,f,g,0,c.spacingMode===0||c.spacingMode===1?i:1);break}case"mix":{const g=new Bs(p,p*3,d);let x=M(m,"time",0),b=M(m,"mixRotate",1),w=M(m,"mixX",1),v=M(m,"mixY",w);for(let y=0,T=0;;y++){g.setFrame(y,x,b,w,v);const A=f[y+1];if(!A){g.shrink(T);break}const S=M(A,"time",0),C=M(A,"mixRotate",1),I=M(A,"mixX",1),Y=M(A,"mixY",I),R=m.curve;R&&(T=dt(R,g,T,y,0,x,S,b,C,1),T=dt(R,g,T,y,1,x,S,w,I,1),T=dt(R,g,T,y,2,x,S,v,Y,1)),x=S,b=C,w=I,v=Y,m=A}n.push(g);break}}}}if(e.physics)for(const l in e.physics){const a=e.physics[l];let c=-1;if(l.length>0){const d=s.findConstraint(l,Ce);if(!d)throw new Error(`Physics constraint not found: ${l}`);c=s.constraints.indexOf(d)}for(const d in a){const u=a[d];let f=u[0];if(!f)continue;const m=u.length;let p,g=0;if(d==="reset"){const x=new _s(m,c);for(let b=0;f!=null;f=u[b+1],b++)x.setFrame(b,M(f,"time",0));n.push(x);continue}switch(d){case"inertia":p=new Os(m,m,c);break;case"strength":p=new Us(m,m,c);break;case"damping":p=new Ns(m,m,c);break;case"mass":p=new Ds(m,m,c);break;case"wind":p=new zs(m,m,c);break;case"gravity":p=new qs(m,m,c);break;case"mix":{g=1,p=new Ws(m,m,c);break}default:continue}It(n,u,p,g,1)}}if(e.slider)for(const l in e.slider){const a=e.slider[l],c=s.findConstraint(l,_t);if(!c)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(c);for(const u in a){const f=a[u];if(!f[0])continue;const p=f.length;switch(u){case"time":It(n,f,new Gs(p,p,d),1,1);break;case"mix":It(n,f,new Hs(p,p,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const a=e.attachments[l],c=s.findSkin(l);if(!c)throw new Error(`Skin not found: ${l}`);for(const d in a){const u=a[d],f=s.findSlot(d);if(!f)throw new Error(`Attachment slot not found: ${d}`);const m=f.index;for(const p in u){const g=u[p],x=c.getAttachment(m,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let v=w[0];if(v){if(b==="deform"){const y=x.bones,T=x.vertices,A=y?T.length/3*2:T.length,S=new Rs(w.length,w.length,m,x);let C=M(v,"time",0);for(let I=0,Y=0;;I++){let R;const k=M(v,"vertices",null);if(!k)R=y?O.newFloatArray(A):T;else{R=O.newFloatArray(A);const q=M(v,"offset",0);if(O.arrayCopy(k,0,R,q,k.length),i!==1)for(let U=q,P=U+k.length;U<P;U++)R[U]*=i;if(!y)for(let U=0;U<A;U++)R[U]+=T[U]}S.setFrame(I,C,R);const X=w[I+1];if(!X){S.shrink(Y);break}const F=M(X,"time",0),V=v.curve;V&&(Y=dt(V,S,Y,I,0,C,F,0,1,1)),C=F,v=X}n.push(S)}else if(b==="sequence"){const y=new Ls(w.length,m,x);let T=0;for(let A=0;A<w.length;A++){const S=M(v,"delay",T),C=M(v,"time",0),I=ms[M(v,"mode","hold")],Y=M(v,"index",0);y.setFrame(A,C,I,Y,S),T=S,v=w[A+1]}n.push(y)}}}}}}if(e.drawOrder){const l=new jt(e.drawOrder.length),a=s.slots.length;let c=0;for(const d of e.drawOrder)l.setFrame(c++,M(d,"time",0),an(s,d,a,null));n.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const a=M(l,"slots",[]),c=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);c[d++]=g.index}const u=M(l,"keys",[]),f=new we(u.length,c,s.slots.length);let m=0;for(const p of u)f.setFrame(m++,M(p,"time",0),an(s,p,c.length,c));n.push(f)}if(e.events){const l=new Le(e.events.length);let a=0;for(let c=0;c<e.events.length;c++,a++){const d=e.events[c],u=s.findEvent(d.name);if(!u)throw new Error(`Event not found: ${d.name}`);const f=u.setupPose,m=new Ue(O.toSinglePrecision(M(d,"time",0)),u);m.intValue=M(d,"int",f.intValue),m.floatValue=M(d,"float",f.floatValue),m.stringValue=M(d,"string",f.stringValue),m.data.audioPath&&(m.volume=M(d,"volume",f.volume),m.balance=M(d,"balance",f.volume)),l.setFrame(a,m)}n.push(l)}let r=0;for(let l=0,a=n.length;l<a;l++)r=Math.max(r,n[l].getDuration());const o=new Fe(t,n,r),h=M(e,"color",null);h!==null&&o.color.setFromString(h),s.animations.push(o)}},Lr=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,i,n,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.sourceIndex=i,this.source=n,this.inheritTimelines=r}};function It(e,t,s,i,n){let r=t[0],o=r.time??0,h=(r.value??i)*n,l=0;for(let a=0;;a++){s.setFrame(a,o,h);const c=t[a+1];if(!c){s.shrink(l),e.push(s);return}const d=c.time??0,u=(c.value??i)*n;r.curve&&(l=dt(r.curve,s,l,a,0,o,d,h,u,n)),o=d,h=u,r=c}}function xi(e,t,s,i,n,r,o){let h=t[0],l=h.time??0,a=(h[i]??r)*o,c=(h[n]??r)*o,d=0;for(let u=0;;u++){s.setFrame(u,l,a,c);const f=t[u+1];if(!f){s.shrink(d),e.push(s);return}const m=f.time??0,p=(f[i]??r)*o,g=(f[n]??r)*o,x=h.curve;x&&(d=dt(x,s,d,u,0,l,m,a,p,o),d=dt(x,s,d,u,1,l,m,c,g,o)),l=m,a=p,c=g,h=f}}function an(e,t,s,i){const n=t.offsets;if(!n)return null;const r=new Array(s).fill(-1),o=new Array(s-n.length);let h=0,l=0;for(const a of n){const c=e.findSlot(a.slot);if(c==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!i)d=c.index;else{d=-1;for(let u=0;u<s;u++)if(i[u]===c.index){d=u;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;h!==d;)o[l++]=h++;r[h+a.offset]=h++}for(;h<s;)o[l++]=h++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=o[--l]);return r}function dt(e,t,s,i,n,r,o,h,l,a){if(e==="stepped")return t.setStepped(i),s;const c=n<<2,d=e[c],u=e[c+1]*a,f=e[c+2],m=e[c+3]*a;return t.setBezier(s,i,n,r,h,d,u,f,m,o,l),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}var Pr=class{commandPool=new Xr;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new pi;renderCommands=[];render(e,t=!1,s,i=2){this.commandPool.reset(),this.renderCommands.length=0;const n=this.clipping,r=e.drawOrder.appliedPose;for(let o=0;o<e.slots.length;o++){const h=r[o],l=h.appliedPose.attachment;if(!l){n.clipEnd(h);continue}const a=h.appliedPose,c=a.color;if((c.a===0||!h.bone.active)&&!(l instanceof Zt)){n.clipEnd(h);continue}let u,f,m,p,g,x,b;if(l instanceof zt){if(x=l.color,x.a===0){n.clipEnd(h);continue}const A=l.sequence,S=A.resolveIndex(a);l.computeWorldVertices(h,l.getOffsets(a),this.worldVertices,0,i),u=this.worldVertices,f=4,m=A.getUVs(S),p=this.quadIndices,g=6,b=A.regions[S]?.texture}else if(l instanceof Ut){if(x=l.color,x.a===0){n.clipEnd(h);continue}this.worldVertices.length<l.worldVerticesLength&&(this.worldVertices=new Float32Array(l.worldVerticesLength)),l.computeWorldVertices(e,h,0,l.worldVerticesLength,this.worldVertices,0,i),u=this.worldVertices,f=l.worldVerticesLength>>1;const A=l.sequence,S=A.resolveIndex(a);m=A.getUVs(S),p=l.triangles,g=p.length,b=A.regions[S]?.texture}else if(l instanceof Zt){n.clipStart(e,h,l);continue}else continue;const w=e.color;let v,y;if(t){let A;if(s){A=Math.floor(s[3]*w.a*c.a*x.a*255);const S=Math.floor(A*s[0]*w.r*c.r*x.r),C=Math.floor(A*s[1]*w.g*c.g*x.g),I=Math.floor(A*s[2]*w.b*c.b*x.b);v=A<<24|S<<16|C<<8|I}else{A=Math.floor(w.a*c.a*x.a*255);const S=Math.floor(A*w.r*c.r*x.r),C=Math.floor(A*w.g*c.g*x.g),I=Math.floor(A*w.b*c.b*x.b);v=A<<24|S<<16|C<<8|I}if(y=4278190080,a.darkColor){const{r:S,g:C,b:I}=a.darkColor;y=4278190080|Math.floor(S*A)<<16|Math.floor(C*A)<<8|Math.floor(I*A)}}else{if(s){const A=Math.floor(s[3]*w.a*c.a*x.a*255),S=Math.floor(s[0]*w.r*c.r*x.r*255),C=Math.floor(s[1]*w.g*c.g*x.g*255),I=Math.floor(s[2]*w.b*c.b*x.b*255);v=A<<24|S<<16|C<<8|I}else{const A=Math.floor(w.a*c.a*x.a*255),S=Math.floor(w.r*c.r*x.r*255),C=Math.floor(w.g*c.g*x.g*255),I=Math.floor(w.b*c.b*x.b*255);v=A<<24|S<<16|C<<8|I}if(y=0,a.darkColor){const{r:A,g:S,b:C}=a.darkColor;y=Math.floor(A*255)<<16|Math.floor(S*255)<<8|Math.floor(C*255)}}n.isClipping()&&(n.clipTrianglesUnpacked(u,0,p,g,m,i),u=n.clippedVerticesTyped,f=n.clippedVerticesLength/i,m=n.clippedUVsTyped,p=n.clippedTrianglesTyped,g=n.clippedTrianglesLength);const T=this.commandPool.getCommand(f,g,i);T.blendMode=h.data.blendMode,T.texture=b,T.positions.set(u.subarray(0,f*i)),T.uvs.set(m.subarray(0,f<<1));for(let A=0;A<f;A++)T.colors[A]=v,T.darkColors[A]=y;p instanceof Uint16Array?T.indices.set(p.subarray(0,g)):T.indices.set(p.slice(0,g)),this.renderCommands.push(T),n.clipEnd(h)}return n.clipEnd(),this.batchCommands(i)}batchSubCommands(e,t,s,i,n,r){const o=e[t],h=this.commandPool.getCommand(i,n,r);h.blendMode=o.blendMode,h.texture=o.texture;let l=0,a=0,c=0,d=0,u=0;for(let f=t;f<=s;f++){const m=e[f];h.positions.set(m.positions,l),l+=m.numVertices*r,h.uvs.set(m.uvs,a),a+=m.numVertices<<1,h.colors.set(m.colors,c),h.darkColors.set(m.darkColors,c),c+=m.numVertices;for(let p=0;p<m.numIndices;p++)h.indices[d+p]=m.indices[p]+u;d+=m.numIndices,u+=m.numVertices}return h}batchCommands(e){if(this.renderCommands.length===0)return;let t,s,i=this.renderCommands[0],n=0,r=1,o=i.numVertices,h=i.numIndices;for(;r<=this.renderCommands.length;){const l=r<this.renderCommands.length?this.renderCommands[r]:null;if(l&&l.numVertices===0&&l.numIndices===0){r++;continue}if(l!==null&&l.texture===i.texture&&l.blendMode===i.blendMode&&l.colors[0]===i.colors[0]&&l.darkColors[0]===i.darkColors[0]&&h+l.numIndices<65535)o+=l.numVertices,h+=l.numIndices;else{const c=this.batchSubCommands(this.renderCommands,n,r-1,o,h,e);if(s?(s.next=c,s=c):t=s=c,r===this.renderCommands.length)break;i=this.renderCommands[r],n=r,o=i.numVertices,h=i.numIndices}r++}return t}},Xr=class{pool=[];inUse=[];getCommand(e,t,s){let i;for(const n of this.pool)if(n._positions.length>=e*s&&n._indices.length>=t){i=n;break}if(i)this.pool.splice(this.pool.indexOf(i),1),i.next=void 0,i.numVertices=e,i.numIndices=t,i.positions=i._positions.subarray(0,e*s),i.uvs=i._uvs.subarray(0,e<<1),i.colors=i._colors.subarray(0,e),i.darkColors=i._darkColors.subarray(0,e),i.indices=i._indices.subarray(0,t);else{const n=new Float32Array(e*s),r=new Float32Array(e<<1),o=new Uint32Array(e),h=new Uint32Array(e),l=new Uint16Array(t);i={positions:n,uvs:r,colors:o,darkColors:h,indices:l,_positions:n,_uvs:r,_colors:o,_darkColors:h,_indices:l,numVertices:e,numIndices:t,blendMode:0,texture:null}}return this.inUse.push(i),i}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},Tt=class{canvas;gl;restorables=[];constructor(e,t={alpha:!0}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{const s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=e=>{e&&e.preventDefault()};contextRestoredHandler=()=>{for(let e=0,t=this.restorables.length;e<t;e++)this.restorables[e].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(e){this.restorables.push(e)}removeRestorable(e){const t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},oe=class Yi extends hs{context;texture=null;boundUnit=0;pma;useMipMaps;constructor(t,s,i,n=!1){super(s),this.context=t instanceof Tt?t:new Tt(t),this.pma=i,this.useMipMaps=n,this.restore(),this.context.addRestorable(this)}setFilters(t,s){const i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Yi.validateMagFilter(s)),this.useMipMaps=Yi.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case 9987:case 9985:case 9986:case 9984:return 9729;default:return t}}static usesMipMaps(t){switch(t){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(t,s){const i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(t){const s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind();const i=s.getParameter(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!this.pma),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this._image),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,t?s.LINEAR_MIPMAP_LINEAR:s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),t&&s.generateMipmap(s.TEXTURE_2D),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){const s=this.context.gl;this.boundUnit=t,s.activeTexture(s.TEXTURE0+t),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){const t=this.context.gl;t.activeTexture(t.TEXTURE0+this.boundUnit),t.bindTexture(t.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},on=class extends qi{constructor(e,t="",s=new $s){super((i,n=!1)=>new oe(e,i,n),t,s)}},Yt=class{x=0;y=0;z=0;constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,s){return this.x=e,this.y=t,this.z=s,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}normalize(){let e=this.length();return e===0?this:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this)}cross(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}multiply(e){const t=e.values;return this.set(this.x*t[_]+this.y*t[K]+this.z*t[J]+t[G],this.x*t[Q]+this.y*t[H]+this.z*t[tt]+t[j],this.x*t[et]+this.y*t[st]+this.z*t[Z]+t[$])}project(e){const t=e.values,s=1/(this.x*t[rt]+this.y*t[at]+this.z*t[ot]+t[nt]);return this.set((this.x*t[_]+this.y*t[K]+this.z*t[J]+t[G])*s,(this.x*t[Q]+this.y*t[H]+this.z*t[tt]+t[j])*s,(this.x*t[et]+this.y*t[st]+this.z*t[Z]+t[$])*s)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(e){const t=e.x-this.x,s=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+s*s+i*i)}},_=0,K=4,J=8,G=12,Q=1,H=5,tt=9,j=13,et=2,st=6,Z=10,$=14,rt=3,at=7,ot=11,nt=15,Ie=class Xt{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new Yt;static yAxis=new Yt;static zAxis=new Yt;static tmpMatrix=new Xt;constructor(){const t=this.values;t[_]=1,t[H]=1,t[Z]=1,t[nt]=1}set(t){return this.values.set(t),this}transpose(){const t=this.temp,s=this.values;return t[_]=s[_],t[K]=s[Q],t[J]=s[et],t[G]=s[rt],t[Q]=s[K],t[H]=s[H],t[tt]=s[st],t[j]=s[at],t[et]=s[J],t[st]=s[tt],t[Z]=s[Z],t[$]=s[ot],t[rt]=s[G],t[at]=s[j],t[ot]=s[$],t[nt]=s[nt],this.set(t)}identity(){const t=this.values;return t[_]=1,t[K]=0,t[J]=0,t[G]=0,t[Q]=0,t[H]=1,t[tt]=0,t[j]=0,t[et]=0,t[st]=0,t[Z]=1,t[$]=0,t[rt]=0,t[at]=0,t[ot]=0,t[nt]=1,this}invert(){const t=this.values,s=this.temp,i=t[rt]*t[st]*t[tt]*t[G]-t[et]*t[at]*t[tt]*t[G]-t[rt]*t[H]*t[Z]*t[G]+t[Q]*t[at]*t[Z]*t[G]+t[et]*t[H]*t[ot]*t[G]-t[Q]*t[st]*t[ot]*t[G]-t[rt]*t[st]*t[J]*t[j]+t[et]*t[at]*t[J]*t[j]+t[rt]*t[K]*t[Z]*t[j]-t[_]*t[at]*t[Z]*t[j]-t[et]*t[K]*t[ot]*t[j]+t[_]*t[st]*t[ot]*t[j]+t[rt]*t[H]*t[J]*t[$]-t[Q]*t[at]*t[J]*t[$]-t[rt]*t[K]*t[tt]*t[$]+t[_]*t[at]*t[tt]*t[$]+t[Q]*t[K]*t[ot]*t[$]-t[_]*t[H]*t[ot]*t[$]-t[et]*t[H]*t[J]*t[nt]+t[Q]*t[st]*t[J]*t[nt]+t[et]*t[K]*t[tt]*t[nt]-t[_]*t[st]*t[tt]*t[nt]-t[Q]*t[K]*t[Z]*t[nt]+t[_]*t[H]*t[Z]*t[nt];if(i===0)throw new Error("non-invertible matrix");const n=1/i;return s[_]=t[tt]*t[$]*t[at]-t[j]*t[Z]*t[at]+t[j]*t[st]*t[ot]-t[H]*t[$]*t[ot]-t[tt]*t[st]*t[nt]+t[H]*t[Z]*t[nt],s[K]=t[G]*t[Z]*t[at]-t[J]*t[$]*t[at]-t[G]*t[st]*t[ot]+t[K]*t[$]*t[ot]+t[J]*t[st]*t[nt]-t[K]*t[Z]*t[nt],s[J]=t[J]*t[j]*t[at]-t[G]*t[tt]*t[at]+t[G]*t[H]*t[ot]-t[K]*t[j]*t[ot]-t[J]*t[H]*t[nt]+t[K]*t[tt]*t[nt],s[G]=t[G]*t[tt]*t[st]-t[J]*t[j]*t[st]-t[G]*t[H]*t[Z]+t[K]*t[j]*t[Z]+t[J]*t[H]*t[$]-t[K]*t[tt]*t[$],s[Q]=t[j]*t[Z]*t[rt]-t[tt]*t[$]*t[rt]-t[j]*t[et]*t[ot]+t[Q]*t[$]*t[ot]+t[tt]*t[et]*t[nt]-t[Q]*t[Z]*t[nt],s[H]=t[J]*t[$]*t[rt]-t[G]*t[Z]*t[rt]+t[G]*t[et]*t[ot]-t[_]*t[$]*t[ot]-t[J]*t[et]*t[nt]+t[_]*t[Z]*t[nt],s[tt]=t[G]*t[tt]*t[rt]-t[J]*t[j]*t[rt]-t[G]*t[Q]*t[ot]+t[_]*t[j]*t[ot]+t[J]*t[Q]*t[nt]-t[_]*t[tt]*t[nt],s[j]=t[J]*t[j]*t[et]-t[G]*t[tt]*t[et]+t[G]*t[Q]*t[Z]-t[_]*t[j]*t[Z]-t[J]*t[Q]*t[$]+t[_]*t[tt]*t[$],s[et]=t[H]*t[$]*t[rt]-t[j]*t[st]*t[rt]+t[j]*t[et]*t[at]-t[Q]*t[$]*t[at]-t[H]*t[et]*t[nt]+t[Q]*t[st]*t[nt],s[st]=t[G]*t[st]*t[rt]-t[K]*t[$]*t[rt]-t[G]*t[et]*t[at]+t[_]*t[$]*t[at]+t[K]*t[et]*t[nt]-t[_]*t[st]*t[nt],s[Z]=t[K]*t[j]*t[rt]-t[G]*t[H]*t[rt]+t[G]*t[Q]*t[at]-t[_]*t[j]*t[at]-t[K]*t[Q]*t[nt]+t[_]*t[H]*t[nt],s[$]=t[G]*t[H]*t[et]-t[K]*t[j]*t[et]-t[G]*t[Q]*t[st]+t[_]*t[j]*t[st]+t[K]*t[Q]*t[$]-t[_]*t[H]*t[$],s[rt]=t[tt]*t[st]*t[rt]-t[H]*t[Z]*t[rt]-t[tt]*t[et]*t[at]+t[Q]*t[Z]*t[at]+t[H]*t[et]*t[ot]-t[Q]*t[st]*t[ot],s[at]=t[K]*t[Z]*t[rt]-t[J]*t[st]*t[rt]+t[J]*t[et]*t[at]-t[_]*t[Z]*t[at]-t[K]*t[et]*t[ot]+t[_]*t[st]*t[ot],s[ot]=t[J]*t[H]*t[rt]-t[K]*t[tt]*t[rt]-t[J]*t[Q]*t[at]+t[_]*t[tt]*t[at]+t[K]*t[Q]*t[ot]-t[_]*t[H]*t[ot],s[nt]=t[K]*t[tt]*t[et]-t[J]*t[H]*t[et]+t[J]*t[Q]*t[st]-t[_]*t[tt]*t[st]-t[K]*t[Q]*t[Z]+t[_]*t[H]*t[Z],t[_]=s[_]*n,t[K]=s[K]*n,t[J]=s[J]*n,t[G]=s[G]*n,t[Q]=s[Q]*n,t[H]=s[H]*n,t[tt]=s[tt]*n,t[j]=s[j]*n,t[et]=s[et]*n,t[st]=s[st]*n,t[Z]=s[Z]*n,t[$]=s[$]*n,t[rt]=s[rt]*n,t[at]=s[at]*n,t[ot]=s[ot]*n,t[nt]=s[nt]*n,this}determinant(){const t=this.values;return t[rt]*t[st]*t[tt]*t[G]-t[et]*t[at]*t[tt]*t[G]-t[rt]*t[H]*t[Z]*t[G]+t[Q]*t[at]*t[Z]*t[G]+t[et]*t[H]*t[ot]*t[G]-t[Q]*t[st]*t[ot]*t[G]-t[rt]*t[st]*t[J]*t[j]+t[et]*t[at]*t[J]*t[j]+t[rt]*t[K]*t[Z]*t[j]-t[_]*t[at]*t[Z]*t[j]-t[et]*t[K]*t[ot]*t[j]+t[_]*t[st]*t[ot]*t[j]+t[rt]*t[H]*t[J]*t[$]-t[Q]*t[at]*t[J]*t[$]-t[rt]*t[K]*t[tt]*t[$]+t[_]*t[at]*t[tt]*t[$]+t[Q]*t[K]*t[ot]*t[$]-t[_]*t[H]*t[ot]*t[$]-t[et]*t[H]*t[J]*t[nt]+t[Q]*t[st]*t[J]*t[nt]+t[et]*t[K]*t[tt]*t[nt]-t[_]*t[st]*t[tt]*t[nt]-t[Q]*t[K]*t[Z]*t[nt]+t[_]*t[H]*t[Z]*t[nt]}translate(t,s,i){const n=this.values;return n[G]+=t,n[j]+=s,n[$]+=i,this}copy(){return new Xt().set(this.values)}projection(t,s,i,n){this.identity();const r=1/Math.tan(i*(Math.PI/180)/2),o=(s+t)/(t-s),h=2*s*t/(t-s),l=this.values;return l[_]=r/n,l[Q]=0,l[et]=0,l[rt]=0,l[K]=0,l[H]=r,l[st]=0,l[at]=0,l[J]=0,l[tt]=0,l[Z]=o,l[ot]=-1,l[G]=0,l[j]=0,l[$]=h,l[nt]=0,this}ortho2d(t,s,i,n){return this.ortho(t,t+i,s,s+n,0,1)}ortho(t,s,i,n,r,o){this.identity();const h=2/(s-t),l=2/(n-i),a=-2/(o-r),c=-(s+t)/(s-t),d=-(n+i)/(n-i),u=-(o+r)/(o-r),f=this.values;return f[_]=h,f[Q]=0,f[et]=0,f[rt]=0,f[K]=0,f[H]=l,f[st]=0,f[at]=0,f[J]=0,f[tt]=0,f[Z]=a,f[ot]=0,f[G]=c,f[j]=d,f[$]=u,f[nt]=1,this}multiply(t){const s=this.temp,i=this.values,n=t.values;return s[_]=i[_]*n[_]+i[K]*n[Q]+i[J]*n[et]+i[G]*n[rt],s[K]=i[_]*n[K]+i[K]*n[H]+i[J]*n[st]+i[G]*n[at],s[J]=i[_]*n[J]+i[K]*n[tt]+i[J]*n[Z]+i[G]*n[ot],s[G]=i[_]*n[G]+i[K]*n[j]+i[J]*n[$]+i[G]*n[nt],s[Q]=i[Q]*n[_]+i[H]*n[Q]+i[tt]*n[et]+i[j]*n[rt],s[H]=i[Q]*n[K]+i[H]*n[H]+i[tt]*n[st]+i[j]*n[at],s[tt]=i[Q]*n[J]+i[H]*n[tt]+i[tt]*n[Z]+i[j]*n[ot],s[j]=i[Q]*n[G]+i[H]*n[j]+i[tt]*n[$]+i[j]*n[nt],s[et]=i[et]*n[_]+i[st]*n[Q]+i[Z]*n[et]+i[$]*n[rt],s[st]=i[et]*n[K]+i[st]*n[H]+i[Z]*n[st]+i[$]*n[at],s[Z]=i[et]*n[J]+i[st]*n[tt]+i[Z]*n[Z]+i[$]*n[ot],s[$]=i[et]*n[G]+i[st]*n[j]+i[Z]*n[$]+i[$]*n[nt],s[rt]=i[rt]*n[_]+i[at]*n[Q]+i[ot]*n[et]+i[nt]*n[rt],s[at]=i[rt]*n[K]+i[at]*n[H]+i[ot]*n[st]+i[nt]*n[at],s[ot]=i[rt]*n[J]+i[at]*n[tt]+i[ot]*n[Z]+i[nt]*n[ot],s[nt]=i[rt]*n[G]+i[at]*n[j]+i[ot]*n[$]+i[nt]*n[nt],this.set(this.temp)}multiplyLeft(t){const s=this.temp,i=this.values,n=t.values;return s[_]=n[_]*i[_]+n[K]*i[Q]+n[J]*i[et]+n[G]*i[rt],s[K]=n[_]*i[K]+n[K]*i[H]+n[J]*i[st]+n[G]*i[at],s[J]=n[_]*i[J]+n[K]*i[tt]+n[J]*i[Z]+n[G]*i[ot],s[G]=n[_]*i[G]+n[K]*i[j]+n[J]*i[$]+n[G]*i[nt],s[Q]=n[Q]*i[_]+n[H]*i[Q]+n[tt]*i[et]+n[j]*i[rt],s[H]=n[Q]*i[K]+n[H]*i[H]+n[tt]*i[st]+n[j]*i[at],s[tt]=n[Q]*i[J]+n[H]*i[tt]+n[tt]*i[Z]+n[j]*i[ot],s[j]=n[Q]*i[G]+n[H]*i[j]+n[tt]*i[$]+n[j]*i[nt],s[et]=n[et]*i[_]+n[st]*i[Q]+n[Z]*i[et]+n[$]*i[rt],s[st]=n[et]*i[K]+n[st]*i[H]+n[Z]*i[st]+n[$]*i[at],s[Z]=n[et]*i[J]+n[st]*i[tt]+n[Z]*i[Z]+n[$]*i[ot],s[$]=n[et]*i[G]+n[st]*i[j]+n[Z]*i[$]+n[$]*i[nt],s[rt]=n[rt]*i[_]+n[at]*i[Q]+n[ot]*i[et]+n[nt]*i[rt],s[at]=n[rt]*i[K]+n[at]*i[H]+n[ot]*i[st]+n[nt]*i[at],s[ot]=n[rt]*i[J]+n[at]*i[tt]+n[ot]*i[Z]+n[nt]*i[ot],s[nt]=n[rt]*i[G]+n[at]*i[j]+n[ot]*i[$]+n[nt]*i[nt],this.set(this.temp)}lookAt(t,s,i){const n=Xt.xAxis,r=Xt.yAxis,o=Xt.zAxis;o.setFrom(s).normalize(),n.setFrom(s).normalize(),n.cross(i).normalize(),r.setFrom(n).cross(o).normalize(),this.identity();const h=this.values;return h[_]=n.x,h[K]=n.y,h[J]=n.z,h[Q]=r.x,h[H]=r.y,h[tt]=r.z,h[et]=-o.x,h[st]=-o.y,h[Z]=-o.z,Xt.tmpMatrix.identity(),Xt.tmpMatrix.values[G]=-t.x,Xt.tmpMatrix.values[j]=-t.y,Xt.tmpMatrix.values[$]=-t.z,this.multiply(Xt.tmpMatrix),this}},ln=class{position=new Yt(0,0,0);direction=new Yt(0,0,-1);up=new Yt(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Ie;inverseProjectionView=new Ie;projection=new Ie;view=new Ie;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){const e=this.projection,t=this.view,s=this.projectionView,i=this.inverseProjectionView,n=this.zoom,r=this.viewportWidth,o=this.viewportHeight;e.ortho(n*(-r/2),n*(r/2),n*(-o/2),n*(o/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),s.set(e.values),s.multiply(t),i.set(s.values).invert()}screenToWorld(e,t,s){const i=e.x,n=s-e.y-1;return e.x=2*i/t-1,e.y=2*n/s-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,s){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=s*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},bi=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=[];autoPreventDefault;isTouch=!1;callbacks;constructor(e,t=!0){this.element=e,this.autoPreventDefault=t,this.callbacks=this.setupCallbacks(e)}setupCallbacks(e){const t=l=>{if(l instanceof MouseEvent&&!this.isTouch){const a=e.getBoundingClientRect();this.mouseX=l.clientX-a.left,this.mouseY=l.clientY-a.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,l)})}},s=l=>{if(l instanceof MouseEvent&&!this.isTouch){const a=e.getBoundingClientRect();this.mouseX=l.clientX-a.left,this.mouseY=l.clientY-a.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,l):c.moved&&c.moved(this.mouseX,this.mouseY,l)})}},i=l=>{if(l instanceof MouseEvent&&!this.isTouch){const a=e.getBoundingClientRect();this.mouseX=l.clientX-a.left,this.mouseY=l.clientY-a.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,l)})}},n=l=>{this.autoPreventDefault&&l.preventDefault();let a=l.deltaY;l.deltaMode===WheelEvent.DOM_DELTA_LINE&&(a*=8),l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a,l)})},r=l=>{if(this.isTouch=!0,!this.touch0||!this.touch1){const c=l.changedTouches.item(0);if(!c)return;const d=e.getBoundingClientRect(),u=c.clientX-d.left,f=c.clientY-d.top,m=new cn(c.identifier,u,f);if(this.mouseX=u,this.mouseY=f,this.buttonDown=!0,!this.touch0)this.touch0=m,this.listeners.map(p=>{p.down&&p.down(m.x,m.y,l)});else if(!this.touch1){this.touch1=m;const p=this.touch1.x-this.touch0.x,g=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(p*p+g*g),this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,this.initialPinchDistance,l)})}}this.autoPreventDefault&&l.preventDefault()},o=l=>{if(this.isTouch=!0,this.touch0){const a=l.changedTouches,c=e.getBoundingClientRect();for(let d=0;d<a.length;d++){const u=a[d],f=u.clientX-c.left,m=u.clientY-c.top;this.touch0.identifier===u.identifier&&(this.touch0.x=this.mouseX=f,this.touch0.y=this.mouseY=m,this.listeners.map(p=>{p.dragged&&p.dragged(f,m,l)})),this.touch1&&this.touch1.identifier===u.identifier&&(this.touch1.x=this.mouseX=f,this.touch1.y=this.mouseY=m)}if(this.touch0&&this.touch1){const d=this.touch1.x-this.touch0.x,u=this.touch1.x-this.touch0.x,f=Math.sqrt(d*d+u*u);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,f,l)})}}this.autoPreventDefault&&l.preventDefault()},h=l=>{this.isTouch=!0;const a=this.touch0;if(a){const c=l.changedTouches,d=e.getBoundingClientRect();for(let u=0;u<c.length;u++){const f=c[u],m=f.clientX-d.left,p=f.clientY-d.top;if(a.identifier===f.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=p,this.listeners.map(g=>{g.up&&g.up(m,p,l)}),this.touch1){const g=this.touch0=this.touch1;this.touch1=null,this.mouseX=g.x,this.mouseY=g.y,this.buttonDown=!0,this.listeners.map(x=>{x.down&&x.down(g.x,g.y,l)})}else{this.buttonDown=!1;break}this.touch1?.identifier&&(this.touch1=null)}}this.autoPreventDefault&&l.preventDefault()};return e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",r,{passive:!1,capture:!1}),e.addEventListener("touchmove",o,{passive:!1,capture:!1}),e.addEventListener("touchend",h,{passive:!1,capture:!1}),e.addEventListener("touchcancel",h),{mouseDown:t,mouseMove:s,mouseUp:i,mouseWheel:n,touchStart:r,touchMove:o,touchEnd:h}}dispose(){const e=this.element;e.removeEventListener("mousedown",this.callbacks.mouseDown,!0),e.removeEventListener("mousemove",this.callbacks.mouseMove,!0),e.removeEventListener("mouseup",this.callbacks.mouseUp,!0),e.removeEventListener("wheel",this.callbacks.mouseWheel,!0),e.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),e.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),e.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),e.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},cn=class{constructor(e,t,s){this.identifier=e,this.x=t,this.y=s}},kr=class{constructor(e,t){this.canvas=e,this.camera=t;let s=0,i=0,n=0,r=0,o=0,h=0,l=0;new bi(e).addListener({down:(a,c)=>{s=t.position.x,i=t.position.y,n=o=a,r=h=c,l=t.zoom},dragged:(a,c)=>{const d=a-n,u=c-r,f=t.screenToWorld(new Yt(0,0),e.clientWidth,e.clientHeight),m=t.screenToWorld(new Yt(d,u),e.clientWidth,e.clientHeight).sub(f);t.position.set(s-m.x,i-m.y,0),t.update(),o=a,h=c},wheel:a=>{const c=a/200*t.zoom,d=t.zoom+c;if(d>0){let u=0,f=0;if(a<0)u=o,f=h;else{const g=new Yt(e.clientWidth/2+15,e.clientHeight/2),x=o-g.x,b=e.clientHeight-1-h-g.y;u=g.x-x,f=e.clientHeight-1-g.y+b}const m=t.screenToWorld(new Yt(u,f),e.clientWidth,e.clientHeight);t.zoom=d,t.update();const p=t.screenToWorld(new Yt(u,f),e.clientWidth,e.clientHeight);t.position.add(m.sub(p)),t.update()}},zoom:(a,c)=>{const d=a/c;t.zoom=l*d},up:(a,c)=>{o=a,h=c},moved:(a,c)=>{o=a,h=c}})}},Lt=class pt{constructor(t,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=t instanceof Tt?t:new Tt(t),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){const t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(s){throw this.dispose(),s}}compileShader(t,s){const i=this.context.gl,n=i.createShader(t);if(!n)throw new Error("Couldn't create shader.");if(i.shaderSource(n,s),i.compileShader(n),!i.getShaderParameter(n,i.COMPILE_STATUS)){const r=`Couldn't compile shader: ${i.getShaderInfoLog(n)}`;if(i.deleteShader(n),!i.isContextLost())throw new Error(r)}return n}compileProgram(t,s){const i=this.context.gl,n=i.createProgram();if(!n)throw new Error("Couldn't compile program.");if(i.attachShader(n,t),i.attachShader(n,s),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS)){const r=`Couldn't compile shader program: ${i.getProgramInfoLog(n)}`;if(i.deleteProgram(n),!i.isContextLost())throw new Error(r)}return n}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,s){this.context.gl.uniform1i(this.getUniformLocation(t),s)}setUniformf(t,s){this.context.gl.uniform1f(this.getUniformLocation(t),s)}setUniform2f(t,s,i){this.context.gl.uniform2f(this.getUniformLocation(t),s,i)}setUniform3f(t,s,i,n){this.context.gl.uniform3f(this.getUniformLocation(t),s,i,n)}setUniform4f(t,s,i,n,r){this.context.gl.uniform4f(this.getUniformLocation(t),s,i,n,r)}setUniform2x2f(t,s){const i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,s){const i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,s){const i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){const s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");const i=s.getUniformLocation(this.program,t);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){const s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");const i=s.getAttribLocation(this.program,t);if(i===-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);const t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){const s=`
|
|
1
|
+
"use strict";var Bn=class{array=[];add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Pi=class{entries={};size=0;add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let s=0,i=e.length;s<i;s++)this.add(e[s]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},it=class Qt{constructor(t=0,s=0,i=0,n=0){this.r=t,this.g=s,this.b=i,this.a=n}static WHITE=new Qt(1,1,1,1);static RED=new Qt(1,0,0,1);static GREEN=new Qt(0,1,0,1);static BLUE=new Qt(0,0,1,1);static MAGENTA=new Qt(1,0,1,1);set(t,s,i,n){return this.r=t,this.g=s,this.b=i,this.a=n,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)==="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,n){return this.r+=t,this.g+=s,this.b+=i,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,s=new Qt){return s.setFromString(t)}},B=class Mt{static epsilon=1e-5;static epsilon2=Mt.epsilon*Mt.epsilon;static PI=3.1415927;static PI2=Mt.PI*2;static invPI2=1/Mt.PI2;static radiansToDegrees=180/Mt.PI;static radDeg=Mt.radiansToDegrees;static degreesToRadians=Mt.PI/180;static degRad=Mt.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*Mt.degRad)}static sinDeg(t){return Math.sin(t*Mt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*Mt.radDeg}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return Mt.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){const n=Math.random(),r=s-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):s-Math.sqrt((1-n)*r*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ue=class he{static linear=new class extends he{applyInternal(t){return t}};static smooth=new class extends he{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends he{applyInternal(t){return t*t}};static fastSlow=new class extends he{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends he{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,s,i){return s===void 0||i===void 0?this.applyInternal(t):t+(s-t)*this.applyInternal(i)}},Xi=class extends ue{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2===0?-2:2)+1}},On=class extends Xi{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},O=class de{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,n,r){for(let a=s,h=n;a<s+r;a++,h++)i[h]=t[a]}static arrayFill(t,s,i,n){for(let r=s;r<i;r++)t[r]=n}static setArraySize(t,s,i=0){const n=t.length;if(n===s)return t;if(t.length=s,n<s)for(let r=n;r<s;r++)t[r]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:de.setArraySize(t,s,i)}static newArray(t,s){const i=[];for(let n=0;n<t;n++)i[n]=s;return i}static newFloatArray(t){if(de.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{const s=[];for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(de.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{const s=[];for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return de.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return de.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,s,i=!0){for(let n=0;n<t.length;n++)if(t[n]===s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Un=class{static logBones(e){for(let t=0;t<e.bones.length;t++){const s=e.bones[t].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},me=class{items=[];instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset?.(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Ee=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}},as=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Nn=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},cs=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ye=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Ye||{}),ki=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ki||{}),Vi=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Dn=class extends cs{setFilters(e,t){}setWraps(e,t){}dispose(){}},ls=class{pages=[];regions=[];constructor(e){const t=new zn(e),s=new Array(4),i={};i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.format=()=>{},i.filter=o=>{o.minFilter=O.enumValue(Ye,s[1]),o.magFilter=O.enumValue(Ye,s[2])},i.repeat=o=>{s[1].indexOf("x")!==-1&&(o.uWrap=10497),s[1].indexOf("y")!==-1&&(o.vWrap=10497)},i.pma=o=>{o.pma=s[1]==="true"};var n={};n.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},n.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},n.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},n.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},n.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},n.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},n.rotate=o=>{const l=s[1];l==="true"?o.degrees=90:l!=="false"&&(o.degrees=parseInt(l))},n.index=o=>{o.index=parseInt(s[1])};let r=t.readLine();for(;r&&r.trim().length===0;)r=t.readLine();for(;!(!r||r.trim().length===0||t.readEntry(s,r)===0);)r=t.readLine();let a=null,h=null,c=null;for(;r!==null;)if(r.trim().length===0)a=null,r=t.readLine();else if(a){const o=new hs(a,r);for(;;){const l=t.readEntry(s,r=t.readLine());if(l===0)break;const d=n[s[0]];if(d)d(o);else{h||(h=[]),c||(c=[]),h.push(s[0]);const m=[];for(let f=0;f<l;f++)m.push(parseInt(s[f+1]));c.push(m)}}o.originalWidth===0&&o.originalHeight===0&&(o.originalWidth=o.width,o.originalHeight=o.height),h&&h.length>0&&c&&c.length>0&&(o.names=h,o.values=c,h=null,c=null),o.u=o.x/a.width,o.v=o.y/a.height,o.degrees===90?(o.u2=(o.x+o.height)/a.width,o.v2=(o.y+o.width)/a.height):(o.u2=(o.x+o.width)/a.width,o.v2=(o.y+o.height)/a.height),this.regions.push(o)}else{for(a=new Bi(r.trim());t.readEntry(s,r=t.readLine())!==0;){const o=i[s[0]];o&&o(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name===e)return this.regions[t];return null}setTextures(e,t=""){for(const s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},zn=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const s=t.indexOf(":");if(s===-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,n=s+1;;i++){const r=t.indexOf(",",n);if(r===-1)return e[i]=t.substr(n).trim(),i;if(e[i]=t.substr(n,r-n).trim(),n=r+1,i===4)return 4}}},Bi=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}},hs=class extends Vi{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ds=class Tn{static empty=[];name;timelineAttachment;timelineSlots=Tn.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,s,i){let n=t[s];if(n.bone.isActive()){const r=(i?n.getAppliedPose():n.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,a=this.timelineSlots.length;r<a;r++){if(n=t[this.timelineSlots[r]],!n.bone.isActive())continue;const h=(i?n.getAppliedPose():n.getPose()).getAttachment();if(h!=null&&h.timelineAttachment===this)return!0}return!1}},Dt=class An extends ds{static nextID=0;id=An.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,s,i,n,r,a,h){n=a+(n>>1)*h;const c=s.appliedPose.deform;let o=this.vertices;const l=this.bones;if(!l){c.length>0&&(o=c);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,x=u.a,b=u.b,w=u.c,v=u.d;for(let y=i,T=a;T<n;y+=2,T+=h){const A=o[y],S=o[y+1];r[T]=A*x+S*b+p,r[T+1]=A*w+S*v+g}return}let d=0,m=0;for(let u=0;u<i;u+=2){const p=l[d];d+=p+1,m+=p}const f=t.bones;if(c.length===0)for(let u=a,p=m*3;u<n;u+=h){let g=0,x=0,b=l[d++];for(b+=d;d<b;d++,p+=3){const w=f[l[d]].appliedPose,v=o[p],y=o[p+1],T=o[p+2];g+=(v*w.a+y*w.b+w.worldX)*T,x+=(v*w.c+y*w.d+w.worldY)*T}r[u]=g,r[u+1]=x}else{const u=c;for(let p=a,g=m*3,x=m<<1;p<n;p+=h){let b=0,w=0,v=l[d++];for(v+=d;d<v;d++,g+=3,x+=2){const y=f[l[d]].appliedPose,T=o[g]+u[x],A=o[g+1]+u[x+1],S=o[g+2];b+=(T*y.a+A*y.b+y.worldX)*S,w+=(T*y.c+A*y.d+y.worldY)*S}r[p]=b,r[p+1]=w}}}copyTo(t){this.bones?(t.bones=[],O.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=O.newFloatArray(this.vertices.length),O.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},Ut=class Ii extends Dt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new it(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new it(0,0,0,0);constructor(t,s){super(t),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Ii(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],O.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],O.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],O.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new Ii(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,s,i){if(!t)throw new Error("Region not set.");const n=i.length;let r=t.u,a=t.v,h=0,c=0;if(t instanceof hs){const o=t.page,l=o.width,d=o.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/l,a-=(t.originalWidth-t.offsetX-t.width)/d,h=t.originalHeight/l,c=t.originalWidth/d;for(let m=0;m<n;m+=2)i[m]=r+s[m+1]*h,i[m+1]=a+(1-s[m])*c;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/l,a-=t.offsetY/d,h=t.originalWidth/l,c=t.originalHeight/d;for(let m=0;m<n;m+=2)i[m]=r+(1-s[m])*h,i[m+1]=a+(1-s[m+1])*c;return;case 270:r-=t.offsetY/l,a-=t.offsetX/d,h=t.originalHeight/l,c=t.originalWidth/d;for(let m=0;m<n;m+=2)i[m]=r+(1-s[m+1])*h,i[m+1]=a+s[m]*c;return;default:r-=t.offsetX/l,a-=(t.originalHeight-t.offsetY-t.height)/d,h=t.originalWidth/l,c=t.originalHeight/d}}else t?(h=t.u2-r,c=t.v2-a):(r=a=0,h=c=1);for(let o=0;o<n;o+=2)i[o]=r+s[o]*h,i[o+1]=a+s[o+1]*c}},zt=class Sn extends ds{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new it(1,1,1,1);tempColor=new it(1,1,1,1);constructor(t,s){super(t),this.sequence=s}copy(){const t=new Sn(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,s,i,n,r){const a=t.bone.appliedPose,h=a.worldX,c=a.worldY,o=a.a,l=a.b,d=a.c,m=a.d;let f=s[0],u=s[1];i[n]=f*o+u*l+h,i[n+1]=f*d+u*m+c,n+=r,f=s[2],u=s[3],i[n]=f*o+u*l+h,i[n+1]=f*d+u*m+c,n+=r,f=s[4],u=s[5],i[n]=f*o+u*l+h,i[n+1]=f*d+u*m+c,n+=r,f=s[6],u=s[7],i[n]=f*o+u*l+h,i[n+1]=f*d+u*m+c}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,s,i,n,r,a,h,c,o,l){if(!t)throw new Error("Region not set.");const d=h/t.originalWidth*n,m=c/t.originalHeight*r,f=-h/2*n+t.offsetX*d,u=-c/2*r+t.offsetY*m,p=f+t.width*d,g=u+t.height*m,x=a*B.degRad,b=Math.cos(x),w=Math.sin(x),v=f*b+s,y=f*w,T=u*b+i,A=u*w,S=p*b+s,C=p*w,I=g*b+i,Y=g*w;o[0]=v-A,o[1]=T+y,o[2]=v-Y,o[3]=I+y,o[4]=S-Y,o[5]=I+C,o[6]=S-A,o[7]=T+C,t==null?(l[0]=0,l[1]=0,l[2]=0,l[3]=1,l[4]=1,l[5]=1,l[6]=1,l[7]=0):(l[1]=t.v2,l[2]=t.u,l[5]=t.v,l[6]=t.u2,t.degrees===90?(l[0]=t.u2,l[3]=t.v2,l[4]=t.u,l[7]=t.v):(l[0]=t.u,l[3]=t.v,l[4]=t.u2,l[7]=t.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},ge=class ns{static _nextID=0;id=ns.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(t,s){this.regions=new Array(t),this.pathSuffix=s}copy(){const t=this.regions.length,s=new ns(t,this.pathSuffix);if(O.arrayCopy(this.regions,0,s.regions,0,t),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const i=this.uvs[0].length;s.uvs=[];for(let n=0;n<t;n++)s.uvs[n]=O.newFloatArray(i),O.arrayCopy(this.uvs[n],0,s.uvs[n],0,i)}if(this.offsets!=null){s.offsets=[];for(let i=0;i<t;i++)s.offsets[i]=[],O.arrayCopy(this.offsets[i],0,s.offsets[i],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof zt){this.uvs=[],this.offsets=[];for(let i=0;i<s;i++)this.uvs[i]=O.newFloatArray(8),this.offsets[i]=[],zt.computeUVs(this.regions[i],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[i],this.uvs[i])}else if(t instanceof Ut){const i=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let n=0;n<s;n++)this.uvs[n]=O.newFloatArray(i.length),Ut.computeUVs(this.regions[n],i,this.uvs[n])}}resolveIndex(t){let s=t.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,s){if(!this.pathSuffix)return t;let i=t;const n=(this.start+s).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return ns._nextID++}},fs=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(fs||{}),us=[0,1,2,3,4,5,6],Re=class{name;timelines=[];timelineIds;bones;color=new it(1,1,1,1);duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=s,this.timelineIds=new Pi,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,i=e;for(let n=0;n<t;n++){const r=i[n];this.timelineIds.addAll(r.propertyIds),Di(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,n,r,a,h,c,o){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!==0&&(s%=this.duration,t>0&&(t%=this.duration));const l=this.timelines;for(let d=0,m=l.length;d<m;d++)l[d].apply(e,t,s,n,r,a,h,c,o)}},Oi=(e=>(e[e.current=0]="current",e[e.setup=1]="setup",e[e.first=2]="first",e))(Oi||{}),Ui=(e=>(e[e.rotate=0]="rotate",e[e.x=1]="x",e[e.y=2]="y",e[e.scaleX=3]="scaleX",e[e.scaleY=4]="scaleY",e[e.shearX=5]="shearX",e[e.shearY=6]="shearY",e[e.inherit=7]="inherit",e[e.rgb=8]="rgb",e[e.alpha=9]="alpha",e[e.rgb2=10]="rgb2",e[e.attachment=11]="attachment",e[e.deform=12]="deform",e[e.event=13]="event",e[e.drawOrder=14]="drawOrder",e[e.drawOrderFolder=15]="drawOrderFolder",e[e.ikConstraint=16]="ikConstraint",e[e.transformConstraint=17]="transformConstraint",e[e.pathConstraintPosition=18]="pathConstraintPosition",e[e.pathConstraintSpacing=19]="pathConstraintSpacing",e[e.pathConstraintMix=20]="pathConstraintMix",e[e.physicsConstraintInertia=21]="physicsConstraintInertia",e[e.physicsConstraintStrength=22]="physicsConstraintStrength",e[e.physicsConstraintDamping=23]="physicsConstraintDamping",e[e.physicsConstraintMass=24]="physicsConstraintMass",e[e.physicsConstraintWind=25]="physicsConstraintWind",e[e.physicsConstraintGravity=26]="physicsConstraintGravity",e[e.physicsConstraintMix=27]="physicsConstraintMix",e[e.physicsConstraintReset=28]="physicsConstraintReset",e[e.sequence=29]="sequence",e[e.sliderTime=30]="sliderTime",e[e.sliderMix=31]="sliderMix",e))(Ui||{}),gt=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=O.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(e,t,s=1){const i=e.length;for(let n=s;n<i;n+=s)if(e[n]>t)return n-s;return i-s}};function Ni(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var qt=class extends gt{curves;constructor(e,t,...s){super(e,...s),this.curves=O.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=O.newFloatArray(t);O.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,n,r,a,h,c,o,l){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(i-r*2+h)*.03,u=(n-a*2+c)*.03,p=((r-h)*3-i+o)*.006,g=((a-c)*3-n+l)*.006;let x=f*2+p,b=u*2+g,w=(r-i)*.3+f+p*.16666667,v=(a-n)*.3+u+g*.16666667,y=i+w,T=n+v;for(let A=m+18;m<A;m+=2)d[m]=y,d[m+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getBezierValue(e,t,s,i){const n=this.curves;if(n[i]>e){const c=this.frames[t],o=this.frames[t+s];return o+(e-c)/(n[i]-c)*(n[i+1]-o)}const r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=e){const c=n[i-2],o=n[i-1];return o+(e-c)/(n[i]-c)*(n[i+1]-o)}t+=this.getFrameEntries();const a=n[r-2],h=n[r-1];return h+(e-a)/(this.frames[t]-a)*(this.frames[t+s]-h)}},pe=class Ie extends qt{constructor(t,s,i){super(t,s,i)}getFrameEntries(){return 2}setFrame(t,s,i){t<<=1,this.frames[t]=s,this.frames[t+1]=i}getCurveValue(t){const s=this.frames;let i=s.length-2;for(let r=2;r<=i;r+=2)if(s[r]>t){i=r-2;break}const n=this.curves[i>>1];switch(n){case 0:{const r=s[i],a=s[i+1];return a+(t-r)/(s[i+2]-r)*(s[i+2+1]-a)}case 1:return s[i+1]}return this.getBezierValue(t,i,1,n-2)}getRelativeValue(t,s,i,n,r,a){if(t<this.frames[0])return Ie.beforeFirstKey(i,s,r,a);const h=this.getCurveValue(t);return i===1?a+h*s:r+(n?h:h+a-r)*s}getAbsoluteValue(t,s,i,n,r,a,h){return h===void 0?this.getAbsoluteValue1(t,s,i,n,r,a):this.getAbsoluteValue2(t,s,i,n,r,a,h)}getAbsoluteValue1(t,s,i,n,r,a){if(t<this.frames[0])return Ie.beforeFirstKey(i,s,r,a);const h=this.getCurveValue(t);return i===1?a+(n?h:h-a)*s:r+(n?h:h-r)*s}getAbsoluteValue2(t,s,i,n,r,a,h){return t<this.frames[0]?Ie.beforeFirstKey(i,s,r,a):i===1?a+(n?h:h-a)*s:r+(n?h:h-r)*s}getScaleValue(t,s,i,n,r,a,h){if(t<this.frames[0])return Ie.beforeFirstKey(i,s,a,h);const c=this.getCurveValue(t)*h;if(s===1&&!n)return c;let o=i===1?h:a;return n?o+(c-h)*s:r?o+(Math.abs(c)*Math.sign(o)-o)*s:(o=Math.abs(o)*Math.sign(c),o+(c-o)*s)}static beforeFirstKey(t,s,i,n){switch(t){case 1:return n;case 2:return i+(n-i)*s;case 0:return i}}};function Di(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var Wt=class extends pe{boneIndex;constructor(e,t,s,i){super(e,t,`${i}|${s}`),this.boneIndex=s,this.additive=!0}apply(e,t,s,i,n,r,a,h,c){const o=e.bones[this.boneIndex];o.active&&this.apply1(c?o.appliedPose:o.pose,o.data.setupPose,s,n,r,a,h)}},Fe=class extends qt{boneIndex;constructor(e,t,s,i,n){super(e,t,`${i}|${s}`,`${n}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}apply(e,t,s,i,n,r,a,h,c){const o=e.bones[this.boneIndex];o.active&&this.apply1(c?o.appliedPose:o.pose,o.data.setupPose,s,n,r,a,h)}},xe=class extends Wt{constructor(e,t,s){super(e,t,s,0)}apply1(e,t,s,i,n,r,a){e.rotation=this.getRelativeValue(s,i,n,r,e.rotation,t.rotation)}},ms=class extends Fe{constructor(e,t,s){super(e,t,s,1,2)}apply1(e,t,s,i,n,r,a){const h=this.frames;if(s<h[0]){switch(n){case 1:e.x=t.x,e.y=t.y;break;case 2:e.x+=(t.x-e.x)*i,e.y+=(t.y-e.y)*i;break}return}let c=0,o=0;const l=gt.search(h,s,3),d=this.curves[l/3];switch(d){case 0:{const m=h[l];c=h[l+1],o=h[l+2];const f=(s-m)/(h[l+3]-m);c+=(h[l+3+1]-c)*f,o+=(h[l+3+2]-o)*f;break}case 1:c=h[l+1],o=h[l+2];break;default:c=this.getBezierValue(s,l,1,d-2),o=this.getBezierValue(s,l,2,d+18-2)}n===1?(e.x=t.x+c*i,e.y=t.y+o*i):r?(e.x+=c*i,e.y+=o*i):(e.x+=(t.x+c-e.x)*i,e.y+=(t.y+o-e.y)*i)}},gs=class extends Wt{constructor(e,t,s){super(e,t,s,1)}apply1(e,t,s,i,n,r,a){e.x=this.getRelativeValue(s,i,n,r,e.x,t.x)}},ps=class extends Wt{constructor(e,t,s){super(e,t,s,2)}apply1(e,t,s,i,n,r,a){e.y=this.getRelativeValue(s,i,n,r,e.y,t.y)}},xs=class extends Fe{constructor(e,t,s){super(e,t,s,3,4)}apply1(e,t,s,i,n,r,a){const h=this.frames;if(s<h[0]){switch(n){case 1:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case 2:e.scaleX+=(t.scaleX-e.scaleX)*i,e.scaleY+=(t.scaleY-e.scaleY)*i;break}return}let c,o;const l=gt.search(h,s,3),d=this.curves[l/3];switch(d){case 0:{const m=h[l];c=h[l+1],o=h[l+2];const f=(s-m)/(h[l+3]-m);c+=(h[l+3+1]-c)*f,o+=(h[l+3+2]-o)*f;break}case 1:c=h[l+1],o=h[l+2];break;default:c=this.getBezierValue(s,l,1,d-2),o=this.getBezierValue(s,l,2,d+18-2)}if(c*=t.scaleX,o*=t.scaleY,i===1&&!r)e.scaleX=c,e.scaleY=o;else{let m=0,f=0;n===1?(m=t.scaleX,f=t.scaleY):(m=e.scaleX,f=e.scaleY),r?(e.scaleX=m+(c-t.scaleX)*i,e.scaleY=f+(o-t.scaleY)*i):a?(e.scaleX=m+(Math.abs(c)*Math.sign(m)-m)*i,e.scaleY=f+(Math.abs(o)*Math.sign(f)-f)*i):(m=Math.abs(m)*Math.sign(c),f=Math.abs(f)*Math.sign(o),e.scaleX=m+(c-m)*i,e.scaleY=f+(o-f)*i)}}},bs=class extends Wt{constructor(e,t,s){super(e,t,s,3)}apply1(e,t,s,i,n,r,a){e.scaleX=this.getScaleValue(s,i,n,r,a,e.scaleX,t.scaleX)}},ws=class extends Wt{constructor(e,t,s){super(e,t,s,4)}apply1(e,t,s,i,n,r,a){e.scaleY=this.getScaleValue(s,i,n,r,a,e.scaleY,t.scaleY)}},ys=class extends Fe{constructor(e,t,s){super(e,t,s,5,6)}apply1(e,t,s,i,n,r,a){const h=this.frames;if(s<h[0]){switch(n){case 1:e.shearX=t.shearX,e.shearY=t.shearY;break;case 2:e.shearX+=(t.shearX-e.shearX)*i,e.shearY+=(t.shearY-e.shearY)*i;break}return}let c=0,o=0;const l=gt.search(h,s,3),d=this.curves[l/3];switch(d){case 0:{const m=h[l];c=h[l+1],o=h[l+2];const f=(s-m)/(h[l+3]-m);c+=(h[l+3+1]-c)*f,o+=(h[l+3+2]-o)*f;break}case 1:c=h[l+1],o=h[l+2];break;default:c=this.getBezierValue(s,l,1,d-2),o=this.getBezierValue(s,l,2,d+18-2)}n===1?(e.shearX=t.shearX+c*i,e.shearY=t.shearY+o*i):r?(e.shearX+=c*i,e.shearY+=o*i):(e.shearX+=(t.shearX+c-e.shearX)*i,e.shearY+=(t.shearY+o-e.shearY)*i)}},vs=class extends Wt{constructor(e,t,s){super(e,t,s,5)}apply1(e,t,s,i,n,r,a){e.shearX=this.getRelativeValue(s,i,n,r,e.shearX,t.shearX)}},Ts=class extends Wt{constructor(e,t,s){super(e,t,s,6)}apply1(e,t,s,i,n,r,a){e.shearY=this.getRelativeValue(s,i,n,r,e.shearY,t.shearY)}},As=class extends gt{boneIndex;constructor(e,t){super(e,`7|${t}`),this.boneIndex=t,this.instant=!0}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,n,r,a,h,c){const o=e.bones[this.boneIndex];if(!o.active)return;const l=c?o.appliedPose:o.pose;if(h)r!==0&&(l.inherit=o.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r!==0&&(l.inherit=o.data.setupPose.inherit):l.inherit=this.frames[gt.search(d,s,2)+1]}}},be=class extends qt{slotIndex;constructor(e,t,s,...i){super(e,t,...i),this.slotIndex=s}apply(e,t,s,i,n,r,a,h,c){const o=e.slots[this.slotIndex];o.bone.active&&this.apply1(o,c?o.appliedPose:o.pose,s,n,r,a)}},Ss=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(e,t,s,i,n,r){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r}apply1(e,t,s,i,n,r){const a=t.color,h=this.frames;if(s<h[0]){const u=e.data.setupPose.color;switch(n){case 1:a.setFromColor(u);break;case 2:a.add((u.r-a.r)*i,(u.g-a.g)*i,(u.b-a.b)*i,(u.a-a.a)*i);break}return}let c=0,o=0,l=0,d=0;const m=gt.search(h,s,5),f=this.curves[m/5];switch(f){case 0:{const u=h[m];c=h[m+1],o=h[m+2],l=h[m+3],d=h[m+4];const p=(s-u)/(h[m+5]-u);c+=(h[m+5+1]-c)*p,o+=(h[m+5+2]-o)*p,l+=(h[m+5+3]-l)*p,d+=(h[m+5+4]-d)*p;break}case 1:c=h[m+1],o=h[m+2],l=h[m+3],d=h[m+4];break;default:c=this.getBezierValue(s,m,1,f-2),o=this.getBezierValue(s,m,2,f+18-2),l=this.getBezierValue(s,m,3,f+18*2-2),d=this.getBezierValue(s,m,4,f+18*3-2)}if(i===1)a.set(c,o,l,d);else if(n===1){const u=e.data.setupPose.color;a.set(u.r+(c-u.r)*i,u.g+(o-u.g)*i,u.b+(l-u.b)*i,u.a+(d-u.a)*i)}else a.add((c-a.r)*i,(o-a.g)*i,(l-a.b)*i,(d-a.a)*i)}},Cs=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(e,t,s,i,n){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n}apply1(e,t,s,i,n,r){const a=t.color;let h=0,c=0,o=0;const l=this.frames;if(s<l[0]){const f=e.data.setupPose.color;switch(n){case 1:{a.r=f.r,a.g=f.g,a.b=f.b;break}case 2:{a.r+=(f.r-a.r)*i,a.g+=(f.g-a.g)*i,a.b+=(f.b-a.b)*i;break}}return}const d=gt.search(l,s,4),m=this.curves[d>>2];switch(m){case 0:{const f=l[d];h=l[d+1],c=l[d+2],o=l[d+3];const u=(s-f)/(l[d+4]-f);h+=(l[d+4+1]-h)*u,c+=(l[d+4+2]-c)*u,o+=(l[d+4+3]-o)*u;break}case 1:h=l[d+1],c=l[d+2],o=l[d+3];break;default:h=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),o=this.getBezierValue(s,d,3,m+18*2-2)}if(i!==1)if(n===1){const f=e.data.setupPose.color;h=f.r+(h-f.r)*i,c=f.g+(c-f.g)*i,o=f.b+(o-f.b)*i}else h=a.r+(h-a.r)*i,c=a.g+(c-a.g)*i,o=a.b+(o-a.b)*i;a.r=h<0?0:h>1?1:h,a.g=c<0?0:c>1?1:c,a.b=o<0?0:o>1?1:o}},Is=class extends pe{slotIndex=0;constructor(e,t,s){super(e,t,`9|${s}`),this.slotIndex=s}apply(e,t,s,i,n,r,a,h,c){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const l=(c?o.appliedPose:o.pose).color;let d=0;const m=this.frames;if(s<m[0]){const f=o.data.setupPose.color.a;switch(r){case 1:l.a=f;break;case 2:l.a+=(f-l.a)*n;break}return}if(d=this.getCurveValue(s),n!==1)if(r===1){const f=o.data.setupPose.color;d=f.a+(d-f.a)*n}else d=l.a+(d-l.a)*n;l.a=d<0?0:d>1?1:d}},Ms=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,i,n,r,a,h,c){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=h,this.frames[e+7]=c}apply1(e,t,s,i,n,r){const a=t.color,h=t.darkColor;let c=0,o=0,l=0;const d=this.frames;if(s<d[0]){const b=e.data.setupPose,w=b.color,v=b.darkColor;switch(n){case 1:{a.setFromColor(w),h.r=v.r,h.g=v.g,h.b=v.b;break}case 2:{a.add((w.r-a.r)*i,(w.g-a.g)*i,(w.b-a.b)*i,(w.a-a.a)*i),h.r+=(v.r-h.r)*i,h.g+=(v.g-h.g)*i,h.b+=(v.b-h.b)*i;break}}return}let m=0,f=0,u=0,p=0;const g=gt.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],c=d[g+5],o=d[g+6],l=d[g+7];const w=(s-b)/(d[g+8]-b);m+=(d[g+8+1]-m)*w,f+=(d[g+8+2]-f)*w,u+=(d[g+8+3]-u)*w,p+=(d[g+8+4]-p)*w,c+=(d[g+8+5]-c)*w,o+=(d[g+8+6]-o)*w,l+=(d[g+8+7]-l)*w;break}case 1:m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],c=d[g+5],o=d[g+6],l=d[g+7];break;default:m=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),u=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),c=this.getBezierValue(s,g,5,x+18*4-2),o=this.getBezierValue(s,g,6,x+18*5-2),l=this.getBezierValue(s,g,7,x+18*6-2)}if(i===1)a.set(m,f,u,p);else if(n===1){const b=e.data.setupPose;let w=b.color;a.set(w.r+(m-w.r)*i,w.g+(f-w.g)*i,w.b+(u-w.b)*i,w.a+(p-w.a)*i),w=b.darkColor,c=w.r+(c-w.r)*i,o=w.g+(o-w.g)*i,l=w.b+(l-w.b)*i}else a.add((m-a.r)*i,(f-a.g)*i,(u-a.b)*i,(p-a.a)*i),c=h.r+(c-h.r)*i,o=h.g+(o-h.g)*i,l=h.b+(l-h.b)*i;h.r=c<0?0:c>1?1:c,h.g=o<0?0:o>1?1:o,h.b=l<0?0:l>1?1:l}},Es=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,i,n,r,a,h){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=h}apply1(e,t,s,i,n,r){const a=t.color,h=t.darkColor;let c=0,o=0,l=0,d=0,m=0,f=0;const u=this.frames;if(s<u[0]){const x=e.data.setupPose,b=x.color,w=x.darkColor;switch(n){case 1:a.r=b.r,a.g=b.g,a.b=b.b,h.r=w.r,h.g=w.g,h.b=w.b;break;case 2:a.r+=(b.r-a.r)*i,a.g+=(b.g-a.g)*i,a.b+=(b.b-a.b)*i,h.r+=(w.r-h.r)*i,h.g+=(w.g-h.g)*i,h.b+=(w.b-h.b)*i;break}return}const p=gt.search(u,s,7),g=this.curves[p/7];switch(g){case 0:{const x=u[p];c=u[p+1],o=u[p+2],l=u[p+3],d=u[p+4],m=u[p+5],f=u[p+6];const b=(s-x)/(u[p+7]-x);c+=(u[p+7+1]-c)*b,o+=(u[p+7+2]-o)*b,l+=(u[p+7+3]-l)*b,d+=(u[p+7+4]-d)*b,m+=(u[p+7+5]-m)*b,f+=(u[p+7+6]-f)*b;break}case 1:c=u[p+1],o=u[p+2],l=u[p+3],d=u[p+4],m=u[p+5],f=u[p+6];break;default:c=this.getBezierValue(s,p,1,g-2),o=this.getBezierValue(s,p,2,g+18-2),l=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),m=this.getBezierValue(s,p,5,g+18*4-2),f=this.getBezierValue(s,p,6,g+18*5-2)}if(i!==1)if(n===1){const x=e.data.setupPose;let b=x.color;c=b.r+(c-b.r)*i,o=b.g+(o-b.g)*i,l=b.b+(l-b.b)*i,b=x.darkColor,d=b.r+(d-b.r)*i,m=b.g+(m-b.g)*i,f=b.b+(f-b.b)*i}else c=a.r+(c-a.r)*i,o=a.g+(o-a.g)*i,l=a.b+(l-a.b)*i,d=h.r+(d-h.r)*i,m=h.g+(m-h.g)*i,f=h.b+(f-h.b)*i;a.r=c<0?0:c>1?1:c,a.g=o<0?0:o>1?1:o,a.b=l<0?0:l>1?1:l,h.r=d<0?0:d>1?1:d,h.g=m<0?0:m>1?1:m,h.b=f<0?0:f>1?1:f}},ie=class extends gt{slotIndex=0;attachmentNames;constructor(e,t){super(e,`11|${t}`),this.slotIndex=t,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,n,r,a,h,c){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const l=c?o.appliedPose:o.pose;h||s<this.frames[0]?r!==0&&this.setAttachment(e,l,o.data.attachmentName):this.setAttachment(e,l,this.attachmentNames[gt.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Ys=class extends qt{slotIndex;attachment;vertices;constructor(e,t,s,i){super(e,t,`12|${s}|${i.id}`),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,n,r,a,h,c,o,l){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(i-r*2+h)*.03,u=c*.03-a*.06,p=((r-h)*3-i+o)*.006,g=(a-c+.33333333)*.018;let x=f*2+p,b=u*2+g,w=(r-i)*.3+f+p*.16666667,v=a*.3+u+g*.16666667,y=i+w,T=v;for(let A=m+18;m<A;m+=2)d[m]=y,d[m+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getCurvePercent(e,t){const s=this.curves;let i=s[t];switch(i){case 0:{const h=this.frames[t];return(e-h)/(this.frames[t+this.getFrameEntries()]-h)}case 1:return 0}if(i-=2,s[i]>e){const h=this.frames[t];return s[i+1]*(e-h)/(s[i]-h)}const n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=e){const h=s[i-2],c=s[i-1];return c+(e-h)/(s[i]-h)*(s[i+1]-c)}const r=s[n-2],a=s[n-1];return a+(1-a)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,i,n,r,a,h,c){const o=e.slots;if(!this.attachment.isTimelineActive(o,this.slotIndex,c))return;const l=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(o[this.slotIndex],c,n,r);for(const g of l)this.applyBeforeFirst(o[g],c,n,r);return}let m,f,u;if(s>=d[d.length-1])u=0,m=this.vertices[d.length-1],f=null;else{const g=gt.search(d,s);u=this.getCurvePercent(s,g),m=this.vertices[g],f=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(o[this.slotIndex],c,m,f,u,p,n,r,a);for(const g of l)this.applyToSlot(o[g],c,m,f,u,p,n,r,a)}applyBeforeFirst(e,t,s,i){if(!e.bone.active)return;const n=t?e.appliedPose:e.pose;if(n.attachment==null||n.attachment.timelineAttachment!==this.attachment)return;const r=n.deform;switch(r.length===0&&(i=1),i){case 1:r.length=0;break;case 2:{if(s===1){r.length=0;return}const a=this.vertices[0].length;r.length=a;const h=r,c=n.attachment;if(c.bones===null){const o=c.vertices;for(let l=0;l<a;l++)h[l]+=(o[l]-h[l])*s}else{s=1-s;for(let o=0;o<a;o++)h[o]*=s}}}}applyToSlot(e,t,s,i,n,r,a,h,c){if(!e.bone.active)return;const o=t?e.appliedPose:e.pose;if(o.attachment===null||o.attachment.timelineAttachment!==this.attachment)return;const l=o.attachment,d=o.deform;d.length===0&&(h=1);const m=h===1;if(d.length=r,i===null)if(a===1)if(c&&!m)if(l.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=l.vertices;for(let u=0;u<r;u++)d[u]+=s[u]-f[u]}else O.arrayCopy(s,0,d,0,r);else if(m)if(l.bones)for(let f=0;f<r;f++)d[f]=s[f]*a;else{const f=l.vertices;for(let u=0;u<r;u++){const p=f[u];d[u]=p+(s[u]-p)*a}}else if(c)if(l.bones)for(let f=0;f<r;f++)d[f]+=s[f]*a;else{const f=l.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*a}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*a;else if(a===1)if(c&&!m)if(l.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=u+(i[f]-u)*n}else{const f=l.vertices;for(let u=0;u<r;u++){const p=s[u];d[u]+=p+(i[u]-p)*n-f[u]}}else if(n===0)O.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const u=s[f];d[f]=u+(i[f]-u)*n}else if(m)if(l.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(i[f]-u)*n)*a}else{const f=l.vertices;for(let u=0;u<r;u++){const p=s[u],g=f[u];d[u]=g+(p+(i[u]-p)*n-g)*a}}else if(c)if(l.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(i[f]-u)*n)*a}else{const f=l.vertices;for(let u=0;u<r;u++){const p=s[u];d[u]+=(p+(i[u]-p)*n-f[u])*a}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(i[f]-u)*n-d[f])*a}}},Rs=class Ht extends gt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,`29|${s}|${i.sequence.id}`),this.slotIndex=s,this.attachment=i,this.instant=!0}getFrameEntries(){return Ht.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,n,r){const a=this.frames;t*=Ht.ENTRIES,a[t]=s,a[t+Ht.MODE]=i|n<<4,a[t+Ht.DELAY]=r}apply(t,s,i,n,r,a,h,c,o){const l=t.slots;if(!this.attachment.isTimelineActive(l,this.slotIndex,o))return;const d=this.attachment.timelineSlots,m=this.frames;if(c||i<m[0]){if(a!==0){this.setupPose(l[this.slotIndex],o);for(const x of d)this.setupPose(l[x],o)}return}const f=gt.search(m,i,Ht.ENTRIES),u=m[f],p=m[f+Ht.MODE],g=m[f+Ht.DELAY];this.applyToSlot(l[this.slotIndex],o,i,u,p,g);for(const x of d)this.applyToSlot(l[x],o,i,u,p,g)}setupPose(t,s){if(!t.bone.active)return;const i=s?t.appliedPose:t.pose;i.attachment===null||i.attachment.timelineAttachment!==this.attachment||(i.sequenceIndex=-1)}applyToSlot(t,s,i,n,r,a){if(!t.bone.active)return;const h=s?t.appliedPose:t.pose;if(h.attachment===null||h.attachment.timelineAttachment!==this.attachment)return;let c=r>>4,o=h.attachment.sequence.regions.length;const l=us[r&15];if(l!==0)switch(c+=(i-n)/a+1e-5|0,l){case 1:c=Math.min(o-1,c);break;case 2:c%=o;break;case 3:{const d=(o<<1)-2;c=d===0?0:c%d,c>=o&&(c=d-c);break}case 4:c=Math.max(o-1-c,0);break;case 5:c=o-1-c%o;break;case 6:{const d=(o<<1)-2;c=d===0?0:(c+o-1)%d,c>=o&&(c=d-c)}}h.sequenceIndex=c}},Le=class Cn extends gt{static propertyIds=["13"];events;constructor(t){super(t,...Cn.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,n,r,a,h,c,o){if(!n)return;const l=this.frames,d=this.frames.length;if(s>i)this.apply(null,s,Number.MAX_VALUE,n,0,a,!1,!1,!1),s=-1;else if(s>=l[d-1])return;if(i<l[0])return;let m=0;if(s<l[0])m=0;else{m=gt.search(l,s)+1;const f=l[m];for(;m>0&&l[m-1]===f;)m--}for(;m<d&&i>=l[m];m++)n.push(this.events[m])}},jt=class Mi extends gt{static propertyID="14";static propertyIds=[Mi.propertyID];drawOrders;constructor(t){super(t,...Mi.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,n,r,a,h,c,o){const l=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(c||i<this.frames[0]){a!==0&&O.arrayCopy(d,0,l,0,t.slots.length);return}const m=this.drawOrders[gt.search(this.frames,i)];if(!m)O.arrayCopy(d,0,l,0,t.slots.length);else for(let f=0,u=m.length;f<u;f++)l[f]=d[m[f]]}},we=class Ei extends gt{static propertyID="15";slots;inFolder;drawOrders;constructor(t,s,i){super(t,...Ei.propertyIds(s)),this.slots=s,this.drawOrders=new Array(t),this.inFolder=new Array(i);for(const n of s)this.inFolder[n]=!0;this.instant=!0}static propertyIds(t){const s=t.length,i=new Array(s);for(let n=0;n<s;n++)i[n]=`${Ei.propertyID}|${t[n]}`;return i}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,n,r,a,h,c,o){const l=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(c||i<this.frames[0])a!==0&&this.setup(l,d);else{const m=this.drawOrders[gt.search(this.frames,i)];if(!m)this.setup(l,d);else{const f=this.inFolder,u=this.slots;for(let p=0,g=0,x=u.length;!(f[l[p].data.index]&&(l[p]=d[u[m[g]]],++g===x));p++);}}}setup(t,s){const{inFolder:i,slots:n}=this;for(let r=0,a=0,h=n.length;!(i[t[r].data.index]&&(t[r]=s[n[a]],++a===h));r++);}};function zi(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var Fs=class extends qt{constraintIndex=0;constructor(e,t,s){super(e,t,`16|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,n,r,a){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r?1:0,this.frames[e+5]=a?1:0}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(!o.active)return;const l=c?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const x=o.data.setupPose;switch(r){case 1:{l.mix=x.mix,l.softness=x.softness,l.bendDirection=x.bendDirection,l.compress=x.compress,l.stretch=x.stretch;break}case 2:{l.mix+=(x.mix-l.mix)*n,l.softness+=(x.softness-l.softness)*n,l.bendDirection=x.bendDirection,l.compress=x.compress,l.stretch=x.stretch;break}}return}let m=0,f=0;const u=gt.search(d,s,6),p=this.curves[u/6];switch(p){case 0:{const x=d[u];m=d[u+1],f=d[u+2];const b=(s-x)/(d[u+6]-x);m+=(d[u+6+1]-m)*b,f+=(d[u+6+2]-f)*b;break}case 1:m=d[u+1],f=d[u+2];break;default:m=this.getBezierValue(s,u,1,p-2),f=this.getBezierValue(s,u,2,p+18-2)}const g=r===1?o.data.setupPose:l;l.mix=g.mix+(m-g.mix)*n,l.softness=g.softness+(f-g.softness)*n,h?r===1&&(l.bendDirection=g.bendDirection,l.compress=g.compress,l.stretch=g.stretch):(l.bendDirection=d[u+3],l.compress=d[u+4]!==0,l.stretch=d[u+5]!==0)}},Ls=class extends qt{constraintIndex=0;constructor(e,t,s){super(e,t,`17|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(e,t,s,i,n,r,a,h){const c=this.frames;e*=7,c[e]=t,c[e+1]=s,c[e+2]=i,c[e+3]=n,c[e+4]=r,c[e+5]=a,c[e+6]=h}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(!o.active)return;const l=c?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const y=o.data.setupPose;switch(r){case 1:{l.mixRotate=y.mixRotate,l.mixX=y.mixX,l.mixY=y.mixY,l.mixScaleX=y.mixScaleX,l.mixScaleY=y.mixScaleY,l.mixShearY=y.mixShearY;break}case 2:{l.mixRotate+=(y.mixRotate-l.mixRotate)*n,l.mixX+=(y.mixX-l.mixX)*n,l.mixY+=(y.mixY-l.mixY)*n,l.mixScaleX+=(y.mixScaleX-l.mixScaleX)*n,l.mixScaleY+=(y.mixScaleY-l.mixScaleY)*n,l.mixShearY+=(y.mixShearY-l.mixShearY)*n;break}}return}let m,f,u,p,g,x;const b=gt.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];m=d[b+1],f=d[b+2],u=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const T=(s-y)/(d[b+7]-y);m+=(d[b+7+1]-m)*T,f+=(d[b+7+2]-f)*T,u+=(d[b+7+3]-u)*T,p+=(d[b+7+4]-p)*T,g+=(d[b+7+5]-g)*T,x+=(d[b+7+6]-x)*T;break}case 1:m=d[b+1],f=d[b+2],u=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:m=this.getBezierValue(s,b,1,w-2),f=this.getBezierValue(s,b,2,w+18-2),u=this.getBezierValue(s,b,3,w+18*2-2),p=this.getBezierValue(s,b,4,w+18*3-2),g=this.getBezierValue(s,b,5,w+18*4-2),x=this.getBezierValue(s,b,6,w+18*5-2)}const v=r===1?o.data.setupPose:l;a?(l.mixRotate=v.mixRotate+m*n,l.mixX=v.mixX+f*n,l.mixY=v.mixY+u*n,l.mixScaleX=v.mixScaleX+p*n,l.mixScaleY=v.mixScaleY+g*n,l.mixShearY=v.mixShearY+x*n):(l.mixRotate=v.mixRotate+(m-v.mixRotate)*n,l.mixX=v.mixX+(f-v.mixX)*n,l.mixY=v.mixY+(u-v.mixY)*n,l.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*n,l.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*n,l.mixShearY=v.mixShearY+(x-v.mixShearY)*n)}},ne=class extends pe{constraintIndex;constructor(e,t,s,i){super(e,t,`${i}|${s}`),this.constraintIndex=s}},Ps=class extends ne{constructor(e,t,s){super(e,t,s,18),this.additive=!0}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(o.active){const l=c?o.appliedPose:o.pose;l.position=this.getAbsoluteValue(s,n,r,a,l.position,o.data.setupPose.position)}}},Xs=class extends ne{constructor(e,t,s){super(e,t,s,19)}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(o.active){const l=c?o.appliedPose:o.pose;l.spacing=this.getAbsoluteValue(s,n,r,!1,l.spacing,o.data.setupPose.spacing)}}},ks=class extends qt{constraintIndex;constructor(e,t,s){super(e,t,`20|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,n){const r=this.frames;e<<=2,r[e]=t,r[e+1]=s,r[e+2]=i,r[e+3]=n}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(!o.active)return;const l=c?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const b=o.data.setupPose;switch(r){case 1:{l.mixRotate=b.mixRotate,l.mixX=b.mixX,l.mixY=b.mixY;break}case 2:{l.mixRotate+=(b.mixRotate-l.mixRotate)*n,l.mixX+=(b.mixX-l.mixX)*n,l.mixY+=(b.mixY-l.mixY)*n;break}}return}let m,f,u;const p=gt.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];m=d[p+1],f=d[p+2],u=d[p+3];const w=(s-b)/(d[p+4]-b);m+=(d[p+4+1]-m)*w,f+=(d[p+4+2]-f)*w,u+=(d[p+4+3]-u)*w;break}case 1:m=d[p+1],f=d[p+2],u=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),f=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+18*2-2)}const x=r===1?o.data.setupPose:l;a?(l.mixRotate=x.mixRotate+m*n,l.mixX=x.mixX+f*n,l.mixY=x.mixY+u*n):(l.mixRotate=x.mixRotate+(m-x.mixRotate)*n,l.mixX=x.mixX+(f-x.mixX)*n,l.mixY=x.mixY+(u-x.mixY)*n)}},Nt=class extends ne{constructor(e,t,s,i){super(e,t,s,i)}apply(e,t,s,i,n,r,a,h,c){if(a&&!this.additive&&(a=!1),this.constraintIndex===-1){const o=s>=this.frames[0]?this.getCurveValue(s):0,l=e.physics;for(const d of l)if(d.active&&this.global(d.data)){const m=c?d.appliedPose:d.pose;this.set(m,this.getAbsoluteValue(s,n,r,a,this.get(m),this.get(d.data.setupPose),o))}}else{const o=e.constraints[this.constraintIndex];if(o.active){const l=c?o.appliedPose:o.pose;this.set(l,this.getAbsoluteValue(s,n,r,a,this.get(l),this.get(o.data.setupPose)))}}}},Vs=class extends Nt{constructor(e,t,s){super(e,t,s,21)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Bs=class extends Nt{constructor(e,t,s){super(e,t,s,22)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Os=class extends Nt{constructor(e,t,s){super(e,t,s,23)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Us=class extends Nt{constructor(e,t,s){super(e,t,s,24)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Ns=class extends Nt{constructor(e,t,s){super(e,t,s,25),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ds=class extends Nt{constructor(e,t,s){super(e,t,s,26),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},zs=class extends Nt{constructor(e,t,s){super(e,t,s,27)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},qs=class In extends gt{static propertyIds=["28"];constraintIndex;constructor(t,s){super(t,...In.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,n,r,a,h,c,o){let l;if(this.constraintIndex!==-1&&(l=t.constraints[this.constraintIndex],!l.active))return;const d=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],r,a,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(i<d[0])&&(s<d[0]||i>=d[gt.search(d,s)+1]))if(l!=null)l.reset(t);else for(const m of t.physics)m.active&&m.reset(t)}},Ws=class extends ne{constructor(e,t,s){super(e,t,s,30)}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(o.active){const l=c?o.appliedPose:o.pose;l.time=this.getAbsoluteValue(s,n,r,a,l.time,o.data.setupPose.time)}}},Gs=class extends ne{constructor(e,t,s){super(e,t,s,31),this.additive=!0}apply(e,t,s,i,n,r,a,h,c){const o=e.constraints[this.constraintIndex];if(o.active){const l=c?o.appliedPose:o.pose;l.mix=this.getAbsoluteValue(s,n,r,a,l.mix,o.data.setupPose.mix)}}},qn=class Yi{static emptyAnimation=new Re("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Wi(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new me(()=>new qi);constructor(t){this.data=t}update(t){t*=this.timeScale;const s=this.tracks;for(let i=0,n=s.length;i<n;i++){const r=s[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let a=t*r.timeScale;if(r.delay>0){if(r.delay-=a,r.delay>0)continue;a=-r.delay,r.delay=0}let h=r.next;if(h){const c=r.trackLast-h.delay;if(c>=0){for(h.delay=0,h.trackTime+=r.timeScale===0?0:(c/r.timeScale+t)*h.timeScale,r.trackTime+=a,this.setTrack(i,h,!0);h.mixingFrom;)h.mixTime+=t,h=h.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[i]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let c=r.mixingFrom;for(r.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}r.trackTime+=a}this.queue.drain()}updateMixingFrom(t,s){const i=t.mixingFrom;if(!i)return!0;const n=this.updateMixingFrom(i,s);if(i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(i.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),i.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(i)}return n}return i.trackTime+=s*i.timeScale,t.mixTime+=s,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,i=this.tracks;let n=!1;for(let h=0,c=i.length;h<c;h++){const o=i[h];if(!o||o.delay>0)continue;n=!0;let l=o.alpha;o.mixingFrom?l*=this.applyMixingFrom(o,t):o.trackTime>=o.trackEnd&&!o.next&&(l=0);let d=o.animationLast,m=o.getAnimationTime(),f=m,u=s;o.reverse&&(f=o.animation.duration-f,u=null);const p=o.animation.timelines,g=p.length;if(h===0&&l===1)for(let x=0;x<g;x++){O.webkit602BugfixHelper(l);const b=p[x];b instanceof ie?this.applyAttachmentTimeline(b,t,f,1,!0):b.apply(t,d,f,u,l,1,!1,!1,!1)}else{const x=o.timelineMode,b=l>=o.alphaAttachmentThreshold,w=o.additive,v=w||o.shortestRotation,y=!v&&o.timelinesRotation.length!==g<<1;y&&(o.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const A=p[T],S=x[T]&js;!v&&A instanceof xe?this.applyRotateTimeline(A,t,f,l,S,o.timelinesRotation,T<<1,y):A instanceof ie?this.applyAttachmentTimeline(A,t,f,S,b):(O.webkit602BugfixHelper(l),A.apply(t,d,f,u,l,S,w,!1,!1))}}o.reverse&&this.eventsReverse(o,d,m),this.queueEvents(o,m),s.length=0,o.nextAnimationLast=m,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Zs,a=t.slots;for(let h=0,c=t.slots.length;h<c;h++){const o=a[h];if(o.attachmentState===r){const l=o.data.attachmentName;o.pose.setAttachment(l?t.getAttachment(o.data.index,l):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(t,s){const i=t.mixingFrom,n=i.mixingFrom!==null?this.applyMixingFrom(i,s):1,r=t.mix(),a=i.alpha*n,h=1-r*t.alpha,c=a*(1-r),o=h>0?c/h:a,l=i.animation.timelines,d=l.length,m=i.timelineMode,f=i.timelineHoldMix,u=r<i.mixAttachmentThreshold,p=r<i.mixDrawOrderThreshold,g=i.additive,x=g||i.shortestRotation,b=!x&&i.timelinesRotation.length!==d<<1;b&&(i.timelinesRotation.length=d<<1);const w=i.timelinesRotation;let v=i.animationLast,y=i.getAnimationTime(),T=y,A=null;i.reverse?T=i.animation.duration-T:r<i.eventThreshold&&(A=this.events),i.totalAlpha=0;for(let S=0;S<d;S++){const C=l[S],I=m[S],Y=I&js;let F=0;if((I&ye)!==0){const k=f[S];F=k==null?o:o*(1-k.mix())}else{if(!p&&C instanceof jt&&Y===0)continue;F=c}if(i.totalAlpha+=F,!x&&C instanceof xe)this.applyRotateTimeline(C,s,T,F,Y,w,S<<1,b);else if(C instanceof ie)this.applyAttachmentTimeline(C,s,T,Y,u&&F>=i.alphaAttachmentThreshold);else{const k=!p||!(C instanceof jt)||Y===0;C.apply(s,v,T,A,F,Y,g,k,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,v,y),t.mixDuration>0&&this.queueEvents(i,y),this.events.length=0,i.nextAnimationLast=y,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(t,s,i,n,r){const a=s.slots[t.slotIndex];if(!a.bone.active||!r&&a.attachmentState===this.unkeyedState+$s)return;let h=i<t.frames[0],c=null;if(h||(c=t.attachmentNames[gt.search(t.frames,i)],h=!r&&c==null),h){if(n===0)return;c=a.data.attachmentName}a.pose.setAttachment(c==null?null:s.getAttachment(a.data.index,c)),r?a.attachmentState=this.unkeyedState+$s:h||(a.attachmentState=this.unkeyedState+Zs)}applyRotateTimeline(t,s,i,n,r,a,h,c){if(c&&(a[h]=0),n===1){t.apply(s,0,i,null,1,r,!1,!1,!1);return}const o=s.bones[t.boneIndex];if(!o.active)return;const l=o.pose,d=o.data.setupPose,m=t.frames;let f,u;if(i<m[0]){switch(r){case 1:{l.rotation=d.rotation;return}case 0:return}f=l.rotation,u=d.rotation}else f=r===1?d.rotation:l.rotation,u=d.rotation+t.getCurveValue(i);let p=0,g=u-f;if(g-=Math.ceil(g/360-.5)*360,g===0)p=a[h];else{let x=0,b=0;c?(x=0,b=g):(x=a[h],b=a[h+1]);const w=x-x%360;p=g+w;let v=g>=0,y=x>=0;Math.abs(b)<=90&&B.signum(b)!==B.signum(g)&&(Math.abs(x-w)>180?(p+=360*B.signum(x),y=v):w!==0?p-=360*B.signum(x):y=v),y!==v&&(p+=360*B.signum(x)),a[h]=p}a[h+1]=g,l.rotation=f+p*n}queueEvents(t,s){const i=t.animationStart,n=t.animationEnd,r=n-i,a=t.reverse;let h=t.trackLast%r;a&&(h=r-h);const c=this.events;let o=0,l=c.length;for(;o<l;o++){const m=c[o];if(m.time<h!==a)break;m.time>=i&&m.time<=n&&this.queue.event(t,m)}let d=!1;if(t.loop)if(r===0)d=!0;else{const m=Math.floor(t.trackTime/r);d=m>0&&m>Math.floor(t.trackLast/r)}else d=s>=n&&t.animationLast<n;for(d&&this.queue.complete(t);o<l;o++){const m=c[o];m.time>=i&&m.time<=n&&this.queue.event(t,m)}}eventsReverse(t,s,i){const n=t.animation.duration,r=n-s,a=n-i,h=t.animation.timelines;for(let c=0,o=t.animation.timelines.length;c<o;c++){const l=h[c];if(!(l instanceof Le))continue;const d=l.events,m=l.frames,f=m.length;if(r>=a){for(let u=0;u<f;u++)if(!(m[u]<a)){if(m[u]>=r)break;this.events.push(d[u])}}else{for(let p=0;p<f&&!(m[p]>=r);p++)this.events.push(d[p]);let u=0;for(;u<f&&!(m[u]>=a);u++);for(;u<f;u++)this.events.push(d[u])}}}clearTracks(){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;const s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){const n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(t,s,i){const n=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,n&&(n.next=null,i&&this.queue.interrupt(n),s.mixingFrom=n,n.mixingTo=s,s.mixTime=0,n.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){return typeof s=="string"?this.setAnimation1(t,s,i):this.setAnimation2(t,s,i)}setAnimation1(t,s,i=!1){const n=this.data.skeletonData.findAnimation(s);if(!n)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(t,n,i)}setAnimation2(t,s,i=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));const a=this.trackEntry(t,s,i,r);return this.setTrack(t,a,n),this.queue.drain(),a}addAnimation(t,s,i=!1,n=0){return typeof s=="string"?this.addAnimation1(t,s,i,n):this.addAnimation2(t,s,i,n)}addAnimation1(t,s,i=!1,n=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(t,r,i,n)}addAnimation2(t,s,i=!1,n=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const a=this.trackEntry(t,s,i,r);return r?(r.next=a,a.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-a.mixDuration,0))):(this.setTrack(t,a,!0),this.queue.drain(),n<0&&(n=0)),a.delay=n,a}setEmptyAnimation(t,s=0){const i=this.setAnimation(t,Yi.emptyAnimation,!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){const n=this.addAnimation(t,Yi.emptyAnimation,!1,i);return i<=0&&(n.delay=Math.max(n.delay+n.mixDuration-s,0)),n.mixDuration=s,n.trackEnd=s,n}setEmptyAnimations(t=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,n=this.tracks.length;i<n;i++){const r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(O.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,n){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=s,r.loop=i,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;const t=this.tracks;for(let s=0,i=t.length;s<i;s++){const n=t[s];if(!n)continue;let r=n;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,n),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(t,s){const i=t.animation.timelines,n=t.animation.timelines.length,r=t.timelineMode;r.length=n;const a=t.timelineHoldMix;a.length=0;const h=t.additive,c=t.keepHold,o=t.mixingTo;for(let l=0;l<n;l++){const d=i[l],m=d.propertyIds,f=this.from(s,d,m);if(h&&d.additive){r[l]=f;continue}let u;if(o===null||d.instant||o.additive&&d.additive||!o.animation?.hasTimeline(m))u=f;else{u=f|ye;for(let p=o.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(m)){p.mixDuration>0&&(a[l]=p);break}}c&&(u=u&~ye|r[l]&ye),r[l]=u}}from(t,s,i){const n=this.propertyIds;let r=_i;for(let a=0,h=i.length;a<h;a++){const c=n.get(i[a]);if(c===void 0)n.set(i[a],t);else{if(c!==t){for(;++a<h;)n.has(i[a])||n.set(i[a],t);return _s}r=Hs}}if(s instanceof we){const a=n.get(jt.propertyID);if(a!=null)return a!==t?_s:Hs}return r}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},qi=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=ue.linear;setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===ue.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=ue.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const e=this.animationEnd-this.animationStart;if(e!==0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Wi=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let e=0;e<this.objects.length;e+=2){const t=this.objects,s=t[e],i=t[e+1],n=this.animState.listeners.slice();switch(s){case 0:i.listener?.start&&i.listener.start(i);for(let r=0;r<n.length;r++){const a=n[r];a.start&&a.start(i)}break;case 1:i.listener?.interrupt&&i.listener.interrupt(i);for(let r=0;r<n.length;r++){const a=n[r];a.interrupt&&a.interrupt(i)}break;case 2:i.listener?.end&&i.listener.end(i);for(let r=0;r<n.length;r++){const a=n[r];a.end&&a.end(i)}case 3:i.listener?.dispose&&i.listener.dispose(i);for(let r=0;r<n.length;r++){const a=n[r];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener?.complete&&i.listener.complete(i);for(let r=0;r<n.length;r++){const a=n[r];a.complete&&a.complete(i)}break;case 5:{const r=t[e+++2];i.listener?.event&&i.listener.event(i,r);for(let a=0;a<n.length;a++){const h=n[a];h.event&&h.event(i,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Gi=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Gi||{}),Wn=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},_s=0,_i=1,Hs=2,js=3,ye=4,Zs=1,$s=2,Gn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){return typeof e=="string"?this.setMix1(e,t,s):this.setMix2(e,t,s)}setMix1(e,t,s){const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);this.setMix2(i,n,s)}setMix2(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");const i=`${e.name}.${t.name}`;this.animationToMixTime[i]=s}getMix(e,t){const s=`${e.name}.${t.name}`,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Hi=class{constructor(e,t="",s=new Ks,i=new ji){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{const i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,n)=>{this.downloader.downloadBinary(e,r=>{this.success(t,e,r),i(r)},(r,a)=>{const h=`Couldn't load binary ${e}: status ${r}, ${a}`;this.error(s,e,h),n(h)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,n)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${n}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,n)=>{this.downloader.downloadJson(e,r=>{this.success(t,e,r),i(r)},(r,a)=>{const h=`Couldn't load JSON ${e}: status ${r}, ${a}`;this.error(s,e,h),n(h)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.getAsset(e),n=i!==void 0;return n&&(this.cache.assetsLoaded[e]=i.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(t,e,r),r)).catch(r=>{this.error(s,e,r)})),n}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),this.reuseAssets(e,t,s))return;const i=this.texturePmaInfo[e];this.cache.assetsLoaded[e]=new Promise((n,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(c=>{if(c.ok)return c.blob();const o=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(o)}).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{if(c){const o=this.createTexture(e,i,c);this.success(t,e,o),n(o)}});else{const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{const o=this.createTexture(e,i,c);this.success(t,e,o),n(o)},c.onerror=()=>{const o=`Couldn't load image: ${e}`;this.error(s,e,o),r(o)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}})}loadTextureAtlas(e,t=()=>{},s=()=>{},i){const n=e.lastIndexOf("/"),r=n>=0?e.substring(0,n+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((a,h)=>{this.downloader.downloadText(e,c=>{try{const o=this.createTextureAtlas(c,r,e,i);let l=o.pages.length,d=!1;if(l===0){this.success(t,e,o),a(o);return}for(const m of o.pages)this.loadTexture(this.texturePath(r,m.name,i),(f,u)=>{d||(m.setTexture(u),--l===0&&(this.success(t,e,o),a(o)))},(f,u)=>{if(!d){const p=`Couldn't load texture ${e} page image: ${f}`;this.error(s,e,p),h(p)}d=!0})}catch(o){const l=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,l),h(l)}},(c,o)=>{const l=`Couldn't load texture atlas ${e}: status ${c}, ${o}`;this.error(s,e,l),h(l)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{}){const i=e.lastIndexOf("/"),n=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,a)=>{this.downloader.downloadText(e,h=>{try{const c=this.createTextureAtlas(h,n,e);this.success(t,e,c),r(c)}catch(c){const o=`Couldn't parse texture atlas ${e}: ${c.message}`;this.error(s,e,o),a(o)}},(h,c)=>{const o=`Couldn't load texture atlas ${e}: status ${h}, ${c}`;this.error(s,e,o),a(o)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,n)=>t(n),(i,n)=>s(n))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;const t=this.cache.assets[e];if(t)return t;const s=this.errors[e];throw Error(`Asset not found: ${e}${s?`
|
|
2
|
+
${s}`:""}`)}remove(e){e=this.pathPrefix+e;const t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(const e in this.cache.assets){const t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof ls){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t,s,i){const n=new ls(e);n.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of n.pages)r.texture?.dispose()}};for(const r of n.pages){const a=this.texturePath(t,r.name,i);this.texturePmaInfo[this.pathPrefix+a]=r.pma}return n}createTexture(e,t,s){const i=this.textureLoader(s,t),n=i.dispose.bind(i);return i.dispose=()=>{this.disposeAssetInternal(e)&&n()},i}texturePath(e,t,s){return s?s[t]:e+t}},ji=class rs{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=rs.AVAILABLE_CACHES.get(t);if(s)return s;const i=new rs;return rs.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){return this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=s,s}getAsset(t){return this.assetsLoaded[t]}},Ks=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!==-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){var t=window.atob(e),s=t.length,i=new Uint8Array(s);for(let n=0;n<s;n++)i[n]=t.charCodeAt(n);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t===-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",i||e,!0);const r=()=>{this.finish(e,n.status,n.responseText)};n.onload=r,n.onerror=r,n.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const n=new XMLHttpRequest;n.open("GET",i||e,!0),n.responseType="arraybuffer";const r=()=>{this.finish(e,n.status,n.response)};n.onload=()=>{n.status===200||n.status===0?this.finish(e,200,new Uint8Array(n.response)):r()},n.onerror=r,n.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){const i=this.callbacks[e];if(delete this.callbacks[e],t===200||t===0)for(let n=0,r=i.length;n<r;n+=2)i[n](s);else for(let n=1,r=i.length;n<r;n+=2)i[n](t,s)}},Js=class Mn extends Dt{color=new it(1,1,1,1);constructor(t){super(t)}copy(){const t=new Mn(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Zt=class En extends Dt{endSlot=null;convex=!1;inverse=!1;color=new it(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){const t=new En(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}},ve=class Yn extends Dt{lengths=[];closed=!1;constantSpeed=!1;color=new it(1,1,1,1);constructor(t){super(t)}copy(){const t=new Yn(this.name);return this.copyTo(t),t.lengths=[],O.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Zi=class Rn extends Dt{x=0;y=0;rotation=0;color=new it(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*B.degRad,i=Math.cos(s),n=Math.sin(s),r=i*t.a+n*t.b,a=i*t.c+n*t.d;return B.atan2Deg(a,r)}copy(){const t=new Rn(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},_n=class{atlas;allowMissingRegions;constructor(e,t=!1){this.atlas=e,this.allowMissingRegions=t}findRegions(e,t,s){const i=s.regions;for(let n=0,r=i.length;n<r;n++)i[n]=this.findRegion(e,s.getPath(t,n))}findRegion(e,t){const s=this.atlas.findRegion(t);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${t} (attachment: ${e})`);return s}newRegionAttachment(e,t,s,i,n){return this.findRegions(s,i,n),new zt(s,n)}newMeshAttachment(e,t,s,i,n){return this.findRegions(s,i,n),new Ut(s,n)}newBoundingBoxAttachment(e,t,s){return new Js(s)}newPathAttachment(e,t,s){return new ve(s)}newPointAttachment(e,t,s){return new Zi(s)}newClippingAttachment(e,t,s){return new Zt(s)}},Pe=class{name;setupPose;skinRequired=!1;constructor(e,t){if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}},Qs=class Fn extends Pe{index=0;parent=null;length=0;color=new it;icon;iconSize=1;iconRotation=0;visible=!1;constructor(t,s,i){if(super(s,new ke),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=t,this.parent=i}copy(t){const s=new Fn(this.index,this.name,t);return s.length=this.length,s.setupPose.set(this.setupPose),s}},Xe=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Xe||{}),ke=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(e){if(e==null)throw new Error("pose cannot be null.");this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,s=this.scaleX,i=this.scaleY,n=this.shearX,r=this.shearY;if(!this.bone.parent){const d=e.scaleX,m=e.scaleY,f=(t+n)*B.degRad,u=(t+90+r)*B.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*i*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*i*m,this.worldX=this.x*d+e.x,this.worldY=this.y*m+e.y;return}const a=this.bone.parent.appliedPose;let h=a.a,c=a.b,o=a.c,l=a.d;switch(this.worldX=h*this.x+c*this.y+a.worldX,this.worldY=o*this.x+l*this.y+a.worldY,this.inherit){case 0:{const d=(t+n)*B.degRad,m=(t+90+r)*B.degRad,f=Math.cos(d)*s,u=Math.cos(m)*i,p=Math.sin(d)*s,g=Math.sin(m)*i;this.a=h*f+c*p,this.b=h*u+c*g,this.c=o*f+l*p,this.d=o*u+l*g;return}case 1:{const d=e.scaleX,m=e.scaleY,f=(t+n)*B.degRad,u=(t+90+r)*B.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*i*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*i*m;break}case 2:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m;h*=f,o*=u;let p=h*h+o*o,g=0;p>B.epsilon2?(p=Math.abs(h*l*u-c*f*o)/p,c=o*p,l=h*p,g=t-B.atan2Deg(o,h)):(h=0,o=0,g=t-90+B.atan2Deg(l,c));const x=(g+n)*B.degRad,b=(g+r+90)*B.degRad,w=Math.cos(x)*s,v=Math.cos(b)*i,y=Math.sin(x)*s,T=Math.sin(b)*i;this.a=(h*w-c*y)*d,this.b=(h*v-c*T)*d,this.c=(o*w+l*y)*m,this.d=(o*v+l*T)*m;break}case 3:case 4:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m,p=t*B.degRad,g=Math.cos(p),x=Math.sin(p);let b=(h*g+c*x)*f,w=(o*g+l*x)*u;const v=1/Math.sqrt(b*b+w*w);b*=v,w*=v;let y=-w,T=b;this.inherit===3&&h*l-c*o<0!=(d<0!=m<0)&&(y=-y,T=-T);const A=n*B.degRad,S=(90+r)*B.degRad,C=Math.cos(A)*s,I=Math.cos(S)*i,Y=Math.sin(A)*s,F=Math.sin(S)*i;this.a=(b*C+y*Y)*d,this.b=(b*I+y*F)*d,this.c=(w*C+T*Y)*m,this.d=(w*I+T*F)*m;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,s=e.scaleY;if(!this.bone.parent){const g=1/t,x=1/s;this.x=(this.worldX-e.x)*g,this.y=(this.worldY-e.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const i=this.bone.parent.appliedPose;let n=i.a,r=i.b,a=i.c,h=i.d;const c=n*h-r*a,o=1/(n*h-r*a),l=h*o,d=r*o,m=a*o,f=n*o,u=this.worldX-i.worldX,p=this.worldY-i.worldY;switch(this.x=u*l-p*d,this.y=p*f-u*m,this.inherit){case 0:this.set5(l*this.a-d*this.c,l*this.b-d*this.d,f*this.c-m*this.a,f*this.d-m*this.b,0);break;case 1:{const g=1/t,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/t,x=1/s;n*=g,a*=x;const b=this.a*g,w=this.b*g,v=this.c*x,y=this.d*x,T=1/(n*n+a*a),A=1/Math.abs(c*g*x);this.set5((n*b+a*v)*T,(n*w+a*y)*T,(n*v-a*b)*A,(n*y-a*w)*A,B.atan2Deg(a,n));break}case 3:case 4:{const g=1/t,x=1/s,b=this.a*g,w=this.b*g,v=this.c*x,y=this.d*x;let T=h*this.a-r*this.c,A=n*this.c-a*this.a;c<0&&(T=-T,A=-A);let S=B.atan2Deg(A,T);this.rotation=S,S*=B.degRad;const C=Math.cos(S),I=Math.sin(S);let Y=(n*C+r*I)*g,F=(a*C+h*I)*x;const k=1/Math.sqrt(Y*Y+F*F);Y*=k,F*=k;const X=this.inherit===3&&c<0!=(t<0!=s<0)?-1:1;this.set4(Y*b+F*v,Y*w+F*y,(Y*v-F*b)*X,(Y*y-F*w)*X)}}}set4(e,t,s,i){const n=e*e+s*s,r=t*t+i*i;n>B.epsilon2?(this.shearX=B.atan2Deg(s,e),this.scaleX=Math.sqrt(n)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>B.epsilon2?(this.shearY=B.atan2Deg(i,t),e*i-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,s,i,n){this.shearX=0;const r=e*e+s*s,a=t*t+i*i;if(r>B.epsilon2){const h=B.atan2Deg(s,e);this.rotation=h+n,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(a),a>B.epsilon2?(this.shearY=B.atan2Deg(i,t),e*i-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-h):this.shearY-=90+h,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(a),this.shearY=0,this.rotation=a>B.epsilon2?B.atan2Deg(i,t)-90+n:n}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e._update)}modifyWorld(e){this.local=e,this.world=e,this.resetWorld(e)}resetWorld(e){const t=this.bone.children;for(let s=0,i=t.length;s<i;s++){const n=t[s].appliedPose;n.world===e&&(n.world=0,n.local=0,n.resetWorld(e))}}getWorldRotationX(){return B.atan2Deg(this.c,this.a)}getWorldRotationY(){return B.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,s=e.x-this.worldX,i=e.y-this.worldY;return e.x=(s*this.d-i*this.b)/t,e.y=(i*this.a-s*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e);return B.atan2Deg(this.a*t-this.c*s,this.d*s-this.b*t)+this.rotation-this.shearX}localToWorldRotation(e){e=(e-this.rotation-this.shearX)*B.degRad;const t=Math.sin(e),s=Math.cos(e);return B.atan2Deg(s*this.c+t*this.d,s*this.a+t*this.b)}rotateWorld(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,n=this.b;this.a=s*i-t*this.c,this.b=s*n-t*this.d,this.c=t*i+s*this.c,this.d=t*n+s*this.d}},ti=class{data;pose;constrainedPose;appliedPose;constructor(e,t,s){if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=s,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},ei=class extends ti{active=!1;constructor(e,t,s){super(e,t,s),this.setupPose()}isActive(){return this.active}},Ve=class Ln extends ei{parent=null;children=[];sorted=!1;constructor(t,s){super(t,new ke,new ke),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const s=new Ln(this.data,t);return s.pose.set(this.pose),s}},re=class extends ei{constructor(e,t,s){super(e,t,s)}isSourceActive(){return!0}},$i=class{_setupPose;pose;constrainedPose;appliedPose;constructor(e){this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,O.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,O.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},oe=class extends Pe{constructor(e,t){super(e,t)}},Be=(e=>(e[e.None=0]="None",e[e.Uniform=1]="Uniform",e[e.Volume=2]="Volume",e))(Be||{}),Oe=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},si=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}setupPose=new Oe(-1,this);constructor(e){this.name=e}},Ue=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}},Ki=class te extends re{bones;target;constructor(t,s){if(super(t,new Ue,new Ue),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of t.bones)this.bones.push(s.bones[i.index].constrainedPose);this.target=s.bones[t.target.index]}copy(t){var s=new te(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mix===0)return;const n=this.target.appliedPose,r=this.bones;switch(r.length){case 1:te.apply(t,r[0],n.worldX,n.worldY,i.compress,i.stretch,this.data.scaleYMode,i.mix);break;case 2:te.apply(t,r[0],r[1],n.worldX,n.worldY,i.bendDirection,i.stretch,this.data.scaleYMode,i.softness,i.mix);break}}sort(t){t.sortBone(this.target);const s=this.bones[0].bone;t.sortBone(s),t._updateCache.push(this),s.sorted=!1,t.sortReset(s.children),t.constrained(s),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,s,i,n,r,a,h,c,o,l){typeof i=="number"?te.apply1(t,s,i,n,r,a,h,c):te.apply2(t,s,i,n,r,a,h,c,o,l)}static apply1(t,s,i,n,r,a,h,c){s.modifyLocal(t);const o=s.bone.parent.appliedPose;let l=o.a,d=o.b,m=o.c,f=o.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(i-s.worldX)*B.signum(t.scaleX),g=(n-s.worldY)*B.signum(t.scaleY);break;case 2:{const x=Math.abs(l*f-d*m)/Math.max(B.epsilon,l*l+m*m),b=l/t.scaleX,w=m/t.scaleY;d=-w*x*t.scaleX,f=b*x*t.scaleY,u+=B.atan2Deg(w,b)}default:{const x=i-o.worldX,b=n-o.worldY,w=l*f-d*m;Math.abs(w)<=B.epsilon?(p=0,g=0):(p=(x*f-b*d)/w-s.x,g=(b*l-x*m)/w-s.y)}}if(u+=B.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<=-180&&(u+=360),s.rotation+=u*c,r||a){switch(s.inherit){case 3:case 4:p=i-s.worldX,g=n-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>B.epsilon){const b=p*p+g*g;if(r&&b<x*x||a&&b>x*x){const w=(Math.sqrt(b)/x-1)*c+1;switch(s.scaleX*=w,h){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(t,s,i,n,r,a,h,c,o,l){if(s.inherit!==0||i.inherit!==0)return;s.modifyLocal(t),i.modifyLocal(t);let d=s.x,m=s.y,f=s.scaleX,u=s.scaleY,p=i.scaleX,g=0,x=0,b=0;f<0?(f=-f,g=180,b=-1):(g=0,b=1),u<0&&(u=-u,b=-b),p<0?(p=-p,x=180):x=0;let w=0,v=0,y=s.a,T=s.b,A=s.c,S=s.d;const C=Math.abs(f-u)<=B.epsilon;!C||h?(i.y=0,w=y*i.x+s.worldX,v=A*i.x+s.worldY):(w=y*i.x+T*i.y+s.worldX,v=A*i.x+S*i.y+s.worldY);const I=s.bone.parent.appliedPose;y=I.a,T=I.b,A=I.c,S=I.d;let Y=y*S-T*A,F=w-I.worldX,k=v-I.worldY;Y=Math.abs(Y)<=B.epsilon?0:1/Y;const X=(F*S-k*T)*Y-d,R=(k*y-F*A)*Y-m;let V=Math.sqrt(X*X+R*R),q=i.bone.data.length*p,U,P;if(V<B.epsilon){te.apply(t,s,n,r,!1,h,0,l),i.rotation=0;return}F=n-I.worldX,k=r-I.worldY;let L=(F*S-k*T)*Y-d,z=(k*y-F*A)*Y-m,D=L*L+z*z;if(o!==0){o*=f*(p+1)*.5;const N=Math.sqrt(D),ct=N-V-q*f+o;if(ct>0){let W=Math.min(1,ct/(o*2))-1;W=(ct-o*(1-W*W))/N,L-=W*L,z-=W*z,D=L*L+z*z}}t:if(C){q*=f;let N=(D-V*V-q*q)/(2*V*q);if(N<-1)N=-1,P=Math.PI*a;else if(N>1){if(N=1,P=0,h)switch(y=(Math.sqrt(D)/(V+q)-1)*l+1,s.scaleX*=y,c){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else P=Math.acos(N)*a;y=V+q*N,T=q*Math.sin(P),U=Math.atan2(z*y-L*T,L*y+z*T)}else{y=f*q,T=u*q;const N=y*y,ct=T*T,W=Math.atan2(z,L);A=ct*V*V+N*D-N*ct;const ut=-2*ct*V,bt=ct-N;if(S=ut*ut-4*bt*A,S>=0){let kt=Math.sqrt(S);ut<0&&(kt=-kt),kt=-(ut+kt)*.5;let Ot=kt/bt,fe=A/kt;const Me=Math.abs(Ot)<Math.abs(fe)?Ot:fe;if(Ot=D-Me*Me,Ot>=0){k=Math.sqrt(Ot)*a,U=W-Math.atan2(k,Me),P=Math.atan2(k/u,(Me-V)/f);break t}}let mt=B.PI,wt=V-y,vt=wt*wt,yt=0,Rt=0,At=V+y,St=At*At,Ft=0;A=-y*V/(N-ct),A>=-1&&A<=1&&(A=Math.acos(A),F=y*Math.cos(A)+V,k=T*Math.sin(A),S=F*F+k*k,S<vt&&(mt=A,vt=S,wt=F,yt=k),S>St&&(Rt=A,St=S,At=F,Ft=k)),D<=(vt+St)*.5?(U=W-Math.atan2(yt*a,wt),P=mt*a):(U=W-Math.atan2(Ft*a,At),P=Rt*a)}const lt=Math.atan2(i.y,i.x)*b;U=(U-lt)*B.radDeg+g-s.rotation,U>180?U-=360:U<=-180&&(U+=360),s.rotation+=U*l,P=((P+lt)*B.radDeg-i.shearX)*b+x-i.rotation,P>180?P-=360:P<=-180&&(P+=360),i.rotation+=P*l}},Te=class extends oe{bones=[];_target=null;set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(e){super(e,new Ue)}create(e){return new Ki(this,e)}},Ne=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}},Ae=class extends oe{bones=[];set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(e){super(e,new Ne)}create(e){return new Ji(this,e)}},ii=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(ii||{}),ni=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ni||{}),ri=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(ri||{}),Ji=class ee extends re{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,s){if(super(t,new Ne,new Ne),!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const i of this.data.bones)this.bones.push(s.bones[i.index].constrainedPose);this.slot=s.slots[t.slot.index]}copy(t){var s=new ee(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.slot.appliedPose.attachment;if(!(i instanceof ve))return;const n=this.appliedPose,r=n.mixRotate,a=n.mixX,h=n.mixY;if(r===0&&a===0&&h===0)return;const c=this.data,o=c.rotateMode===0,l=c.rotateMode===2,d=this.bones,m=d.length,f=o?m:m+1,u=O.setArraySize(this.spaces,f),p=l?this.lengths=O.setArraySize(this.lengths,m):[],g=n.spacing;switch(c.spacingMode){case 2:if(l)for(let T=0,A=f-1;T<A;T++){const S=d[T],C=S.bone.data.length,I=C*S.a,Y=C*S.c;p[T]=Math.sqrt(I*I+Y*Y)}O.arrayFill(u,1,f,g);break;case 3:{let T=0;for(let A=0,S=f-1;A<S;){const C=d[A],I=C.bone.data.length;if(I<B.epsilon)l&&(p[A]=0),u[++A]=g;else{const Y=I*C.a,F=I*C.c,k=Math.sqrt(Y*Y+F*F);l&&(p[A]=k),u[++A]=k,T+=k}}if(T>0){T=f/T*g;for(let A=1;A<f;A++)u[A]*=T}break}default:{const T=c.spacingMode===0;for(let A=0,S=f-1;A<S;){const C=d[A],I=C.bone.data.length;if(I<B.epsilon)l&&(p[A]=0),u[++A]=g;else{const Y=I*C.a,F=I*C.c,k=Math.sqrt(Y*Y+F*F);l&&(p[A]=k),u[++A]=(T?Math.max(0,I+g):g)*k/I}}}}const x=this.computeWorldPositions(t,i,f,o);let b=x[0],w=x[1],v=c.offsetRotation,y=!1;if(v===0)y=c.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?B.degRad:-B.degRad}for(let T=0,A=3,S=t._update;T<m;T++,A+=3){const C=d[T];C.worldX+=(b-C.worldX)*a,C.worldY+=(w-C.worldY)*h;const I=x[A],Y=x[A+1],F=I-b,k=Y-w;if(l){const X=p[T];if(X!==0){const R=(Math.sqrt(F*F+k*k)/X-1)*r+1;C.a*=R,C.c*=R}}if(b=I,w=Y,r>0){let X=C.a,R=C.b,V=C.c,q=C.d,U=0,P=0,L=0;if(o?U=x[A-1]:u[T+1]===0?U=x[A+2]:U=Math.atan2(k,F),U-=Math.atan2(V,X),y){P=Math.cos(U),L=Math.sin(U);const z=C.bone.data.length;b+=(z*(P*X-L*V)-F)*r,w+=(z*(L*X+P*V)-k)*r}else U+=v;U>B.PI?U-=B.PI2:U<-B.PI&&(U+=B.PI2),U*=r,P=Math.cos(U),L=Math.sin(U),C.a=P*X-L*V,C.b=P*R-L*q,C.c=L*X+P*V,C.d=L*R+P*q}C.modifyWorld(S)}}computeWorldPositions(t,s,i,n){const r=this.slot;let a=this.appliedPose.position,h=this.spaces,c=O.setArraySize(this.positions,i*3+2),o=this.world;const l=s.closed;let d=s.worldVerticesLength,m=d/6,f=ee.NONE;if(!s.constantSpeed){const P=s.lengths;m-=l?1:2;const L=P[m];this.data.positionMode===1&&(a*=L);let z;switch(this.data.spacingMode){case 2:z=L;break;case 3:z=L/i;break;default:z=1}o=O.setArraySize(this.world,8);for(let D=0,lt=0,N=0;D<i;D++,lt+=3){const ct=h[D]*z;a+=ct;let W=a;if(l)W%=L,W<0&&(W+=L),N=0;else if(W<0){f!==ee.BEFORE&&(f=ee.BEFORE,s.computeWorldVertices(t,r,2,4,o,0,2)),this.addBeforePosition(W,o,0,c,lt);continue}else if(W>L){f!==ee.AFTER&&(f=ee.AFTER,s.computeWorldVertices(t,r,d-6,4,o,0,2)),this.addAfterPosition(W-L,o,0,c,lt);continue}for(;;N++){const ut=P[N];if(!(W>ut)){if(N===0)W/=ut;else{const bt=P[N-1];W=(W-bt)/(ut-bt)}break}}N!==f&&(f=N,l&&N===m?(s.computeWorldVertices(t,r,d-4,4,o,0,2),s.computeWorldVertices(t,r,0,4,o,4,2)):s.computeWorldVertices(t,r,N*6+2,8,o,0,2)),this.addCurvePosition(W,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],c,lt,n||D>0&&ct===0)}return c}l?(d+=2,o=O.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d-4,o,0,2),s.computeWorldVertices(t,r,0,2,o,d-4,2),o[d-2]=o[0],o[d-1]=o[1]):(m--,d-=4,o=O.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d,o,0,2));const u=O.setArraySize(this.curves,m);let p=0,g=o[0],x=o[1],b=0,w=0,v=0,y=0,T=0,A=0,S=0,C=0,I=0,Y=0,F=0,k=0,X=0,R=0;for(let P=0,L=2;P<m;P++,L+=6)b=o[L],w=o[L+1],v=o[L+2],y=o[L+3],T=o[L+4],A=o[L+5],S=(g-b*2+v)*.1875,C=(x-w*2+y)*.1875,I=((b-v)*3-g+T)*.09375,Y=((w-y)*3-x+A)*.09375,F=S*2+I,k=C*2+Y,X=(b-g)*.75+S+I*.16666667,R=(w-x)*.75+C+Y*.16666667,p+=Math.sqrt(X*X+R*R),X+=F,R+=k,F+=I,k+=Y,p+=Math.sqrt(X*X+R*R),X+=F,R+=k,p+=Math.sqrt(X*X+R*R),X+=F+I,R+=k+Y,p+=Math.sqrt(X*X+R*R),u[P]=p,g=T,x=A;this.data.positionMode===1&&(a*=p);let V;switch(this.data.spacingMode){case 2:V=p;break;case 3:V=p/i;break;default:V=1}const q=this.segments;let U=0;for(let P=0,L=0,z=0,D=0;P<i;P++,L+=3){const lt=h[P]*V;a+=lt;let N=a;if(l)N%=p,N<0&&(N+=p),z=0,D=0;else if(N<0){this.addBeforePosition(N,o,0,c,L);continue}else if(N>p){this.addAfterPosition(N-p,o,d-4,c,L);continue}for(;;z++){const ct=u[z];if(!(N>ct)){if(z===0)N/=ct;else{const W=u[z-1];N=(N-W)/(ct-W)}break}}if(z!==f){f=z;let ct=z*6;for(g=o[ct],x=o[ct+1],b=o[ct+2],w=o[ct+3],v=o[ct+4],y=o[ct+5],T=o[ct+6],A=o[ct+7],S=(g-b*2+v)*.03,C=(x-w*2+y)*.03,I=((b-v)*3-g+T)*.006,Y=((w-y)*3-x+A)*.006,F=S*2+I,k=C*2+Y,X=(b-g)*.3+S+I*.16666667,R=(w-x)*.3+C+Y*.16666667,U=Math.sqrt(X*X+R*R),q[0]=U,ct=1;ct<8;ct++)X+=F,R+=k,F+=I,k+=Y,U+=Math.sqrt(X*X+R*R),q[ct]=U;X+=F,R+=k,U+=Math.sqrt(X*X+R*R),q[8]=U,X+=F+I,R+=k+Y,U+=Math.sqrt(X*X+R*R),q[9]=U,D=0}for(N*=U;;D++){const ct=q[D];if(!(N>ct)){if(D===0)N/=ct;else{const W=q[D-1];N=D+(N-W)/(ct-W)}break}}this.addCurvePosition(N*.1,g,x,b,w,v,y,T,A,c,L,n||P>0&<===0)}return c}addBeforePosition(t,s,i,n,r){const a=s[i],h=s[i+1],c=s[i+2]-a,o=s[i+3]-h,l=Math.atan2(o,c);n[r]=a+t*Math.cos(l),n[r+1]=h+t*Math.sin(l),n[r+2]=l}addAfterPosition(t,s,i,n,r){const a=s[i+2],h=s[i+3],c=a-s[i],o=h-s[i+1],l=Math.atan2(o,c);n[r]=a+t*Math.cos(l),n[r+1]=h+t*Math.sin(l),n[r+2]=l}addCurvePosition(t,s,i,n,r,a,h,c,o,l,d,m){if(t===0||Number.isNaN(t)){l[d]=s,l[d+1]=i,l[d+2]=Math.atan2(r-i,n-s);return}const f=t*t,u=f*t,p=1-t,g=p*p,x=g*p,b=p*t,w=b*3,v=p*w,y=w*t,T=s*x+n*v+a*y+c*u,A=i*x+r*v+h*y+o*u;l[d]=T,l[d+1]=A,m&&(t<.001?l[d+2]=Math.atan2(r-i,n-s):l[d+2]=Math.atan2(A-(i*g+r*b*2+h*f),T-(s*g+n*b*2+a*f)))}sort(t){const s=this.slot.data.index,i=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,s,i),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,s,i),this.sortPath(t,this.slot.pose.attachment,i);const n=this.bones,r=this.bones.length;for(let a=0;a<r;a++){const h=n[a].bone;t.sortBone(h),t.constrained(h)}t._updateCache.push(this);for(let a=0;a<r;a++)t.sortReset(n[a].bone.children);for(let a=0;a<r;a++)n[a].bone.sorted=!0}sortPathSlot(t,s,i,n){const r=s.getAttachments();for(let a=0,h=r.length;a<h;a++){const c=r[a];c.slotIndex===i&&this.sortPath(t,c.attachment,n)}}sortPath(t,s,i){if(!(s instanceof ve))return;const n=s.bones;if(n==null)t.sortBone(i);else{const r=t.bones;for(let a=0,h=n.length;a<h;){let c=n[a++];for(c+=a;a<c;)t.sortBone(r[n[a++]])}}}isSourceActive(){return this.slot.bone.active}},Qi=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Qi||{}),De=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(e){this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}},ze=class{color=new it(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof Dt)||!(this.attachment instanceof Dt)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}},tn=class Pn extends ti{skeleton;bone;attachmentState=0;constructor(t,s){if(super(t,new ze,new ze),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new it,this.constrainedPose.darkColor=new it),this.setupPose()}copy(t,s,i){const n=new Pn(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(n.pose.darkColor=new it,n.constrainedPose.darkColor=new it),n.pose.set(t.pose),n}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},en=class os{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return os.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*os.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n;if(!i.parent)n=new Ve(i,null);else{const r=this.bones[i.parent.index];n=new Ve(i,r),r.children.push(n)}this.bones.push(n)}this.slots=[];for(const s of this.data.slots)this.slots.push(new tn(s,this));this.drawOrder=new $i(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const i=s.create(this);i instanceof oi&&this.physics.push(i),this.constraints.push(i)}this.color=new it(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const t=this.slots;for(let a=0,h=t.length;a<h;a++)t[a].unconstrained();const s=this.bones,i=s.length;for(let a=0,h=i;a<h;a++){const c=s[a];c.sorted=c.data.skinRequired,c.active=!c.sorted,c.unconstrained()}if(this.skin){const a=this.skin.bones;for(let h=0,c=this.skin.bones.length;h<c;h++){let o=this.bones[a[h].index];do o.sorted=!1,o.active=!0,o=o.parent;while(o)}}const n=this.constraints;let r=this.constraints.length;for(let a=0;a<r;a++)n[a].unconstrained();for(let a=0;a<r;a++){const h=n[a];h.active=h.isSourceActive()&&(!h.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(h.data)),h.active&&h.sort(this)}for(let a=0;a<i;a++)this.sortBone(s[a]);r=this._updateCache.length;for(let a=0;a<r;a++){const h=this._updateCache[a];h instanceof Ve&&(this._updateCache[a]=h.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;const s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){const n=t[s];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let n=0,r=this.resetCache.length;n<r;n++)s[n].resetConstrained();const i=this._updateCache;for(let n=0,r=this._updateCache.length;n<r;n++)i[n].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const t=this.bones;for(let i=0,n=t.length;i<n;i++)t[i].setupPose();const s=this.constraints;for(let i=0,n=s.length;i<n;i++)s[i].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const t=this.slots;for(let s=0,i=t.length;s<i;s++)t[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");const s=this.bones;for(let i=0,n=s.length;i<n;i++)if(s[i].data.name===t)return s[i];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const s=this.slots;for(let i=0,n=s.length;i<n;i++)if(s[i].data.name===t)return s[i];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){const s=this.data.findSkin(t);if(!s)throw new Error(`Skin not found: ${t}`);this.setSkin(s)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{const s=this.slots;for(let i=0,n=s.length;i<n;i++){const r=s[i],a=r.data.attachmentName;if(a){const h=t.getAttachment(i,a);h&&r.pose.setAttachment(h)}}}this.skin=t,this.updateCache()}}getAttachment(t,s){return typeof t=="string"?this.getAttachmentByName(t,s):this.getAttachmentByIndex(t,s)}getAttachmentByName(t,s){const i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachmentByIndex(t,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");const i=this.findSlot(t);if(!i)throw new Error(`Slot not found: ${t}`);let n=null;if(s&&(n=this.getAttachment(i.data.index,s),!n))throw new Error(`Attachment not found: ${s}, for slot: ${t}`);i.pose.setAttachment(n)}findConstraint(t,s){if(t==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=i.length;n<r;n++){const a=i[n];if(a instanceof s&&a.data.name===t)return a}return null}getBoundsRect(t){const s=new Ee,i=new Ee;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),n=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,a=r;let h=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let d=0,m=r.length;d<m;d++){const f=a[d];if(!f.bone.active)continue;let u=0,p=null,g=null;const x=f.appliedPose.attachment;if(x){if(x instanceof zt)u=8,p=O.setArraySize(i,u,0),x.computeWorldVertices(f,x.getOffsets(f.appliedPose),p,0,2),g=os.quadTriangles;else if(x instanceof Ut)u=x.worldVerticesLength,p=O.setArraySize(i,u,0),x.computeWorldVertices(this,f,0,u,p,0,2),g=x.triangles;else if(x instanceof Zt&&n){n.clipEnd(f),n.clipStart(this,f,x);continue}if(p&&g){n?.isClipping()&&n.clipTriangles(p,g,g.length)&&(p=n.clippedVertices,u=n.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const v=p[b],y=p[b+1];h=Math.min(h,v),c=Math.min(c,y),o=Math.max(o,v),l=Math.max(l,y)}}}n&&n.clipEnd(f)}n&&n.clipEnd(),t.set(h,c),s.set(o-h,l-c)}setScale(t,s){this.scaleX=t,this.scaleY=s}setPosition(t,s){this.x=t,this.y=s}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physics;for(let n=0,r=i.length;n<r;n++)i[n].translate(t,s)}physicsRotate(t,s,i){const n=this.physics;for(let r=0,a=n.length;r<a;r++)n[r].rotate(t,s,i)}},oi=class Xn extends re{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(t,s){if(super(t,new De,new De),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[t.bone.index].constrainedPose}copy(t){var s=new Xn(this.data,t);return s.pose.set(this.pose),s}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,s){this.ux-=t,this.uy-=s,this.cx-=t,this.cy-=s}rotate(t,s,i){const n=i*B.degRad,r=Math.cos(n),a=Math.sin(n),h=this.cx-t,c=this.cy-s;this.translate(h*r-c*a-h,h*a+c*r-c)}update(t,s){const i=this.appliedPose,n=i.mix;if(n===0)return;const r=this.data.x>0,a=this.data.y>0,h=this.data.rotate>0||this.data.shearX>0,c=this.data.scaleX>0,o=this.bone;let l=o.bone.data.length,d=this.data.step,m=0;switch(s){case 0:return;case 1:this.reset(t);case 2:{const f=Math.max(t.time-this.lastTime,0),u=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=o.worldX,g=o.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,b=i.inertia,w=t.data.referenceScale,v=-1,y=0,T=0,A=this.data.limit*f,S=A*Math.abs(t.scaleY);if(A*=Math.abs(t.scaleX),r||a){if(r){const C=(this.ux-p)*b;this.xOffset+=C>A?A:C<-A?-A:C,this.ux=p}if(a){const C=(this.uy-g)*b;this.yOffset+=C>S?S:C<-S?-S:C,this.uy=g}if(x>=d){const C=this.xOffset,I=this.yOffset;v=i.damping**(60*d),y=d*i.massInverse,T=i.strength;const Y=w*i.wind,F=w*i.gravity,k=(Y*t.windX+F*t.gravityX)*t.scaleX,X=(Y*t.windY+F*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(k-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),a&&(this.yVelocity-=(X+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),x-=d;while(x>=d);this.xLag=this.xOffset-C,this.yLag=this.yOffset-I}m=Math.max(0,1-x/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*n*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*n*this.data.y)}if(h||c){let C=Math.atan2(o.c,o.a),I=0,Y=0,F=0,k=this.cx-o.worldX,X=this.cy-o.worldY;if(k>A?k=A:k<-A&&(k=-A),X>S?X=S:X<-S&&(X=-S),x=this.remaining,h){F=(this.data.rotate+this.data.shearX)*n,m=this.rotateLag*Math.max(0,1-u/d);let R=Math.atan2(X+this.ty,k+this.tx)-C-(this.rotateOffset-m)*F;this.rotateOffset+=(R-Math.ceil(R*B.invPI2-.5)*B.PI2)*b,R=(this.rotateOffset-m)*F+C,I=Math.cos(R),Y=Math.sin(R),c&&(R=l*o.getWorldScaleX(),R>0&&(this.scaleOffset+=(k*I+X*Y)*b/R))}else{I=Math.cos(C),Y=Math.sin(C);const R=l*o.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);R>0&&(this.scaleOffset+=(k*I+X*Y)*b/R)}if(x>=d){v===-1&&(v=i.damping**(60*d),y=d*i.massInverse,T=i.strength);const R=i.wind*t.windX+i.gravity*t.gravityX,V=(i.wind*t.windY+i.gravity*t.gravityY)*en.yDir,q=this.rotateOffset,U=this.scaleOffset,P=l/w;for(;;)if(x-=d,c&&(this.scaleVelocity+=(R*I-V*Y-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),h){if(this.rotateVelocity-=((R*Y+V*I)*P+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,x<d)break;const L=this.rotateOffset*F+C;I=Math.cos(L),Y=Math.sin(L)}else if(x<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-U}m=Math.max(0,1-x/d)}this.remaining=x}this.cx=o.worldX,this.cy=o.worldY;break}case 3:m=Math.max(0,1-this.remaining/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*n*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*n*this.data.y)}if(h){let f=(this.rotateOffset-this.rotateLag*m)*n,u=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=f*this.data.rotate,u=Math.sin(x),p=Math.cos(x),g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d),x+=f*this.data.shearX,u=Math.sin(x),p=Math.cos(x),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c}else f*=this.data.rotate,u=Math.sin(f),p=Math.cos(f),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c,g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d}if(c){let f=1+(this.scaleOffset-this.scaleLag*m)*n*this.data.scaleX;switch(o.a*=f,o.c*=f,this.data.scaleYMode){case 1:o.b*=f,o.d*=f;break;case 2:f=Math.abs(f),f=f>=.7?1/f:4-3.67347*f,o.b*=f,o.d*=f}}s!==3&&(this.tx=l*o.a,this.ty=l*o.c),o.modifyWorld(t._update)}sort(t){const s=this.bone.bone;t.sortBone(s),t._updateCache.push(this),t.sortReset(s.children),t.constrained(s)}isSourceActive(){return this.bone.bone.active}},Se=class extends oe{set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(e){if(e==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=e}constructor(e){super(e,new De)}create(e){return new oi(this,e)}};typeof Math.fround>"u"&&(Math.fround=(e=>t=>(e[0]=t,e[0]))(new Float32Array(1)));var qe=class{time=0;mix=0;set(e){this.time=e.time,this.mix=e.mix}},sn=class Ri extends re{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,s){if(super(t,new qe,new qe),!s)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=s.bones[t.bone.index])}copy(t){var s=new Ri(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mix===0)return;const n=this.data,r=n.animation,a=this.bone;if(a!==null){if(!a.active)return;n.local&&a.appliedPose.validateLocalTransform(t),i.time=n.offset+(n.property.value(t,a.appliedPose,n.local,Ri.offsets)-n.property.offset)*n.scale,n.loop?i.time=r.duration+i.time%r.duration:i.time=Math.max(0,i.time)}const h=t.bones,c=r.bones;for(let o=0,l=r.bones.length;o<l;o++)h[c[o]].appliedPose.modifyLocal(t);r.apply(t,i.time,i.time,n.loop,null,i.mix,0,n.additive,!1,!0)}sort(t){const s=this.bone,i=this.data;s&&!i.local&&t.sortBone(s),t._updateCache.push(this);const n=t.bones,r=i.animation.bones;for(let d=0,m=i.animation.bones.length;d<m;d++){const f=n[r[d]];f.sorted=!1,t.sortReset(f.children),t.constrained(f)}const a=i.animation.timelines,h=t.slots,c=t.constraints,o=t.physics,l=t.physics.length;for(let d=0,m=i.animation.timelines.length;d<m;d++){const f=a[d];if(Ni(f))t.constrained(h[f.slotIndex]);else if(f instanceof jt||f instanceof we)t.drawOrder.constrained();else if(f instanceof Nt)if(f.constraintIndex===-1)for(let u=0;u<l;u++)t.constrained(o[u]);else t.constrained(c[f.constraintIndex]);else if(zi(f)){const u=f.constraintIndex;u!==-1&&t.constrained(c[u])}}}},Gt=class extends oe{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(e){super(e,new qe)}create(e){return new sn(this,e)}},ai=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSliderAnimations(e){const t=this.constraints;for(let s=0,i=this.constraints.length;s<i;s++){const n=t[s];n instanceof Gt&&n.animation!=null&&e.push(n.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const s=this.constraints;for(let i=0,n=this.constraints.length;i<n;i++){const r=s[i];if(r instanceof t&&r.name===e)return r}return null}},ci=class{slotIndex=0;placeholder;attachment;constructor(e=0,t,s){this.slotIndex=e,this.placeholder=t,this.attachment=s}},We=class{name;attachments=[];bones=[];constraints=[];color=new it(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let s=0;s<e.bones.length;s++){const i=e.bones[s];let n=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<e.constraints.length;s++){const i=e.constraints[s];let n=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===i){n=!0;break}n||this.constraints.push(i)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const i=t[s];this.setAttachment(i.slotIndex,i.placeholder,i.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){const i=e.bones[s];let n=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<e.constraints.length;s++){const i=e.constraints[s];let n=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===i){n=!0;break}n||this.constraints.push(i)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const i=t[s];i.attachment&&(i.attachment instanceof Ut?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)))}}getAttachment(e,t){const s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){const s=this.attachments[e];s&&delete s[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new ci(t,i,n))}}return e}getAttachmentsForSlot(e,t){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new ci(e,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){const n=e.slots[i],r=n.pose.getAttachment();if(r&&s<t.attachments.length){const a=t.attachments[s];for(const h in a){const c=a[h];if(r===c){const o=this.getAttachment(s,h);o&&n.pose.setAttachment(o);break}}}s++}}},li=class extends Pe{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(super(t,new ze),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.boneData=s}},hi=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(hi||{}),Ge=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}},nn=class kn extends re{bones;source;constructor(t,s){if(super(t,new Ge,new Ge),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(s.bones[n.index].constrainedPose);const i=s.bones[t.source.index];if(i==null)throw new Error("source cannot be null.");this.source=i}copy(t){var s=new kn(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mixRotate===0&&i.mixX===0&&i.mixY===0&&i.mixScaleX===0&&i.mixScaleY===0&&i.mixShearY===0)return;const n=this.data,r=n.localSource,a=n.localTarget,h=n.additive,c=n.clamp,o=n.offsets,l=this.source.appliedPose;r&&l.validateLocalTransform(t);const d=n.properties,m=n.properties.length,f=t._update,u=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=u[p];a?x.modifyLocal(t):x.modifyWorld(f);for(let b=0;b<m;b++){const w=d[b],v=w.value(t,l,r,o)-w.offset,y=w.to;for(let T=0,A=w.to.length;T<A;T++){const S=y[T];if(S.mix(i)!==0){let C=S.offset+v*S.scale;c&&(S.offset<S.max?C=B.clamp(C,S.offset,S.max):C=B.clamp(C,S.max,S.offset)),S.apply(t,i,x,C,a,h)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const s=this.bones,i=this.bones.length,n=!this.data.localTarget;if(n)for(let r=0;r<i;r++)t.sortBone(s[r].bone);t._updateCache.push(this);for(let r=0;r<i;r++){const a=s[r].bone;t.sortReset(a.children),t.constrained(a)}for(let r=0;r<i;r++)s[r].bone.sorted=n}isSourceActive(){return this.source.active}},ft=class Et extends oe{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(t){super(t,new Ge)}create(t){return new nn(this,t)}getOffsetRotation(){return this.offsets[Et.ROTATION]}setOffsetRotation(t){this.offsets[Et.ROTATION]=t}getOffsetX(){return this.offsets[Et.X]}setOffsetX(t){this.offsets[Et.X]=t}getOffsetY(){return this.offsets[Et.Y]}setOffsetY(t){this.offsets[Et.Y]=t}getOffsetScaleX(){return this.offsets[Et.SCALEX]}setOffsetScaleX(t){this.offsets[Et.SCALEX]=t}getOffsetScaleY(){return this.offsets[Et.SCALEY]}setOffsetScaleY(t){this.offsets[Et.SCALEY]=t}getOffsetShearY(){return this.offsets[Et.SHEARY]}setOffsetShearY(t){this.offsets[Et.SHEARY]=t}},$t=class{offset=0;to=[]},Kt=class{offset=0;max=0;scale=0},_e=class extends $t{value(e,t,s,i){if(s)return t.rotation+i[ft.ROTATION];const n=e.scaleX,r=e.scaleY;let a=Math.atan2(t.c/r,t.a/n)*B.radDeg+((t.a*t.d-t.b*t.c)*n*r>0?i[ft.ROTATION]:-i[ft.ROTATION]);return a<0&&(a+=360),a}},di=class extends Kt{mix(e){return e.mixRotate}apply(e,t,s,i,n,r){if(n)s.rotation+=(r?i:i-s.rotation)*t.mixRotate;else{const a=e.scaleX,h=e.scaleY,c=1/a,o=1/h,l=s.a*c,d=s.b*c,m=s.c*o,f=s.d*o;i*=B.degRad,r||(i-=Math.atan2(m,l)),i>B.PI?i-=B.PI2:i<-B.PI&&(i+=B.PI2),i*=t.mixRotate;const u=Math.cos(i),p=Math.sin(i);s.a=(u*l-p*m)*a,s.b=(u*d-p*f)*a,s.c=(p*l+u*m)*h,s.d=(p*d+u*f)*h}}},He=class extends $t{value(e,t,s,i){return s?t.x+i[ft.X]:(i[ft.X]*t.a+i[ft.Y]*t.b+t.worldX)/e.scaleX}},fi=class extends Kt{mix(e){return e.mixX}apply(e,t,s,i,n,r){n?s.x+=(r?i:i-s.x)*t.mixX:(r||(i-=s.worldX/e.scaleX),s.worldX+=i*t.mixX*e.scaleX)}},je=class extends $t{value(e,t,s,i){return s?t.y+i[ft.Y]:(i[ft.X]*t.c+i[ft.Y]*t.d+t.worldY)/e.scaleY}},ui=class extends Kt{mix(e){return e.mixY}apply(e,t,s,i,n,r){n?s.y+=(r?i:i-s.y)*t.mixY:(r||(i-=s.worldY/e.scaleY),s.worldY+=i*t.mixY*e.scaleY)}},Ze=class extends $t{value(e,t,s,i){if(s)return t.scaleX+i[ft.SCALEX];const n=t.a/e.scaleX,r=t.c/e.scaleY;return Math.sqrt(n*n+r*r)+i[ft.SCALEX]}},mi=class extends Kt{mix(e){return e.mixScaleX}apply(e,t,s,i,n,r){if(n)r?s.scaleX*=1+(i-1)*t.mixScaleX:s.scaleX!==0&&(s.scaleX+=(i-s.scaleX)*t.mixScaleX);else if(r){const a=1+(i-1)*t.mixScaleX;s.a*=a,s.c*=a}else{let a=s.a/e.scaleX,h=s.c/e.scaleY,c=Math.sqrt(a*a+h*h);c!==0&&(c=1+(i-c)*t.mixScaleX/c,s.a*=c,s.c*=c)}}},$e=class extends $t{value(e,t,s,i){if(s)return t.scaleY+i[ft.SCALEY];const n=t.b/e.scaleX,r=t.d/e.scaleY;return Math.sqrt(n*n+r*r)+i[ft.SCALEY]}},gi=class extends Kt{mix(e){return e.mixScaleY}apply(e,t,s,i,n,r){if(n)r?s.scaleY*=1+(i-1)*t.mixScaleY:s.scaleY!==0&&(s.scaleY+=(i-s.scaleY)*t.mixScaleY);else if(r){const a=1+(i-1)*t.mixScaleY;s.b*=a,s.d*=a}else{let a=s.b/e.scaleX,h=s.d/e.scaleY,c=Math.sqrt(a*a+h*h);c!==0&&(c=1+(i-c)*t.mixScaleY/c,s.b*=c,s.d*=c)}}},Ke=class extends $t{value(e,t,s,i){if(s)return t.shearY+i[ft.SHEARY];const n=1/e.scaleX,r=1/e.scaleY;return(Math.atan2(t.d*r,t.b*n)-Math.atan2(t.c*r,t.a*n))*B.radDeg-90+i[ft.SHEARY]}},pi=class extends Kt{mix(e){return e.mixShearY}apply(e,t,s,i,n,r){if(n)r||(i-=s.shearY),s.shearY+=i*t.mixShearY;else{const a=e.scaleX,h=e.scaleY,c=s.b/a,o=s.d/h,l=Math.atan2(o,c);i=(i+90)*B.degRad,r?i-=B.PI/2:(i-=l-Math.atan2(s.c/h,s.a/a),i>B.PI?i-=B.PI2:i<-B.PI&&(i+=B.PI2)),i=l+i*t.mixShearY;const d=Math.sqrt(c*c+o*o);s.b=Math.cos(i)*d*a,s.d=Math.sin(i)*d*h}}},Hn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new ai;s.name="";const i=new rn(e),n=i.readInt32(),r=i.readInt32();s.hash=r===0&&n===0?null:r.toString(16)+n.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;const a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let h=0;h=i.readInt(!0);for(let f=0;f<h;f++){const u=i.readString();if(!u)throw new Error("String in string table must not be null.");i.strings.push(u)}const c=s.bones;h=i.readInt(!0);for(let f=0;f<h;f++){const u=i.readString();if(!u)throw new Error("Bone name must not be null.");const p=f===0?null:c[i.readInt(!0)],g=new Qs(f,u,p),x=g.setupPose;x.rotation=i.readFloat(),x.x=i.readFloat()*t,x.y=i.readFloat()*t,x.scaleX=i.readFloat(),x.scaleY=i.readFloat(),x.shearX=i.readFloat(),x.shearY=i.readFloat(),x.inherit=i.readByte(),g.length=i.readFloat()*t,g.skinRequired=i.readBoolean(),a&&(it.rgba8888ToColor(g.color,i.readInt32()),g.icon=i.readString()??void 0,g.iconSize=i.readFloat(),g.iconRotation=i.readFloat(),g.visible=i.readBoolean()),c.push(g)}h=i.readInt(!0);for(let f=0;f<h;f++){const u=i.readString();if(!u)throw new Error("Slot name must not be null.");const p=c[i.readInt(!0)],g=new li(f,u,p);it.rgba8888ToColor(g.setupPose.color,i.readInt32());const x=i.readInt32();x!==-1&&it.rgb888ToColor(g.setupPose.darkColor=new it,x),g.attachmentName=i.readStringRef(),g.blendMode=i.readInt(!0),a&&(g.visible=i.readBoolean()),s.slots.push(g)}const o=s.constraints,l=i.readInt(!0);for(let f=0;f<l;f++){const u=i.readString();if(!u)throw new Error("Constraint data name must not be null.");let p;switch(i.readByte()){case mr:{const g=new Te(u);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(c[i.readInt(!0)]);g.target=c[i.readInt(!0)];const x=i.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=i.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?i.readFloat():1),(x&128)!==0&&(b.softness=i.readFloat()*t),o.push(g);break}case pr:{const g=new ft(u);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(c[i.readInt(!0)]);g.source=c[i.readInt(!0)];let x=i.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,v;w<p;w++){let y=1,T;switch(i.readByte()){case 0:T=new _e;break;case 1:{y=t,T=new He;break}case 2:{y=t,T=new je;break}case 3:T=new Ze;break;case 4:T=new $e;break;case 5:T=new Ke;break;default:T=null}if(T){T.offset=i.readFloat()*y,v=i.readByte();for(let A=0;A<v;A++){let S=1,C;switch(i.readByte()){case 0:C=new di;break;case 1:{S=t,C=new fi;break}case 2:{S=t,C=new ui;break}case 3:C=new mi;break;case 4:C=new gi;break;case 5:C=new pi;break;default:C=null}C&&(C.offset=i.readFloat()*S,C.max=i.readFloat()*S,C.scale=i.readFloat()*S/y,T.to[A]=C)}g.properties[w]=T}}x=i.readByte(),(x&1)!==0&&(g.offsets[ft.ROTATION]=i.readFloat()),(x&2)!==0&&(g.offsets[ft.X]=i.readFloat()*t),(x&4)!==0&&(g.offsets[ft.Y]=i.readFloat()*t),(x&8)!==0&&(g.offsets[ft.SCALEX]=i.readFloat()),(x&16)!==0&&(g.offsets[ft.SCALEY]=i.readFloat()),(x&32)!==0&&(g.offsets[ft.SHEARY]=i.readFloat()),x=i.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=i.readFloat()),(x&2)!==0&&(b.mixX=i.readFloat()),(x&4)!==0&&(b.mixY=i.readFloat()),(x&8)!==0&&(b.mixScaleX=i.readFloat()),(x&16)!==0&&(b.mixScaleY=i.readFloat()),(x&32)!==0&&(b.mixShearY=i.readFloat()),o.push(g);break}case gr:{const g=new Ae(u);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(c[i.readInt(!0)]);g.slot=s.slots[i.readInt(!0)];const x=i.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=i.readFloat());const b=g.setupPose;b.position=i.readFloat(),g.positionMode===0&&(b.position*=t),b.spacing=i.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=t),b.mixRotate=i.readFloat(),b.mixX=i.readFloat(),b.mixY=i.readFloat(),o.push(g);break}case xr:{const g=new Se(u);g.bone=c[i.readInt(!0)];let x=i.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=i.readFloat()),(x&4)!==0&&(g.y=i.readFloat()),(x&8)!==0&&(g.rotate=i.readFloat()),(x&16)!==0){let w=i.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(x&32)!==0&&(g.shearX=i.readFloat()),g.limit=((x&64)!==0?i.readFloat():5e3)*t,g.step=1/i.readUnsignedByte();const b=g.setupPose;b.inertia=i.readFloat(),b.strength=i.readFloat(),b.damping=i.readFloat(),b.massInverse=(x&128)!==0?i.readFloat():1,b.wind=i.readFloat(),b.gravity=i.readFloat(),x=i.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?i.readFloat():1,o.push(g);break}case br:{const g=new Gt(u),x=i.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0){const b=i.readFloat();a&&(x&64)!==0?g.max=b:g.setupPose.time=b}if((x&16)!==0&&(g.setupPose.mix=(x&32)!==0?i.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=c[i.readInt(!0)];const b=i.readFloat();let w=1;switch(i.readByte()){case 0:g.property=new _e;break;case 1:{w=t,g.property=new He;break}case 2:{w=t,g.property=new je;break}case 3:g.property=new Ze;break;case 4:g.property=new $e;break;case 5:g.property=new Ke;break;default:continue}g.property.offset=b*w,g.offset=i.readFloat(),g.scale=i.readFloat()/w}o.push(g);break}}}const d=this.readSkin(i,s,!0,a);d&&(s.defaultSkin=d,s.skins.push(d));{let f=s.skins.length;for(O.setArraySize(s.skins,h=f+i.readInt(!0));f<h;f++){const u=this.readSkin(i,s,!1,a);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[f]=u}}h=this.linkedMeshes.length;for(let f=0;f<h;f++){const u=this.linkedMeshes[f],p=s.skins[u.skinIndex];if(!u.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(u.sourceIndex,u.source);if(!g)throw new Error(`Source mesh not found: ${u.source}`);u.mesh.timelineAttachment=u.inheritTimelines?g:u.mesh,u.mesh.setSourceMesh(g),u.mesh.updateSequence()}this.linkedMeshes.length=0,h=i.readInt(!0);for(let f=0;f<h;f++){const u=i.readString();if(!u)throw new Error("Event data name must not be null");const p=new si(u),g=p.setupPose;g.intValue=i.readInt(!1),g.floatValue=i.readFloat(),g.stringValue=i.readString(),p._audioPath=i.readString(),p.audioPath&&(g.volume=i.readFloat(),g.balance=i.readFloat()),s.events.push(p)}const m=s.animations;h=i.readInt(!0);for(let f=0;f<h;f++){const u=i.readString();if(!u)throw new Error("Animation name must not be null.");m.push(this.readAnimation(i,u,s,a))}for(let f=0;f<l;f++){const u=o[f];u instanceof Gt&&(u.animation=m[i.readInt(!0)])}return s}readSkin(e,t,s,i){let n=null,r=0;if(s){if(r=e.readInt(!0),r===0)return null;n=new We("default")}else{const a=e.readString();if(!a)throw new Error("Skin name must not be null.");n=new We(a),i&&it.rgba8888ToColor(n.color,e.readInt32());let h=e.readInt(!0),c=t.bones,o=n.bones;for(let l=0;l<h;l++)o[l]=c[e.readInt(!0)];h=e.readInt(!0),c=t.constraints,o=n.constraints;for(let l=0;l<h;l++)o[l]=c[e.readInt(!0)];r=e.readInt(!0)}for(let a=0;a<r;a++){const h=e.readInt(!0);for(let c=0,o=e.readInt(!0);c<o;c++){const l=e.readStringRef();if(!l)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,n,h,l,i);d&&n.setAttachment(h,l,d)}}return n}readAttachment(e,t,s,i,n,r){const a=this.scale,h=e.readByte(),c=(h&8)!==0?e.readStringRef():n;if(!c)throw new Error("Attachment name must not be null");switch(h&7){case 0:{let o=(h&16)!==0?e.readStringRef():null;const l=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),m=(h&128)!==0?e.readFloat():0,f=e.readFloat(),u=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),b=e.readFloat();o||(o=c);const w=this.attachmentLoader.newRegionAttachment(s,n,c,o,d);return w?(w.path=o,w.x=f*a,w.y=u*a,w.scaleX=p,w.scaleY=g,w.rotation=m,w.width=x*a,w.height=b*a,it.rgba8888ToColor(w.color,l),w.updateSequence(),w):null}case 1:{const o=this.readVertices(e,(h&16)!==0),l=r?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,n,c);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,r&&it.rgba8888ToColor(d.color,l),d):null}case 2:{let o=(h&16)!==0?e.readStringRef():c;const l=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),m=e.readInt(!0),f=this.readVertices(e,(h&128)!==0),u=this.readFloatArray(e,f.length,1),p=this.readShortArray(e,(f.length-m-2)*3),g=e.readInt(!0);let x=null;if(g>0){x=[];for(let T=0;T<g;T++)x[T]=e.readInt(!0)}let b=[],w=0,v=0;r&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),v=e.readFloat()),o||(o=c);const y=this.attachmentLoader.newMeshAttachment(s,n,c,o,d);return y?(y.path=o,it.rgba8888ToColor(y.color,l),y.hullLength=m<<1,y.bones=f.bones,y.vertices=f.vertices,y.worldVerticesLength=f.length,y.regionUVs=u,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*a,y.height=v*a),y.updateSequence(),y):null}case 3:{const o=(h&16)!==0?e.readStringRef():c;if(o==null)throw new Error("Path of linked mesh must not be null");const l=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),m=(h&128)!==0,f=e.readInt(!0),u=e.readInt(!0),p=e.readStringRef();let g=0,x=0;r&&(g=e.readFloat(),x=e.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,n,c,o,d);return b?(b.path=o,it.rgba8888ToColor(b.color,l),r&&(b.width=g*a,b.height=x*a),this.linkedMeshes.push(new jn(b,u,i,f,p,m)),b):null}case 4:{const o=(h&16)!==0,l=(h&32)!==0,d=this.readVertices(e,(h&64)!==0),m=this.readFloatArray(e,d.length/6,a),f=r?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n,c);return u?(u.closed=o,u.constantSpeed=l,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=m,r&&it.rgba8888ToColor(u.color,f),u):null}case 5:{const o=e.readFloat(),l=e.readFloat(),d=e.readFloat(),m=r?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,n,c);return f?(f.x=l*a,f.y=d*a,f.rotation=o,r&&it.rgba8888ToColor(f.color,m),f):null}case 6:{const o=e.readInt(!0),l=this.readVertices(e,(h&16)!==0),d=r?e.readInt32():0,m=this.attachmentLoader.newClippingAttachment(s,n,c);return m?(m.endSlot=t.slots[o],m.convex=(h&32)!==0,m.inverse=(h&64)!==0,m.worldVerticesLength=l.length,m.vertices=l.vertices,m.bones=l.bones,r&&it.rgba8888ToColor(m.color,d),m):null}}}readSequence(e,t){if(!t)return new ge(1,!1);const s=new ge(e.readInt(!0),!0);return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,t){const s=this.scale,n=e.readInt(!0)<<1;if(!t)return new on(null,this.readFloatArray(e,n,s),n);const r=e.readInt(!0),a=[],h=[];for(let c=0,o=0;c<r;){const l=e.readInt(!0);a[c++]=l;for(let d=0;d<l;d++,o+=3)a[c++]=e.readInt(!0),h[o]=e.readFloat()*s,h[o+1]=e.readFloat()*s,h[o+2]=e.readFloat()}return new on(a,O.toFloatArray(h),n)}readFloatArray(e,t,s){const i=[];if(s===1)for(let n=0;n<t;n++)i[n]=e.readFloat();else for(let n=0;n<t;n++)i[n]=e.readFloat()*s;return i}readShortArray(e,t){const s=[];for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s,i){e.readInt(!0);const n=[],r=this.scale;for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=b-1;switch(x){case cr:{const v=new ie(b,u);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readStringRef());n.push(v);break}case lr:{const v=e.readInt(!0),y=new Ss(b,v,u);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let Y=0,F=0;y.setFrame(Y,T,A,S,C,I),Y!==w;Y++){const k=e.readFloat(),X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(Y);break;case Bt:ht(e,y,F++,Y,0,T,k,A,X,1),ht(e,y,F++,Y,1,T,k,S,R,1),ht(e,y,F++,Y,2,T,k,C,V,1),ht(e,y,F++,Y,3,T,k,I,q,1)}T=k,A=X,S=R,C=V,I=q}n.push(y);break}case hr:{const v=e.readInt(!0),y=new Cs(b,v,u);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let I=0,Y=0;y.setFrame(I,T,A,S,C),I!==w;I++){const F=e.readFloat(),k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(I);break;case Bt:ht(e,y,Y++,I,0,T,F,A,k,1),ht(e,y,Y++,I,1,T,F,S,X,1),ht(e,y,Y++,I,2,T,F,C,R,1)}T=F,A=k,S=X,C=R}n.push(y);break}case dr:{const v=e.readInt(!0),y=new Ms(b,v,u);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let X=0,R=0;y.setFrame(X,T,A,S,C,I,Y,F,k),X!==w;X++){const V=e.readFloat(),q=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,lt=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(X);break;case Bt:ht(e,y,R++,X,0,T,V,A,q,1),ht(e,y,R++,X,1,T,V,S,U,1),ht(e,y,R++,X,2,T,V,C,P,1),ht(e,y,R++,X,3,T,V,I,L,1),ht(e,y,R++,X,4,T,V,Y,z,1),ht(e,y,R++,X,5,T,V,F,D,1),ht(e,y,R++,X,6,T,V,k,lt,1)}T=V,A=q,S=U,C=P,I=L,Y=z,F=D,k=lt}n.push(y);break}case fr:{const v=e.readInt(!0),y=new Es(b,v,u);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let k=0,X=0;y.setFrame(k,T,A,S,C,I,Y,F),k!==w;k++){const R=e.readFloat(),V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:y.setStepped(k);break;case Bt:ht(e,y,X++,k,0,T,R,A,V,1),ht(e,y,X++,k,1,T,R,S,q,1),ht(e,y,X++,k,2,T,R,C,U,1),ht(e,y,X++,k,3,T,R,I,P,1),ht(e,y,X++,k,4,T,R,Y,L,1),ht(e,y,X++,k,5,T,R,F,z,1)}T=R,A=V,S=q,C=U,I=P,Y=L,F=z}n.push(y);break}case ur:{const v=new Is(b,e.readInt(!0),u);let y=e.readFloat(),T=e.readUnsignedByte()/255;for(let A=0,S=0;v.setFrame(A,y,T),A!==w;A++){const C=e.readFloat(),I=e.readUnsignedByte()/255;switch(e.readByte()){case Vt:v.setStepped(A);break;case Bt:ht(e,v,S++,A,0,y,C,T,I,1)}y=C,T=I}n.push(v)}}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===ar){const v=new As(b,u);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readByte());n.push(v);continue}const w=e.readInt(!0);switch(x){case Kn:xt(e,n,new xe(b,w,u),1);break;case Jn:xt(e,n,new ms(b,w,u),r);break;case Qn:xt(e,n,new gs(b,w,u),r);break;case tr:xt(e,n,new ps(b,w,u),r);break;case er:xt(e,n,new xs(b,w,u),1);break;case sr:xt(e,n,new bs(b,w,u),1);break;case ir:xt(e,n,new ws(b,w,u),1);break;case nr:xt(e,n,new ys(b,w,u),1);break;case rr:xt(e,n,new vs(b,w,u),1);break;case or:xt(e,n,new Ts(b,w,u),1);break}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new Fs(p,e.readInt(!0),u);let b=e.readByte(),w=e.readFloat(),v=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,y=(b&4)!==0?e.readFloat()*r:0;for(let T=0,A=0;x.setFrame(T,w,v,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),T!==g;T++){b=e.readByte();const S=e.readFloat(),C=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,I=(b&4)!==0?e.readFloat()*r:0;(b&64)!==0?x.setStepped(T):(b&128)!==0&&(ht(e,x,A++,T,0,w,S,v,C,1),ht(e,x,A++,T,1,w,S,y,I,r)),w=S,v=C,y=I}n.push(x)}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new Ls(p,e.readInt(!0),u);let b=e.readFloat(),w=e.readFloat(),v=e.readFloat(),y=e.readFloat(),T=e.readFloat(),A=e.readFloat(),S=e.readFloat();for(let C=0,I=0;x.setFrame(C,b,w,v,y,T,A,S),C!==g;C++){const Y=e.readFloat(),F=e.readFloat(),k=e.readFloat(),X=e.readFloat(),R=e.readFloat(),V=e.readFloat(),q=e.readFloat();switch(e.readByte()){case Vt:x.setStepped(C);break;case Bt:ht(e,x,I++,C,0,b,Y,w,F,1),ht(e,x,I++,C,1,b,Y,v,k,1),ht(e,x,I++,C,2,b,Y,y,X,1),ht(e,x,I++,C,3,b,Y,T,R,1),ht(e,x,I++,C,4,b,Y,A,V,1),ht(e,x,I++,C,5,b,Y,S,q,1)}b=Y,w=F,v=k,y=X,T=R,A=V,S=q}n.push(x)}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=s.constraints[u];for(let g=0,x=e.readInt(!0);g<x;g++){const b=e.readByte(),w=e.readInt(!0),v=e.readInt(!0);switch(b){case vr:xt(e,n,new Ps(w,v,u),p.positionMode===0?r:1);break;case Tr:xt(e,n,new Xs(w,v,u),p.spacingMode===0||p.spacingMode===1?r:1);break;case Ar:{const y=new ks(w,v,u);let T=e.readFloat(),A=e.readFloat(),S=e.readFloat(),C=e.readFloat();for(let I=0,Y=0,F=y.getFrameCount()-1;y.setFrame(I,T,A,S,C),I!==F;I++){const k=e.readFloat(),X=e.readFloat(),R=e.readFloat(),V=e.readFloat();switch(e.readByte()){case Vt:y.setStepped(I);break;case Bt:ht(e,y,Y++,I,0,T,k,A,X,1),ht(e,y,Y++,I,1,T,k,S,R,1),ht(e,y,Y++,I,2,T,k,C,V,1)}T=k,A=X,S=R,C=V}n.push(y)}}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0)-1;for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===Fr){const v=new qs(b,u);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat());n.push(v);continue}const w=e.readInt(!0);switch(x){case Sr:xt(e,n,new Vs(b,w,u),1);break;case Cr:xt(e,n,new Bs(b,w,u),1);break;case Ir:xt(e,n,new Os(b,w,u),1);break;case Mr:xt(e,n,new Us(b,w,u),1);break;case Er:xt(e,n,new Ns(b,w,u),1);break;case Yr:xt(e,n,new Ds(b,w,u),1);break;case Rr:xt(e,n,new zs(b,w,u),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=e.readInt(!0);switch(x){case Lr:xt(e,n,new Ws(b,w,u),1);break;case Pr:xt(e,n,new Gs(b,w,u),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=s.skins[e.readInt(!0)];for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readInt(!0);for(let b=0,w=e.readInt(!0);b<w;b++){const v=e.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=u.getAttachment(x,v),T=e.readByte(),A=e.readInt(!0),S=A-1;switch(T){case wr:{const C=y,I=C.bones,Y=C.vertices,F=I?Y.length/3*2:Y.length,k=e.readInt(!0),X=new Ys(A,k,x,C);let R=e.readFloat();for(let V=0,q=0;;V++){let U,P=e.readInt(!0);if(P===0)U=I?O.newFloatArray(F):Y;else{U=O.newFloatArray(F);const z=e.readInt(!0);if(P+=z,r===1)for(let D=z;D<P;D++)U[D]=e.readFloat();else for(let D=z;D<P;D++)U[D]=e.readFloat()*r;if(!I)for(let D=0,lt=U.length;D<lt;D++)U[D]+=Y[D]}if(X.setFrame(V,R,U),V===S)break;const L=e.readFloat();switch(e.readByte()){case Vt:X.setStepped(V);break;case Bt:ht(e,X,q++,V,0,R,L,0,1,1)}R=L}n.push(X);break}case yr:{const C=new Rs(A,x,y);for(let I=0;I<A;I++){const Y=e.readFloat(),F=e.readInt32();C.setFrame(I,Y,us[F&15],F>>4,e.readFloat())}n.push(C);break}}}}}const a=s.slots.length,h=e.readInt(!0);if(h>0){const m=new jt(h);for(let f=0;f<h;f++)m.setFrame(f,e.readFloat(),an(e,a));n.push(m)}const c=e.readInt(!0);for(let m=0;m<c;m++){const f=e.readInt(!0),u=new Array(f);for(let x=0;x<f;x++)u[x]=e.readInt(!0);const p=e.readInt(!0),g=new we(p,u,a);for(let x=0;x<p;x++)g.setFrame(x,e.readFloat(),an(e,f));n.push(g)}const o=e.readInt(!0);if(o>0){const m=new Le(o);for(let f=0;f<o;f++){const u=e.readFloat(),p=s.events[e.readInt(!0)],g=new Oe(u,p);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),m.setFrame(f,g)}n.push(m)}let l=0;for(let m=0,f=n.length;m<f;m++)l=Math.max(l,n[m].getDuration());const d=new Re(t,n,l);return i&&it.rgba8888ToColor(d.color,e.readInt32()),d}},rn=class{constructor(e,t=[],s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){const e=this.readInt(!0);return e===0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s<e;){const i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(i),s++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}},jn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,i,n,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.sourceIndex=i,this.source=n,this.inheritTimelines=r}},on=class{constructor(e=null,t,s=0){this.bones=e,this.vertices=t,this.length=s}};function xt(e,t,s,i){s instanceof pe?Zn(e,t,s,i):$n(e,t,s,i)}function Zn(e,t,s,i){let n=e.readFloat(),r=e.readFloat()*i;for(let a=0,h=0,c=s.getFrameCount()-1;s.setFrame(a,n,r),a!==c;a++){const o=e.readFloat(),l=e.readFloat()*i;switch(e.readByte()){case Vt:s.setStepped(a);break;case Bt:ht(e,s,h++,a,0,n,o,r,l,i)}n=o,r=l}t.push(s)}function $n(e,t,s,i){let n=e.readFloat(),r=e.readFloat()*i,a=e.readFloat()*i;for(let h=0,c=0,o=s.getFrameCount()-1;s.setFrame(h,n,r,a),h!==o;h++){const l=e.readFloat(),d=e.readFloat()*i,m=e.readFloat()*i;switch(e.readByte()){case Vt:s.setStepped(h);break;case Bt:ht(e,s,c++,h,0,n,l,r,d,i),ht(e,s,c++,h,1,n,l,a,m,i)}n=l,r=d,a=m}t.push(s)}function an(e,t){const s=e.readInt(!0);if(s===0)return null;const i=new Array(t).fill(-1),n=new Array(t-s);let r=0,a=0;for(let h=0;h<s;h++){const c=e.readInt(!0);for(;r!==c;)n[a++]=r++;i[r+e.readInt(!0)]=r++}for(;r<t;)n[a++]=r++;for(let h=t-1;h>=0;h--)i[h]===-1&&(i[h]=n[--a]);return i}function ht(e,t,s,i,n,r,a,h,c,o){t.setBezier(s,i,n,r,h,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,a,c)}var Kn=0,Jn=1,Qn=2,tr=3,er=4,sr=5,ir=6,nr=7,rr=8,or=9,ar=10,cr=0,lr=1,hr=2,dr=3,fr=4,ur=5,mr=0,gr=1,pr=2,xr=3,br=4,wr=0,yr=1,vr=0,Tr=1,Ar=2,Sr=0,Cr=1,Ir=2,Mr=4,Er=5,Yr=6,Rr=7,Fr=8,Lr=0,Pr=1,Vt=1,Bt=2,cn=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new me(()=>O.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=e.slots,a=r.length;s.length=0,n.freeAll(i),i.length=0;for(let h=0;h<a;h++){const c=r[h];if(!c.bone.active)continue;const o=c.appliedPose.attachment;if(o instanceof Js){s.push(o);let l=n.obtain();l.length!==o.worldVerticesLength&&(l=O.newFloatArray(o.worldVerticesLength)),i.push(l),o.computeWorldVertices(e,c,0,o.worldVerticesLength,l,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const n=this.polygons;for(let r=0,a=n.length;r<a;r++){const h=n[r],c=h;for(let o=0,l=h.length;o<l;o+=2){const d=c[o],m=c[o+1];e=Math.min(e,d),t=Math.min(t,m),s=Math.max(s,d),i=Math.max(i,m)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){const n=this.minX,r=this.minY,a=this.maxX,h=this.maxY;if(e<=n&&s<=n||t<=r&&i<=r||e>=a&&s>=a||t>=h&&i>=h)return!1;const c=(i-t)/(s-e);let o=c*(n-e)+t;if(o>r&&o<h||(o=c*(a-e)+t,o>r&&o<h))return!0;let l=(r-t)/c+e;return l>n&&l<a||(l=(h-t)/c+e,l>n&&l<a)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){const s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){const i=e,n=e.length;let r=n-2,a=!1;for(let h=0;h<n;h+=2){const c=i[h+1],o=i[r+1];if(c<s&&o>=s||o<s&&c>=s){const l=i[h];l+(s-c)/(o-c)*(i[r]-l)<t&&(a=!a)}r=h}return a}intersectsSegment(e,t,s,i){const n=this.polygons;for(let r=0,a=n.length;r<a;r++)if(this.intersectsSegmentPolygon(n[r],e,t,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(e,t,s,i,n){const r=e,a=e.length,h=t-i,c=s-n,o=t*n-s*i;let l=r[a-2],d=r[a-1];for(let m=0;m<a;m+=2){const f=r[m],u=r[m+1],p=l*u-d*f,g=l-f,x=d-u,b=h*x-c*g,w=(o*g-h*p)/b;if((w>=l&&w<=f||w>=f&&w<=l)&&(w>=t&&w<=i||w>=i&&w<=t)){const v=(o*x-c*p)/b;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=n||v>=n&&v<=s))return!0}l=f,d=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");const t=this.boundingBoxes.indexOf(e);return t===-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},ln=class Ct{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new me(()=>[]);polygonIndicesPool=new me(()=>[]);triangulate(t){const s=t;let i=t.length>>1;const n=this.indicesArray;n.length=0;for(let h=0;h<i;h++)n[h]=h;const r=this.isConcaveArray;r.length=0;for(let h=0;h<i;h++)r[h]=Ct.isConcave(h,i,s,n);const a=this.triangles;for(a.length=0;i>3;){let h=i-1,c=0,o=1;for(;;){t:if(!r[c]){const m=n[h]<<1,f=n[c]<<1,u=n[o]<<1,p=s[m],g=s[m+1],x=s[f],b=s[f+1],w=s[u],v=s[u+1];for(let y=o+1<i?o+1:0;y!==h;){if(r[y]){const T=n[y]<<1,A=s[T],S=s[T+1];if(Ct.positiveArea(w,v,p,g,A,S)&&Ct.positiveArea(p,g,x,b,A,S)&&Ct.positiveArea(x,b,w,v,A,S))break t}++y===i&&(y=0)}break}if(o===0){do{if(!r[c])break;c--}while(c>0);h=c>0?c-1:i-1,o=c+1<i?c+1:0;break}h=c,c=o,++o===i&&(o=0)}a.push(n[h],n[c],n[o]),n.splice(c,1),r.splice(c,1),i--;const l=c>0?c-1:i-1,d=c<i?c:0;r[l]=Ct.isConcave(l,i,s,n),r[d]=Ct.isConcave(d,i,s,n)}return i===3&&a.push(n[2],n[0],n[1]),a}decompose(t,s){const i=t,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let h=this.polygonPool.obtain();h.length=0;let c=-1,o=0;for(let l=0,d=s.length;l<d;l+=3){const m=s[l]<<1,f=s[l+1]<<1,u=s[l+2]<<1,p=i[m],g=i[m+1],x=i[f],b=i[f+1],w=i[u],v=i[u+1];if(c===m){const y=h.length-4;if(Ct.winding(h[y],h[y+1],h[y+2],h[y+3],w,v)===o&&Ct.winding(w,v,h[0],h[1],h[2],h[3])===o){h.push(w,v),a.push(u);continue}}h.length>0&&(n.push(h),r.push(a),h=this.polygonPool.obtain(),a=this.polygonIndicesPool.obtain()),h.length=0,h.push(p,g,x,b),h.push(w,v),a.length=0,a.push(m,f,u),o=Ct.winding(p,g,x,b,w,v),c=m}h.length>0&&(n.push(h),r.push(a));for(let l=0,d=n.length;l<d;l++){if(a=r[l],a.length===0)continue;const m=a[0];let f=a[a.length-1];h=n[l];const u=h.length-4;let p=h[u],g=h[u+1],x=h[u+2],b=h[u+3];const w=h[0],v=h[1],y=h[2],T=h[3],A=Ct.winding(p,g,x,b,w,v);for(let S=0;S<d;S++){if(S===l)continue;const C=r[S];if(C.length!==3)continue;const I=C[0],Y=C[1],F=C[2],k=n[S],X=k[k.length-2],R=k[k.length-1];I!==m||Y!==f||Ct.winding(p,g,x,b,X,R)===A&&Ct.winding(X,R,w,v,y,T)===A&&(k.length=0,C.length=0,h.push(X,R),a.push(F),f=F,p=x,g=b,x=X,b=R,S=-1)}}for(let l=n.length-1;l>=0;l--)h=n[l],h.length===0?(n.splice(l,1),this.polygonPool.free(h),a=r[l],r.splice(l,1),this.polygonIndicesPool.free(a)):h.push(h[0],h[1]);return n}static isConcave(t,s,i,n){const r=n[t>0?t-1:s-1]<<1,a=n[t]<<1,h=n[t+1<s?t+1:0]<<1;return!Ct.positiveArea(i[r],i[r+1],i[a],i[a+1],i[h],i[h+1])}static positiveArea(t,s,i,n,r,a){return t*(a-n)+i*(s-a)+r*(n-s)>=0}static winding(t,s,i,n,r,a){return t*(a-n)+i*(s-a)+r*(n-s)>=0?1:-1}},xi=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(e,t,s){if(this.clipAttachment)return;const i=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const n=O.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,t,0,i,n,0,2);const r=this.clippingPolygon,a=this.makeClockwise(r);a||this.inverse||s.convex?(a||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new ln),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(e){this.clipAttachment&&(e&&this.clipAttachment.endSlot!==e.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,n,r,a,h){return i&&n&&r&&typeof a=="boolean"&&typeof h=="number"?this.clipTrianglesRender(e,t,s,i,n,r,a,h):this.clipTrianglesNoRender(e,t,s)}clipTrianglesNoRender(e,t,s){const i=this.clippedVertices;i.length=0;const n=this.clippedTriangles;n.length=0;let r=0;if(this.inverse){const l=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let m=t[d]<<1;const f=e[m],u=e[m+1];m=t[d+1]<<1;const p=e[m],g=e[m+1];m=t[d+2]<<1;const x=e[m],b=e[m+1];this.clipInverse(f,u,p,g,x,b,l);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=w[v++];let A=T>>1,S=i.length;const C=O.setArraySize(i,S+T);O.arrayCopy(w,v,C,S,T),S=n.length;const I=O.setArraySize(n,S+3*(A-2));for(let Y=1;Y<A-1;Y++,S+=3)I[S]=r,I[S+1]=r+Y,I[S+2]=r+Y+1;r+=A,v+=T}}return!0}const a=this.clipOutput,h=this.clippingPolygons,c=h.length;let o=null;for(let l=0;l<s;l+=3){let d=t[l]<<1;const m=e[d],f=e[d+1];d=t[l+1]<<1;const u=e[d],p=e[d+1];d=t[l+2]<<1;const g=e[d],x=e[d+1];for(let b=0;b<c;b++){let w=i.length;if(this.clip(m,f,u,p,g,x,h[b])){o=this.clipOutput;const v=a.length;if(v===0)continue;let y=v>>1;const T=O.setArraySize(i,w+v);O.arrayCopy(o,0,T,w,v),w=n.length;const A=O.setArraySize(n,w+3*(y-2));y--;for(let S=1;S<y;S++,w+=3)A[w]=r,A[w+1]=r+S,A[w+2]=r+S+1;r+=y}else{const v=O.setArraySize(i,w+6);v[w]=m,v[w+1]=f,v[w+2]=u,v[w+3]=p,v[w+4]=g,v[w+5]=x,w=n.length;const y=O.setArraySize(n,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return o!=null}clipTrianglesRender(e,t,s,i,n,r,a,h){const c=this.clippedVertices;c.length=0;const o=this.clippedTriangles;o.length=0;let l=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=t[g],b=t[g+1],w=t[g+2];const v=e[x*h],y=e[x*h+1],T=e[b*h],A=e[b*h+1],S=e[w*h],C=e[w*h+1];this.clipInverse(v,y,T,A,S,C,p);const I=this.inverseVertices.length;if(I===0)continue;const Y=i[x<<=1],F=i[x+1],k=i[b<<=1],X=i[b+1],R=i[w<<=1],V=i[w+1],q=A-C,U=S-T,P=v-S,L=C-y,z=1/(q*P+U*(y-C)),D=this.inverseVertices;for(let lt=0;lt<I;){const N=D[lt++],ct=N>>1;let W=c.length;const ut=O.setArraySize(c,W+ct*h);for(let mt=0;mt<N;mt+=2,W+=h){const wt=D[lt+mt],vt=D[lt+mt+1];ut[W]=wt,ut[W+1]=vt,ut[W+2]=n.r,ut[W+3]=n.g,ut[W+4]=n.b,ut[W+5]=n.a;const yt=wt-S,Rt=vt-C,At=(q*yt+U*Rt)*z,St=(L*yt+P*Rt)*z,Ft=1-At-St;ut[W+6]=Y*At+k*St+R*Ft,ut[W+7]=F*At+X*St+V*Ft,a&&(ut[W+8]=r.r,ut[W+9]=r.g,ut[W+10]=r.b,ut[W+11]=r.a)}W=o.length;const bt=O.setArraySize(o,W+3*(ct-2));for(let mt=1;mt<ct-1;mt++,W+=3)bt[W]=l,bt[W+1]=l+mt,bt[W+2]=l+mt+1;l+=ct,lt+=N}}return!0}const d=this.clipOutput,m=this.clippingPolygons,f=this.clippingPolygons.length;let u=null;for(let p=0;p<s;p+=3){let g=t[p];const x=e[g*h],b=e[g*h+1],w=i[g<<1],v=i[(g<<1)+1];g=t[p+1];const y=e[g*h],T=e[g*h+1],A=i[g<<1],S=i[(g<<1)+1];g=t[p+2];const C=e[g*h],I=e[g*h+1],Y=i[g<<1],F=i[(g<<1)+1],k=T-I,X=C-y,R=x-C,V=I-b,q=1/(k*R+X*(b-I));for(let U=0;U<f;U++){let P=c.length;if(this.clip(x,b,y,T,C,I,m[U])){u=this.clipOutput;const L=d.length;if(L===0)continue;let z=L>>1;const D=O.setArraySize(c,P+z*h);for(let N=0;N<L;N+=2,P+=h){const ct=u[N],W=u[N+1];D[P]=ct,D[P+1]=W,D[P+2]=n.r,D[P+3]=n.g,D[P+4]=n.b,D[P+5]=n.a;const ut=ct-C,bt=W-I,mt=(k*ut+X*bt)*q,wt=(V*ut+R*bt)*q,vt=1-mt-wt;D[P+6]=w*mt+A*wt+Y*vt,D[P+7]=v*mt+S*wt+F*vt,a&&(D[P+8]=r.r,D[P+9]=r.g,D[P+10]=r.b,D[P+11]=r.a)}P=o.length;const lt=O.setArraySize(o,P+3*(z-2));z--;for(let N=1;N<z;N++,P+=3)lt[P]=l,lt[P+1]=l+N,lt[P+2]=l+N+1;l+=z+1}else{const L=O.setArraySize(c,P+3*h);L[P]=x,L[P+1]=b,L[P+2]=n.r,L[P+3]=n.g,L[P+4]=n.b,L[P+5]=n.a,a?(L[P+6]=w,L[P+7]=v,L[P+8]=r.r,L[P+9]=r.g,L[P+10]=r.b,L[P+11]=r.a,L[P+12]=y,L[P+13]=T,L[P+14]=n.r,L[P+15]=n.g,L[P+16]=n.b,L[P+17]=n.a,L[P+18]=A,L[P+19]=S,L[P+20]=r.r,L[P+21]=r.g,L[P+22]=r.b,L[P+23]=r.a,L[P+24]=C,L[P+25]=I,L[P+26]=n.r,L[P+27]=n.g,L[P+28]=n.b,L[P+29]=n.a,L[P+30]=Y,L[P+31]=F,L[P+32]=r.r,L[P+33]=r.g,L[P+34]=r.b,L[P+35]=r.a):(L[P+6]=w,L[P+7]=v,L[P+8]=y,L[P+9]=T,L[P+10]=n.r,L[P+11]=n.g,L[P+12]=n.b,L[P+13]=n.a,L[P+14]=A,L[P+15]=S,L[P+16]=C,L[P+17]=I,L[P+18]=n.r,L[P+19]=n.g,L[P+20]=n.b,L[P+21]=n.a,L[P+22]=Y,L[P+23]=F),P=o.length;const z=O.setArraySize(o,P+3);z[P]=l,z[P+1]=l+1,z[P+2]=l+2,l+=3;break}}}return u!=null}clipTrianglesUnpacked(e,t,s,i,n,r=2){let a=this._clippedVerticesTyped,h=this._clippedUVsTyped,c=this._clippedTrianglesTyped,o=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const u=this.clippingPolygons[0];for(let p=0;p<i;p+=3){let g=s[p]*r;const x=e[t+g],b=e[t+g+1];let w=s[p]<<1;const v=n[w],y=n[w+1];g=s[p+1]*r;const T=e[t+g],A=e[t+g+1];w=s[p+1]<<1;const S=n[w],C=n[w+1];g=s[p+2]*r;const I=e[t+g],Y=e[t+g+1];w=s[p+2]<<1;const F=n[w],k=n[w+1];this.clipInverse(x,b,T,A,I,Y,u);const X=this.inverseVertices.length;if(X===0)continue;const R=A-Y,V=I-T,q=x-I,U=Y-b,P=1/(R*q+V*(b-Y)),L=this.inverseVertices;for(let z=0;z<X;){const D=L[z++],lt=D>>1;let N=this.clippedVerticesLength;const ct=N+lt*r,W=this.clippedUVsLength+lt*2;a.length<ct&&(this._clippedVerticesTyped=new Float32Array(ct*2),this._clippedVerticesTyped.set(a.subarray(0,N)),a=this._clippedVerticesTyped),h.length<W&&(this._clippedUVsTyped=new Float32Array(W*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped),this.clippedVerticesLength=ct,this.clippedUVsLength=W;const ut=this._clippedVerticesTyped,bt=this._clippedUVsTyped;let mt=W-lt*2;for(let yt=0;yt<D;yt+=2,N+=r,mt+=2){const Rt=L[z+yt],At=L[z+yt+1];ut[N]=Rt,ut[N+1]=At;const St=Rt-I,Ft=At-Y,kt=(R*St+V*Ft)*P,Ot=(U*St+q*Ft)*P,fe=1-kt-Ot;bt[mt]=v*kt+S*Ot+F*fe,bt[mt+1]=y*kt+C*Ot+k*fe}N=this.clippedTrianglesLength;const wt=N+3*(lt-2);c.length<wt&&(this._clippedTrianglesTyped=new Uint16Array(wt*2),this._clippedTrianglesTyped.set(c.subarray(0,N)),c=this._clippedTrianglesTyped),this.clippedTrianglesLength=wt;const vt=c;for(let yt=1;yt<lt-1;yt++,N+=3)vt[N]=o,vt[N+1]=o+yt,vt[N+2]=o+yt+1;o+=lt,z+=D}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const l=this.clipOutput,d=this.clippingPolygons,m=this.clippingPolygons.length;let f=null;for(let u=0;u<i;u+=3){let p=s[u],g=p*r;const x=e[t+g],b=e[t+g+1];let w=p<<1;const v=n[w],y=n[w+1];p=s[u+1],g=p*r;const T=e[t+g],A=e[t+g+1];w=p<<1;const S=n[w],C=n[w+1];p=s[u+2],g=p*r;const I=e[t+g],Y=e[t+g+1];w=p<<1;const F=n[w],k=n[w+1],X=A-Y,R=I-T,V=x-I,q=Y-b,U=1/(X*V+R*(b-Y));for(let P=0;P<m;P++){let L=this.clippedVerticesLength;if(this.clip(x,b,T,A,I,Y,d[P])){f=l;const z=l.length;if(z===0)continue;let D=z>>1;const lt=L+D*r;a.length<lt&&(this._clippedVerticesTyped=new Float32Array(lt*2),this._clippedVerticesTyped.set(a.subarray(0,L)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+D*2)*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),a=this._clippedVerticesTyped,h=this._clippedUVsTyped);const N=a,ct=h;this.clippedVerticesLength=lt;let W=this.clippedUVsLength;this.clippedUVsLength=W+D*2;for(let mt=0;mt<z;mt+=2,L+=r,W+=2){const wt=f[mt],vt=f[mt+1];N[L]=wt,N[L+1]=vt;const yt=wt-I,Rt=vt-Y,At=(X*yt+R*Rt)*U,St=(q*yt+V*Rt)*U,Ft=1-At-St;ct[W]=v*At+S*St+F*Ft,ct[W+1]=y*At+C*St+k*Ft}L=this.clippedTrianglesLength;const ut=L+3*(D-2);c.length<ut&&(this._clippedTrianglesTyped=new Uint16Array(ut*2),this._clippedTrianglesTyped.set(c.subarray(0,L)),c=this._clippedTrianglesTyped),this.clippedTrianglesLength=ut;const bt=c;D--;for(let mt=1;mt<D;mt++,L+=3)bt[L]=o,bt[L+1]=o+mt,bt[L+2]=o+mt+1;o+=D+1}else{let z=L+3*r;a.length<z&&(this._clippedVerticesTyped=new Float32Array(z*2),this._clippedVerticesTyped.set(a.subarray(0,L)),a=this._clippedVerticesTyped),a[L]=x,a[L+1]=b,a[L+r]=T,a[L+r+1]=A,a[L+r*2]=I,a[L+r*2+1]=Y;const D=this.clippedUVsLength+3*2;h.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped);const lt=this.clippedUVsLength;h[lt]=v,h[lt+1]=y,h[lt+2]=S,h[lt+3]=C,h[lt+4]=F,h[lt+5]=k,this.clippedVerticesLength=z,this.clippedUVsLength=D,L=this.clippedTrianglesLength,z=L+3,c.length<z&&(this._clippedTrianglesTyped=new Uint16Array(z*2),this._clippedTrianglesTyped.set(c.subarray(0,L)),c=this._clippedTrianglesTyped);const N=c;N[L]=o,N[L+1]=o+1,N[L+2]=o+2,o+=3,this.clippedTrianglesLength=z;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),f!==null}clip(e,t,s,i,n,r,a){const h=this.clipOutput;let c=!1,o,l;a.length%4>=2?(o=this.clipOutput,l=this.scratch):(o=this.scratch,l=this.clipOutput);const d=a;o.length=8;const m=o;m[0]=e,m[1]=t,m[2]=s,m[3]=i,m[4]=n,m[5]=r,m[6]=e,m[7]=t,l.length=0;const f=a.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],x=p-d[u+2],b=g-d[u+3],w=l.length,v=o;for(let T=0,A=o.length-2;T<A;){e=v[T],t=v[T+1],T+=2,s=v[T],i=v[T+1];const S=b*(p-s)>x*(g-i),C=b*(p-e)-x*(g-t);if(C>0)if(S)l.push(s,i);else{const I=s-e,Y=i-t,F=C/(I*b-Y*x);F>=0&&F<=1?(l.push(e+I*F,t+Y*F),c=!0):l.push(s,i)}else if(S){const I=s-e,Y=i-t,F=C/(I*b-Y*x);F>=0&&F<=1?(l.push(e+I*F,t+Y*F,s,i),c=!0):l.push(s,i)}else c=!0}if(w===l.length)return h.length=0,!0;if(l.push(l[0],l[1]),u===f)break;const y=l;l=o,l.length=0,o=y}if(h!==l){h.length=0;for(let u=0,p=l.length-2;u<p;u++)h[u]=l[u]}else h.length=h.length-2;return c}clipInverse(e,t,s,i,n,r,a){this.inverseVertices.length=0;const h=a.length-4;let c,o;a.length%4>=2?(c=this.clipOutput,o=this.scratch):(c=this.scratch,o=this.clipOutput),c.length=8;let l=a,d=c;d[0]=e,d[1]=t,d[2]=s,d[3]=i,d[4]=n,d[5]=r,d[6]=e,d[7]=t,o.length=0;for(let m=0;;m+=2){const f=l[m],u=l[m+1],p=f-l[m+2],g=u-l[m+3],x=o.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=c;for(let y=0,T=c.length-2;y<T;){e=d[y],t=d[y+1],y+=2,s=d[y],i=d[y+1];const A=g*(f-s)>p*(u-i),S=g*(f-e)-p*(u-t);if(S>0)if(A)o.push(s,i);else{const C=s-e,I=i-t,Y=S/(C*g-I*p);if(Y>=0&&Y<=1){const F=e+C*Y,k=t+I*Y;o.push(F,k),this.inverseVertices.push(F,k,s,i)}else o.push(s,i)}else if(A){const C=s-e,I=i-t,Y=S/(C*g-I*p);if(Y>=0&&Y<=1){const F=e+C*Y,k=t+I*Y;this.inverseVertices.push(F,k),o.push(F,k,s,i)}else o.push(s,i)}else this.inverseVertices.push(s,i)}const w=this.inverseVertices.length-b-1;if(w>=6?this.inverseVertices[b]=w:this.inverseVertices.length=b,x===o.length||(o.push(o[0],o[1]),m===h))break;const v=o;o=c,o.length=0,c=v}}makeClockwise(e){const t=e,s=e.length;let i=!0,n=!0,r=0,a=t[s-2],h=t[s-1],c=t[0],o=t[1];for(let d=2;d<s;d+=2){const m=t[d],f=t[d+1];r+=c*f-m*o;const u=(c-a)*(f-o)-(o-h)*(m-c);n=n&&u<=0,i=i&&u>=0,a=c,h=o,c=m,o=f}r+=c*t[1]-t[0]*o;const l=(c-a)*(t[1]-o)-(o-h)*(t[0]-c);if(n=n&&l<=0,i=i&&l>=0,r>=0){for(let d=0,m=s-2,f=s>>1;d<f;d+=2){const u=t[d],p=t[d+1],g=m-d;t[d]=t[g],t[d+1]=t[g+1],t[g]=u,t[g+1]=p}return i}return n}makeConvex(e){const t=e.length,s=e;this.clipOutput.length=t;const i=this.clipOutput;i[0]=s[0],i[1]=s[1];for(let a=2;a<t;a+=2){const h=s[a],c=s[a+1];let o=a-2;for(;o>=0&&(i[o]>h||i[o]===h&&i[o+1]>c);o-=2)i[o+2]=i[o],i[o+3]=i[o+1];i[o+2]=h,i[o+3]=c}s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3];let n=4;for(let a=4;a<t;a+=2,n+=2){const h=i[a],c=i[a+1];for(;(s[n-2]-s[n-4])*(c-s[n-3])-(s[n-1]-s[n-3])*(h-s[n-4])>=0&&(n-=2,n!==2););s[n]=h,s[n+1]=c}s[n]=i[t-4],s[n+1]=i[t-3];const r=n;n+=2;for(let a=t-6;a>=0;a-=2,n+=2){const h=i[a],c=i[a+1];for(;(s[n-2]-s[n-4])*(c-s[n-3])-(s[n-1]-s[n-3])*(h-s[n-4])>=0&&(n-=2,n!==r););s[n]=h,s[n+1]=c}e.length=n-2}},Xr=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new ai,i=typeof e=="string"?JSON.parse(e):e,n=i.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=M(n,"referenceScale",100)*t,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let r=0;r<i.bones.length;r++){const a=i.bones[r];let h=null;const c=M(a,"parent",null);c&&(h=s.findBone(c));const o=new Qs(s.bones.length,a.name,h);o.length=M(a,"length",0)*t;const l=o.setupPose;l.x=M(a,"x",0)*t,l.y=M(a,"y",0)*t,l.rotation=M(a,"rotation",0),l.scaleX=M(a,"scaleX",1),l.scaleY=M(a,"scaleY",1),l.shearX=M(a,"shearX",0),l.shearY=M(a,"shearY",0),l.inherit=O.enumValue(Xe,M(a,"inherit","Normal")),o.skinRequired=M(a,"skin",!1);const d=M(a,"color",null);d&&o.color.setFromString(d),o.icon=M(a,"icon",void 0),o.iconSize=M(a,"iconSize",1),o.iconRotation=M(a,"iconRotation",0),s.bones.push(o)}if(i.slots)for(let r=0;r<i.slots.length;r++){const a=i.slots[r],h=a.name,c=s.findBone(a.bone);if(!c)throw new Error(`Couldn't find bone ${a.bone} for slot ${h}`);const o=new li(s.slots.length,h,c),l=M(a,"color",null);l&&o.setupPose.color.setFromString(l);const d=M(a,"dark",null);d&&(o.setupPose.darkColor=it.fromString(d)),o.attachmentName=M(a,"attachment",null),o.blendMode=O.enumValue(hi,M(a,"blend","normal")),o.visible=M(a,"visible",!0),s.slots.push(o)}if(i.constraints)for(const r of i.constraints){const a=r.name,h=M(r,"skin",!1);switch(M(r,"type",!1)){case"ik":{const c=new Te(a);c.skinRequired=h;for(let f=0;f<r.bones.length;f++){const u=s.findBone(r.bones[f]);if(!u)throw new Error(`Couldn't find bone ${r.bones[f]} for IK constraint ${a}.`);c.bones.push(u)}const o=r.target,l=s.findBone(o);if(!l)throw new Error(`Couldn't find target bone ${o} for IK constraint ${a}.`);c.target=l;const d=M(r,"scaleY",null);d!=null&&(c.scaleYMode=O.enumValue(Be,d));const m=c.setupPose;m.mix=M(r,"mix",1),m.softness=M(r,"softness",0)*t,m.bendDirection=M(r,"bendPositive",!0)?1:-1,m.compress=M(r,"compress",!1),m.stretch=M(r,"stretch",!1),s.constraints.push(c);break}case"transform":{const c=new ft(a);c.skinRequired=h;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);c.bones.push(y)}const o=r.source,l=s.findBone(o);if(!l)throw new Error(`Couldn't find source bone ${o} for transform constraint ${r.name}.`);c.source=l,c.localSource=M(r,"localSource",!1),c.localTarget=M(r,"localTarget",!1),c.additive=M(r,"additive",!1),c.clamp=M(r,"clamp",!1);let d=!1,m=!1,f=!1,u=!1,p=!1,g=!1;const x=Object.entries(M(r,"properties",{}));for(const[w,v]of x){const y=this.fromProperty(w),T=this.propertyScale(w,t);y.offset=M(v,"offset",0)*T;const A=Object.entries(M(v,"to",{}));for(const[S,C]of A){let I=1,Y;switch(S){case"rotate":{d=!0,Y=new di;break}case"x":{m=!0,Y=new fi,I=t;break}case"y":{f=!0,Y=new ui,I=t;break}case"scaleX":{u=!0,Y=new mi;break}case"scaleY":{p=!0,Y=new gi;break}case"shearY":{g=!0,Y=new pi;break}default:throw new Error(`Invalid transform constraint to property: ${S}`)}Y.offset=M(C,"offset",0)*I,Y.max=M(C,"max",1)*I,Y.scale=M(C,"scale",1)*I/T,y.to.push(Y)}y.to.length>0&&c.properties.push(y)}c.offsets[ft.ROTATION]=M(r,"rotation",0),c.offsets[ft.X]=M(r,"x",0)*t,c.offsets[ft.Y]=M(r,"y",0)*t,c.offsets[ft.SCALEX]=M(r,"scaleX",0),c.offsets[ft.SCALEY]=M(r,"scaleY",0),c.offsets[ft.SHEARY]=M(r,"shearY",0);const b=c.setupPose;d&&(b.mixRotate=M(r,"mixRotate",1)),m&&(b.mixX=M(r,"mixX",1)),f&&(b.mixY=M(r,"mixY",b.mixX)),u&&(b.mixScaleX=M(r,"mixScaleX",1)),p&&(b.mixScaleY=M(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=M(r,"mixShearY",1)),s.constraints.push(c);break}case"path":{const c=new Ae(a);c.skinRequired=h;for(let m=0;m<r.bones.length;m++){const f=r.bones[m],u=s.findBone(f);if(!u)throw new Error(`Couldn't find bone ${f} for path constraint ${r.name}.`);c.bones.push(u)}const o=r.slot,l=s.findSlot(o);if(!l)throw new Error(`Couldn't find slot ${o} for path constraint ${r.name}.`);c.slot=l,c.positionMode=O.enumValue(ii,M(r,"positionMode","Percent")),c.spacingMode=O.enumValue(ni,M(r,"spacingMode","Length")),c.rotateMode=O.enumValue(ri,M(r,"rotateMode","Tangent")),c.offsetRotation=M(r,"rotation",0);const d=c.setupPose;d.position=M(r,"position",0),c.positionMode===0&&(d.position*=t),d.spacing=M(r,"spacing",0),(c.spacingMode===0||c.spacingMode===1)&&(d.spacing*=t),d.mixRotate=M(r,"mixRotate",1),d.mixX=M(r,"mixX",1),d.mixY=M(r,"mixY",d.mixX),s.constraints.push(c);break}case"physics":{const c=new Se(a);c.skinRequired=h;const o=r.bone,l=s.findBone(o);if(l==null)throw new Error(`Physics bone not found: ${o}`);c.bone=l,c.x=M(r,"x",0),c.y=M(r,"y",0),c.rotate=M(r,"rotate",0),c.scaleX=M(r,"scaleX",0);const d=M(r,"scaleY",null);d!=null&&(c.scaleYMode=O.enumValue(Be,d)),c.shearX=M(r,"shearX",0),c.limit=M(r,"limit",5e3)*t,c.step=1/M(r,"fps",60);const m=c.setupPose;m.inertia=M(r,"inertia",.5),m.strength=M(r,"strength",100),m.damping=M(r,"damping",.85),m.massInverse=1/M(r,"mass",1),m.wind=M(r,"wind",0),m.gravity=M(r,"gravity",0),m.mix=M(r,"mix",1),c.inertiaGlobal=M(r,"inertiaGlobal",!1),c.strengthGlobal=M(r,"strengthGlobal",!1),c.dampingGlobal=M(r,"dampingGlobal",!1),c.massGlobal=M(r,"massGlobal",!1),c.windGlobal=M(r,"windGlobal",!1),c.gravityGlobal=M(r,"gravityGlobal",!1),c.mixGlobal=M(r,"mixGlobal",!1),s.constraints.push(c);break}case"slider":{const c=new Gt(a);c.skinRequired=h,c.additive=M(r,"additive",!1),c.loop=M(r,"loop",!1),c.setupPose.mix=M(r,"mix",1);const o=r.bone;if(o){if(c.bone=s.findBone(o),!c.bone)throw new Error(`Slider bone not found: ${o}`);const l=r.property;c.property=this.fromProperty(l);const d=this.propertyScale(l,t);c.property.offset=M(r,"from",0)*d,c.offset=M(r,"to",0),c.scale=M(r,"scale",1)/d,c.max=M(r,"max",0),c.local=M(r,"local",!1)}else c.setupPose.time=M(r,"time",0);s.constraints.push(c);break}}}if(i.skins)for(let r=0;r<i.skins.length;r++){const a=i.skins[r],h=new We(a.name);if(a.bones)for(let c=0;c<a.bones.length;c++){const o=a.bones[c],l=s.findBone(o);if(!l)throw new Error(`Couldn't find bone ${o} for skin ${a.name}.`);h.bones.push(l)}if(a.ik)for(let c=0;c<a.ik.length;c++){const o=a.ik[c],l=s.findConstraint(o,Te);if(!l)throw new Error(`Couldn't find IK constraint ${o} for skin ${a.name}.`);h.constraints.push(l)}if(a.transform)for(let c=0;c<a.transform.length;c++){const o=a.transform[c],l=s.findConstraint(o,ft);if(!l)throw new Error(`Couldn't find transform constraint ${o} for skin ${a.name}.`);h.constraints.push(l)}if(a.path)for(let c=0;c<a.path.length;c++){const o=a.path[c],l=s.findConstraint(o,Ae);if(!l)throw new Error(`Couldn't find path constraint ${o} for skin ${a.name}.`);h.constraints.push(l)}if(a.physics)for(let c=0;c<a.physics.length;c++){const o=a.physics[c],l=s.findConstraint(o,Se);if(!l)throw new Error(`Couldn't find physics constraint ${o} for skin ${a.name}.`);h.constraints.push(l)}if(a.slider)for(let c=0;c<a.slider.length;c++){const o=a.slider[c],l=s.findConstraint(o,Gt);if(!l)throw new Error(`Couldn't find slider constraint ${o} for skin ${a.name}.`);h.constraints.push(l)}for(const c in a.attachments){const o=s.findSlot(c);if(!o)throw new Error(`Couldn't find skin slot ${c} for skin ${a.name}.`);const l=a.attachments[c];for(const d in l){const m=this.readAttachment(l[d],h,o.index,d,s);m&&h.setAttachment(o.index,d,m)}}s.skins.push(h),h.name==="default"&&(s.defaultSkin=h)}for(let r=0,a=this.linkedMeshes.length;r<a;r++){const h=this.linkedMeshes[r],c=h.skin?s.findSkin(h.skin):s.defaultSkin;if(!c)throw new Error(`Skin not found: ${h.skin}`);const o=c.getAttachment(h.sourceIndex,h.source);if(!o)throw new Error(`Source mesh not found: ${h.source}`);h.mesh.timelineAttachment=h.inheritTimelines?o:h.mesh,h.mesh.setSourceMesh(o),h.mesh.updateSequence();t:if(h.inheritTimelines&&h.slotIndex!==h.sourceIndex){const l=o.timelineSlots;for(const m of l)if(m===h.slotIndex)break t;const d=[...l];d[l.length]=h.slotIndex,o.timelineSlots=d}}if(this.linkedMeshes.length=0,i.events)for(const r in i.events){const a=i.events[r],h=new si(r),c=h.setupPose;c.intValue=M(a,"int",0),c.floatValue=M(a,"float",0),c.stringValue=M(a,"string",""),h._audioPath=M(a,"audio",null),h.audioPath&&(c.volume=M(a,"volume",c.volume),c.balance=M(a,"balance",c.balance)),s.events.push(h)}if(i.animations)for(const r in i.animations){const a=i.animations[r];this.readAnimation(a,r,s)}if(i.constraints)for(const r in i.constraints){const a=i.constraints[r];if(a.type==="slider"){const h=s.findConstraint(a.name,Gt),c=a.animation,o=s.findAnimation(c);if(!o)throw new Error(`Slider animation not found: ${c}`);h.animation=o}}return s}fromProperty(e){let t;switch(e){case"rotate":t=new _e;break;case"x":t=new He;break;case"y":t=new je;break;case"scaleX":t=new Ze;break;case"scaleY":t=new $e;break;case"shearY":t=new Ke;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,s,i,n){const r=this.scale,a=M(e,"name",i);switch(M(e,"type","region")){case"region":{const h=M(e,"path",a),c=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,i,a,h,c);if(!o)return null;o.path=h,o.x=M(e,"x",0)*r,o.y=M(e,"y",0)*r,o.scaleX=M(e,"scaleX",1),o.scaleY=M(e,"scaleY",1),o.rotation=M(e,"rotation",0),o.width=e.width*r,o.height=e.height*r;const l=M(e,"color",null);return l&&o.color.setFromString(l),o.updateSequence(),o}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(t,i,a);if(!h)return null;this.readVertices(e,h,e.vertexCount<<1);const c=M(e,"color",null);return c&&h.color.setFromString(c),h}case"mesh":case"linkedmesh":{const h=M(e,"path",a),c=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,i,a,h,c);if(!o)return null;o.path=h;const l=M(e,"color",null);l&&o.color.setFromString(l),o.width=M(e,"width",0)*r,o.height=M(e,"height",0)*r;const d=M(e,"source",null);if(d){let f=s;const u=M(e,"slot",null);if(u){const p=n.findSlot(u);if(!p)throw new Error(`Source mesh slot not found: ${u}`);f=p.index}return this.linkedMeshes.push(new kr(o,M(e,"skin",null),s,f,d,M(e,"timelines",!0))),o}const m=e.uvs;return this.readVertices(e,o,m.length),o.triangles=e.triangles,o.regionUVs=m,o.edges=M(e,"edges",null),o.hullLength=M(e,"hull",0)*2,o.updateSequence(),o}case"path":{const h=this.attachmentLoader.newPathAttachment(t,i,a);if(!h)return null;h.closed=M(e,"closed",!1),h.constantSpeed=M(e,"constantSpeed",!0);const c=e.vertexCount;this.readVertices(e,h,c<<1);const o=O.newArray(c/3,0);for(let d=0;d<e.lengths.length;d++)o[d]=e.lengths[d]*r;h.lengths=o;const l=M(e,"color",null);return l&&h.color.setFromString(l),h}case"point":{const h=this.attachmentLoader.newPointAttachment(t,i,a);if(!h)return null;h.x=M(e,"x",0)*r,h.y=M(e,"y",0)*r,h.rotation=M(e,"rotation",0);const c=M(e,"color",null);return c&&h.color.setFromString(c),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(t,i,a);if(!h)return null;const c=M(e,"end",null);c&&(h.endSlot=n.findSlot(c)),h.convex=M(e,"convex",!1),h.inverse=M(e,"inverse",!1);const o=e.vertexCount;this.readVertices(e,h,o<<1);const l=M(e,"color",null);return l&&h.color.setFromString(l),h}}return null}readSequence(e){if(e==null)return new ge(1,!1);const t=new ge(M(e,"count",0),!0);return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(e,"setup",0),t}readVertices(e,t,s){const i=this.scale;t.worldVerticesLength=s;const n=e.vertices;if(s===n.length){const h=O.toFloatArray(n);if(i!==1)for(let c=0,o=n.length;c<o;c++)h[c]*=i;t.vertices=h;return}const r=[],a=[];for(let h=0,c=n.length;h<c;){const o=n[h++];a.push(o);for(let l=h+o*4;h<l;h+=4)a.push(n[h]),r.push(n[h+1]*i),r.push(n[h+2]*i),r.push(n[h+3])}t.bones=a,t.vertices=O.toFloatArray(r)}readAnimation(e,t,s){const i=this.scale,n=[];if(e.slots)for(const c in e.slots){const o=e.slots[c],l=s.findSlot(c);if(!l)throw new Error(`Slot not found: ${c}`);const d=l.index;for(const m in o){const f=o[m];if(!f)continue;const u=f.length;switch(m){case"attachment":{const p=new ie(u,d);for(let g=0;g<u;g++){const x=f[g];p.setFrame(g,M(x,"time",0),M(x,"name",null))}n.push(p);break}case"rgba":{const p=new Ss(u,u<<2,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=f[w+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),A=it.fromString(y.color),S=g.curve;S&&(v=dt(S,p,v,w,0,x,T,b.r,A.r,1),v=dt(S,p,v,w,1,x,T,b.g,A.g,1),v=dt(S,p,v,w,2,x,T,b.b,A.b,1),v=dt(S,p,v,w,3,x,T,b.a,A.a,1)),x=T,b=A,g=y}n.push(p);break}case"rgb":{const p=new Cs(u,u*3,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=f[w+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),A=it.fromString(y.color),S=g.curve;S&&(v=dt(S,p,v,w,0,x,T,b.r,A.r,1),v=dt(S,p,v,w,1,x,T,b.g,A.g,1),v=dt(S,p,v,w,2,x,T,b.b,A.b,1)),x=T,b=A,g=y}n.push(p);break}case"alpha":{It(n,f,new Is(u,u,d),0,1);break}case"rgba2":{const p=new Ms(u,u*7,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.light),w=it.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const A=M(T,"time",0),S=it.fromString(T.light),C=it.fromString(T.dark),I=g.curve;I&&(y=dt(I,p,y,v,0,x,A,b.r,S.r,1),y=dt(I,p,y,v,1,x,A,b.g,S.g,1),y=dt(I,p,y,v,2,x,A,b.b,S.b,1),y=dt(I,p,y,v,3,x,A,b.a,S.a,1),y=dt(I,p,y,v,4,x,A,w.r,C.r,1),y=dt(I,p,y,v,5,x,A,w.g,C.g,1),y=dt(I,p,y,v,6,x,A,w.b,C.b,1)),x=A,b=S,w=C,g=T}n.push(p);break}case"rgb2":{const p=new Es(u,u*6,d);let g=f[0],x=M(g,"time",0),b=it.fromString(g.light),w=it.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const A=M(T,"time",0),S=it.fromString(T.light),C=it.fromString(T.dark),I=g.curve;I&&(y=dt(I,p,y,v,0,x,A,b.r,S.r,1),y=dt(I,p,y,v,1,x,A,b.g,S.g,1),y=dt(I,p,y,v,2,x,A,b.b,S.b,1),y=dt(I,p,y,v,3,x,A,w.r,C.r,1),y=dt(I,p,y,v,4,x,A,w.g,C.g,1),y=dt(I,p,y,v,5,x,A,w.b,C.b,1)),x=A,b=S,w=C,g=T}n.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${f.name} (${o.name})`)}}}if(e.bones)for(const c in e.bones){const o=e.bones[c],l=s.findBone(c);if(!l)throw new Error(`Bone not found: ${c}`);const d=l.index;for(const m in o){const f=o[m],u=f.length;if(u!==0)switch(m){case"rotate":It(n,f,new xe(u,u,d),0,1);break;case"translate":bi(n,f,new ms(u,u<<1,d),"x","y",0,i);break;case"translatex":It(n,f,new gs(u,u,d),0,i);break;case"translatey":It(n,f,new ps(u,u,d),0,i);break;case"scale":bi(n,f,new xs(u,u<<1,d),"x","y",1,1);break;case"scalex":It(n,f,new bs(u,u,d),1,1);break;case"scaley":It(n,f,new ws(u,u,d),1,1);break;case"shear":bi(n,f,new ys(u,u<<1,d),"x","y",0,1);break;case"shearx":It(n,f,new vs(u,u,d),0,1);break;case"sheary":It(n,f,new Ts(u,u,d),0,1);break;case"inherit":{const p=new As(u,l.index);for(let g=0;g<f.length;g++){const x=f[g];p.setFrame(g,M(x,"time",0),O.enumValue(Xe,M(x,"inherit","Normal")))}n.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${f.name} (${o.name})`)}}}if(e.ik)for(const c in e.ik){const o=e.ik[c];let l=o[0];if(!l)continue;const d=s.findConstraint(c,Te);if(!d)throw new Error(`IK Constraint not found: ${c}`);const m=new Fs(o.length,o.length<<1,s.constraints.indexOf(d));let f=M(l,"time",0),u=M(l,"mix",1),p=M(l,"softness",0)*i;for(let g=0,x=0;;g++){m.setFrame(g,f,u,p,M(l,"bendPositive",!0)?1:-1,M(l,"compress",!1),M(l,"stretch",!1));const b=o[g+1];if(!b){m.shrink(x);break}const w=M(b,"time",0),v=M(b,"mix",1),y=M(b,"softness",0)*i,T=l.curve;T&&(x=dt(T,m,x,g,0,f,w,u,v,1),x=dt(T,m,x,g,1,f,w,p,y,i)),f=w,u=v,p=y,l=b}n.push(m)}if(e.transform)for(const c in e.transform){const o=e.transform[c];let l=o[0];if(!l)continue;const d=s.findConstraint(c,ft);if(!d)throw new Error(`Transform constraint not found: ${c}`);const m=new Ls(o.length,o.length*6,s.constraints.indexOf(d));let f=M(l,"time",0),u=M(l,"mixRotate",1),p=M(l,"mixX",1),g=M(l,"mixY",p),x=M(l,"mixScaleX",1),b=M(l,"mixScaleY",1),w=M(l,"mixShearY",1);for(let v=0,y=0;;v++){m.setFrame(v,f,u,p,g,x,b,w);const T=o[v+1];if(!T){m.shrink(y);break}const A=M(T,"time",0),S=M(T,"mixRotate",1),C=M(T,"mixX",1),I=M(T,"mixY",C),Y=M(T,"mixScaleX",1),F=M(T,"mixScaleY",1),k=M(T,"mixShearY",1),X=l.curve;X&&(y=dt(X,m,y,v,0,f,A,u,S,1),y=dt(X,m,y,v,1,f,A,p,C,1),y=dt(X,m,y,v,2,f,A,g,I,1),y=dt(X,m,y,v,3,f,A,x,Y,1),y=dt(X,m,y,v,4,f,A,b,F,1),y=dt(X,m,y,v,5,f,A,w,k,1)),f=A,u=S,p=C,g=I,x=Y,b=F,w=k,l=T}n.push(m)}if(e.path)for(const c in e.path){const o=e.path[c],l=s.findConstraint(c,Ae);if(!l)throw new Error(`Path constraint not found: ${c}`);const d=s.constraints.indexOf(l);for(const m in o){const f=o[m];let u=f[0];if(!u)continue;const p=f.length;switch(m){case"position":{const g=new Ps(p,p,d);It(n,f,g,0,l.positionMode===0?i:1);break}case"spacing":{const g=new Xs(p,p,d);It(n,f,g,0,l.spacingMode===0||l.spacingMode===1?i:1);break}case"mix":{const g=new ks(p,p*3,d);let x=M(u,"time",0),b=M(u,"mixRotate",1),w=M(u,"mixX",1),v=M(u,"mixY",w);for(let y=0,T=0;;y++){g.setFrame(y,x,b,w,v);const A=f[y+1];if(!A){g.shrink(T);break}const S=M(A,"time",0),C=M(A,"mixRotate",1),I=M(A,"mixX",1),Y=M(A,"mixY",I),F=u.curve;F&&(T=dt(F,g,T,y,0,x,S,b,C,1),T=dt(F,g,T,y,1,x,S,w,I,1),T=dt(F,g,T,y,2,x,S,v,Y,1)),x=S,b=C,w=I,v=Y,u=A}n.push(g);break}}}}if(e.physics)for(const c in e.physics){const o=e.physics[c];let l=-1;if(c.length>0){const d=s.findConstraint(c,Se);if(!d)throw new Error(`Physics constraint not found: ${c}`);l=s.constraints.indexOf(d)}for(const d in o){const m=o[d];let f=m[0];if(!f)continue;const u=m.length;let p,g=0;if(d==="reset"){const x=new qs(u,l);for(let b=0;f!=null;f=m[b+1],b++)x.setFrame(b,M(f,"time",0));n.push(x);continue}switch(d){case"inertia":p=new Vs(u,u,l);break;case"strength":p=new Bs(u,u,l);break;case"damping":p=new Os(u,u,l);break;case"mass":p=new Us(u,u,l);break;case"wind":p=new Ns(u,u,l);break;case"gravity":p=new Ds(u,u,l);break;case"mix":{g=1,p=new zs(u,u,l);break}default:continue}It(n,m,p,g,1)}}if(e.slider)for(const c in e.slider){const o=e.slider[c],l=s.findConstraint(c,Gt);if(!l)throw new Error(`Slider not found: ${c}`);const d=s.constraints.indexOf(l);for(const m in o){const f=o[m];if(!f[0])continue;const p=f.length;switch(m){case"time":It(n,f,new Ws(p,p,d),1,1);break;case"mix":It(n,f,new Gs(p,p,d),1,1);break}}}if(e.attachments)for(const c in e.attachments){const o=e.attachments[c],l=s.findSkin(c);if(!l)throw new Error(`Skin not found: ${c}`);for(const d in o){const m=o[d],f=s.findSlot(d);if(!f)throw new Error(`Attachment slot not found: ${d}`);const u=f.index;for(const p in m){const g=m[p],x=l.getAttachment(u,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let v=w[0];if(v){if(b==="deform"){const y=x.bones,T=x.vertices,A=y?T.length/3*2:T.length,S=new Ys(w.length,w.length,u,x);let C=M(v,"time",0);for(let I=0,Y=0;;I++){let F;const k=M(v,"vertices",null);if(!k)F=y?O.newFloatArray(A):T;else{F=O.newFloatArray(A);const q=M(v,"offset",0);if(O.arrayCopy(k,0,F,q,k.length),i!==1)for(let U=q,P=U+k.length;U<P;U++)F[U]*=i;if(!y)for(let U=0;U<A;U++)F[U]+=T[U]}S.setFrame(I,C,F);const X=w[I+1];if(!X){S.shrink(Y);break}const R=M(X,"time",0),V=v.curve;V&&(Y=dt(V,S,Y,I,0,C,R,0,1,1)),C=R,v=X}n.push(S)}else if(b==="sequence"){const y=new Rs(w.length,u,x);let T=0;for(let A=0;A<w.length;A++){const S=M(v,"delay",T),C=M(v,"time",0),I=fs[M(v,"mode","hold")],Y=M(v,"index",0);y.setFrame(A,C,I,Y,S),T=S,v=w[A+1]}n.push(y)}}}}}}if(e.drawOrder){const c=new jt(e.drawOrder.length),o=s.slots.length;let l=0;for(const d of e.drawOrder)c.setFrame(l++,M(d,"time",0),hn(s,d,o,null));n.push(c)}if(e.drawOrderFolder)for(const c of e.drawOrderFolder){const o=M(c,"slots",[]),l=new Array(o.length);let d=0;for(const p of o){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);l[d++]=g.index}const m=M(c,"keys",[]),f=new we(m.length,l,s.slots.length);let u=0;for(const p of m)f.setFrame(u++,M(p,"time",0),hn(s,p,l.length,l));n.push(f)}if(e.events){const c=new Le(e.events.length);let o=0;for(let l=0;l<e.events.length;l++,o++){const d=e.events[l],m=s.findEvent(d.name);if(!m)throw new Error(`Event not found: ${d.name}`);const f=m.setupPose,u=new Oe(O.toSinglePrecision(M(d,"time",0)),m);u.intValue=M(d,"int",f.intValue),u.floatValue=M(d,"float",f.floatValue),u.stringValue=M(d,"string",f.stringValue),u.data.audioPath&&(u.volume=M(d,"volume",f.volume),u.balance=M(d,"balance",f.volume)),c.setFrame(o,u)}n.push(c)}let r=0;for(let c=0,o=n.length;c<o;c++)r=Math.max(r,n[c].getDuration());const a=new Re(t,n,r),h=M(e,"color",null);h!==null&&a.color.setFromString(h),s.animations.push(a)}},kr=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,i,n,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.sourceIndex=i,this.source=n,this.inheritTimelines=r}};function It(e,t,s,i,n){let r=t[0],a=r.time??0,h=(r.value??i)*n,c=0;for(let o=0;;o++){s.setFrame(o,a,h);const l=t[o+1];if(!l){s.shrink(c),e.push(s);return}const d=l.time??0,m=(l.value??i)*n;r.curve&&(c=dt(r.curve,s,c,o,0,a,d,h,m,n)),a=d,h=m,r=l}}function bi(e,t,s,i,n,r,a){let h=t[0],c=h.time??0,o=(h[i]??r)*a,l=(h[n]??r)*a,d=0;for(let m=0;;m++){s.setFrame(m,c,o,l);const f=t[m+1];if(!f){s.shrink(d),e.push(s);return}const u=f.time??0,p=(f[i]??r)*a,g=(f[n]??r)*a,x=h.curve;x&&(d=dt(x,s,d,m,0,c,u,o,p,a),d=dt(x,s,d,m,1,c,u,l,g,a)),c=u,o=p,l=g,h=f}}function hn(e,t,s,i){const n=t.offsets;if(!n)return null;const r=new Array(s).fill(-1),a=new Array(s-n.length);let h=0,c=0;for(const o of n){const l=e.findSlot(o.slot);if(l==null)throw new Error(`Draw order slot not found: ${o.slot}`);let d=0;if(!i)d=l.index;else{d=-1;for(let m=0;m<s;m++)if(i[m]===l.index){d=m;break}if(d===-1)throw new Error(`Slot not in folder: ${o.slot}`)}for(;h!==d;)a[c++]=h++;r[h+o.offset]=h++}for(;h<s;)a[c++]=h++;for(let o=s-1;o>=0;o--)r[o]===-1&&(r[o]=a[--c]);return r}function dt(e,t,s,i,n,r,a,h,c,o){if(e==="stepped")return t.setStepped(i),s;const l=n<<2,d=e[l],m=e[l+1]*o,f=e[l+2],u=e[l+3]*o;return t.setBezier(s,i,n,r,h,d,m,f,u,a,c),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}var Vr=class{commandPool=new Br;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new xi;renderCommands=[];render(e,t=!1,s,i=2){this.commandPool.reset(),this.renderCommands.length=0;const n=this.clipping,r=e.drawOrder.appliedPose;for(let a=0;a<e.slots.length;a++){const h=r[a],c=h.appliedPose.attachment;if(!c){n.clipEnd(h);continue}const o=h.appliedPose,l=o.color;if((l.a===0||!h.bone.active)&&!(c instanceof Zt)){n.clipEnd(h);continue}let m,f,u,p,g,x,b;if(c instanceof zt){if(x=c.color,x.a===0){n.clipEnd(h);continue}const A=c.sequence,S=A.resolveIndex(o);c.computeWorldVertices(h,c.getOffsets(o),this.worldVertices,0,i),m=this.worldVertices,f=4,u=A.getUVs(S),p=this.quadIndices,g=6,b=A.regions[S]?.texture}else if(c instanceof Ut){if(x=c.color,x.a===0){n.clipEnd(h);continue}this.worldVertices.length<c.worldVerticesLength&&(this.worldVertices=new Float32Array(c.worldVerticesLength)),c.computeWorldVertices(e,h,0,c.worldVerticesLength,this.worldVertices,0,i),m=this.worldVertices,f=c.worldVerticesLength>>1;const A=c.sequence,S=A.resolveIndex(o);u=A.getUVs(S),p=c.triangles,g=p.length,b=A.regions[S]?.texture}else if(c instanceof Zt){n.clipStart(e,h,c);continue}else continue;const w=e.color;let v,y;if(t){let A;if(s){A=Math.floor(s[3]*w.a*l.a*x.a*255);const S=Math.floor(A*s[0]*w.r*l.r*x.r),C=Math.floor(A*s[1]*w.g*l.g*x.g),I=Math.floor(A*s[2]*w.b*l.b*x.b);v=A<<24|S<<16|C<<8|I}else{A=Math.floor(w.a*l.a*x.a*255);const S=Math.floor(A*w.r*l.r*x.r),C=Math.floor(A*w.g*l.g*x.g),I=Math.floor(A*w.b*l.b*x.b);v=A<<24|S<<16|C<<8|I}if(y=4278190080,o.darkColor){const{r:S,g:C,b:I}=o.darkColor;y=4278190080|Math.floor(S*A)<<16|Math.floor(C*A)<<8|Math.floor(I*A)}}else{if(s){const A=Math.floor(s[3]*w.a*l.a*x.a*255),S=Math.floor(s[0]*w.r*l.r*x.r*255),C=Math.floor(s[1]*w.g*l.g*x.g*255),I=Math.floor(s[2]*w.b*l.b*x.b*255);v=A<<24|S<<16|C<<8|I}else{const A=Math.floor(w.a*l.a*x.a*255),S=Math.floor(w.r*l.r*x.r*255),C=Math.floor(w.g*l.g*x.g*255),I=Math.floor(w.b*l.b*x.b*255);v=A<<24|S<<16|C<<8|I}if(y=0,o.darkColor){const{r:A,g:S,b:C}=o.darkColor;y=Math.floor(A*255)<<16|Math.floor(S*255)<<8|Math.floor(C*255)}}n.isClipping()&&(n.clipTrianglesUnpacked(m,0,p,g,u,i),m=n.clippedVerticesTyped,f=n.clippedVerticesLength/i,u=n.clippedUVsTyped,p=n.clippedTrianglesTyped,g=n.clippedTrianglesLength);const T=this.commandPool.getCommand(f,g,i);T.blendMode=h.data.blendMode,T.texture=b,T.positions.set(m.subarray(0,f*i)),T.uvs.set(u.subarray(0,f<<1));for(let A=0;A<f;A++)T.colors[A]=v,T.darkColors[A]=y;p instanceof Uint16Array?T.indices.set(p.subarray(0,g)):T.indices.set(p.slice(0,g)),this.renderCommands.push(T),n.clipEnd(h)}return n.clipEnd(),this.batchCommands(i)}batchSubCommands(e,t,s,i,n,r){const a=e[t],h=this.commandPool.getCommand(i,n,r);h.blendMode=a.blendMode,h.texture=a.texture;let c=0,o=0,l=0,d=0,m=0;for(let f=t;f<=s;f++){const u=e[f];h.positions.set(u.positions,c),c+=u.numVertices*r,h.uvs.set(u.uvs,o),o+=u.numVertices<<1,h.colors.set(u.colors,l),h.darkColors.set(u.darkColors,l),l+=u.numVertices;for(let p=0;p<u.numIndices;p++)h.indices[d+p]=u.indices[p]+m;d+=u.numIndices,m+=u.numVertices}return h}batchCommands(e){if(this.renderCommands.length===0)return;let t,s,i=this.renderCommands[0],n=0,r=1,a=i.numVertices,h=i.numIndices;for(;r<=this.renderCommands.length;){const c=r<this.renderCommands.length?this.renderCommands[r]:null;if(c&&c.numVertices===0&&c.numIndices===0){r++;continue}if(c!==null&&c.texture===i.texture&&c.blendMode===i.blendMode&&c.colors[0]===i.colors[0]&&c.darkColors[0]===i.darkColors[0]&&h+c.numIndices<65535)a+=c.numVertices,h+=c.numIndices;else{const l=this.batchSubCommands(this.renderCommands,n,r-1,a,h,e);if(s?(s.next=l,s=l):t=s=l,r===this.renderCommands.length)break;i=this.renderCommands[r],n=r,a=i.numVertices,h=i.numIndices}r++}return t}},Br=class{pool=[];inUse=[];getCommand(e,t,s){let i;for(const n of this.pool)if(n._positions.length>=e*s&&n._indices.length>=t){i=n;break}if(i)this.pool.splice(this.pool.indexOf(i),1),i.next=void 0,i.numVertices=e,i.numIndices=t,i.positions=i._positions.subarray(0,e*s),i.uvs=i._uvs.subarray(0,e<<1),i.colors=i._colors.subarray(0,e),i.darkColors=i._darkColors.subarray(0,e),i.indices=i._indices.subarray(0,t);else{const n=new Float32Array(e*s),r=new Float32Array(e<<1),a=new Uint32Array(e),h=new Uint32Array(e),c=new Uint16Array(t);i={positions:n,uvs:r,colors:a,darkColors:h,indices:c,_positions:n,_uvs:r,_colors:a,_darkColors:h,_indices:c,numVertices:e,numIndices:t,blendMode:0,texture:null}}return this.inUse.push(i),i}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},Tt=class{canvas;gl;restorables=[];constructor(e,t={alpha:!0}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{const s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=e=>{e&&e.preventDefault()};contextRestoredHandler=()=>{for(let e=0,t=this.restorables.length;e<t;e++)this.restorables[e].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(e){this.restorables.push(e)}removeRestorable(e){const t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},ae=class Fi extends cs{context;texture=null;boundUnit=0;pma;useMipMaps;constructor(t,s,i,n=!1){super(s),this.context=t instanceof Tt?t:new Tt(t),this.pma=i,this.useMipMaps=n,this.restore(),this.context.addRestorable(this)}setFilters(t,s){const i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Fi.validateMagFilter(s)),this.useMipMaps=Fi.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case 9987:case 9985:case 9986:case 9984:return 9729;default:return t}}static usesMipMaps(t){switch(t){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(t,s){const i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(t){const s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind();const i=s.getParameter(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!this.pma),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this._image),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,t?s.LINEAR_MIPMAP_LINEAR:s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),t&&s.generateMipmap(s.TEXTURE_2D),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){const s=this.context.gl;this.boundUnit=t,s.activeTexture(s.TEXTURE0+t),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){const t=this.context.gl;t.activeTexture(t.TEXTURE0+this.boundUnit),t.bindTexture(t.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},dn=class extends Hi{constructor(e,t="",s=new Ks){super((i,n=!1)=>new ae(e,i,n),t,s)}},Yt=class{x=0;y=0;z=0;constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,s){return this.x=e,this.y=t,this.z=s,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}normalize(){let e=this.length();return e===0?this:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this)}cross(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}multiply(e){const t=e.values;return this.set(this.x*t[G]+this.y*t[K]+this.z*t[J]+t[_],this.x*t[Q]+this.y*t[H]+this.z*t[tt]+t[j],this.x*t[et]+this.y*t[st]+this.z*t[Z]+t[$])}project(e){const t=e.values,s=1/(this.x*t[rt]+this.y*t[ot]+this.z*t[at]+t[nt]);return this.set((this.x*t[G]+this.y*t[K]+this.z*t[J]+t[_])*s,(this.x*t[Q]+this.y*t[H]+this.z*t[tt]+t[j])*s,(this.x*t[et]+this.y*t[st]+this.z*t[Z]+t[$])*s)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(e){const t=e.x-this.x,s=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+s*s+i*i)}},G=0,K=4,J=8,_=12,Q=1,H=5,tt=9,j=13,et=2,st=6,Z=10,$=14,rt=3,ot=7,at=11,nt=15,Ce=class Xt{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new Yt;static yAxis=new Yt;static zAxis=new Yt;static tmpMatrix=new Xt;constructor(){const t=this.values;t[G]=1,t[H]=1,t[Z]=1,t[nt]=1}set(t){return this.values.set(t),this}transpose(){const t=this.temp,s=this.values;return t[G]=s[G],t[K]=s[Q],t[J]=s[et],t[_]=s[rt],t[Q]=s[K],t[H]=s[H],t[tt]=s[st],t[j]=s[ot],t[et]=s[J],t[st]=s[tt],t[Z]=s[Z],t[$]=s[at],t[rt]=s[_],t[ot]=s[j],t[at]=s[$],t[nt]=s[nt],this.set(t)}identity(){const t=this.values;return t[G]=1,t[K]=0,t[J]=0,t[_]=0,t[Q]=0,t[H]=1,t[tt]=0,t[j]=0,t[et]=0,t[st]=0,t[Z]=1,t[$]=0,t[rt]=0,t[ot]=0,t[at]=0,t[nt]=1,this}invert(){const t=this.values,s=this.temp,i=t[rt]*t[st]*t[tt]*t[_]-t[et]*t[ot]*t[tt]*t[_]-t[rt]*t[H]*t[Z]*t[_]+t[Q]*t[ot]*t[Z]*t[_]+t[et]*t[H]*t[at]*t[_]-t[Q]*t[st]*t[at]*t[_]-t[rt]*t[st]*t[J]*t[j]+t[et]*t[ot]*t[J]*t[j]+t[rt]*t[K]*t[Z]*t[j]-t[G]*t[ot]*t[Z]*t[j]-t[et]*t[K]*t[at]*t[j]+t[G]*t[st]*t[at]*t[j]+t[rt]*t[H]*t[J]*t[$]-t[Q]*t[ot]*t[J]*t[$]-t[rt]*t[K]*t[tt]*t[$]+t[G]*t[ot]*t[tt]*t[$]+t[Q]*t[K]*t[at]*t[$]-t[G]*t[H]*t[at]*t[$]-t[et]*t[H]*t[J]*t[nt]+t[Q]*t[st]*t[J]*t[nt]+t[et]*t[K]*t[tt]*t[nt]-t[G]*t[st]*t[tt]*t[nt]-t[Q]*t[K]*t[Z]*t[nt]+t[G]*t[H]*t[Z]*t[nt];if(i===0)throw new Error("non-invertible matrix");const n=1/i;return s[G]=t[tt]*t[$]*t[ot]-t[j]*t[Z]*t[ot]+t[j]*t[st]*t[at]-t[H]*t[$]*t[at]-t[tt]*t[st]*t[nt]+t[H]*t[Z]*t[nt],s[K]=t[_]*t[Z]*t[ot]-t[J]*t[$]*t[ot]-t[_]*t[st]*t[at]+t[K]*t[$]*t[at]+t[J]*t[st]*t[nt]-t[K]*t[Z]*t[nt],s[J]=t[J]*t[j]*t[ot]-t[_]*t[tt]*t[ot]+t[_]*t[H]*t[at]-t[K]*t[j]*t[at]-t[J]*t[H]*t[nt]+t[K]*t[tt]*t[nt],s[_]=t[_]*t[tt]*t[st]-t[J]*t[j]*t[st]-t[_]*t[H]*t[Z]+t[K]*t[j]*t[Z]+t[J]*t[H]*t[$]-t[K]*t[tt]*t[$],s[Q]=t[j]*t[Z]*t[rt]-t[tt]*t[$]*t[rt]-t[j]*t[et]*t[at]+t[Q]*t[$]*t[at]+t[tt]*t[et]*t[nt]-t[Q]*t[Z]*t[nt],s[H]=t[J]*t[$]*t[rt]-t[_]*t[Z]*t[rt]+t[_]*t[et]*t[at]-t[G]*t[$]*t[at]-t[J]*t[et]*t[nt]+t[G]*t[Z]*t[nt],s[tt]=t[_]*t[tt]*t[rt]-t[J]*t[j]*t[rt]-t[_]*t[Q]*t[at]+t[G]*t[j]*t[at]+t[J]*t[Q]*t[nt]-t[G]*t[tt]*t[nt],s[j]=t[J]*t[j]*t[et]-t[_]*t[tt]*t[et]+t[_]*t[Q]*t[Z]-t[G]*t[j]*t[Z]-t[J]*t[Q]*t[$]+t[G]*t[tt]*t[$],s[et]=t[H]*t[$]*t[rt]-t[j]*t[st]*t[rt]+t[j]*t[et]*t[ot]-t[Q]*t[$]*t[ot]-t[H]*t[et]*t[nt]+t[Q]*t[st]*t[nt],s[st]=t[_]*t[st]*t[rt]-t[K]*t[$]*t[rt]-t[_]*t[et]*t[ot]+t[G]*t[$]*t[ot]+t[K]*t[et]*t[nt]-t[G]*t[st]*t[nt],s[Z]=t[K]*t[j]*t[rt]-t[_]*t[H]*t[rt]+t[_]*t[Q]*t[ot]-t[G]*t[j]*t[ot]-t[K]*t[Q]*t[nt]+t[G]*t[H]*t[nt],s[$]=t[_]*t[H]*t[et]-t[K]*t[j]*t[et]-t[_]*t[Q]*t[st]+t[G]*t[j]*t[st]+t[K]*t[Q]*t[$]-t[G]*t[H]*t[$],s[rt]=t[tt]*t[st]*t[rt]-t[H]*t[Z]*t[rt]-t[tt]*t[et]*t[ot]+t[Q]*t[Z]*t[ot]+t[H]*t[et]*t[at]-t[Q]*t[st]*t[at],s[ot]=t[K]*t[Z]*t[rt]-t[J]*t[st]*t[rt]+t[J]*t[et]*t[ot]-t[G]*t[Z]*t[ot]-t[K]*t[et]*t[at]+t[G]*t[st]*t[at],s[at]=t[J]*t[H]*t[rt]-t[K]*t[tt]*t[rt]-t[J]*t[Q]*t[ot]+t[G]*t[tt]*t[ot]+t[K]*t[Q]*t[at]-t[G]*t[H]*t[at],s[nt]=t[K]*t[tt]*t[et]-t[J]*t[H]*t[et]+t[J]*t[Q]*t[st]-t[G]*t[tt]*t[st]-t[K]*t[Q]*t[Z]+t[G]*t[H]*t[Z],t[G]=s[G]*n,t[K]=s[K]*n,t[J]=s[J]*n,t[_]=s[_]*n,t[Q]=s[Q]*n,t[H]=s[H]*n,t[tt]=s[tt]*n,t[j]=s[j]*n,t[et]=s[et]*n,t[st]=s[st]*n,t[Z]=s[Z]*n,t[$]=s[$]*n,t[rt]=s[rt]*n,t[ot]=s[ot]*n,t[at]=s[at]*n,t[nt]=s[nt]*n,this}determinant(){const t=this.values;return t[rt]*t[st]*t[tt]*t[_]-t[et]*t[ot]*t[tt]*t[_]-t[rt]*t[H]*t[Z]*t[_]+t[Q]*t[ot]*t[Z]*t[_]+t[et]*t[H]*t[at]*t[_]-t[Q]*t[st]*t[at]*t[_]-t[rt]*t[st]*t[J]*t[j]+t[et]*t[ot]*t[J]*t[j]+t[rt]*t[K]*t[Z]*t[j]-t[G]*t[ot]*t[Z]*t[j]-t[et]*t[K]*t[at]*t[j]+t[G]*t[st]*t[at]*t[j]+t[rt]*t[H]*t[J]*t[$]-t[Q]*t[ot]*t[J]*t[$]-t[rt]*t[K]*t[tt]*t[$]+t[G]*t[ot]*t[tt]*t[$]+t[Q]*t[K]*t[at]*t[$]-t[G]*t[H]*t[at]*t[$]-t[et]*t[H]*t[J]*t[nt]+t[Q]*t[st]*t[J]*t[nt]+t[et]*t[K]*t[tt]*t[nt]-t[G]*t[st]*t[tt]*t[nt]-t[Q]*t[K]*t[Z]*t[nt]+t[G]*t[H]*t[Z]*t[nt]}translate(t,s,i){const n=this.values;return n[_]+=t,n[j]+=s,n[$]+=i,this}copy(){return new Xt().set(this.values)}projection(t,s,i,n){this.identity();const r=1/Math.tan(i*(Math.PI/180)/2),a=(s+t)/(t-s),h=2*s*t/(t-s),c=this.values;return c[G]=r/n,c[Q]=0,c[et]=0,c[rt]=0,c[K]=0,c[H]=r,c[st]=0,c[ot]=0,c[J]=0,c[tt]=0,c[Z]=a,c[at]=-1,c[_]=0,c[j]=0,c[$]=h,c[nt]=0,this}ortho2d(t,s,i,n){return this.ortho(t,t+i,s,s+n,0,1)}ortho(t,s,i,n,r,a){this.identity();const h=2/(s-t),c=2/(n-i),o=-2/(a-r),l=-(s+t)/(s-t),d=-(n+i)/(n-i),m=-(a+r)/(a-r),f=this.values;return f[G]=h,f[Q]=0,f[et]=0,f[rt]=0,f[K]=0,f[H]=c,f[st]=0,f[ot]=0,f[J]=0,f[tt]=0,f[Z]=o,f[at]=0,f[_]=l,f[j]=d,f[$]=m,f[nt]=1,this}multiply(t){const s=this.temp,i=this.values,n=t.values;return s[G]=i[G]*n[G]+i[K]*n[Q]+i[J]*n[et]+i[_]*n[rt],s[K]=i[G]*n[K]+i[K]*n[H]+i[J]*n[st]+i[_]*n[ot],s[J]=i[G]*n[J]+i[K]*n[tt]+i[J]*n[Z]+i[_]*n[at],s[_]=i[G]*n[_]+i[K]*n[j]+i[J]*n[$]+i[_]*n[nt],s[Q]=i[Q]*n[G]+i[H]*n[Q]+i[tt]*n[et]+i[j]*n[rt],s[H]=i[Q]*n[K]+i[H]*n[H]+i[tt]*n[st]+i[j]*n[ot],s[tt]=i[Q]*n[J]+i[H]*n[tt]+i[tt]*n[Z]+i[j]*n[at],s[j]=i[Q]*n[_]+i[H]*n[j]+i[tt]*n[$]+i[j]*n[nt],s[et]=i[et]*n[G]+i[st]*n[Q]+i[Z]*n[et]+i[$]*n[rt],s[st]=i[et]*n[K]+i[st]*n[H]+i[Z]*n[st]+i[$]*n[ot],s[Z]=i[et]*n[J]+i[st]*n[tt]+i[Z]*n[Z]+i[$]*n[at],s[$]=i[et]*n[_]+i[st]*n[j]+i[Z]*n[$]+i[$]*n[nt],s[rt]=i[rt]*n[G]+i[ot]*n[Q]+i[at]*n[et]+i[nt]*n[rt],s[ot]=i[rt]*n[K]+i[ot]*n[H]+i[at]*n[st]+i[nt]*n[ot],s[at]=i[rt]*n[J]+i[ot]*n[tt]+i[at]*n[Z]+i[nt]*n[at],s[nt]=i[rt]*n[_]+i[ot]*n[j]+i[at]*n[$]+i[nt]*n[nt],this.set(this.temp)}multiplyLeft(t){const s=this.temp,i=this.values,n=t.values;return s[G]=n[G]*i[G]+n[K]*i[Q]+n[J]*i[et]+n[_]*i[rt],s[K]=n[G]*i[K]+n[K]*i[H]+n[J]*i[st]+n[_]*i[ot],s[J]=n[G]*i[J]+n[K]*i[tt]+n[J]*i[Z]+n[_]*i[at],s[_]=n[G]*i[_]+n[K]*i[j]+n[J]*i[$]+n[_]*i[nt],s[Q]=n[Q]*i[G]+n[H]*i[Q]+n[tt]*i[et]+n[j]*i[rt],s[H]=n[Q]*i[K]+n[H]*i[H]+n[tt]*i[st]+n[j]*i[ot],s[tt]=n[Q]*i[J]+n[H]*i[tt]+n[tt]*i[Z]+n[j]*i[at],s[j]=n[Q]*i[_]+n[H]*i[j]+n[tt]*i[$]+n[j]*i[nt],s[et]=n[et]*i[G]+n[st]*i[Q]+n[Z]*i[et]+n[$]*i[rt],s[st]=n[et]*i[K]+n[st]*i[H]+n[Z]*i[st]+n[$]*i[ot],s[Z]=n[et]*i[J]+n[st]*i[tt]+n[Z]*i[Z]+n[$]*i[at],s[$]=n[et]*i[_]+n[st]*i[j]+n[Z]*i[$]+n[$]*i[nt],s[rt]=n[rt]*i[G]+n[ot]*i[Q]+n[at]*i[et]+n[nt]*i[rt],s[ot]=n[rt]*i[K]+n[ot]*i[H]+n[at]*i[st]+n[nt]*i[ot],s[at]=n[rt]*i[J]+n[ot]*i[tt]+n[at]*i[Z]+n[nt]*i[at],s[nt]=n[rt]*i[_]+n[ot]*i[j]+n[at]*i[$]+n[nt]*i[nt],this.set(this.temp)}lookAt(t,s,i){const n=Xt.xAxis,r=Xt.yAxis,a=Xt.zAxis;a.setFrom(s).normalize(),n.setFrom(s).normalize(),n.cross(i).normalize(),r.setFrom(n).cross(a).normalize(),this.identity();const h=this.values;return h[G]=n.x,h[K]=n.y,h[J]=n.z,h[Q]=r.x,h[H]=r.y,h[tt]=r.z,h[et]=-a.x,h[st]=-a.y,h[Z]=-a.z,Xt.tmpMatrix.identity(),Xt.tmpMatrix.values[_]=-t.x,Xt.tmpMatrix.values[j]=-t.y,Xt.tmpMatrix.values[$]=-t.z,this.multiply(Xt.tmpMatrix),this}},fn=class{position=new Yt(0,0,0);direction=new Yt(0,0,-1);up=new Yt(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Ce;inverseProjectionView=new Ce;projection=new Ce;view=new Ce;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){const e=this.projection,t=this.view,s=this.projectionView,i=this.inverseProjectionView,n=this.zoom,r=this.viewportWidth,a=this.viewportHeight;e.ortho(n*(-r/2),n*(r/2),n*(-a/2),n*(a/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),s.set(e.values),s.multiply(t),i.set(s.values).invert()}screenToWorld(e,t,s){const i=e.x,n=s-e.y-1;return e.x=2*i/t-1,e.y=2*n/s-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,s){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=s*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},wi=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=[];autoPreventDefault;isTouch=!1;callbacks;constructor(e,t=!0){this.element=e,this.autoPreventDefault=t,this.callbacks=this.setupCallbacks(e)}setupCallbacks(e){const t=c=>{if(c instanceof MouseEvent&&!this.isTouch){const o=e.getBoundingClientRect();this.mouseX=c.clientX-o.left,this.mouseY=c.clientY-o.top,this.buttonDown=!0,this.listeners.map(l=>{l.down&&l.down(this.mouseX,this.mouseY,c)})}},s=c=>{if(c instanceof MouseEvent&&!this.isTouch){const o=e.getBoundingClientRect();this.mouseX=c.clientX-o.left,this.mouseY=c.clientY-o.top,this.listeners.map(l=>{this.buttonDown?l.dragged&&l.dragged(this.mouseX,this.mouseY,c):l.moved&&l.moved(this.mouseX,this.mouseY,c)})}},i=c=>{if(c instanceof MouseEvent&&!this.isTouch){const o=e.getBoundingClientRect();this.mouseX=c.clientX-o.left,this.mouseY=c.clientY-o.top,this.buttonDown=!1,this.listeners.map(l=>{l.up&&l.up(this.mouseX,this.mouseY,c)})}},n=c=>{this.autoPreventDefault&&c.preventDefault();let o=c.deltaY;c.deltaMode===WheelEvent.DOM_DELTA_LINE&&(o*=8),c.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=24),this.listeners.map(l=>{l.wheel&&l.wheel(o,c)})},r=c=>{if(this.isTouch=!0,!this.touch0||!this.touch1){const l=c.changedTouches.item(0);if(!l)return;const d=e.getBoundingClientRect(),m=l.clientX-d.left,f=l.clientY-d.top,u=new un(l.identifier,m,f);if(this.mouseX=m,this.mouseY=f,this.buttonDown=!0,!this.touch0)this.touch0=u,this.listeners.map(p=>{p.down&&p.down(u.x,u.y,c)});else if(!this.touch1){this.touch1=u;const p=this.touch1.x-this.touch0.x,g=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(p*p+g*g),this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,this.initialPinchDistance,c)})}}this.autoPreventDefault&&c.preventDefault()},a=c=>{if(this.isTouch=!0,this.touch0){const o=c.changedTouches,l=e.getBoundingClientRect();for(let d=0;d<o.length;d++){const m=o[d],f=m.clientX-l.left,u=m.clientY-l.top;this.touch0.identifier===m.identifier&&(this.touch0.x=this.mouseX=f,this.touch0.y=this.mouseY=u,this.listeners.map(p=>{p.dragged&&p.dragged(f,u,c)})),this.touch1&&this.touch1.identifier===m.identifier&&(this.touch1.x=this.mouseX=f,this.touch1.y=this.mouseY=u)}if(this.touch0&&this.touch1){const d=this.touch1.x-this.touch0.x,m=this.touch1.x-this.touch0.x,f=Math.sqrt(d*d+m*m);this.listeners.map(u=>{u.zoom&&u.zoom(this.initialPinchDistance,f,c)})}}this.autoPreventDefault&&c.preventDefault()},h=c=>{this.isTouch=!0;const o=this.touch0;if(o){const l=c.changedTouches,d=e.getBoundingClientRect();for(let m=0;m<l.length;m++){const f=l[m],u=f.clientX-d.left,p=f.clientY-d.top;if(o.identifier===f.identifier)if(this.touch0=null,this.mouseX=u,this.mouseY=p,this.listeners.map(g=>{g.up&&g.up(u,p,c)}),this.touch1){const g=this.touch0=this.touch1;this.touch1=null,this.mouseX=g.x,this.mouseY=g.y,this.buttonDown=!0,this.listeners.map(x=>{x.down&&x.down(g.x,g.y,c)})}else{this.buttonDown=!1;break}this.touch1?.identifier&&(this.touch1=null)}}this.autoPreventDefault&&c.preventDefault()};return e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",r,{passive:!1,capture:!1}),e.addEventListener("touchmove",a,{passive:!1,capture:!1}),e.addEventListener("touchend",h,{passive:!1,capture:!1}),e.addEventListener("touchcancel",h),{mouseDown:t,mouseMove:s,mouseUp:i,mouseWheel:n,touchStart:r,touchMove:a,touchEnd:h}}dispose(){const e=this.element;e.removeEventListener("mousedown",this.callbacks.mouseDown,!0),e.removeEventListener("mousemove",this.callbacks.mouseMove,!0),e.removeEventListener("mouseup",this.callbacks.mouseUp,!0),e.removeEventListener("wheel",this.callbacks.mouseWheel,!0),e.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),e.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),e.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),e.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},un=class{constructor(e,t,s){this.identifier=e,this.x=t,this.y=s}},Or=class{constructor(e,t){this.canvas=e,this.camera=t;let s=0,i=0,n=0,r=0,a=0,h=0,c=0;new wi(e).addListener({down:(o,l)=>{s=t.position.x,i=t.position.y,n=a=o,r=h=l,c=t.zoom},dragged:(o,l)=>{const d=o-n,m=l-r,f=t.screenToWorld(new Yt(0,0),e.clientWidth,e.clientHeight),u=t.screenToWorld(new Yt(d,m),e.clientWidth,e.clientHeight).sub(f);t.position.set(s-u.x,i-u.y,0),t.update(),a=o,h=l},wheel:o=>{const l=o/200*t.zoom,d=t.zoom+l;if(d>0){let m=0,f=0;if(o<0)m=a,f=h;else{const g=new Yt(e.clientWidth/2+15,e.clientHeight/2),x=a-g.x,b=e.clientHeight-1-h-g.y;m=g.x-x,f=e.clientHeight-1-g.y+b}const u=t.screenToWorld(new Yt(m,f),e.clientWidth,e.clientHeight);t.zoom=d,t.update();const p=t.screenToWorld(new Yt(m,f),e.clientWidth,e.clientHeight);t.position.add(u.sub(p)),t.update()}},zoom:(o,l)=>{const d=o/l;t.zoom=c*d},up:(o,l)=>{a=o,h=l},moved:(o,l)=>{a=o,h=l}})}},Lt=class pt{constructor(t,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=t instanceof Tt?t:new Tt(t),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){const t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(s){throw this.dispose(),s}}compileShader(t,s){const i=this.context.gl,n=i.createShader(t);if(!n)throw new Error("Couldn't create shader.");if(i.shaderSource(n,s),i.compileShader(n),!i.getShaderParameter(n,i.COMPILE_STATUS)){const r=`Couldn't compile shader: ${i.getShaderInfoLog(n)}`;if(i.deleteShader(n),!i.isContextLost())throw new Error(r)}return n}compileProgram(t,s){const i=this.context.gl,n=i.createProgram();if(!n)throw new Error("Couldn't compile program.");if(i.attachShader(n,t),i.attachShader(n,s),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS)){const r=`Couldn't compile shader program: ${i.getProgramInfoLog(n)}`;if(i.deleteProgram(n),!i.isContextLost())throw new Error(r)}return n}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,s){this.context.gl.uniform1i(this.getUniformLocation(t),s)}setUniformf(t,s){this.context.gl.uniform1f(this.getUniformLocation(t),s)}setUniform2f(t,s,i){this.context.gl.uniform2f(this.getUniformLocation(t),s,i)}setUniform3f(t,s,i,n){this.context.gl.uniform3f(this.getUniformLocation(t),s,i,n)}setUniform4f(t,s,i,n,r){this.context.gl.uniform4f(this.getUniformLocation(t),s,i,n,r)}setUniform2x2f(t,s){const i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,s){const i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,s){const i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){const s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");const i=s.getUniformLocation(this.program,t);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){const s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");const i=s.getAttribLocation(this.program,t);if(i===-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);const t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){const s=`
|
|
3
3
|
attribute vec4 ${pt.POSITION};
|
|
4
4
|
attribute vec4 ${pt.COLOR};
|
|
5
5
|
attribute vec2 ${pt.TEXCOORDS};
|
|
@@ -81,4 +81,4 @@ varying LOWP vec4 v_color;
|
|
|
81
81
|
void main () {
|
|
82
82
|
gl_FragColor = v_color;
|
|
83
83
|
}
|
|
84
|
-
`;return new pt(t,s,i)}},wi=class{constructor(e,t,s,i){this.attributes=t,this.context=e instanceof Tt?e:new Tt(e),this.elementsPerVertex=0;for(let n=0;n<t.length;n++)this.elementsPerVertex+=t[n].numElements;this.vertices=new Float32Array(s*this.elementsPerVertex),this.indices=new Uint16Array(i),this.context.addRestorable(this)}context;vertices;verticesBuffer=null;verticesLength=0;dirtyVertices=!1;indices;indicesBuffer=null;indicesLength=0;dirtyIndices=!1;elementsPerVertex=0;getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(let t=0;t<this.attributes.length;t++){const s=this.attributes[t];e+=s.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error(`Mesh can't store more than ${this.maxVertices()} vertices`);this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error(`Mesh can't store more than ${this.maxIndices()} indices`);this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){const n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?n.drawElements(t,i,n.UNSIGNED_SHORT,s*2):n.drawArrays(t,s,i),this.unbind(e)}bind(e){const t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],r=e.getAttributeLocation(n.name);t.enableVertexAttribArray(r),t.vertexAttribPointer(r,n.numElements,t.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=n.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){const t=this.context.gl;for(let s=0;s<this.attributes.length;s++){const i=this.attributes[s],n=e.getAttributeLocation(i.name);t.disableVertexAttribArray(n)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){const e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);const e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},le=class{constructor(e,t,s){this.name=e,this.type=t,this.numElements=s}},Qe=class extends le{constructor(){super(Lt.POSITION,0,2)}},Vr=class extends le{constructor(){super(Lt.POSITION,0,3)}},yi=class extends le{constructor(e=0){super(Lt.TEXCOORDS+(e===0?"":e),0,2)}},ts=class extends le{constructor(){super(Lt.COLOR,0,4)}},hn=class extends le{constructor(){super(Lt.COLOR2,0,4)}},dn=(e=>(e[e.Float=0]="Float",e))(dn||{}),Gt=1,Br=769,fn=771,Or=774,vi=class se{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(t,s=!0,i=10920){if(i>10920)throw new Error(`Can't have more than 10920 triangles per batch: ${i}`);this.context=t instanceof Tt?t:new Tt(t);const n=s?[new Qe,new ts,new yi,new hn]:[new Qe,new ts,new yi];this.mesh=new wi(t,n,i,i*3);const r=this.context.gl;this.srcColorBlend=r.SRC_ALPHA,this.srcAlphaBlend=r.ONE,this.dstBlend=r.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,this.lastTexture=null,this.isDrawing=!0;const s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),se.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgbPma:Gt,dstRgb:fn,srcAlpha:Gt},{srcRgbPma:Gt,dstRgb:Gt,srcAlpha:Gt},{srcRgbPma:Or,dstRgb:fn,srcAlpha:Gt},{srcRgbPma:Gt,dstRgb:Br,srcAlpha:Gt}];setBlendMode(t){const s=se.blendModesGL[t],i=s.srcRgbPma,n=s.srcAlpha,r=s.dstRgb;if(this.srcColorBlend===i&&this.srcAlphaBlend===n&&this.dstBlend===r)return;this.srcColorBlend=i,this.srcAlphaBlend=n,this.dstBlend=r,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(i,r,n,r)}draw(t,s,i){t!==this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();const n=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);const r=this.mesh.getIndices();for(let o=this.indicesLength,h=0;h<i.length;o++,h++)r[o]=i[h]+n;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!==0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,se.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;const t=this.context.gl;t.disable(t.BLEND),se.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){const t=se.globalDrawCalls;return se.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},Ti=class{context;isDrawing=!1;mesh;shapeType=4;color=new it(1,1,1,1);shader=null;vertexIndex=0;tmp=new Ee;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error(`Can't have more than 10920 triangles per batch: ${t}`);this.context=e instanceof Tt?e:new Tt(e),this.mesh=new wi(e,[new Qe,new ts],t,0);const s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;const t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,s){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,s,t,s))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,s,i){this.color.set(e,t,s,i)}point(e,t,s){this.check(0,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,n){this.check(1,2),n||(n=this.color),this.vertex(e,t,n),this.vertex(s,i,n)}triangle(e,t,s,i,n,r,o,h,l,a){this.check(e?4:1,3),h||(h=this.color),l||(l=this.color),a||(a=this.color),e?(this.vertex(t,s,h),this.vertex(i,n,l),this.vertex(r,o,a)):(this.vertex(t,s,h),this.vertex(i,n,l),this.vertex(i,n,h),this.vertex(r,o,l),this.vertex(r,o,h),this.vertex(t,s,l))}quad(e,t,s,i,n,r,o,h,l,a,c,d,u){this.check(e?4:1,3),a||(a=this.color),c||(c=this.color),d||(d=this.color),u||(u=this.color),e?(this.vertex(t,s,a),this.vertex(i,n,c),this.vertex(r,o,d),this.vertex(r,o,d),this.vertex(h,l,u),this.vertex(t,s,a)):(this.vertex(t,s,a),this.vertex(i,n,c),this.vertex(i,n,c),this.vertex(r,o,d),this.vertex(r,o,d),this.vertex(h,l,u),this.vertex(h,l,u),this.vertex(t,s,a))}rect(e,t,s,i,n,r){this.quad(e,t,s,t+i,s,t+i,s+n,t,s+n,r,r,r,r)}rectLine(e,t,s,i,n,r,o){this.check(e?4:1,8),o||(o=this.color);const h=this.tmp.set(n-s,t-i);h.normalize(),r*=.5;const l=h.x*r,a=h.y*r;e?(this.vertex(t+l,s+a,o),this.vertex(t-l,s-a,o),this.vertex(i+l,n+a,o),this.vertex(i-l,n-a,o),this.vertex(i+l,n+a,o),this.vertex(t-l,s-a,o)):(this.vertex(t+l,s+a,o),this.vertex(t-l,s-a,o),this.vertex(i+l,n+a,o),this.vertex(i-l,n-a,o),this.vertex(i+l,n+a,o),this.vertex(t+l,s+a,o),this.vertex(i-l,n-a,o),this.vertex(t-l,s-a,o))}x(e,t,s){this.line(e-s,t-s,e+s,t+s),this.line(e-s,t+s,e+s,t-s)}polygon(e,t,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color),t<<=1,s<<=1;const n=e[t],r=e[t+1],o=t+s;for(let h=t,l=t+s-2;h<l;h+=2){const a=e[h],c=e[h+1];let d=0,u=0;h+2>=o?(d=n,u=r):(d=e[h+2],u=e[h+3]),this.vertex(a,c,i),this.vertex(d,u,i)}}circle(e,t,s,i,n,r=0){if(r===0&&(r=Math.max(1,6*B.cbrt(i)|0)),r<=0)throw new Error("segments must be > 0.");n||(n=this.color);const o=2*B.PI/r,h=Math.cos(o),l=Math.sin(o);let a=i,c=0;if(e){this.check(4,r*3+3),r--;for(let d=0;d<r;d++){this.vertex(t,s,n),this.vertex(t+a,s+c,n);const u=a;a=h*a-l*c,c=l*u+h*c,this.vertex(t+a,s+c,n)}this.vertex(t,s,n),this.vertex(t+a,s+c,n)}else{this.check(1,r*2+2);for(let d=0;d<r;d++){this.vertex(t+a,s+c,n);const u=a;a=h*a-l*c,c=l*u+h*c,this.vertex(t+a,s+c,n)}this.vertex(t+a,s+c,n)}a=i,c=0,this.vertex(t+a,s+c,n)}curve(e,t,s,i,n,r,o,h,l,a){this.check(1,l*2+2),a||(a=this.color);const c=1/l,d=c*c,u=c*c*c,f=3*c,m=3*d,p=6*d,g=6*u,x=e-s*2+n,b=t-i*2+r,w=(s-n)*3-e+o,v=(i-r)*3-t+h;let y=e,T=t,A=(s-e)*f+x*m+w*u,S=(i-t)*f+b*m+v*u,C=x*p+w*g,I=b*p+v*g;const Y=w*g,R=v*g;for(;l-- >0;)this.vertex(y,T,a),y+=A,T+=S,A+=C,S+=I,C+=Y,I+=R,this.vertex(y,T,a);this.vertex(y,T,a),this.vertex(o,h,a)}vertex(e,t,s){let i=this.vertexIndex;const n=this.mesh.getVertices();n[i++]=e,n[i++]=t,n[i++]=s.r,n[i++]=s.g,n[i++]=s.b,n[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();const e=this.context.gl;e.disable(e.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!==0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType===e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}},un=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(un||{}),mn=class Fi{boneLineColor=new it(1,0,0,1);boneOriginColor=new it(0,1,0,1);attachmentLineColor=new it(0,0,1,.5);triangleLineColor=new it(1,.64,0,.5);pathColor=new it().setFromString("FF7F00");clipColor=new it(.8,0,0,2);aabbColor=new it(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;scale=1;boneWidth=2;context;bounds=new nn;temp=[];vertices=O.newFloatArray(2*1024);static LIGHT_GRAY=new it(192/255,192/255,192/255,1);static GREEN=new it(0,1,0,1);constructor(t){this.context=t instanceof Tt?t:new Tt(t)}draw(t,s,i){const n=s.x,r=s.y,o=this.context.gl;t.setBlendMode(o.ONE,o.ONE,o.ONE_MINUS_SRC_ALPHA);const h=s.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let l=0,a=h.length;l<a;l++){const c=h[l];if(i&&i.indexOf(c.data.name)>-1||!c.parent)continue;const d=c.appliedPose,u=c.data.length*d.a+d.worldX,f=c.data.length*d.c+d.worldY;t.rectLine(!0,d.worldX,d.worldY,u,f,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(n,r,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);const l=s.slots;for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(u instanceof zt){const f=this.vertices;u.computeWorldVertices(d,u.getOffsets(d.appliedPose),f,0,2),t.line(f[0],f[1],f[2],f[3]),t.line(f[2],f[3],f[4],f[5]),t.line(f[4],f[5],f[6],f[7]),t.line(f[6],f[7],f[0],f[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){const l=s.slots;for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(!(u instanceof Ut))continue;const f=this.vertices;u.computeWorldVertices(s,d,0,u.worldVerticesLength,f,0,2);const m=u.triangles;let p=u.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let g=0,x=m.length;g<x;g+=3){const b=m[g]*2,w=m[g+1]*2,v=m[g+2]*2;t.triangle(!1,f[b],f[b+1],f[w],f[w+1],f[v],f[v+1])}}if(this.drawMeshHull&&p>0){t.setColor(this.attachmentLineColor),p=(p>>1)*2;let g=f[p-2],x=f[p-1];for(let b=0,w=p;b<w;b+=2){const v=f[b],y=f[b+1];t.line(v,y,g,x),g=v,x=y}}}}if(this.drawBoundingBoxes){const l=this.bounds;l.update(s,!0),t.setColor(this.aabbColor),t.rect(!1,l.minX,l.minY,l.getWidth(),l.getHeight());const a=l.polygons,c=l.boundingBoxes;for(let d=0,u=a.length;d<u;d++){const f=a[d];t.setColor(c[d].color),t.polygon(f,0,f.length)}}if(this.drawPaths){const l=s.slots;for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(!(u instanceof Te))continue;let f=u.worldVerticesLength;const m=this.temp=O.setArraySize(this.temp,f,0);u.computeWorldVertices(s,d,0,f,m,0,2);const p=this.pathColor;let g=m[2],x=m[3],b=0,w=0;if(u.closed){t.setColor(p);const v=m[0],y=m[1],T=m[f-2],A=m[f-1];b=m[f-4],w=m[f-3],t.curve(g,x,v,y,T,A,b,w,32),t.setColor(Fi.LIGHT_GRAY),t.line(g,x,v,y),t.line(b,w,T,A)}f-=4;for(let v=4;v<f;v+=6){const y=m[v],T=m[v+1],A=m[v+2],S=m[v+3];b=m[v+4],w=m[v+5],t.setColor(p),t.curve(g,x,y,T,A,S,b,w,32),t.setColor(Fi.LIGHT_GRAY),t.line(g,x,y,T),t.line(b,w,A,S),g=b,x=w}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let l=0,a=h.length;l<a;l++){const c=h[l];if(i&&i.indexOf(c.data.name)>-1)continue;const d=c.appliedPose;t.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){const l=s.slots;t.setColor(this.clipColor);for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(!(u instanceof Zt))continue;const f=u.worldVerticesLength,m=this.temp=O.setArraySize(this.temp,f,0);u.computeWorldVertices(s,d,0,f,m,0,2);for(let p=0,g=m.length;p<g;p+=2){const x=m[p],b=m[p+1],w=m[(p+2)%m.length],v=m[(p+3)%m.length];t.line(x,b,w,v)}}}}dispose(){}},Ur=class{constructor(e,t,s){this.vertices=e,this.numVertices=t,this.numFloats=s}},gn=class Pn{static QUAD_TRIANGLES=[0,1,2,2,3,0];tempColor=new it;tempColor2=new it;vertices;vertexSize=8;twoColorTint=!1;renderable=new Ur([],0,0);clipper=new pi;pmaAdditiveBatching=!0;constructor(t,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=O.newFloatArray(this.vertexSize*1024)}draw(t,s,i=-1,n=-1,r=null){const o=this.clipper,h=this.twoColorTint;let l=null;const a=this.renderable;let c,d;const u=s.drawOrder.appliedPose;let f;const m=s.color,p=h?12:8;let g=!1;i===-1&&(g=!0);for(let x=0,b=u.length;x<b;x++){const w=u[x];if(!w.bone.active){o.clipEnd(w);continue}if(i>=0&&i===w.data.index&&(g=!0),!g){o.clipEnd(w);continue}n>=0&&n===w.data.index&&(g=!1);const v=w.appliedPose,y=v.attachment;let T;if(y instanceof zt){a.vertices=this.vertices,a.numVertices=4,a.numFloats=p<<2;const A=y.sequence,S=A.resolveIndex(v);y.computeWorldVertices(w,y.getOffsets(v),a.vertices,0,p),d=Pn.QUAD_TRIANGLES,c=A.getUVs(S),T=A.regions[S]?.texture,f=y.color}else if(y instanceof Ut){a.vertices=this.vertices,a.numVertices=y.worldVerticesLength>>1,a.numFloats=a.numVertices*p,a.numFloats>a.vertices.length&&(a.vertices=this.vertices=O.newFloatArray(a.numFloats)),y.computeWorldVertices(s,w,0,y.worldVerticesLength,a.vertices,0,p),d=y.triangles;const A=y.sequence,S=A.resolveIndex(v);T=A.regions[S]?.texture,c=A.getUVs(S),f=y.color}else if(y instanceof Zt){o.clipEnd(w),o.clipStart(s,w,y);continue}else{o.clipEnd(w);continue}if(T){const A=v.color,S=this.tempColor,C=m.a*A.a*f.a;S.r=m.r*A.r*f.r*C,S.g=m.g*A.g*f.g*C,S.b=m.b*A.b*f.b*C;const I=w.data.blendMode,Y=this.pmaAdditiveBatching&&I===1;S.a=Y?0:C;const R=this.tempColor2;v.darkColor?(R.r=v.darkColor.r*C,R.g=v.darkColor.g*C,R.b=v.darkColor.b*C,R.a=1):R.set(0,0,0,1);const k=Y?0:I;if(k!==l&&(l=k,t.setBlendMode(l)),o.isClipping()&&o.clipTriangles(a.vertices,d,d.length,c,S,R,h,p)){const X=new Float32Array(o.clippedVertices),F=o.clippedTriangles;r&&r(X,X.length,p),t.draw(T,X,F)}else{const X=a.vertices;if(h)for(let V=2,q=0,U=a.numFloats;V<U;V+=p,q+=2)X[V]=S.r,X[V+1]=S.g,X[V+2]=S.b,X[V+3]=S.a,X[V+4]=c[q],X[V+5]=c[q+1],X[V+6]=R.r,X[V+7]=R.g,X[V+8]=R.b,X[V+9]=R.a;else for(let V=2,q=0,U=a.numFloats;V<U;V+=p,q+=2)X[V]=S.r,X[V+1]=S.g,X[V+2]=S.b,X[V+3]=S.a,X[V+4]=c[q],X[V+5]=c[q+1];const F=a.vertices.subarray(0,a.numFloats);r&&r(a.vertices,a.numFloats,p),t.draw(T,F,d)}}o.clipEnd(w)}o.clipEnd()}getSkeletonClipping(){return this.clipper}},E=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],es=[0,1,2,2,3,0],ss=new it(1,1,1,1),pn=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;maxCanvasWidth=0;maxCanvasHeight=0;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,s=!0){this.canvas=e,this.context=t instanceof Tt?t:new Tt(t),this.twoColorTint=s,this.camera=new ln(e.width,e.height),this.batcherShader=s?Lt.newTwoColoredTextured(this.context):Lt.newColoredTextured(this.context),this.batcher=new vi(this.context,s),this.shapesShader=Lt.newColored(this.context),this.shapes=new Ti(this.context),this.skeletonRenderer=new gn(this.context,s),this.skeletonDebugRenderer=new mn(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(e,t=-1,s=-1,i=null){this.enableRenderer(this.batcher),this.skeletonRenderer.draw(this.batcher,e,t,s,i)}drawSkeletonDebug(e,t){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.draw(this.shapes,e,t)}drawTexture(e,t,s,i,n,r){this.enableRenderer(this.batcher),r||(r=ss);var o=0;E[o++]=t,E[o++]=s,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=0,E[o++]=1,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o++]=0),E[o++]=t+i,E[o++]=s,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=1,E[o++]=1,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o++]=0),E[o++]=t+i,E[o++]=s+n,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=1,E[o++]=0,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o++]=0),E[o++]=t,E[o++]=s+n,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=0,E[o++]=0,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o]=0),this.batcher.draw(e,E,es)}drawTextureUV(e,t,s,i,n,r,o,h,l,a){this.enableRenderer(this.batcher),a||(a=ss);var c=0;E[c++]=t,E[c++]=s,E[c++]=a.r,E[c++]=a.g,E[c++]=a.b,E[c++]=a.a,E[c++]=r,E[c++]=o,this.twoColorTint&&(E[c++]=0,E[c++]=0,E[c++]=0,E[c++]=0),E[c++]=t+i,E[c++]=s,E[c++]=a.r,E[c++]=a.g,E[c++]=a.b,E[c++]=a.a,E[c++]=h,E[c++]=o,this.twoColorTint&&(E[c++]=0,E[c++]=0,E[c++]=0,E[c++]=0),E[c++]=t+i,E[c++]=s+n,E[c++]=a.r,E[c++]=a.g,E[c++]=a.b,E[c++]=a.a,E[c++]=h,E[c++]=l,this.twoColorTint&&(E[c++]=0,E[c++]=0,E[c++]=0,E[c++]=0),E[c++]=t,E[c++]=s+n,E[c++]=a.r,E[c++]=a.g,E[c++]=a.b,E[c++]=a.a,E[c++]=r,E[c++]=l,this.twoColorTint&&(E[c++]=0,E[c++]=0,E[c++]=0,E[c]=0),this.batcher.draw(e,E,es)}drawTextureRotated(e,t,s,i,n,r,o,h,l){this.enableRenderer(this.batcher),l||(l=ss);const a=t+r,c=s+o,d=-r,u=-o,f=i-r,m=n-o,p=d,g=u,x=d,b=m,w=f,v=m,y=f,T=u;let A=0,S=0,C=0,I=0,Y=0,R=0,k=0,X=0;if(h!==0){const V=B.cosDeg(h),q=B.sinDeg(h);A=V*p-q*g,S=q*p+V*g,k=V*x-q*b,X=q*x+V*b,Y=V*w-q*v,R=q*w+V*v,C=Y+(A-k),I=R+(S-X)}else A=p,S=g,k=x,X=b,Y=w,R=v,C=y,I=T;A+=a,S+=c,C+=a,I+=c,Y+=a,R+=c,k+=a,X+=c;var F=0;E[F++]=A,E[F++]=S,E[F++]=l.r,E[F++]=l.g,E[F++]=l.b,E[F++]=l.a,E[F++]=0,E[F++]=1,this.twoColorTint&&(E[F++]=0,E[F++]=0,E[F++]=0,E[F++]=0),E[F++]=C,E[F++]=I,E[F++]=l.r,E[F++]=l.g,E[F++]=l.b,E[F++]=l.a,E[F++]=1,E[F++]=1,this.twoColorTint&&(E[F++]=0,E[F++]=0,E[F++]=0,E[F++]=0),E[F++]=Y,E[F++]=R,E[F++]=l.r,E[F++]=l.g,E[F++]=l.b,E[F++]=l.a,E[F++]=1,E[F++]=0,this.twoColorTint&&(E[F++]=0,E[F++]=0,E[F++]=0,E[F++]=0),E[F++]=k,E[F++]=X,E[F++]=l.r,E[F++]=l.g,E[F++]=l.b,E[F++]=l.a,E[F++]=0,E[F++]=0,this.twoColorTint&&(E[F++]=0,E[F++]=0,E[F++]=0,E[F]=0),this.batcher.draw(e,E,es)}drawRegion(e,t,s,i,n,r){this.enableRenderer(this.batcher),r||(r=ss);var o=0;E[o++]=t,E[o++]=s,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=e.u,E[o++]=e.v2,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o++]=0),E[o++]=t+i,E[o++]=s,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=e.u2,E[o++]=e.v2,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o++]=0),E[o++]=t+i,E[o++]=s+n,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=e.u2,E[o++]=e.v,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o++]=0),E[o++]=t,E[o++]=s+n,E[o++]=r.r,E[o++]=r.g,E[o++]=r.b,E[o++]=r.a,E[o++]=e.u,E[o++]=e.v,this.twoColorTint&&(E[o++]=0,E[o++]=0,E[o++]=0,E[o]=0),this.batcher.draw(e.page.texture,E,es)}line(e,t,s,i,n,r){this.enableRenderer(this.shapes),this.shapes.line(e,t,s,i,n)}triangle(e,t,s,i,n,r,o,h,l,a){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,s,i,n,r,o,h,l,a)}quad(e,t,s,i,n,r,o,h,l,a,c,d,u){this.enableRenderer(this.shapes),this.shapes.quad(e,t,s,i,n,r,o,h,l,a,c,d,u)}rect(e,t,s,i,n,r){this.enableRenderer(this.shapes),this.shapes.rect(e,t,s,i,n,r)}rectLine(e,t,s,i,n,r,o){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,s,i,n,r,o)}polygon(e,t,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,s,i)}circle(e,t,s,i,n,r=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,s,i,n,r)}curve(e,t,s,i,n,r,o,h,l,a){this.enableRenderer(this.shapes),this.shapes.curve(e,t,s,i,n,r,o,h,l,a)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(e,t,s){const i=this.canvas,n=this.getSafeDevicePixelRatio(i.clientWidth,i.clientHeight);var r=Math.round(i.clientWidth*n),o=Math.round(i.clientHeight*n);if((i.width!==r||i.height!==o)&&(i.width=r,i.height=o),e===3&&t!==void 0&&s!==void 0){const h=o/r,l=s/t,a=h>l?r/t:o/s;t*=a,s*=a,this.camera.setViewport(t,s),this.context.gl.viewport((r-t)/2,(o-s)/2,t,s)}else{if(e===2){const h=this.camera.viewportWidth,l=this.camera.viewportHeight,a=l/h,c=o/r,d=a<c?h/r:l/o;this.camera.setViewport(r*d,o*d)}else e===1&&this.camera.setViewport(r,o);this.context.gl.viewport(0,0,r,o)}this.camera.update()}getSafeDevicePixelRatio(e,t){const s=window.devicePixelRatio||1;if(e<=0||t<=0)return s;if(this.maxCanvasWidth===0||this.maxCanvasHeight===0){const i=this.context.gl,n=i.getParameter(i.MAX_RENDERBUFFER_SIZE),r=i.getParameter(i.MAX_VIEWPORT_DIMS);this.maxCanvasWidth=Math.min(n,r[0]),this.maxCanvasHeight=Math.min(n,r[1])}return Math.min(s,this.maxCanvasWidth/e,this.maxCanvasHeight/t)}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof vi?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Lt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof Ti?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Lt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},xn=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e[e.FitClip=3]="FitClip",e))(xn||{}),ce,Jt,Ai=0,Nr=1,Si=1,is=165,ns=108,Pt=163,Dr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new cs;backgroundColor=new it(.135,.135,.135,1);tempColor=new it;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!Jt){const t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Ai++;Jt=new Image,Jt.src=qr,t||(Jt.crossOrigin="anonymous"),Jt.onload=s,ce=new Image,ce.src=zr,t||(ce.crossOrigin="anonymous"),ce.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Ai<2||e&&this.fadeOut>Si)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,5));const s=this.tempColor,i=this.renderer,n=i.canvas,r=i.context.gl;if(i.resize(1),i.camera.position.set(n.width/2,n.height/2,0),i.batcher.setBlendMode(0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Si)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/Si,t=1-(t-1)*(t-1),s.a*=t,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(r.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),r.clear(r.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/Nr,1),s.set(t,t,t,t),this.logo||(this.logo=new oe(i.context,Jt,!0),this.spinner=new oe(i.context,ce,!0)),i.camera.zoom=Math.max(1,Pt/n.height),i.begin(),i.drawTexture(this.logo,(n.width-is)/2,(n.height-ns)/2,is,ns,s),this.spinner&&i.drawTextureRotated(this.spinner,(n.width-Pt)/2,(n.height-Pt)/2,Pt,Pt,Pt/2,Pt/2,this.angle,s),i.end()}drawInCoordinates(e,t){if(Ai<2)return;this.timeKeeper.update();const s=this.renderer;s.batcher.setBlendMode(0),this.logo||(this.logo=new oe(s.context,Jt,!0),this.spinner=new oe(s.context,ce,!0));const i=e-is/2,n=t-ns/2;s.drawTexture(this.logo,i,n,is,ns),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,n-25,Pt,Pt,Pt/2,Pt/2,this.angle)}},zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlOtmVFtdTGrrZkJCxYXsTgaI6r9MY4/UpNItW4mFDaXsTlaM6qVZlBq3UwofFrJp0HMWJ9DvXUzobCznJ1BzFjWlTLrZkJh/TDWBzFjTgo51s2EgnKI0Rrx+FiOWzNzVaym91Syx5qZsGBWb2ZFa0ZN6dbMhAWTcpkUrRmXD2K5NTNhgVbH0Zpxbl/mWjMTFvRIo0e0ZpzcncnWzISKtvmiMWNRJ4qslwmVXRXsas2Ix8ZwzFqZsGFREYtaM+Oaa1ljrUzYkJ9G/ok6TlzKjJWZVFor0y7c1Zu7WjLiqiGsskamXdHopyT4vALmzS9k/t19uHtKHlOSIMn6xAtARjIZ1sFcUSZ0Y4La+G6M18hS2IlCn4a+WoC0JNL0d/dUupdnUj40g6EJ2VEdMnhrOG/p5f/jUXz8SgmvaGU6KpNRNsLVQV0OdXf24s63h/P2gWoOrBjMCr2GJFQnnxnIM3q5P1PPmaYv+4ev4/C6UtbpV2gzXCkgL5W8Bwt48OIc6ul6Tp+s4+SyASxLiI4+PYCn1bHzDZxvaQW6vZzto7MYnQIpNkf7kp5EuozYUroqEjcNKHHd0Tl9mBPN1pk+hFeieGBnBtog7UXjsj9pWg+m6duecw2cay1OC/uxMC47KmP9OIYfoz1YoC20J/rzRG4quTZK2EAyJGs20qwUbYw0aNRmUxtvfUW/uEtNzc1NB1/X8LVyd15hh82F43AvD+VlXcsSJEZa1CQ3ejleAO7oxR3RDP0XN91X4+NXYb8nkv7UNTwV7e0YTdu7I3g33t7tuaEbNwSZpps2fSyvs4M2Tjhot+jb0Xzbltj8r5j/xVt/6Z1Ob93U1ZYO691EhhzchcHeXosVjcNZysyezLw4xRZt05R+fTeuj8vOj+zKyG0j2aZcVVs6v+QalnjrMFZASQYl2nBoSyz06e3j/Xk8rgWYmMvEICu2pm1HOTuc7okV8FgRj0XukwzanhvCc/F+72TjoQjdObN1OFuDLmh0xP+WHtxiI10ukJlCprb4guiv1fP+avZrS1C7NAkliHZjDtZwMMgqbukAltpMlwuMy2FcEBPqvfLLar5Uqi0hBdEwryy+Mv5n6zkbjTBa+dlMlwvUZFETZKGiFM7tvbhdJ3gSVRO0wzIjnxmvl/J6a6JsGMYGrahtpssFeqbR841S3mhN80OjOaSDEdqd6SjaMKgzgzRK7q1ib3PT9sYyNo7JZoyNFNvRcVMZmy7WOvIuryv/Zvdmdt90+nY0bRp3AvROohFwdwW7dTG7RFlbwlqdrbOBYg005NAQmZU0HWt1rXMBH1Xw0dQ8pmqzoaPmdhun7bHZjNVe9qP9eFQfO1VkUmHjhAVUZ1GtnKFSbjrkrPfy4i4UW5t/6ZxM54J0CqxFe81KpGsQyE4h23oYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjLna+bdOy+IiFquIpGq16Pb79cNYv3IIK/X/ugx+Ui6TVKvYVU9Nc8gX8od8Ir/IN/KPfCQ/yVfyl/6/pfJvLChkQdD6wyqntquCXYuKWJSfRr6D0dEAxV3xlw/khyD+kd/ku/88cHo+09tS3LBpO1HHCVUqcIA6CqB4K+6X6x35L/JM2loXurlWmUmlA5XogOIcK8/If5HncrSWo7F6cKIWPjT/RXGOlWfkv8hzaWsN4uaaysE6WIkOKM6x8oz8F3kusXqo2vxC5jtYiQ4ozrH0TeS5qIZcrB7qkrwdA8U5Vp6R/yLPZV8V+2L14Cl5THGwEh1QnGPlGfkv8lyUlIzFQ1cNYVVHrcjZ0VCcFe9Y+Eb+izy3ceclUl43aFN52DXXssYpnY6a4qFS8ZcP2uIf+e7inRh6pdFrdTGrm8uiHx/L8T2V7NGWzvJBLJ/bl7mTuzO5qBNFDoiJID/IF/KHfCK/yDfyT3O7d/KbfNfS80hNIrU0g9L6HOq1x5iTQo6FNpeLfCQ/yVfyl3xmXYwxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHNk9z4JwJ0SqKTdQkbyEwhU393T6V7zzR6pieR3tE1ITeVXImhe6BXDGZFdRbVeank2TBhcaEMr0rwbixj49IBLL2/L/ffmMuNHfqO9tFZjJYBd1ewO3Lx+IcVfKhqna5nHZYR6XFPH+5R3eeI5t9fx/fvjeC9Jdew5OKZKqFR/RDVKL6vL/f9PJafmyvHsL+a/ff24V6NmjZQbGchVbY6UM2BluqHv1rCqzVZ1KQlkZboepCdQvacPsz5bjTfXao+yMEaDt7Wk9tSIMVGig3TejCtJSM2bSpkPjWPqd1S6Zao+lORSYWmgkOjORRNwZqd5ezMSiHLRooNr5XwWjS6/1XHX9vL2T67N7M1iyXa9JCrYjVrS1gbpJyw6hBfsmiNCYT0P9/A+Wj1/6qGr5YNYFlJBiWJogEzezLz/ZG8/9s4fgtSyuvNYbyp1IONFBtu7sHNv4/j9yAxUHWrdaWsG9+N8XHd+YxkMpSy+aySz841cC5oXbmHCnnI74yxAgZ3YbDeB4PEQCOpBpFNZWwa2ZWRcdnxLsl00crtRB0n2lLg8JNRfDKoM4NsolgBSmw/UMADba1+qpmqfyf6x1u/0a/og3I+aEunP6/i86osqmygcGarF4p54dex/Bo0LqfqOfVwIQ/HW5/RSkwV1oN2WLlHTc82TljAwM4M1O5LWwYKZTjibYXNS0N5KcjKTe10PadfLObFuJwK4ozp+UzXDBTUjL+M5ZcBnRkQV53dMIwNQTu6bSTbVEzbi5awuVByd2E/FgaN0Tc1fKOzBHHV2aAdVSdv6s5NNkp7cSH/++xAng2yyHx+CM/H21YhfdPp+0U1X0TbSZnXx8faG9Aop0MS0cToh1p+iLcpOkLj9t/JOk5eqoPHxnDsyf486an5yqCDK7XZ1O4oZ4dWyy3FSXHUAYq47uyYbMZoGmhpG3DlEFb6uNiVBhpyaHhnBO8oJmfqOROJjzIiP43hJ8UxITqqX56S2Hur2KsOnq3nrE6PPNKPRwrSKbAZrjTQNZmuE7oxYXMZmxWbw9dxWFu4W4ezVedOE6qzI7oyYkY+M7TPeWsPbk2UX1qioSN+E3OZqOR2cReKE+qQRFN0Pi7y73g/UawU1KzezJpXwLz5hczX1ueUPKYkNb6GJQZ+j7/aAfRZREsv+quGsMoamXZBW2Gt5eU0alorEzYsKmJRa/m4NdeyxlqZsCGa84DKnVorEzboC7podis69DfIJmwufHMc7famvvmxZiYsKOtKWbRm1OcW1syEBboSJFozLh/EcmtmwgIluaM14/phrLdmJixYXMTiaM24p5I91syEBTphFOR7Y2tmwgJNvUFOr+tov3UzoaAv44KYUatv62ZCoemdhtG0+hzqrZsJBR08DWLG0gxKrZu50qvpxos3U5NItW4mFPp1ot+lPlpq2lYXs9qamVBZUMiC1ox4pJYjvlfStAu6GmTLcLboMtPIV4/6im5fFfuUi9QIap2MiWP+D96R1vPmsD/fAAAAAElFTkSuQmCC",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAABsCAYAAAALzHKmAAAQ7klEQVR42u3da4xdVRUA4D0zd2Y6nZY59DVtZ1puS9+lzC0YAi2UQ8AAQczFpPgA9VIeIQbirRqJ0cBUBVGjDr/QCKSNRSMmpuODxAdxqhgwxkhFjf6Sxh/+UUNVNGJCzR7uTvas7LXX2q9zzp3em6y0gTN3Zu75utZe5+yztxC9V+/Ve5X9En1Vjd7J6SFbLNF7naPw+l2jh7YHMBWssqMHtlsRdim4qsLtIawaPiHEQOLoNrA9iIkQDnRrVA1qD2LZ8ISoxYqKo13sQAtBWBayQWZUAXGRQM9JjCngDVY0UqJNDbQrMcaGmArdUKpIjbYiQLsCZCyIMQBy8QwnilR4Q5AuCpxFYvRFmBLbEiwKwpsSaWycVQGZBKMrwBjA9BhxDe57u2L2hOoKNCbOrgAZitEVYUxoKSMErQvSxYIzCkguRg5EF4AUhqUlhy/YUKSxcRaKsioYOQhD4I0yYxkR3PcJBcuFysmgsXAWBTMJyBCMIQh9kGGxXIXvexCQXbHGAMrBWTbM2CCpMSMLIxehC77lSJwXGth7M0FzoVJIXXDWQnGmhOkL0ic7YhhtWdGGkAuPAjUWGoF4faCmwBkbZmyUqUCyMqMLRA4+E6IsdTjidUHKBYrh9CnpRcH0ypKxsyOGEYNIIeTCOz91OIJ1QYoB5eAMyZo+MFNnyVTZ0YiRC9EGEMOyAgshxErHsL2XK1gOUgwohtM1a5YNM7Rsu4K0ZkcbRm4mpPBRwFZ5hg9eCqkrUB+csWGGogzNkqEgrdnRhpGLkINudaLgwvVB6oqzCjCTZElb2Y4B0gUjBtEG0ARnDRLjjoG9DwcshtQGlIPTljVjwUySLWNkyRCQVHa0ZUUTRAwgF91a33BEy0VKAcVwwqwZC2bqbOlUurllOxQkJzNyINoAYqjWhYYjWg5SCiiG05Q1U8FMjTIoS8YE6YORi1BHtJ4KIcQEEtTXUWAxpK44YVlPBdO1jCdFWTZIE8bVGEYMIRPcZGBw4HKQcoBiOE1ZMzbMgVQwU6JMAdKEEcuIJogUvg1YCCE2gsCO42DlIIVAKZwpYJaSLVNnSU6XjYHUmxhTmXaFaMO3EYkLqMC+FsLlIoVAKZzMrEnBhJeLfLNlKMrYWRIDCbOkFSSVHbHM6AKRC6/ODUewNqQ+OLlZkxpjUmV8MBbMUJSxyzY3Q1IgTRgxiBRCHdem0KDAUkBh9sRwwjEnAXMMgTnKhFlUtiwkS5rGka4g9SaGgxFmRC7AzTCEEBcyA36dDSsXqAtOLkysjGMwY5XxVChjZ0kuSCo7YlkRQsQQYtDEFsegsLoCxUp7Kpgps2UslFGzJGccSYHUmxhOZqwzEZqAbfUMCisHKIZzgsCpl3MTzMwTpi1bYp2477gyFKUxS7qWbdjY2EBS2dGE0QQRA7gNCyHEdhjE8RhUDlBT9tzgmjWZMFNlSy+Urk1OzCyJlW0XkK4YOQh1cDtcgwBrQmoDWkdgboBZE8mYsJSHlnFbJ+5bwmOPJ7lZkirbC8aRsMvmgtTHjBhGE0QbwJ2egUE1ITVlUC5OmDVdYNrKuN70xM6WoShjlW4464dbtiFIWK6x7GjESEHUUe0iYncnbMdQSE0Z1ITTNOb0hRmjjLtmS9dmJ2rp1jtuKktyyrb6YLEMCUHq2dGG0QQRQ7f72kzc+cJecerne8Wvv7JNPHPvenEkz8Sh3UtFc92QyGt9Yko/HgOLAIUZlItTz5ouMF3KuE+2jFLCQ1D6lm6fLMkBacuOJowYRBUXyfjuHjF3NhdnsfjvAfH6E9vFt9XxKgikEKgJZyyYalzOLeMu2bLbULI6bh+QGwmQ+rgRlumdGEQAao+K56bEL2woVUwOiev0r8OAUjiJrMmFCbvykGxZRAmPitK1dHM7bohyMsuyi/I8f0+e57fJYIKEZXpXo9E4mOf5XTKyLLvCBLETF8uY2SKepkC+dpX4T02Ivepr4HvZcOZ5fmee54fyPL+DmTUhzAs6n4n8bN5dr9f3YdkSg8nsxG0lPBVKVpNjG0/aGhzfLDmRZdnumZmZp8+c+cdZPV555fSr7Xb7s0jJ3i5Pcue4MxKkPPkvvXTqz/B92u32l0wYOzG1fkhcd/py8Rcbyq/vFM/KY1WA95h/3zzP71bfU6JsNpsfgj+P/FlbrdaDGExYyuXvLz8H+DudODH700ajcSM3W6Yu4alQ1spCOTd38jcKocTZbh9+9NixY99XJ8AEUkcpo9W64yH197m5k7+bnZ19QT+J09NHntQhwji/Jg58qi6++ofLxJ8gSFneVw2Ka4QQDfh1Ok4dZavVmtZ/nrm5k7/Vf55O1tRhboUw5+ZOvqyOl5+R/FyOHj32PYVU/tloNG5IXcKrhJIzngwp3fNjomazea/64BuNxts646f50lWv169utw9/DmtqdJQyZFaSJVuV6nq9fqMEof5/vV6/CYBqgJDlee+yAbF/+4i4ZWqZeNfaIfHWzn+Hx0KcEuU9+s8jv3ej0bhVlXOZydX/k0iRMeb8P0D5e6tj8zy/Xb9UJIc56h/yqVOnXul8lmuZ2bJslKmbHG7XrbpCmCXFRLvdfqQD6jTS3Jiy5I4OykM6ADV+1Eu1DmV6evopBORexzDi1L+X/HnGxsb2w3Hm9PSRJ9QxWPOTZdmlKht2hi+w6dkox5bqffI8fye3hDteGqKaHVsHXihKl0tB+h0cY+lute54AGRKDCW89LNTRynHb7ChUWVVjetOnJh9EYBUyPZeNCoOtsbFQwdXi4/esELcd+tq8cCHJ8UXp+viy9efLz7AgamjlKXc1AA1m83DoIRDlFubzeb96hhZLVTlgJ24gttutx+ONa50bHZKRenaeTs1OfpAfnr6yOOdE7EZdNwmlKocntXLNkA5JTGq47Ds+Lf94lWsyfnXleLfnIwJUN4DOnNYwuUxh2A3Ln9XULrfK8t3J27Tu3BVwiOjXJqoAy8UZej1yclGo3GTLN+gu3w+z/P3YaWbQqk3Ne12e4ZC+c8rxWsYytcPiP9RpZxCqWDKnxOiBNlyAUpOnGsoh4tA2Rm8X9xqtT6md5wyZmYe+0YRKL+1S/wYQ3n8zctBl5SBUv5djivfjMOPduIzcizeiYfr9foVvUwZG+XCuzibZKnSceZ5/v4QlKp8y7ElhnJlTeTP7BI/kllRYfzrfvHqFy4UX1vaL/aVlSmROzwbwdS29T2UcEwZF+V8ozM2lu1VY812u/15akypGh3TmFJesJbHHD167IdUxz3YJy5bNySuX1mbvy55CbMLtzU6tjGlsdFptVqfUMc0Go23F4wy1l2dSnbfvpMwVPe9WWVLDsrOJaF9MFu2Wq1PqmNkGce67xiXhTjdNwdlvV6/BgxfbPfBfVCetxi6b9/rlCup65QzM48dl2OjLMv26CibzeZ96sTIzEFdpwQXz9U1yrtVlpR/Zll2Fec65Y6l4pbbx8XHH9kknvzJlPjlHy8Tp29eKT5ou0aJoIT3w3dBlLDzVpfAJEZ1XOdaJZxnOSlvPMjPzxFljIvng914RwebsjYO7uhMyHu46sOfnf3Oz2TXDW6vvYxdFoIXz3Wc8J5zs9n8iOn2IrxTc2BM3Glqdp7dI553uaOjxrhwcob+MyuUpjs6WZZdon8OcigjPx8V+u+GTWFTSWEx3WYcdJ225jNDSE4q0GHCzlueHOyujn6bUWYgeb9ZZUaQPe+GzQ+Gc8+oOGhC+c1d4gfI16n3XDAhQ7+9qE9l01E2Go132GYKyXE1NiFDTcpoNpv3LOYJGWXNErJNW9sEp63p2RKiVPMn1bS1DgxsyhoGdGpmizj+xtXiDYnx7/vFmce3iWdW1cTVGEY4hQ2ZW0nNq8Qm/M6XbXm3S100lwGedFybuvNOibLI+ZS2ceU4eAxiEuvCkfmU8ycToDxETe6FgCBQHeqyAbFvfEhcO7BwDuXFCEbTZF840XeHK0jYcbs2OIGle0mVJ/mmnClEPQqxyTY5I8/zFhif7fSZee4bnrPOU4AssnRXHaVTCTd14dRDY3UbTIiSeFhsN/aMjgnqthFx880rxX3yATL5p3y4LPXzOaBkUyBjZMlYpbtQlIOBD475ZEusjMNSvkXe6VEoJVDkeZ2dzIfIFsRzU+JF2OyM9M9fTC/6SUYOyFQPjQ2nWiUjxnPfw5EeHqMWIqAeIFsAU847lJM2JM6xsewt1OIDLs99P7ZFHNdB/upS8XtPiD7PfLuCXJNolYyyFiNI/Zit65ItrOVafFbHcFohY7hPTN21Tjz4uc3iqfsnxKdX1MTl1OoYRFaMsToGB6Trw2JFP/OdZC2hJZ7ZkrMoAbbSGmelDJ91hFKuJeS7jlBMkJnrAqqJlgMUZS/dArPlGHNdSg5M3xXXtvquuEatvIYtDRhpxbUJuIgqsU5lGWtUploK0KuEU9mSW8YpmFQ556xNuYW7NiW13B+FkMiKHIy+C6eGgBxJvMR0oSv5hi6+z4HJyZoU0M2RVvDlrOQbcxVfX5AhZbuqy0v7ZstYMLHlAVlLTF9ALLbvu9Y5Zylpn/XOsd0ibIvxr2KCLHpp6SCUIdnSZSF+WzfOhem6GD+1KwR3Z4jNjrtDpNoZwmWd8yrupZN6Hx3fbMmFSe0Swdq2ZIPjxk1112Duo8OBGLrBkw/IoncdK2XHsdC9dHz204m50xh3tzFq1zFqtzHXrfCw7OgDsqyNnZLszVijsmXgrmNcmGtS78lIoMX2aJz03fKO2sDJddPQSCDPiQ1DfWBycY6XtXstc2PQKuxgG2McmXTPb9/9vmuJYXKyJrWjbeg+3xPM4O73nWqvbyw7xgZZSJbEUBa157cNJjdr2vb+5iA1YV3HxYscj30PDCEHIgcjtfm8K8hSsmRotkwFk5s1TTghUAopB6xrjHMBBkI0YYTZ0dZlxwLpkiWDULpmy5gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Wr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new Tt(e,t.webglConfig),this.renderer=new pn(e,this.context),this.gl=this.context.gl,this.assetManager=new on(this.context,t.pathPrefix),this.input=new bi(e),t.app.loadAssets&&t.app.loadAssets(this);const s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new cs;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,s,i){this.gl.clearColor(e,t,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};export{Es as AlphaTimeline,Fe as Animation,Nn as AnimationState,Dn as AnimationStateAdapter,zn as AnimationStateData,Wi as AssetCache,on as AssetManager,qi as AssetManagerBase,qn as AtlasAttachmentLoader,us as Attachment,ie as AttachmentTimeline,tn as BinaryInput,ci as BlendMode,Be as Bone,Js as BoneData,Ve as BonePose,Wt as BoneTimeline1,Re as BoneTimeline2,Ks as BoundingBoxAttachment,kr as CameraController,Zt as ClippingAttachment,it as Color,hn as Color2Attribute,ts as ColorAttribute,re as Constraint,ae as ConstraintData,ne as ConstraintTimeline1,qt as CurveTimeline,pe as CurveTimeline1,Vn as DebugUtils,Rs as DeformTimeline,$s as Downloader,Gi as DrawOrder,we as DrawOrderFolderTimeline,jt as DrawOrderTimeline,Ue as Event,ei as EventData,Ni as EventQueue,Le as EventTimeline,Di as EventType,ye as FIRST,On as FakeTexture,$t as FromProperty,He as FromRotate,$e as FromScaleX,Ke as FromScaleY,Je as FromShearY,je as FromX,Ze as FromY,oe as GLTexture,ve as HOLD,zi as HOLD_FIRST,Hi as IkConstraint,Ae as IkConstraintData,Ne as IkConstraintPose,Ps as IkConstraintTimeline,ke as Inherit,Cs as InheritTimeline,bi as Input,Xn as IntSet,ue as Interpolation,Dr as LoadingScreen,_ as M00,K as M01,J as M02,G as M03,Q as M10,H as M11,tt as M12,j as M13,et as M20,st as M21,Z as M22,$ as M23,rt as M30,at as M31,ot as M32,nt as M33,Tt as ManagedWebGLRenderingContext,B as MathUtils,Ie as Matrix4,wi as Mesh,Ut as MeshAttachment,ln as OrthoCamera,Te as PathAttachment,ji as PathConstraint,Se as PathConstraintData,Bs as PathConstraintMixTimeline,De as PathConstraintPose,ks as PathConstraintPositionTimeline,Vs as PathConstraintSpacingTimeline,Zi as Physics,ri as PhysicsConstraint,Ns as PhysicsConstraintDampingTimeline,Ce as PhysicsConstraintData,qs as PhysicsConstraintGravityTimeline,Os as PhysicsConstraintInertiaTimeline,Ds as PhysicsConstraintMassTimeline,Ws as PhysicsConstraintMixTimeline,ze as PhysicsConstraintPose,_s as PhysicsConstraintResetTimeline,Us as PhysicsConstraintStrengthTimeline,Nt as PhysicsConstraintTimeline,zs as PhysicsConstraintWindTimeline,_i as PointAttachment,vi as PolygonBatcher,me as Pool,Qs as Posed,ti as PosedActive,Xe as PosedData,Qe as Position2Attribute,Vr as Position3Attribute,si as PositionMode,Ri as Pow,kn as PowOut,ki as Property,Zs as RETAIN,Fs as RGB2Timeline,Ys as RGBA2Timeline,Is as RGBATimeline,Ms as RGBTimeline,zt as RegionAttachment,xn as ResizeMode,ni as RotateMode,xe as RotateTimeline,js as SETUP,Pe as SUBSEQUENT,ws as ScaleTimeline,ys as ScaleXTimeline,Oe as ScaleYMode,vs as ScaleYTimeline,pn as SceneRenderer,ge as Sequence,ms as SequenceMode,gs as SequenceModeValues,Ls as SequenceTimeline,Lt as Shader,Ti as ShapeRenderer,un as ShapeType,Ts as ShearTimeline,As as ShearXTimeline,Ss as ShearYTimeline,Ki as Skeleton,Wn as SkeletonBinary,nn as SkeletonBounds,pi as SkeletonClipping,ai as SkeletonData,mn as SkeletonDebugRenderer,Rr as SkeletonJson,gn as SkeletonRenderer,Pr as SkeletonRendererCore,_e as Skin,oi as SkinEntry,Ji as Slider,_t as SliderData,Hs as SliderMixTimeline,We as SliderPose,Gs as SliderTimeline,$i as Slot,be as SlotCurveTimeline,li as SlotData,qe as SlotPose,ii as SpacingMode,Wr as SpineCanvas,ls as StringSet,yi as TexCoordAttribute,hs as Texture,ds as TextureAtlas,Xi as TextureAtlasPage,fs as TextureAtlasRegion,Ye as TextureFilter,Pi as TextureRegion,Li as TextureWrap,cs as TimeKeeper,gt as Timeline,Kt as ToProperty,hi as ToRotate,ui as ToScaleX,mi as ToScaleY,gi as ToShearY,di as ToX,fi as ToY,cn as Touch,Ui as TrackEntry,Qi as TransformConstraint,ft as TransformConstraintData,Ge as TransformConstraintPose,Xs as TransformConstraintTimeline,ps as TranslateTimeline,xs as TranslateXTimeline,bs as TranslateYTimeline,rn as Triangulator,O as Utils,Ee as Vector2,Yt as Vector3,Dt as VertexAttachment,le as VertexAttribute,dn as VertexAttributeType,Bn as WindowedMean,Bi as isBoneTimeline,Oi as isConstraintTimeline,Vi as isSlotTimeline};
|
|
84
|
+
`;return new pt(t,s,i)}},yi=class{constructor(e,t,s,i){this.attributes=t,this.context=e instanceof Tt?e:new Tt(e),this.elementsPerVertex=0;for(let n=0;n<t.length;n++)this.elementsPerVertex+=t[n].numElements;this.vertices=new Float32Array(s*this.elementsPerVertex),this.indices=new Uint16Array(i),this.context.addRestorable(this)}context;vertices;verticesBuffer=null;verticesLength=0;dirtyVertices=!1;indices;indicesBuffer=null;indicesLength=0;dirtyIndices=!1;elementsPerVertex=0;getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(let t=0;t<this.attributes.length;t++){const s=this.attributes[t];e+=s.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error(`Mesh can't store more than ${this.maxVertices()} vertices`);this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error(`Mesh can't store more than ${this.maxIndices()} indices`);this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){const n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?n.drawElements(t,i,n.UNSIGNED_SHORT,s*2):n.drawArrays(t,s,i),this.unbind(e)}bind(e){const t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],r=e.getAttributeLocation(n.name);t.enableVertexAttribArray(r),t.vertexAttribPointer(r,n.numElements,t.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=n.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){const t=this.context.gl;for(let s=0;s<this.attributes.length;s++){const i=this.attributes[s],n=e.getAttributeLocation(i.name);t.disableVertexAttribArray(n)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){const e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);const e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},ce=class{constructor(e,t,s){this.name=e,this.type=t,this.numElements=s}},Je=class extends ce{constructor(){super(Lt.POSITION,0,2)}},Ur=class extends ce{constructor(){super(Lt.POSITION,0,3)}},vi=class extends ce{constructor(e=0){super(Lt.TEXCOORDS+(e===0?"":e),0,2)}},Qe=class extends ce{constructor(){super(Lt.COLOR,0,4)}},mn=class extends ce{constructor(){super(Lt.COLOR2,0,4)}},gn=(e=>(e[e.Float=0]="Float",e))(gn||{}),_t=1,Nr=769,pn=771,Dr=774,Ti=class se{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(t,s=!0,i=10920){if(i>10920)throw new Error(`Can't have more than 10920 triangles per batch: ${i}`);this.context=t instanceof Tt?t:new Tt(t);const n=s?[new Je,new Qe,new vi,new mn]:[new Je,new Qe,new vi];this.mesh=new yi(t,n,i,i*3);const r=this.context.gl;this.srcColorBlend=r.SRC_ALPHA,this.srcAlphaBlend=r.ONE,this.dstBlend=r.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,this.lastTexture=null,this.isDrawing=!0;const s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),se.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgbPma:_t,dstRgb:pn,srcAlpha:_t},{srcRgbPma:_t,dstRgb:_t,srcAlpha:_t},{srcRgbPma:Dr,dstRgb:pn,srcAlpha:_t},{srcRgbPma:_t,dstRgb:Nr,srcAlpha:_t}];setBlendMode(t){const s=se.blendModesGL[t],i=s.srcRgbPma,n=s.srcAlpha,r=s.dstRgb;if(this.srcColorBlend===i&&this.srcAlphaBlend===n&&this.dstBlend===r)return;this.srcColorBlend=i,this.srcAlphaBlend=n,this.dstBlend=r,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(i,r,n,r)}draw(t,s,i){t!==this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();const n=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);const r=this.mesh.getIndices();for(let a=this.indicesLength,h=0;h<i.length;a++,h++)r[a]=i[h]+n;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!==0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,se.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;const t=this.context.gl;t.disable(t.BLEND),se.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){const t=se.globalDrawCalls;return se.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},Ai=class{context;isDrawing=!1;mesh;shapeType=4;color=new it(1,1,1,1);shader=null;vertexIndex=0;tmp=new Ee;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error(`Can't have more than 10920 triangles per batch: ${t}`);this.context=e instanceof Tt?e:new Tt(e),this.mesh=new yi(e,[new Je,new Qe],t,0);const s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;const t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,s){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,s,t,s))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,s,i){this.color.set(e,t,s,i)}point(e,t,s){this.check(0,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,n){this.check(1,2),n||(n=this.color),this.vertex(e,t,n),this.vertex(s,i,n)}triangle(e,t,s,i,n,r,a,h,c,o){this.check(e?4:1,3),h||(h=this.color),c||(c=this.color),o||(o=this.color),e?(this.vertex(t,s,h),this.vertex(i,n,c),this.vertex(r,a,o)):(this.vertex(t,s,h),this.vertex(i,n,c),this.vertex(i,n,h),this.vertex(r,a,c),this.vertex(r,a,h),this.vertex(t,s,c))}quad(e,t,s,i,n,r,a,h,c,o,l,d,m){this.check(e?4:1,3),o||(o=this.color),l||(l=this.color),d||(d=this.color),m||(m=this.color),e?(this.vertex(t,s,o),this.vertex(i,n,l),this.vertex(r,a,d),this.vertex(r,a,d),this.vertex(h,c,m),this.vertex(t,s,o)):(this.vertex(t,s,o),this.vertex(i,n,l),this.vertex(i,n,l),this.vertex(r,a,d),this.vertex(r,a,d),this.vertex(h,c,m),this.vertex(h,c,m),this.vertex(t,s,o))}rect(e,t,s,i,n,r){this.quad(e,t,s,t+i,s,t+i,s+n,t,s+n,r,r,r,r)}rectLine(e,t,s,i,n,r,a){this.check(e?4:1,8),a||(a=this.color);const h=this.tmp.set(n-s,t-i);h.normalize(),r*=.5;const c=h.x*r,o=h.y*r;e?(this.vertex(t+c,s+o,a),this.vertex(t-c,s-o,a),this.vertex(i+c,n+o,a),this.vertex(i-c,n-o,a),this.vertex(i+c,n+o,a),this.vertex(t-c,s-o,a)):(this.vertex(t+c,s+o,a),this.vertex(t-c,s-o,a),this.vertex(i+c,n+o,a),this.vertex(i-c,n-o,a),this.vertex(i+c,n+o,a),this.vertex(t+c,s+o,a),this.vertex(i-c,n-o,a),this.vertex(t-c,s-o,a))}x(e,t,s){this.line(e-s,t-s,e+s,t+s),this.line(e-s,t+s,e+s,t-s)}polygon(e,t,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color),t<<=1,s<<=1;const n=e[t],r=e[t+1],a=t+s;for(let h=t,c=t+s-2;h<c;h+=2){const o=e[h],l=e[h+1];let d=0,m=0;h+2>=a?(d=n,m=r):(d=e[h+2],m=e[h+3]),this.vertex(o,l,i),this.vertex(d,m,i)}}circle(e,t,s,i,n,r=0){if(r===0&&(r=Math.max(1,6*B.cbrt(i)|0)),r<=0)throw new Error("segments must be > 0.");n||(n=this.color);const a=2*B.PI/r,h=Math.cos(a),c=Math.sin(a);let o=i,l=0;if(e){this.check(4,r*3+3),r--;for(let d=0;d<r;d++){this.vertex(t,s,n),this.vertex(t+o,s+l,n);const m=o;o=h*o-c*l,l=c*m+h*l,this.vertex(t+o,s+l,n)}this.vertex(t,s,n),this.vertex(t+o,s+l,n)}else{this.check(1,r*2+2);for(let d=0;d<r;d++){this.vertex(t+o,s+l,n);const m=o;o=h*o-c*l,l=c*m+h*l,this.vertex(t+o,s+l,n)}this.vertex(t+o,s+l,n)}o=i,l=0,this.vertex(t+o,s+l,n)}curve(e,t,s,i,n,r,a,h,c,o){this.check(1,c*2+2),o||(o=this.color);const l=1/c,d=l*l,m=l*l*l,f=3*l,u=3*d,p=6*d,g=6*m,x=e-s*2+n,b=t-i*2+r,w=(s-n)*3-e+a,v=(i-r)*3-t+h;let y=e,T=t,A=(s-e)*f+x*u+w*m,S=(i-t)*f+b*u+v*m,C=x*p+w*g,I=b*p+v*g;const Y=w*g,F=v*g;for(;c-- >0;)this.vertex(y,T,o),y+=A,T+=S,A+=C,S+=I,C+=Y,I+=F,this.vertex(y,T,o);this.vertex(y,T,o),this.vertex(a,h,o)}vertex(e,t,s){let i=this.vertexIndex;const n=this.mesh.getVertices();n[i++]=e,n[i++]=t,n[i++]=s.r,n[i++]=s.g,n[i++]=s.b,n[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();const e=this.context.gl;e.disable(e.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!==0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType===e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}},xn=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(xn||{}),bn=class Li{boneLineColor=new it(1,0,0,1);boneOriginColor=new it(0,1,0,1);attachmentLineColor=new it(0,0,1,.5);triangleLineColor=new it(1,.64,0,.5);pathColor=new it().setFromString("FF7F00");clipColor=new it(.8,0,0,2);aabbColor=new it(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;scale=1;boneWidth=2;context;bounds=new cn;temp=[];vertices=O.newFloatArray(2*1024);static LIGHT_GRAY=new it(192/255,192/255,192/255,1);static GREEN=new it(0,1,0,1);constructor(t){this.context=t instanceof Tt?t:new Tt(t)}draw(t,s,i){const n=s.x,r=s.y,a=this.context.gl;t.setBlendMode(a.ONE,a.ONE,a.ONE_MINUS_SRC_ALPHA);const h=s.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let c=0,o=h.length;c<o;c++){const l=h[c];if(i&&i.indexOf(l.data.name)>-1||!l.parent)continue;const d=l.appliedPose,m=l.data.length*d.a+d.worldX,f=l.data.length*d.c+d.worldY;t.rectLine(!0,d.worldX,d.worldY,m,f,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(n,r,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);const c=s.slots;for(let o=0,l=c.length;o<l;o++){const d=c[o];if(!d.bone.active)continue;const m=d.appliedPose.attachment;if(m instanceof zt){const f=this.vertices;m.computeWorldVertices(d,m.getOffsets(d.appliedPose),f,0,2),t.line(f[0],f[1],f[2],f[3]),t.line(f[2],f[3],f[4],f[5]),t.line(f[4],f[5],f[6],f[7]),t.line(f[6],f[7],f[0],f[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){const c=s.slots;for(let o=0,l=c.length;o<l;o++){const d=c[o];if(!d.bone.active)continue;const m=d.appliedPose.attachment;if(!(m instanceof Ut))continue;const f=this.vertices;m.computeWorldVertices(s,d,0,m.worldVerticesLength,f,0,2);const u=m.triangles;let p=m.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let g=0,x=u.length;g<x;g+=3){const b=u[g]*2,w=u[g+1]*2,v=u[g+2]*2;t.triangle(!1,f[b],f[b+1],f[w],f[w+1],f[v],f[v+1])}}if(this.drawMeshHull&&p>0){t.setColor(this.attachmentLineColor),p=(p>>1)*2;let g=f[p-2],x=f[p-1];for(let b=0,w=p;b<w;b+=2){const v=f[b],y=f[b+1];t.line(v,y,g,x),g=v,x=y}}}}if(this.drawBoundingBoxes){const c=this.bounds;c.update(s,!0),t.setColor(this.aabbColor),t.rect(!1,c.minX,c.minY,c.getWidth(),c.getHeight());const o=c.polygons,l=c.boundingBoxes;for(let d=0,m=o.length;d<m;d++){const f=o[d];t.setColor(l[d].color),t.polygon(f,0,f.length)}}if(this.drawPaths){const c=s.slots;for(let o=0,l=c.length;o<l;o++){const d=c[o];if(!d.bone.active)continue;const m=d.appliedPose.attachment;if(!(m instanceof ve))continue;let f=m.worldVerticesLength;const u=this.temp=O.setArraySize(this.temp,f,0);m.computeWorldVertices(s,d,0,f,u,0,2);const p=this.pathColor;let g=u[2],x=u[3],b=0,w=0;if(m.closed){t.setColor(p);const v=u[0],y=u[1],T=u[f-2],A=u[f-1];b=u[f-4],w=u[f-3],t.curve(g,x,v,y,T,A,b,w,32),t.setColor(Li.LIGHT_GRAY),t.line(g,x,v,y),t.line(b,w,T,A)}f-=4;for(let v=4;v<f;v+=6){const y=u[v],T=u[v+1],A=u[v+2],S=u[v+3];b=u[v+4],w=u[v+5],t.setColor(p),t.curve(g,x,y,T,A,S,b,w,32),t.setColor(Li.LIGHT_GRAY),t.line(g,x,y,T),t.line(b,w,A,S),g=b,x=w}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let c=0,o=h.length;c<o;c++){const l=h[c];if(i&&i.indexOf(l.data.name)>-1)continue;const d=l.appliedPose;t.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){const c=s.slots;t.setColor(this.clipColor);for(let o=0,l=c.length;o<l;o++){const d=c[o];if(!d.bone.active)continue;const m=d.appliedPose.attachment;if(!(m instanceof Zt))continue;const f=m.worldVerticesLength,u=this.temp=O.setArraySize(this.temp,f,0);m.computeWorldVertices(s,d,0,f,u,0,2);for(let p=0,g=u.length;p<g;p+=2){const x=u[p],b=u[p+1],w=u[(p+2)%u.length],v=u[(p+3)%u.length];t.line(x,b,w,v)}}}}dispose(){}},zr=class{constructor(e,t,s){this.vertices=e,this.numVertices=t,this.numFloats=s}},wn=class Vn{static QUAD_TRIANGLES=[0,1,2,2,3,0];tempColor=new it;tempColor2=new it;vertices;vertexSize=8;twoColorTint=!1;renderable=new zr([],0,0);clipper=new xi;pmaAdditiveBatching=!0;constructor(t,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=O.newFloatArray(this.vertexSize*1024)}draw(t,s,i=-1,n=-1,r=null){const a=this.clipper,h=this.twoColorTint;let c=null;const o=this.renderable;let l,d;const m=s.drawOrder.appliedPose;let f;const u=s.color,p=h?12:8;let g=!1;i===-1&&(g=!0);for(let x=0,b=m.length;x<b;x++){const w=m[x];if(!w.bone.active){a.clipEnd(w);continue}if(i>=0&&i===w.data.index&&(g=!0),!g){a.clipEnd(w);continue}n>=0&&n===w.data.index&&(g=!1);const v=w.appliedPose,y=v.attachment;let T;if(y instanceof zt){o.vertices=this.vertices,o.numVertices=4,o.numFloats=p<<2;const A=y.sequence,S=A.resolveIndex(v);y.computeWorldVertices(w,y.getOffsets(v),o.vertices,0,p),d=Vn.QUAD_TRIANGLES,l=A.getUVs(S),T=A.regions[S]?.texture,f=y.color}else if(y instanceof Ut){o.vertices=this.vertices,o.numVertices=y.worldVerticesLength>>1,o.numFloats=o.numVertices*p,o.numFloats>o.vertices.length&&(o.vertices=this.vertices=O.newFloatArray(o.numFloats)),y.computeWorldVertices(s,w,0,y.worldVerticesLength,o.vertices,0,p),d=y.triangles;const A=y.sequence,S=A.resolveIndex(v);T=A.regions[S]?.texture,l=A.getUVs(S),f=y.color}else if(y instanceof Zt){a.clipEnd(w),a.clipStart(s,w,y);continue}else{a.clipEnd(w);continue}if(T){const A=v.color,S=this.tempColor,C=u.a*A.a*f.a;S.r=u.r*A.r*f.r*C,S.g=u.g*A.g*f.g*C,S.b=u.b*A.b*f.b*C;const I=w.data.blendMode,Y=this.pmaAdditiveBatching&&I===1;S.a=Y?0:C;const F=this.tempColor2;v.darkColor?(F.r=v.darkColor.r*C,F.g=v.darkColor.g*C,F.b=v.darkColor.b*C,F.a=1):F.set(0,0,0,1);const k=Y?0:I;if(k!==c&&(c=k,t.setBlendMode(c)),a.isClipping()&&a.clipTriangles(o.vertices,d,d.length,l,S,F,h,p)){const X=new Float32Array(a.clippedVertices),R=a.clippedTriangles;r&&r(X,X.length,p),t.draw(T,X,R)}else{const X=o.vertices;if(h)for(let V=2,q=0,U=o.numFloats;V<U;V+=p,q+=2)X[V]=S.r,X[V+1]=S.g,X[V+2]=S.b,X[V+3]=S.a,X[V+4]=l[q],X[V+5]=l[q+1],X[V+6]=F.r,X[V+7]=F.g,X[V+8]=F.b,X[V+9]=F.a;else for(let V=2,q=0,U=o.numFloats;V<U;V+=p,q+=2)X[V]=S.r,X[V+1]=S.g,X[V+2]=S.b,X[V+3]=S.a,X[V+4]=l[q],X[V+5]=l[q+1];const R=o.vertices.subarray(0,o.numFloats);r&&r(o.vertices,o.numFloats,p),t.draw(T,R,d)}}a.clipEnd(w)}a.clipEnd()}getSkeletonClipping(){return this.clipper}},E=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],ts=[0,1,2,2,3,0],es=new it(1,1,1,1),yn=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;maxCanvasWidth=0;maxCanvasHeight=0;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,s=!0){this.canvas=e,this.context=t instanceof Tt?t:new Tt(t),this.twoColorTint=s,this.camera=new fn(e.width,e.height),this.batcherShader=s?Lt.newTwoColoredTextured(this.context):Lt.newColoredTextured(this.context),this.batcher=new Ti(this.context,s),this.shapesShader=Lt.newColored(this.context),this.shapes=new Ai(this.context),this.skeletonRenderer=new wn(this.context,s),this.skeletonDebugRenderer=new bn(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(e,t=-1,s=-1,i=null){this.enableRenderer(this.batcher),this.skeletonRenderer.draw(this.batcher,e,t,s,i)}drawSkeletonDebug(e,t){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.draw(this.shapes,e,t)}drawTexture(e,t,s,i,n,r){this.enableRenderer(this.batcher),r||(r=es);var a=0;E[a++]=t,E[a++]=s,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=0,E[a++]=1,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a++]=0),E[a++]=t+i,E[a++]=s,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=1,E[a++]=1,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a++]=0),E[a++]=t+i,E[a++]=s+n,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=1,E[a++]=0,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a++]=0),E[a++]=t,E[a++]=s+n,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=0,E[a++]=0,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a]=0),this.batcher.draw(e,E,ts)}drawTextureUV(e,t,s,i,n,r,a,h,c,o){this.enableRenderer(this.batcher),o||(o=es);var l=0;E[l++]=t,E[l++]=s,E[l++]=o.r,E[l++]=o.g,E[l++]=o.b,E[l++]=o.a,E[l++]=r,E[l++]=a,this.twoColorTint&&(E[l++]=0,E[l++]=0,E[l++]=0,E[l++]=0),E[l++]=t+i,E[l++]=s,E[l++]=o.r,E[l++]=o.g,E[l++]=o.b,E[l++]=o.a,E[l++]=h,E[l++]=a,this.twoColorTint&&(E[l++]=0,E[l++]=0,E[l++]=0,E[l++]=0),E[l++]=t+i,E[l++]=s+n,E[l++]=o.r,E[l++]=o.g,E[l++]=o.b,E[l++]=o.a,E[l++]=h,E[l++]=c,this.twoColorTint&&(E[l++]=0,E[l++]=0,E[l++]=0,E[l++]=0),E[l++]=t,E[l++]=s+n,E[l++]=o.r,E[l++]=o.g,E[l++]=o.b,E[l++]=o.a,E[l++]=r,E[l++]=c,this.twoColorTint&&(E[l++]=0,E[l++]=0,E[l++]=0,E[l]=0),this.batcher.draw(e,E,ts)}drawTextureRotated(e,t,s,i,n,r,a,h,c){this.enableRenderer(this.batcher),c||(c=es);const o=t+r,l=s+a,d=-r,m=-a,f=i-r,u=n-a,p=d,g=m,x=d,b=u,w=f,v=u,y=f,T=m;let A=0,S=0,C=0,I=0,Y=0,F=0,k=0,X=0;if(h!==0){const V=B.cosDeg(h),q=B.sinDeg(h);A=V*p-q*g,S=q*p+V*g,k=V*x-q*b,X=q*x+V*b,Y=V*w-q*v,F=q*w+V*v,C=Y+(A-k),I=F+(S-X)}else A=p,S=g,k=x,X=b,Y=w,F=v,C=y,I=T;A+=o,S+=l,C+=o,I+=l,Y+=o,F+=l,k+=o,X+=l;var R=0;E[R++]=A,E[R++]=S,E[R++]=c.r,E[R++]=c.g,E[R++]=c.b,E[R++]=c.a,E[R++]=0,E[R++]=1,this.twoColorTint&&(E[R++]=0,E[R++]=0,E[R++]=0,E[R++]=0),E[R++]=C,E[R++]=I,E[R++]=c.r,E[R++]=c.g,E[R++]=c.b,E[R++]=c.a,E[R++]=1,E[R++]=1,this.twoColorTint&&(E[R++]=0,E[R++]=0,E[R++]=0,E[R++]=0),E[R++]=Y,E[R++]=F,E[R++]=c.r,E[R++]=c.g,E[R++]=c.b,E[R++]=c.a,E[R++]=1,E[R++]=0,this.twoColorTint&&(E[R++]=0,E[R++]=0,E[R++]=0,E[R++]=0),E[R++]=k,E[R++]=X,E[R++]=c.r,E[R++]=c.g,E[R++]=c.b,E[R++]=c.a,E[R++]=0,E[R++]=0,this.twoColorTint&&(E[R++]=0,E[R++]=0,E[R++]=0,E[R]=0),this.batcher.draw(e,E,ts)}drawRegion(e,t,s,i,n,r){this.enableRenderer(this.batcher),r||(r=es);var a=0;E[a++]=t,E[a++]=s,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=e.u,E[a++]=e.v2,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a++]=0),E[a++]=t+i,E[a++]=s,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=e.u2,E[a++]=e.v2,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a++]=0),E[a++]=t+i,E[a++]=s+n,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=e.u2,E[a++]=e.v,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a++]=0),E[a++]=t,E[a++]=s+n,E[a++]=r.r,E[a++]=r.g,E[a++]=r.b,E[a++]=r.a,E[a++]=e.u,E[a++]=e.v,this.twoColorTint&&(E[a++]=0,E[a++]=0,E[a++]=0,E[a]=0),this.batcher.draw(e.page.texture,E,ts)}line(e,t,s,i,n,r){this.enableRenderer(this.shapes),this.shapes.line(e,t,s,i,n)}triangle(e,t,s,i,n,r,a,h,c,o){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,s,i,n,r,a,h,c,o)}quad(e,t,s,i,n,r,a,h,c,o,l,d,m){this.enableRenderer(this.shapes),this.shapes.quad(e,t,s,i,n,r,a,h,c,o,l,d,m)}rect(e,t,s,i,n,r){this.enableRenderer(this.shapes),this.shapes.rect(e,t,s,i,n,r)}rectLine(e,t,s,i,n,r,a){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,s,i,n,r,a)}polygon(e,t,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,s,i)}circle(e,t,s,i,n,r=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,s,i,n,r)}curve(e,t,s,i,n,r,a,h,c,o){this.enableRenderer(this.shapes),this.shapes.curve(e,t,s,i,n,r,a,h,c,o)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(e,t,s){const i=this.canvas,n=this.getSafeDevicePixelRatio(i.clientWidth,i.clientHeight);var r=Math.round(i.clientWidth*n),a=Math.round(i.clientHeight*n);if((i.width!==r||i.height!==a)&&(i.width=r,i.height=a),e===3&&t!==void 0&&s!==void 0){const h=a/r,c=s/t,o=h>c?r/t:a/s;t*=o,s*=o,this.camera.setViewport(t,s),this.context.gl.viewport((r-t)/2,(a-s)/2,t,s)}else{if(e===2){const h=this.camera.viewportWidth,c=this.camera.viewportHeight,o=c/h,l=a/r,d=o<l?h/r:c/a;this.camera.setViewport(r*d,a*d)}else e===1&&this.camera.setViewport(r,a);this.context.gl.viewport(0,0,r,a)}this.camera.update()}getSafeDevicePixelRatio(e,t){const s=window.devicePixelRatio||1;if(e<=0||t<=0)return s;if(this.maxCanvasWidth===0||this.maxCanvasHeight===0){const i=this.context.gl,n=i.getParameter(i.MAX_RENDERBUFFER_SIZE),r=i.getParameter(i.MAX_VIEWPORT_DIMS);this.maxCanvasWidth=Math.min(n,r[0]),this.maxCanvasHeight=Math.min(n,r[1])}return Math.min(s,this.maxCanvasWidth/e,this.maxCanvasHeight/t)}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof Ti?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Lt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof Ai?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Lt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},vn=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e[e.FitClip=3]="FitClip",e))(vn||{}),le,Jt,Si=0,qr=1,Ci=1,ss=165,is=108,Pt=163,Wr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new as;backgroundColor=new it(.135,.135,.135,1);tempColor=new it;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!Jt){const t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Si++;Jt=new Image,Jt.src=_r,t||(Jt.crossOrigin="anonymous"),Jt.onload=s,le=new Image,le.src=Gr,t||(le.crossOrigin="anonymous"),le.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Si<2||e&&this.fadeOut>Ci)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,5));const s=this.tempColor,i=this.renderer,n=i.canvas,r=i.context.gl;if(i.resize(1),i.camera.position.set(n.width/2,n.height/2,0),i.batcher.setBlendMode(0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Ci)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/Ci,t=1-(t-1)*(t-1),s.a*=t,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(r.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),r.clear(r.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/qr,1),s.set(t,t,t,t),this.logo||(this.logo=new ae(i.context,Jt,!0),this.spinner=new ae(i.context,le,!0)),i.camera.zoom=Math.max(1,Pt/n.height),i.begin(),i.drawTexture(this.logo,(n.width-ss)/2,(n.height-is)/2,ss,is,s),this.spinner&&i.drawTextureRotated(this.spinner,(n.width-Pt)/2,(n.height-Pt)/2,Pt,Pt,Pt/2,Pt/2,this.angle,s),i.end()}drawInCoordinates(e,t){if(Si<2)return;this.timeKeeper.update();const s=this.renderer;s.batcher.setBlendMode(0),this.logo||(this.logo=new ae(s.context,Jt,!0),this.spinner=new ae(s.context,le,!0));const i=e-ss/2,n=t-is/2;s.drawTexture(this.logo,i,n,ss,is),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,n-25,Pt,Pt,Pt/2,Pt/2,this.angle)}},Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlOtmVFtdTGrrZkJCxYXsTgaI6r9MY4/UpNItW4mFDaXsTlaM6qVZlBq3UwofFrJp0HMWJ9DvXUzobCznJ1BzFjWlTLrZkJh/TDWBzFjTgo51s2EgnKI0Rrx+FiOWzNzVaym91Syx5qZsGBWb2ZFa0ZN6dbMhAWTcpkUrRmXD2K5NTNhgVbH0Zpxbl/mWjMTFvRIo0e0ZpzcncnWzISKtvmiMWNRJ4qslwmVXRXsas2Ix8ZwzFqZsGFREYtaM+Oaa1ljrUzYkJ9G/ok6TlzKjJWZVFor0y7c1Zu7WjLiqiGsskamXdHopyT4vALmzS9k/t19uHtKHlOSIMn6xAtARjIZ1sFcUSZ0Y4La+G6M18hS2IlCn4a+WoC0JNL0d/dUupdnUj40g6EJ2VEdMnhrOG/p5f/jUXz8SgmvaGU6KpNRNsLVQV0OdXf24s63h/P2gWoOrBjMCr2GJFQnnxnIM3q5P1PPmaYv+4ev4/C6UtbpV2gzXCkgL5W8Bwt48OIc6ul6Tp+s4+SyASxLiI4+PYCn1bHzDZxvaQW6vZzto7MYnQIpNkf7kp5EuozYUroqEjcNKHHd0Tl9mBPN1pk+hFeieGBnBtog7UXjsj9pWg+m6duecw2cay1OC/uxMC47KmP9OIYfoz1YoC20J/rzRG4quTZK2EAyJGs20qwUbYw0aNRmUxtvfUW/uEtNzc1NB1/X8LVyd15hh82F43AvD+VlXcsSJEZa1CQ3ejleAO7oxR3RDP0XN91X4+NXYb8nkv7UNTwV7e0YTdu7I3g33t7tuaEbNwSZpps2fSyvs4M2Tjhot+jb0Xzbltj8r5j/xVt/6Z1Ob93U1ZYO691EhhzchcHeXosVjcNZysyezLw4xRZt05R+fTeuj8vOj+zKyG0j2aZcVVs6v+QalnjrMFZASQYl2nBoSyz06e3j/Xk8rgWYmMvEICu2pm1HOTuc7okV8FgRj0XukwzanhvCc/F+72TjoQjdObN1OFuDLmh0xP+WHtxiI10ukJlCprb4guiv1fP+avZrS1C7NAkliHZjDtZwMMgqbukAltpMlwuMy2FcEBPqvfLLar5Uqi0hBdEwryy+Mv5n6zkbjTBa+dlMlwvUZFETZKGiFM7tvbhdJ3gSVRO0wzIjnxmvl/J6a6JsGMYGrahtpssFeqbR841S3mhN80OjOaSDEdqd6SjaMKgzgzRK7q1ib3PT9sYyNo7JZoyNFNvRcVMZmy7WOvIuryv/Zvdmdt90+nY0bRp3AvROohFwdwW7dTG7RFlbwlqdrbOBYg005NAQmZU0HWt1rXMBH1Xw0dQ8pmqzoaPmdhun7bHZjNVe9qP9eFQfO1VkUmHjhAVUZ1GtnKFSbjrkrPfy4i4UW5t/6ZxM54J0CqxFe81KpGsQyE4h23oYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjLna+bdOy+IiFquIpGq16Pb79cNYv3IIK/X/ugx+Ui6TVKvYVU9Nc8gX8od8Ir/IN/KPfCQ/yVfyl/6/pfJvLChkQdD6wyqntquCXYuKWJSfRr6D0dEAxV3xlw/khyD+kd/ku/88cHo+09tS3LBpO1HHCVUqcIA6CqB4K+6X6x35L/JM2loXurlWmUmlA5XogOIcK8/If5HncrSWo7F6cKIWPjT/RXGOlWfkv8hzaWsN4uaaysE6WIkOKM6x8oz8F3kusXqo2vxC5jtYiQ4ozrH0TeS5qIZcrB7qkrwdA8U5Vp6R/yLPZV8V+2L14Cl5THGwEh1QnGPlGfkv8lyUlIzFQ1cNYVVHrcjZ0VCcFe9Y+Eb+izy3ceclUl43aFN52DXXssYpnY6a4qFS8ZcP2uIf+e7inRh6pdFrdTGrm8uiHx/L8T2V7NGWzvJBLJ/bl7mTuzO5qBNFDoiJID/IF/KHfCK/yDfyT3O7d/KbfNfS80hNIrU0g9L6HOq1x5iTQo6FNpeLfCQ/yVfyl3xmXYwxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHNk9z4JwJ0SqKTdQkbyEwhU393T6V7zzR6pieR3tE1ITeVXImhe6BXDGZFdRbVeank2TBhcaEMr0rwbixj49IBLL2/L/ffmMuNHfqO9tFZjJYBd1ewO3Lx+IcVfKhqna5nHZYR6XFPH+5R3eeI5t9fx/fvjeC9Jdew5OKZKqFR/RDVKL6vL/f9PJafmyvHsL+a/ff24V6NmjZQbGchVbY6UM2BluqHv1rCqzVZ1KQlkZboepCdQvacPsz5bjTfXao+yMEaDt7Wk9tSIMVGig3TejCtJSM2bSpkPjWPqd1S6Zao+lORSYWmgkOjORRNwZqd5ezMSiHLRooNr5XwWjS6/1XHX9vL2T67N7M1iyXa9JCrYjVrS1gbpJyw6hBfsmiNCYT0P9/A+Wj1/6qGr5YNYFlJBiWJogEzezLz/ZG8/9s4fgtSyuvNYbyp1IONFBtu7sHNv4/j9yAxUHWrdaWsG9+N8XHd+YxkMpSy+aySz841cC5oXbmHCnnI74yxAgZ3YbDeB4PEQCOpBpFNZWwa2ZWRcdnxLsl00crtRB0n2lLg8JNRfDKoM4NsolgBSmw/UMADba1+qpmqfyf6x1u/0a/og3I+aEunP6/i86osqmygcGarF4p54dex/Bo0LqfqOfVwIQ/HW5/RSkwV1oN2WLlHTc82TljAwM4M1O5LWwYKZTjibYXNS0N5KcjKTe10PadfLObFuJwK4ozp+UzXDBTUjL+M5ZcBnRkQV53dMIwNQTu6bSTbVEzbi5awuVByd2E/FgaN0Tc1fKOzBHHV2aAdVSdv6s5NNkp7cSH/++xAng2yyHx+CM/H21YhfdPp+0U1X0TbSZnXx8faG9Aop0MS0cToh1p+iLcpOkLj9t/JOk5eqoPHxnDsyf486an5yqCDK7XZ1O4oZ4dWyy3FSXHUAYq47uyYbMZoGmhpG3DlEFb6uNiVBhpyaHhnBO8oJmfqOROJjzIiP43hJ8UxITqqX56S2Hur2KsOnq3nrE6PPNKPRwrSKbAZrjTQNZmuE7oxYXMZmxWbw9dxWFu4W4ezVedOE6qzI7oyYkY+M7TPeWsPbk2UX1qioSN+E3OZqOR2cReKE+qQRFN0Pi7y73g/UawU1KzezJpXwLz5hczX1ueUPKYkNb6GJQZ+j7/aAfRZREsv+quGsMoamXZBW2Gt5eU0alorEzYsKmJRa/m4NdeyxlqZsCGa84DKnVorEzboC7podis69DfIJmwufHMc7famvvmxZiYsKOtKWbRm1OcW1syEBboSJFozLh/EcmtmwgIluaM14/phrLdmJixYXMTiaM24p5I91syEBTphFOR7Y2tmwgJNvUFOr+tov3UzoaAv44KYUatv62ZCoemdhtG0+hzqrZsJBR08DWLG0gxKrZu50qvpxos3U5NItW4mFPp1ot+lPlpq2lYXs9qamVBZUMiC1ox4pJYjvlfStAu6GmTLcLboMtPIV4/6im5fFfuUi9QIap2MiWP+D96R1vPmsD/fAAAAAElFTkSuQmCC",_r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAABsCAYAAAALzHKmAAAQ7klEQVR42u3da4xdVRUA4D0zd2Y6nZY59DVtZ1puS9+lzC0YAi2UQ8AAQczFpPgA9VIeIQbirRqJ0cBUBVGjDr/QCKSNRSMmpuODxAdxqhgwxkhFjf6Sxh/+UUNVNGJCzR7uTvas7LXX2q9zzp3em6y0gTN3Zu75utZe5+yztxC9V+/Ve5X9En1Vjd7J6SFbLNF7naPw+l2jh7YHMBWssqMHtlsRdim4qsLtIawaPiHEQOLoNrA9iIkQDnRrVA1qD2LZ8ISoxYqKo13sQAtBWBayQWZUAXGRQM9JjCngDVY0UqJNDbQrMcaGmArdUKpIjbYiQLsCZCyIMQBy8QwnilR4Q5AuCpxFYvRFmBLbEiwKwpsSaWycVQGZBKMrwBjA9BhxDe57u2L2hOoKNCbOrgAZitEVYUxoKSMErQvSxYIzCkguRg5EF4AUhqUlhy/YUKSxcRaKsioYOQhD4I0yYxkR3PcJBcuFysmgsXAWBTMJyBCMIQh9kGGxXIXvexCQXbHGAMrBWTbM2CCpMSMLIxehC77lSJwXGth7M0FzoVJIXXDWQnGmhOkL0ic7YhhtWdGGkAuPAjUWGoF4faCmwBkbZmyUqUCyMqMLRA4+E6IsdTjidUHKBYrh9CnpRcH0ypKxsyOGEYNIIeTCOz91OIJ1QYoB5eAMyZo+MFNnyVTZ0YiRC9EGEMOyAgshxErHsL2XK1gOUgwohtM1a5YNM7Rsu4K0ZkcbRm4mpPBRwFZ5hg9eCqkrUB+csWGGogzNkqEgrdnRhpGLkINudaLgwvVB6oqzCjCTZElb2Y4B0gUjBtEG0ARnDRLjjoG9DwcshtQGlIPTljVjwUySLWNkyRCQVHa0ZUUTRAwgF91a33BEy0VKAcVwwqwZC2bqbOlUurllOxQkJzNyINoAYqjWhYYjWg5SCiiG05Q1U8FMjTIoS8YE6YORi1BHtJ4KIcQEEtTXUWAxpK44YVlPBdO1jCdFWTZIE8bVGEYMIRPcZGBw4HKQcoBiOE1ZMzbMgVQwU6JMAdKEEcuIJogUvg1YCCE2gsCO42DlIIVAKZwpYJaSLVNnSU6XjYHUmxhTmXaFaMO3EYkLqMC+FsLlIoVAKZzMrEnBhJeLfLNlKMrYWRIDCbOkFSSVHbHM6AKRC6/ODUewNqQ+OLlZkxpjUmV8MBbMUJSxyzY3Q1IgTRgxiBRCHdem0KDAUkBh9sRwwjEnAXMMgTnKhFlUtiwkS5rGka4g9SaGgxFmRC7AzTCEEBcyA36dDSsXqAtOLkysjGMwY5XxVChjZ0kuSCo7YlkRQsQQYtDEFsegsLoCxUp7Kpgps2UslFGzJGccSYHUmxhOZqwzEZqAbfUMCisHKIZzgsCpl3MTzMwTpi1bYp2477gyFKUxS7qWbdjY2EBS2dGE0QQRA7gNCyHEdhjE8RhUDlBT9tzgmjWZMFNlSy+Urk1OzCyJlW0XkK4YOQh1cDtcgwBrQmoDWkdgboBZE8mYsJSHlnFbJ+5bwmOPJ7lZkirbC8aRsMvmgtTHjBhGE0QbwJ2egUE1ITVlUC5OmDVdYNrKuN70xM6WoShjlW4464dbtiFIWK6x7GjESEHUUe0iYncnbMdQSE0Z1ITTNOb0hRmjjLtmS9dmJ2rp1jtuKktyyrb6YLEMCUHq2dGG0QQRQ7f72kzc+cJecerne8Wvv7JNPHPvenEkz8Sh3UtFc92QyGt9Yko/HgOLAIUZlItTz5ouMF3KuE+2jFLCQ1D6lm6fLMkBacuOJowYRBUXyfjuHjF3NhdnsfjvAfH6E9vFt9XxKgikEKgJZyyYalzOLeMu2bLbULI6bh+QGwmQ+rgRlumdGEQAao+K56bEL2woVUwOiev0r8OAUjiJrMmFCbvykGxZRAmPitK1dHM7bohyMsuyi/I8f0+e57fJYIKEZXpXo9E4mOf5XTKyLLvCBLETF8uY2SKepkC+dpX4T02Ivepr4HvZcOZ5fmee54fyPL+DmTUhzAs6n4n8bN5dr9f3YdkSg8nsxG0lPBVKVpNjG0/aGhzfLDmRZdnumZmZp8+c+cdZPV555fSr7Xb7s0jJ3i5Pcue4MxKkPPkvvXTqz/B92u32l0wYOzG1fkhcd/py8Rcbyq/vFM/KY1WA95h/3zzP71bfU6JsNpsfgj+P/FlbrdaDGExYyuXvLz8H+DudODH700ajcSM3W6Yu4alQ1spCOTd38jcKocTZbh9+9NixY99XJ8AEUkcpo9W64yH197m5k7+bnZ19QT+J09NHntQhwji/Jg58qi6++ofLxJ8gSFneVw2Ka4QQDfh1Ok4dZavVmtZ/nrm5k7/Vf55O1tRhboUw5+ZOvqyOl5+R/FyOHj32PYVU/tloNG5IXcKrhJIzngwp3fNjomazea/64BuNxts646f50lWv169utw9/DmtqdJQyZFaSJVuV6nq9fqMEof5/vV6/CYBqgJDlee+yAbF/+4i4ZWqZeNfaIfHWzn+Hx0KcEuU9+s8jv3ej0bhVlXOZydX/k0iRMeb8P0D5e6tj8zy/Xb9UJIc56h/yqVOnXul8lmuZ2bJslKmbHG7XrbpCmCXFRLvdfqQD6jTS3Jiy5I4OykM6ADV+1Eu1DmV6evopBORexzDi1L+X/HnGxsb2w3Hm9PSRJ9QxWPOTZdmlKht2hi+w6dkox5bqffI8fye3hDteGqKaHVsHXihKl0tB+h0cY+lute54AGRKDCW89LNTRynHb7ChUWVVjetOnJh9EYBUyPZeNCoOtsbFQwdXi4/esELcd+tq8cCHJ8UXp+viy9efLz7AgamjlKXc1AA1m83DoIRDlFubzeb96hhZLVTlgJ24gttutx+ONa50bHZKRenaeTs1OfpAfnr6yOOdE7EZdNwmlKocntXLNkA5JTGq47Ds+Lf94lWsyfnXleLfnIwJUN4DOnNYwuUxh2A3Ln9XULrfK8t3J27Tu3BVwiOjXJqoAy8UZej1yclGo3GTLN+gu3w+z/P3YaWbQqk3Ne12e4ZC+c8rxWsYytcPiP9RpZxCqWDKnxOiBNlyAUpOnGsoh4tA2Rm8X9xqtT6md5wyZmYe+0YRKL+1S/wYQ3n8zctBl5SBUv5djivfjMOPduIzcizeiYfr9foVvUwZG+XCuzibZKnSceZ5/v4QlKp8y7ElhnJlTeTP7BI/kllRYfzrfvHqFy4UX1vaL/aVlSmROzwbwdS29T2UcEwZF+V8ozM2lu1VY812u/15akypGh3TmFJesJbHHD167IdUxz3YJy5bNySuX1mbvy55CbMLtzU6tjGlsdFptVqfUMc0Go23F4wy1l2dSnbfvpMwVPe9WWVLDsrOJaF9MFu2Wq1PqmNkGce67xiXhTjdNwdlvV6/BgxfbPfBfVCetxi6b9/rlCup65QzM48dl2OjLMv26CibzeZ96sTIzEFdpwQXz9U1yrtVlpR/Zll2Fec65Y6l4pbbx8XHH9kknvzJlPjlHy8Tp29eKT5ou0aJoIT3w3dBlLDzVpfAJEZ1XOdaJZxnOSlvPMjPzxFljIvng914RwebsjYO7uhMyHu46sOfnf3Oz2TXDW6vvYxdFoIXz3Wc8J5zs9n8iOn2IrxTc2BM3Glqdp7dI553uaOjxrhwcob+MyuUpjs6WZZdon8OcigjPx8V+u+GTWFTSWEx3WYcdJ225jNDSE4q0GHCzlueHOyujn6bUWYgeb9ZZUaQPe+GzQ+Gc8+oOGhC+c1d4gfI16n3XDAhQ7+9qE9l01E2Go132GYKyXE1NiFDTcpoNpv3LOYJGWXNErJNW9sEp63p2RKiVPMn1bS1DgxsyhoGdGpmizj+xtXiDYnx7/vFmce3iWdW1cTVGEY4hQ2ZW0nNq8Qm/M6XbXm3S100lwGedFybuvNOibLI+ZS2ceU4eAxiEuvCkfmU8ycToDxETe6FgCBQHeqyAbFvfEhcO7BwDuXFCEbTZF840XeHK0jYcbs2OIGle0mVJ/mmnClEPQqxyTY5I8/zFhif7fSZee4bnrPOU4AssnRXHaVTCTd14dRDY3UbTIiSeFhsN/aMjgnqthFx880rxX3yATL5p3y4LPXzOaBkUyBjZMlYpbtQlIOBD475ZEusjMNSvkXe6VEoJVDkeZ2dzIfIFsRzU+JF2OyM9M9fTC/6SUYOyFQPjQ2nWiUjxnPfw5EeHqMWIqAeIFsAU847lJM2JM6xsewt1OIDLs99P7ZFHNdB/upS8XtPiD7PfLuCXJNolYyyFiNI/Zit65ItrOVafFbHcFohY7hPTN21Tjz4uc3iqfsnxKdX1MTl1OoYRFaMsToGB6Trw2JFP/OdZC2hJZ7ZkrMoAbbSGmelDJ91hFKuJeS7jlBMkJnrAqqJlgMUZS/dArPlGHNdSg5M3xXXtvquuEatvIYtDRhpxbUJuIgqsU5lGWtUploK0KuEU9mSW8YpmFQ556xNuYW7NiW13B+FkMiKHIy+C6eGgBxJvMR0oSv5hi6+z4HJyZoU0M2RVvDlrOQbcxVfX5AhZbuqy0v7ZstYMLHlAVlLTF9ALLbvu9Y5Zylpn/XOsd0ibIvxr2KCLHpp6SCUIdnSZSF+WzfOhem6GD+1KwR3Z4jNjrtDpNoZwmWd8yrupZN6Hx3fbMmFSe0Swdq2ZIPjxk1112Duo8OBGLrBkw/IoncdK2XHsdC9dHz204m50xh3tzFq1zFqtzHXrfCw7OgDsqyNnZLszVijsmXgrmNcmGtS78lIoMX2aJz03fKO2sDJddPQSCDPiQ1DfWBycY6XtXstc2PQKuxgG2McmXTPb9/9vmuJYXKyJrWjbeg+3xPM4O73nWqvbyw7xgZZSJbEUBa157cNJjdr2vb+5iA1YV3HxYscj30PDCEHIgcjtfm8K8hSsmRotkwFk5s1TTghUAopB6xrjHMBBkI0YYTZ0dZlxwLpkiWDULpmy5gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Hr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new Tt(e,t.webglConfig),this.renderer=new yn(e,this.context),this.gl=this.context.gl,this.assetManager=new dn(this.context,t.pathPrefix),this.input=new wi(e),t.app.loadAssets&&t.app.loadAssets(this);const s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new as;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,s,i){this.gl.clearColor(e,t,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};export{$s as ATTACH_RETAIN,Zs as ATTACH_SETUP,Is as AlphaTimeline,Re as Animation,qn as AnimationState,Wn as AnimationStateAdapter,Gn as AnimationStateData,ji as AssetCache,dn as AssetManager,Hi as AssetManagerBase,_n as AtlasAttachmentLoader,ds as Attachment,ie as AttachmentTimeline,rn as BinaryInput,hi as BlendMode,Ve as Bone,Qs as BoneData,ke as BonePose,Wt as BoneTimeline1,Fe as BoneTimeline2,Js as BoundingBoxAttachment,_s as CURRENT,Or as CameraController,Zt as ClippingAttachment,it as Color,mn as Color2Attribute,Qe as ColorAttribute,re as Constraint,oe as ConstraintData,ne as ConstraintTimeline1,qt as CurveTimeline,pe as CurveTimeline1,Un as DebugUtils,Ys as DeformTimeline,Ks as Downloader,$i as DrawOrder,we as DrawOrderFolderTimeline,jt as DrawOrderTimeline,Oe as Event,si as EventData,Wi as EventQueue,Le as EventTimeline,Gi as EventType,Hs as FIRST,Dn as FakeTexture,$t as FromProperty,_e as FromRotate,Ze as FromScaleX,$e as FromScaleY,Ke as FromShearY,He as FromX,je as FromY,ae as GLTexture,ye as HOLD,Ki as IkConstraint,Te as IkConstraintData,Ue as IkConstraintPose,Fs as IkConstraintTimeline,Xe as Inherit,As as InheritTimeline,wi as Input,Bn as IntSet,ue as Interpolation,Wr as LoadingScreen,G as M00,K as M01,J as M02,_ as M03,Q as M10,H as M11,tt as M12,j as M13,et as M20,st as M21,Z as M22,$ as M23,rt as M30,ot as M31,at as M32,nt as M33,js as MODE,Tt as ManagedWebGLRenderingContext,B as MathUtils,Ce as Matrix4,yi as Mesh,Ut as MeshAttachment,Oi as MixFrom,fn as OrthoCamera,ve as PathAttachment,Ji as PathConstraint,Ae as PathConstraintData,ks as PathConstraintMixTimeline,Ne as PathConstraintPose,Ps as PathConstraintPositionTimeline,Xs as PathConstraintSpacingTimeline,Qi as Physics,oi as PhysicsConstraint,Os as PhysicsConstraintDampingTimeline,Se as PhysicsConstraintData,Ds as PhysicsConstraintGravityTimeline,Vs as PhysicsConstraintInertiaTimeline,Us as PhysicsConstraintMassTimeline,zs as PhysicsConstraintMixTimeline,De as PhysicsConstraintPose,qs as PhysicsConstraintResetTimeline,Bs as PhysicsConstraintStrengthTimeline,Nt as PhysicsConstraintTimeline,Ns as PhysicsConstraintWindTimeline,Zi as PointAttachment,Ti as PolygonBatcher,me as Pool,ti as Posed,ei as PosedActive,Pe as PosedData,Je as Position2Attribute,Ur as Position3Attribute,ii as PositionMode,Xi as Pow,On as PowOut,Ui as Property,Es as RGB2Timeline,Ms as RGBA2Timeline,Ss as RGBATimeline,Cs as RGBTimeline,zt as RegionAttachment,vn as ResizeMode,ri as RotateMode,xe as RotateTimeline,_i as SETUP,xs as ScaleTimeline,bs as ScaleXTimeline,Be as ScaleYMode,ws as ScaleYTimeline,yn as SceneRenderer,ge as Sequence,fs as SequenceMode,us as SequenceModeValues,Rs as SequenceTimeline,Lt as Shader,Ai as ShapeRenderer,xn as ShapeType,ys as ShearTimeline,vs as ShearXTimeline,Ts as ShearYTimeline,en as Skeleton,Hn as SkeletonBinary,cn as SkeletonBounds,xi as SkeletonClipping,ai as SkeletonData,bn as SkeletonDebugRenderer,Xr as SkeletonJson,wn as SkeletonRenderer,Vr as SkeletonRendererCore,We as Skin,ci as SkinEntry,sn as Slider,Gt as SliderData,Gs as SliderMixTimeline,qe as SliderPose,Ws as SliderTimeline,tn as Slot,be as SlotCurveTimeline,li as SlotData,ze as SlotPose,ni as SpacingMode,Hr as SpineCanvas,Pi as StringSet,vi as TexCoordAttribute,cs as Texture,ls as TextureAtlas,Bi as TextureAtlasPage,hs as TextureAtlasRegion,Ye as TextureFilter,Vi as TextureRegion,ki as TextureWrap,as as TimeKeeper,gt as Timeline,Kt as ToProperty,di as ToRotate,mi as ToScaleX,gi as ToScaleY,pi as ToShearY,fi as ToX,ui as ToY,un as Touch,qi as TrackEntry,nn as TransformConstraint,ft as TransformConstraintData,Ge as TransformConstraintPose,Ls as TransformConstraintTimeline,ms as TranslateTimeline,gs as TranslateXTimeline,ps as TranslateYTimeline,ln as Triangulator,O as Utils,Ee as Vector2,Yt as Vector3,Dt as VertexAttachment,ce as VertexAttribute,gn as VertexAttributeType,Nn as WindowedMean,Di as isBoneTimeline,zi as isConstraintTimeline,Ni as isSlotTimeline};
|