@esotericsoftware/spine-canvas 4.2.81 → 4.2.82

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,2 +1,2 @@
1
- "use strict";var Ps=Object.defineProperty,Bs=(e,t,s)=>t in e?Ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,B=(e,t,s)=>(Bs(e,typeof t!="symbol"?t+"":t,s),s),Vs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},st=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var 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}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,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(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new be().setFromString(e)}},D=be;B(D,"WHITE",new be(1,1,1,1)),B(D,"RED",new be(1,0,0,1)),B(D,"GREEN",new be(0,1,0,1)),B(D,"BLUE",new be(0,0,1,1)),B(D,"MAGENTA",new be(1,0,1,1));var ne=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ne.degRad)}static sinDeg(e){return Math.sin(e*ne.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ne.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ne.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},E=ne;B(E,"PI",3.1415927),B(E,"PI2",ne.PI*2),B(E,"invPI2",1/ne.PI2),B(E,"radiansToDegrees",180/ne.PI),B(E,"radDeg",ne.radiansToDegrees),B(E,"degreesToRadians",ne.PI/180),B(E,"degRad",ne.degreesToRadians);var ns=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ls=class extends ns{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}},Ls=class extends ls{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Se=class{static arrayCopy(e,t,s,i,a){for(let c=t,o=i;c<t+a;c++,o++)s[o]=e[c]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:Se.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return Se.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Se.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=Se;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ns=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Te=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&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}},Ve=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},Os=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let 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)}},Ds=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}},rt=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},os=class extends rt{id=os.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,c){s=a+(s>>1)*c;let o=e.bone.skeleton,r=e.deform,l=this.vertices,n=this.bones;if(!n){r.length>0&&(l=r);let f=e.bone,m=f.worldX,x=f.worldY,p=f.a,w=f.b,g=f.c,b=f.d;for(let v=t,y=a;y<s;v+=2,y+=c){let S=l[v],A=l[v+1];i[y]=S*p+A*w+m,i[y+1]=S*g+A*b+x}return}let h=0,u=0;for(let f=0;f<t;f+=2){let m=n[h];h+=m+1,u+=m}let d=o.bones;if(r.length==0)for(let f=a,m=u*3;f<s;f+=c){let x=0,p=0,w=n[h++];for(w+=h;h<w;h++,m+=3){let g=d[n[h]],b=l[m],v=l[m+1],y=l[m+2];x+=(b*g.a+v*g.b+g.worldX)*y,p+=(b*g.c+v*g.d+g.worldY)*y}i[f]=x,i[f+1]=p}else{let f=r;for(let m=a,x=u*3,p=u<<1;m<s;m+=c){let w=0,g=0,b=n[h++];for(b+=h;h<b;h++,x+=3,p+=2){let v=d[n[h]],y=l[x]+f[p],S=l[x+1]+f[p+1],A=l[x+2];w+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}i[m]=w,i[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},le=os;B(le,"nextID",0);var Le=class{id=Le.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Le(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Le._nextID++}},it=Le;B(it,"_nextID",0);var hs=(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))(hs||{}),cs=[0,1,2,3,4,5,6],Ne=class{name;timelines=[];timelineIds=new st;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}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,a,c,o,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(e,t,s,a,c,o,r)}},ds=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(ds||{}),fs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(fs||{}),q={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.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 search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},oe=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,c,o,r,l,n,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(i-c*2+r)*.03,m=(a-o*2+l)*.03,x=((c-r)*3-i+n)*.006,p=((o-l)*3-a+h)*.006,w=f*2+x,g=m*2+p,b=(c-i)*.3+f+x*.16666667,v=(o-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let l=this.frames[t],n=this.frames[t+s];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}let c=i+18;for(i+=2;i<c;i+=2)if(a[i]>=e){let l=a[i-2],n=a[i-1];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}t+=this.getFrameEntries();let o=a[c-2],r=a[c-1];return r+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-r)}},ae=class extends oe{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){let t=this.frames,s=t.length-2;for(let a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],c=t[s+1];return c+(e-a)/(t[s+2]-a)*(t[s+2+1]-c);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);switch(s){case 0:return a+c*t;case 1:case 2:c+=a-i}return i+c*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);return s==0?a+(c-a)*t:i+(c-i)*t}getAbsoluteValue2(e,t,s,i,a,c){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(c-a)*t:i+(c-i)*t}getScaleValue(e,t,s,i,a,c){const o=this.frames;if(e<o[0]){switch(s){case 0:return c;case 1:return a+(c-a)*t}return a}let r=this.getCurveValue(e)*c;if(t==1)return s==3?a+r-c:r;if(i==1)switch(s){case 0:return c+(Math.abs(r)*E.signum(c)-c)*t;case 1:case 2:return a+(Math.abs(r)*E.signum(a)-a)*t}else{let l=0;switch(s){case 0:return l=Math.abs(c)*E.signum(r),l+(r-l)*t;case 1:case 2:return l=Math.abs(a)*E.signum(r),l+(r-l)*t}}return a+(r-c)*t}},Oe=class extends oe{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Me=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,c,r.rotation,r.data.rotation))}},at=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:r.x=r.data.x+n*a,r.y=r.data.y+h*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+h-r.y)*a;break;case 3:r.x+=n*a,r.y+=h*a}}},nt=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,c,r.x,r.data.x))}},lt=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,c,r.y,r.data.y))}},ot=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,h,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}if(n*=r.data.scaleX,h*=r.data.scaleY,a==1)c==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=n,r.scaleY=h);else{let f=0,m=0;if(o==1)switch(c){case 0:f=r.data.scaleX,m=r.data.scaleY,r.scaleX=f+(Math.abs(n)*E.signum(f)-f)*a,r.scaleY=m+(Math.abs(h)*E.signum(m)-m)*a;break;case 1:case 2:f=r.scaleX,m=r.scaleY,r.scaleX=f+(Math.abs(n)*E.signum(f)-f)*a,r.scaleY=m+(Math.abs(h)*E.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}else switch(c){case 0:f=Math.abs(r.data.scaleX)*E.signum(n),m=Math.abs(r.data.scaleY)*E.signum(h),r.scaleX=f+(n-f)*a,r.scaleY=m+(h-m)*a;break;case 1:case 2:f=Math.abs(r.scaleX)*E.signum(n),m=Math.abs(r.scaleY)*E.signum(h),r.scaleX=f+(n-f)*a,r.scaleY=m+(h-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}}}},ht=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,c,o,r.scaleX,r.data.scaleX))}},ct=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,c,o,r.scaleY,r.data.scaleY))}},dt=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+h*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+h-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=h*a}}},ft=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,c,r.shearX,r.data.shearX))}},ut=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,c,r.shearY,r.data.shearY))}},mt=class extends J{boneIndex=0;constructor(e,t){super(e,[q.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;if(o==1){c==0&&(r.inherit=r.data.inherit);return}let l=this.frames;if(s<l[0]){(c==0||c==1)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[J.search(l,s,2)+1]}},gt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,a,c){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let p=r.data.color;switch(c){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let h=0,u=0,d=0,f=0,m=J.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let p=l[m];h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];let w=(s-p)/(l[m+5]-p);h+=(l[m+5+1]-h)*w,u+=(l[m+5+2]-u)*w,d+=(l[m+5+3]-d)*w,f+=(l[m+5+4]-f)*w;break;case 1:h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];break;default:h=this.getBezierValue(s,m,1,x-2),u=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),f=this.getBezierValue(s,m,4,x+18*3-2)}a==1?n.set(h,u,d,f):(c==0&&n.setFromColor(r.data.color),n.add((h-n.r)*a,(u-n.g)*a,(d-n.b)*a,(f-n.a)*a))}},xt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let x=r.data.color;switch(c){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*a,n.g+=(x.g-n.g)*a,n.b+=(x.b-n.b)*a}return}let h=0,u=0,d=0,f=J.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let x=l[f];h=l[f+1],u=l[f+2],d=l[f+3];let p=(s-x)/(l[f+4]-x);h+=(l[f+4+1]-h)*p,u+=(l[f+4+2]-u)*p,d+=(l[f+4+3]-d)*p;break;case 1:h=l[f+1],u=l[f+2],d=l[f+3];break;default:h=this.getBezierValue(s,f,1,m-2),u=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(a==1)n.r=h,n.g=u,n.b=d;else{if(c==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(h-n.r)*a,n.g+=(u-n.g)*a,n.b+=(d-n.b)*a}}},bt=class extends ae{slotIndex=0;constructor(e,t,s){super(e,t,q.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(s<this.frames[0]){let h=r.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*a}return}let n=this.getCurveValue(s);a==1?l.a=n:(c==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*a)}},wt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.alpha+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,a,c,o,r,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.setFromColor(v),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let u=0,d=0,f=0,m=0,x=0,p=0,w=0,g=J.search(l,s,8),b=this.curves[g>>3];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];let y=(s-v)/(l[g+8]-v);u+=(l[g+8+1]-u)*y,d+=(l[g+8+2]-d)*y,f+=(l[g+8+3]-f)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,p+=(l[g+8+6]-p)*y,w+=(l[g+8+7]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),m=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2),w=this.getBezierValue(s,g,7,b+18*6-2)}if(a==1)n.set(u,d,f,m),h.r=x,h.g=p,h.b=w;else{if(c==0){n.setFromColor(r.data.color);let v=r.data.darkColor;h.r=v.r,h.g=v.g,h.b=v.b}n.add((u-n.r)*a,(d-n.g)*a,(f-n.b)*a,(m-n.a)*a),h.r+=(x-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},pt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let u=0,d=0,f=0,m=0,x=0,p=0,w=0,g=J.search(l,s,7),b=this.curves[g/7];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];let y=(s-v)/(l[g+7]-v);u+=(l[g+7+1]-u)*y,d+=(l[g+7+2]-d)*y,f+=(l[g+7+3]-f)*y,x+=(l[g+7+4]-x)*y,p+=(l[g+7+5]-p)*y,w+=(l[g+7+6]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),p=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2)}if(a==1)n.r=u,n.g=d,n.b=f,h.r=x,h.g=p,h.b=w;else{if(c==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b}n.r+=(u-n.r)*a,n.g+=(d-n.g)*a,n.b+=(f-n.b)*a,h.r+=(x-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},we=class extends J{slotIndex=0;attachmentNames;constructor(e,t){super(e,[q.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(r.bone.active){if(o==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},yt=class extends oe{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[q.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,c,o,r,l,n,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(i-c*2+r)*.03,m=l*.03-o*.06,x=((c-r)*3-i+n)*.006,p=(o-l+.33333333)*.018,w=f*2+x,g=m*2+p,b=(c-i)*.3+f+x*.16666667,v=o*.3+m+p*.16666667,y=i+b,S=v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],l=s[i-1];return l+(e-r)/(s[i]-r)*(s[i+1]-l)}let c=s[a-2],o=s[a-1];return o+(1-o)*(e-c)/(this.frames[t+this.getFrameEntries()]-c)}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof le)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(c=0);let h=this.vertices,u=h[0].length,d=this.frames;if(s<d[0]){switch(c){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=u;let g=l;if(g.bones){a=1-a;for(var f=0;f<u;f++)n[f]*=a}else{let b=g.vertices;for(var f=0;f<u;f++)n[f]+=(b[f]-n[f])*a}}return}if(n.length=u,s>=d[d.length-1]){let g=h[d.length-1];if(a==1)if(c==3){let b=l;if(b.bones)for(let v=0;v<u;v++)n[v]+=g[v];else{let v=b.vertices;for(let y=0;y<u;y++)n[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,n,0,u);else switch(c){case 0:{let v=l;if(v.bones)for(let y=0;y<u;y++)n[y]=g[y]*a;else{let y=v.vertices;for(let S=0;S<u;S++){let A=y[S];n[S]=A+(g[S]-A)*a}}break}case 1:case 2:for(let v=0;v<u;v++)n[v]+=(g[v]-n[v])*a;break;case 3:let b=l;if(b.bones)for(let v=0;v<u;v++)n[v]+=g[v]*a;else{let v=b.vertices;for(let y=0;y<u;y++)n[y]+=(g[y]-v[y])*a}}return}let m=J.search1(d,s),x=this.getCurvePercent(s,m),p=h[m],w=h[m+1];if(a==1)if(c==3){let g=l;if(g.bones)for(let b=0;b<u;b++){let v=p[b];n[b]+=v+(w[b]-v)*x}else{let b=g.vertices;for(let v=0;v<u;v++){let y=p[v];n[v]+=y+(w[v]-y)*x-b[v]}}}else for(let g=0;g<u;g++){let b=p[g];n[g]=b+(w[g]-b)*x}else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<u;v++){let y=p[v];n[v]=(y+(w[v]-y)*x)*a}else{let v=b.vertices;for(let y=0;y<u;y++){let S=p[y],A=v[y];n[y]=A+(S+(w[y]-S)*x-A)*a}}break}case 1:case 2:for(let b=0;b<u;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x-n[b])*a}break;case 3:let g=l;if(g.bones)for(let b=0;b<u;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x)*a}else{let b=g.vertices;for(let v=0;v<u;v++){let y=p[v];n[v]+=(y+(w[v]-y)*x-b[v])*a}}}}},us=class extends J{events;constructor(e){super(e,us.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,c,o){if(!i)return;let r=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,c,o),t=-1;else if(t>=r[l-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let h=r[n];for(;n>0&&r[n-1]==h;)n--}for(;n<l&&s>=r[n];n++)i.push(this.events[n])}},Xe=us;B(Xe,"propertyIds",[""+q.event]);var ms=class extends J{drawOrders;constructor(e){super(e,ms.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,c,o){if(o==1){c==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(c==0||c==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),l=this.drawOrders[r];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,h=e.slots;for(let u=0,d=l.length;u<d;u++)n[u]=h[l[u]]}}},pe=ms;B(pe,"propertyIds",[""+q.drawOrder]);var vt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,c,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,a,c,o){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,h=0,u=J.search(l,s,6),d=this.curves[u/6];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+6]-f);n+=(l[u+6+1]-n)*m,h+=(l[u+6+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}c==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(h-r.data.softness)*a,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[u+3],r.compress=l[u+4]!=0,r.stretch=l[u+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(h-r.softness)*a,o==0&&(r.bendDirection=l[u+3],r.compress=l[u+4]!=0,r.stretch=l[u+5]!=0))}},St=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=a,l[e+4]=c,l[e+5]=o,l[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){let w=r.data;switch(c){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,h,u,d,f,m,x=J.search(l,s,7),p=this.curves[x/7];switch(p){case 0:let w=l[x];n=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];let g=(s-w)/(l[x+7]-w);n+=(l[x+7+1]-n)*g,h+=(l[x+7+2]-h)*g,u+=(l[x+7+3]-u)*g,d+=(l[x+7+4]-d)*g,f+=(l[x+7+5]-f)*g,m+=(l[x+7+6]-m)*g;break;case 1:n=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];break;default:n=this.getBezierValue(s,x,1,p-2),h=this.getBezierValue(s,x,2,p+18-2),u=this.getBezierValue(s,x,3,p+18*2-2),d=this.getBezierValue(s,x,4,p+18*3-2),f=this.getBezierValue(s,x,5,p+18*4-2),m=this.getBezierValue(s,x,6,p+18*5-2)}if(c==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(h-w.mixX)*a,r.mixY=w.mixY+(u-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(f-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(u-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(f-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},At=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,c,r.position,r.data.position))}},It=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,c,r.spacing,r.data.spacing))}},Ct=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let c=this.frames;e<<=2,c[e]=t,c[e+1]=s,c[e+2]=i,c[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,h,u,d=J.search(l,s,4),f=this.curves[d>>2];switch(f){case 0:let m=l[d];n=l[d+1],h=l[d+2],u=l[d+3];let x=(s-m)/(l[d+4]-m);n+=(l[d+4+1]-n)*x,h+=(l[d+4+2]-h)*x,u+=(l[d+4+3]-u)*x;break;case 1:n=l[d+1],h=l[d+2],u=l[d+3];break;default:n=this.getBezierValue(s,d,1,f-2),h=this.getBezierValue(s,d,2,f+18-2),u=this.getBezierValue(s,d,3,f+18*2-2)}if(c==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(h-m.mixX)*a,r.mixY=m.mixY+(u-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(u-r.mixY)*a}},ue=class extends ae{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,c,this.get(n),this.setup(n),l))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,c,this.get(r),this.setup(r)))}},kt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Yt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Tt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Mt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Xt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ft=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Et=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},gs=class extends J{constraintIndex;constructor(e,t){super(e,gs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,c,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},De=gs;B(De,"propertyIds",[q.physicsConstraintReset.toString()]);var me=class extends J{slotIndex;attachment;constructor(e,t,s){super(e,[q.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,i,a){let c=this.frames;e*=me.ENTRIES,c[e]=t,c[e+me.MODE]=s|i<<4,c[e+me.DELAY]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof le)||l.timelineAttachment!=n))return;if(o==1){c==0&&(r.sequenceIndex=-1);return}let h=this.frames;if(s<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let u=J.search(h,s,me.ENTRIES),d=h[u],f=h[u+me.MODE],m=h[u+me.DELAY];if(!this.attachment.sequence)return;let x=f>>4,p=this.attachment.sequence.regions.length,w=cs[f&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(p-1,x);break;case 2:x%=p;break;case 3:{let g=(p<<1)-2;x=g==0?0:x%g,x>=p&&(x=g-x);break}case 4:x=Math.max(p-1-x,0);break;case 5:x=p-1-x%p;break;case 6:{let g=(p<<1)-2;x=g==0?0:(x+p-1)%g,x>=p&&(x=g-x)}}r.sequenceIndex=x}},Ae=me;B(Ae,"ENTRIES",3),B(Ae,"MODE",1),B(Ae,"DELAY",2);var qe=class{static emptyAnimation(){return qe._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ws(this);propertyIDs=new st;animationsChanged=!1;trackEntryPool=new Te(()=>new bs);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let c=e*a.timeScale;if(a.delay>0){if(a.delay-=c,a.delay>0)continue;c=-a.delay,a.delay=0}let o=a.next;if(o){let r=a.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*o.timeScale,a.trackTime+=c,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=c}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let u=0,d=s.length;u<d;u++){let f=s[u];if(!f||f.delay>0)continue;i=!0;let m=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,m):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let p=x>=f.alphaAttachmentThreshold,w=f.animationLast,g=f.getAnimationTime(),b=g,v=t;f.reverse&&(b=f.animation.duration-b,v=null);let y=f.animation.timelines,S=y.length;if(u==0&&x==1||m==3){u==0&&(p=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(x,m);var a=y[A];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,x,m,0)}}else{let A=f.timelineMode,k=f.shortestRotation,T=!k&&f.timelinesRotation.length!=S<<1;T&&(f.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let F=y[Y],X=A[Y]==_e?m:0;!k&&F instanceof Me?this.applyRotateTimeline(F,e,b,x,X,f.timelinesRotation,Y<<1,T):F instanceof we?this.applyAttachmentTimeline(F,e,b,m,p):(R.webkit602BugfixHelper(x,m),F.apply(e,w,b,v,x,X,0))}}this.queueEvents(f,g),t.length=0,f.nextAnimationLast=g,f.nextTrackLast=f.trackTime}for(var c=this.unkeyedState+Bt,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==c){var h=n.data.attachmentName;n.setAttachment(h?e.getAttachment(n.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let c=a<i.mixAttachmentThreshold,o=a<i.mixDrawOrderThreshold,r=i.animation.timelines,l=r.length,n=i.alpha*e.interruptAlpha,h=n*(1-a),u=i.animationLast,d=i.getAnimationTime(),f=d,m=null;if(i.reverse?f=i.animation.duration-f:a<i.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)r[x].apply(t,u,f,m,h,s,1);else{let x=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,g=!w&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let b=0;b<l;b++){let v=r[b],y=1,S,A=0;switch(x[b]){case _e:if(!o&&v instanceof pe)continue;S=s,A=h;break;case Rt:S=0,A=h;break;case Pt:S=s,A=n;break;case We:S=0,A=n;break;default:S=0;let k=p[b];A=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=A,!w&&v instanceof Me?this.applyRotateTimeline(v,t,f,A,S,i.timelinesRotation,b<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,f,S,c&&A>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof pe&&S==0&&(y=0),v.apply(t,u,f,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var c=t.slots[e.slotIndex];c.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,c,c.data.attachmentName,a):this.setAttachment(t,c,e.attachmentNames[J.search1(e.frames,s)],a),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+Bt))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+ys)}applyRotateTimeline(e,t,s,i,a,c,o,r){if(r&&(c[o]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let n=e.frames,h=0,u=0;if(s<n[0])switch(a){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,u=l.data.rotation}else h=a==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(s);let d=0,f=u-h;if(f-=Math.ceil(f/360-.5)*360,f==0)d=c[o];else{let m=0,x=0;r?(m=0,x=f):(m=c[o],x=c[o+1]);let p=m-m%360;d=f+p;let w=f>=0,g=m>=0;Math.abs(x)<=90&&E.signum(x)!=E.signum(f)&&(Math.abs(m-p)>180?(d+=360*E.signum(m),g=w):p!=0?d-=360*E.signum(m):g=w),g!=w&&(d+=360*E.signum(m)),c[o]=d}c[o+1]=f,l.rotation=h+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,c=e.trackLast%a,o=this.events,r=0,l=o.length;for(;r<l;r++){let h=o[r];if(h.time<c)break;h.time>i||this.queue.event(e,h)}let n=!1;if(e.loop)if(a==0)n=!0;else{const h=Math.floor(e.trackTime/a);n=h>0&&h>Math.floor(e.trackLast/a)}else n=t>=i&&e.animationLast<i;for(n&&this.queue.complete(e);r<l;r++){let h=o[r];h.time<s||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let c=this.trackEntry(e,t,s,a);return this.setCurrent(e,c,i),this.queue.drain(),c}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let c=this.trackEntry(e,t,s,a);return a?(a.next=c,c.previous=a,i<=0&&(i=Math.max(i+a.getTrackComplete()-c.mixDuration,0))):(this.setCurrent(e,c,!0),this.queue.drain(),i<0&&(i=0)),c.delay=i,c}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,qe.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,qe.emptyAnimation(),!1,s);return s<=0&&(i.delay=Math.max(i.delay+i.mixDuration-t,0)),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=o.addAll(s[r].getPropertyIds())?We:Pt;return}e:for(let r=0;r<i;r++){let l=s[r],n=l.getPropertyIds();if(!o.addAll(n))a[r]=_e;else if(!t||l instanceof we||l instanceof pe||l instanceof Xe||!t.animation.hasTimeline(n))a[r]=Rt;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=ps,c[r]=h;continue e}break}a[r]=We}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},xs=qe;B(xs,"_emptyAnimation",new Ne("<empty>",[],0));var bs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!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;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let 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}},ws=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(se.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(se.interrupt),this.objects.push(e)}end(e){this.objects.push(se.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(se.dispose),this.objects.push(e)}complete(e){this.objects.push(se.complete),this.objects.push(e)}event(e,t){this.objects.push(se.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case se.start:a.listener&&a.listener.start&&a.listener.start(a);for(let o=0;o<t.length;o++){let r=t[o];r.start&&r.start(a)}break;case se.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let o=0;o<t.length;o++){let r=t[o];r.interrupt&&r.interrupt(a)}break;case se.end:a.listener&&a.listener.end&&a.listener.end(a);for(let o=0;o<t.length;o++){let r=t[o];r.end&&r.end(a)}case se.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let o=0;o<t.length;o++){let r=t[o];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case se.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let o=0;o<t.length;o++){let r=t[o];r.complete&&r.complete(a)}break;case se.event:let c=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,c);for(let o=0;o<t.length;o++){let r=t[o];r.event&&r.event(a,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},se=(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))(se||{}),qs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},_e=0,Rt=1,Pt=2,We=3,ps=4,Bt=1,ys=2,_s=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Ue=class extends le{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ue(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},ze=class extends le{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new ze(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Vt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ge=(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))(Ge||{}),vs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(vs||{}),Ss=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ws=class extends Vt{setFilters(e,t){}setWraps(e,t){}dispose(){}},As=class{pages=new Array;regions=new Array;constructor(e){let t=new Us(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(Ge,s[1]),n.magFilter=R.enumValue(Ge,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let h=s[1];h=="true"?n.degrees=90:h!="false"&&(n.degrees=parseInt(h))},a.index=n=>{n.index=parseInt(s[1])};let c=t.readLine();for(;c&&c.trim().length==0;)c=t.readLine();for(;!(!c||c.trim().length==0||t.readEntry(s,c)==0);)c=t.readLine();let o=null,r=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=t.readLine();else if(o){let n=new Lt(o,c);for(;;){let h=t.readEntry(s,c=t.readLine());if(h==0)break;let u=a[s[0]];if(u)u(n);else{r||(r=[]),l||(l=[]),r.push(s[0]);let d=[];for(let f=0;f<h;f++)d.push(parseInt(s[f+1]));l.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&l&&l.length>0&&(n.names=r,n.values=l,r=null,l=null),n.u=n.x/o.width,n.v=n.y/o.height,n.degrees==90?(n.u2=(n.x+n.height)/o.width,n.v2=(n.y+n.width)/o.height):(n.u2=(n.x+n.width)/o.width,n.v2=(n.y+n.height)/o.height),this.regions.push(n)}else{for(o=new Is(c.trim());t.readEntry(s,c=t.readLine())!=0;){let n=i[s[0]];n&&n(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(let 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()}},Us=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;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let c=t.indexOf(",",a);if(c==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,c-a).trim(),a=c+1,i==4)return 4}}},Is=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Lt=class extends Ss{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)}},ye=class extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,c=0,o=0;if(this.region instanceof Lt){let r=this.region,l=r.page,n=l.width,h=l.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=i+e[u+1]*c,t[u+1]=a+(1-e[u])*o;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/h,c=r.originalWidth/n,o=r.originalHeight/h;for(let u=0;u<s;u+=2)t[u]=i+(1-e[u])*c,t[u+1]=a+(1-e[u+1])*o;return;case 270:i-=r.offsetY/n,a-=r.offsetX/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=i+(1-e[u+1])*c,t[u+1]=a+e[u]*o;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/n,o=r.originalHeight/h}else this.region?(c=this.region.u2-i,o=this.region.v2-a):(i=a=0,c=o=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*c,t[r+1]=a+e[r+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,c)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ie=class extends le{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ie(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Nt=class extends le{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*E.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,c=s*e.c+i*e.d;return E.atan2Deg(c,a)}copy(){let e=new Nt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Cs=class extends rt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,c=-this.height/2*this.scaleY+this.region.offsetY*i,o=a+this.region.width*s,r=c+this.region.height*i,l=this.rotation*E.degRad,n=Math.cos(l),h=Math.sin(l),u=this.x,d=this.y,f=a*n+u,m=a*h,x=c*n+d,p=c*h,w=o*n+u,g=o*h,b=r*n+d,v=r*h,y=this.offset;y[0]=f-p,y[1]=x+m,y[2]=f-v,y[3]=b+m,y[4]=w-v,y[5]=b+g,y[6]=w-p,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,c=this.offset,o=a.worldX,r=a.worldY,l=a.a,n=a.b,h=a.c,u=a.d,d=0,f=0;d=c[0],f=c[1],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[2],f=c[3],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[4],f=c[5],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[6],f=c[7],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r}copy(){let e=new Cs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},V=Cs;B(V,"X1",0),B(V,"Y1",1),B(V,"C1R",2),B(V,"C1G",3),B(V,"C1B",4),B(V,"C1A",5),B(V,"U1",6),B(V,"V1",7),B(V,"X2",8),B(V,"Y2",9),B(V,"C2R",10),B(V,"C2G",11),B(V,"C2B",12),B(V,"C2A",13),B(V,"U2",14),B(V,"V2",15),B(V,"X3",16),B(V,"Y3",17),B(V,"C3R",18),B(V,"C3G",19),B(V,"C3B",20),B(V,"C3A",21),B(V,"U3",22),B(V,"V3",23),B(V,"X4",24),B(V,"Y4",25),B(V,"C4R",26),B(V,"C4G",27),B(V,"C4B",28),B(V,"C4A",29),B(V,"U4",30),B(V,"V4",31);var zs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,c=i.length;a<c;a++){let o=s.getPath(t,a),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new V(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=c}return a}newMeshAttachment(e,t,s,i){let a=new ye(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=c}return a}newBoundingBoxAttachment(e,t){return new Ue(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new Nt(t)}newClippingAttachment(e,t){return new ze(t)}},Ot=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Fe.Normal;skinRequired=!1;color=new D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Fe=(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))(Fe||{}),Dt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,c,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=c,this.ashearY=o;let r=this.parent;if(!r){let d=this.skeleton;const f=d.scaleX,m=d.scaleY,x=(s+c)*E.degRad,p=(s+90+o)*E.degRad;this.a=Math.cos(x)*i*f,this.b=Math.cos(p)*a*f,this.c=Math.sin(x)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*f+d.x,this.worldY=t*m+d.y;return}let l=r.a,n=r.b,h=r.c,u=r.d;switch(this.worldX=l*e+n*t+r.worldX,this.worldY=h*e+u*t+r.worldY,this.inherit){case 0:{const d=(s+c)*E.degRad,f=(s+90+o)*E.degRad,m=Math.cos(d)*i,x=Math.cos(f)*a,p=Math.sin(d)*i,w=Math.sin(f)*a;this.a=l*m+n*p,this.b=l*x+n*w,this.c=h*m+u*p,this.d=h*x+u*w;return}case 1:{const d=(s+c)*E.degRad,f=(s+90+o)*E.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(f)*a,this.c=Math.sin(d)*i,this.d=Math.sin(f)*a;break}case 2:{let d=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;l*=d,h*=f;let m=l*l+h*h,x=0;m>1e-4?(m=Math.abs(l*u*f-n*d*h)/m,n=h*m,u=l*m,x=Math.atan2(h,l)*E.radDeg):(l=0,h=0,x=90-Math.atan2(u,n)*E.radDeg);const p=(s+c-x)*E.degRad,w=(s+o-x+90)*E.degRad,g=Math.cos(p)*i,b=Math.cos(w)*a,v=Math.sin(p)*i,y=Math.sin(w)*a;this.a=l*g-n*v,this.b=l*b-n*y,this.c=h*g+u*v,this.d=h*b+u*y;break}case 3:case 4:{s*=E.degRad;const d=Math.cos(s),f=Math.sin(s);let m=(l*d+n*f)/this.skeleton.scaleX,x=(h*d+u*f)/this.skeleton.scaleY,p=Math.sqrt(m*m+x*x);p>1e-5&&(p=1/p),m*=p,x*=p,p=Math.sqrt(m*m+x*x),this.inherit==3&&l*u-n*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*p,g=Math.sin(s)*p;c*=E.degRad,o=(90+o)*E.degRad;const b=Math.cos(c)*i,v=Math.cos(o)*a,y=Math.sin(c)*i,S=Math.sin(o)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=x*b+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;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}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let t=e.a,s=e.b,i=e.c,a=e.d,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c,h=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=h*o-u*r,this.ay=u*n-h*l;let d,f,m,x;if(this.inherit==1)d=this.a,f=this.b,m=this.c,x=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,a=t*this.skeleton.scaleY*v/this.skeleton.scaleX,c=1/(t*a-s*i),o=a*c,r=s*c;break}case 3:case 4:let p=E.cosDeg(this.rotation),w=E.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.inherit==3&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=E.PI/2+Math.atan2(i,t);s=Math.cos(b)*g,a=Math.sin(b)*g,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c}d=o*this.a-r*this.c,f=o*this.b-r*this.d,m=n*this.c-l*this.a,x=n*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*x-f*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*f+m*x,p)*E.radDeg,this.arotation=Math.atan2(m,d)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,f)*E.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*E.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*E.radDeg}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){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let 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.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*E.radDeg}rotateWorld(e){e*=E.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Ee=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ks=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new qt){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,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)=>{let 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.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(t,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(t,e,this.textureLoader(c))},c.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),c=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new As(o),l=r.pages.length,n=!1;for(let h of r.pages)this.loadTexture(i?i[h.name]:c+h.name,(u,d)=>{n||(h.setTexture(d),--l==0&&this.success(t,e,r))},(u,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${u}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
- `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},qt=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){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=t.charCodeAt(a);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;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let a=()=>{this.finish(e,i.status,i.responseText)};i.onload=a,i.onerror=a,i.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;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let a=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):a()},i.onerror=a,i.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){let i=this.callbacks[e];delete this.callbacks[e];let a=t==200||t==0?[s]:[t,s];for(let c=a.length-1,o=i.length;c<o;c+=2)i[c].apply(null,a)}},_t=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Wt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Ys=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,a,c,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,h=r.c,u=r.d,d=-e.ashearX-e.arotation,f=0,m=0;switch(e.inherit){case 1:f=(t-e.worldX)*E.signum(e.skeleton.scaleX),m=(s-e.worldY)*E.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(l*u-n*h)/Math.max(1e-4,l*l+h*h),g=l/e.skeleton.scaleX,b=h/e.skeleton.scaleY;n=-b*w*e.skeleton.scaleX,u=g*w*e.skeleton.scaleY,d+=Math.atan2(b,g)*E.radDeg;default:let v=t-r.worldX,y=s-r.worldY,S=l*u-n*h;Math.abs(S)<=1e-4?(f=0,m=0):(f=(v*u-y*n)/S-e.ax,m=(y*l-v*h)/S-e.ay)}d+=Math.atan2(m,f)*E.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,p=e.ascaleY;if(i||a){switch(e.inherit){case 3:case 4:f=t-e.worldX,m=s-e.worldY}const w=e.data.length*x;if(w>1e-4){const g=f*f+m*m;if(i&&g<w*w||a&&g>w*w){const b=(Math.sqrt(g)/w-1)*o+1;x*=b,c&&(p*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,x,p,e.ashearX,e.ashearY)}apply2(e,t,s,i,a,c,o,r,l){if(e.inherit!=0||t.inherit!=0)return;let n=e.ax,h=e.ay,u=e.ascaleX,d=e.ascaleY,f=u,m=d,x=t.ascaleX,p=0,w=0,g=0;u<0?(u=-u,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),x<0?(x=-x,w=180):w=0;let b=t.ax,v=0,y=0,S=0,A=e.a,k=e.b,T=e.c,Y=e.d,F=Math.abs(u-d)<=1e-4;!F||c?(v=0,y=A*b+e.worldX,S=T*b+e.worldY):(v=t.ay,y=A*b+k*v+e.worldX,S=T*b+Y*v+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,k=X.b,T=X.c,Y=X.d;let C=A*Y-k*T,M=y-X.worldX,P=S-X.worldY;C=Math.abs(C)<=1e-4?0:1/C;let O=(M*Y-P*k)*C-n,_=(P*A-M*T)*C-h,N=Math.sqrt(O*O+_*_),G=t.data.length*x,$,j;if(N<1e-4){this.apply1(e,s,i,!1,c,!1,l),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}M=s-X.worldX,P=i-X.worldY;let L=(M*Y-P*k)*C-n,W=(P*A-M*T)*C-h,U=L*L+W*W;if(r!=0){r*=u*(x+1)*.5;let K=Math.sqrt(U),Q=K-N-G*u+r;if(Q>0){let Z=Math.min(1,Q/(r*2))-1;Z=(Q-r*(1-Z*Z))/K,L-=Z*L,W-=Z*W,U=L*L+W*W}}e:if(F){G*=u;let K=(U-N*N-G*G)/(2*N*G);K<-1?(K=-1,j=Math.PI*a):K>1?(K=1,j=0,c&&(A=(Math.sqrt(U)/(N+G)-1)*l+1,f*=A,o&&(m*=A))):j=Math.acos(K)*a,A=N+G*K,k=G*Math.sin(j),$=Math.atan2(W*A-L*k,L*A+W*k)}else{A=u*G,k=d*G;let K=A*A,Q=k*k,Z=Math.atan2(W,L);T=Q*N*N+K*U-K*Q;let fe=-2*Q*N,ke=Q-K;if(Y=fe*fe-4*ke*T,Y>=0){let ve=Math.sqrt(Y);fe<0&&(ve=-ve),ve=-(fe+ve)*.5;let Ye=ve/ke,as=T/ve,Be=Math.abs(Ye)<Math.abs(as)?Ye:as;if(Ye=U-Be*Be,Ye>=0){P=Math.sqrt(Ye)*a,$=Z-Math.atan2(P,Be),j=Math.atan2(P/d,(Be-N)/u);break e}}let ts=E.PI,Re=N-A,et=Re*Re,ss=0,rs=0,Pe=N+A,tt=Pe*Pe,is=0;T=-A*N/(K-Q),T>=-1&&T<=1&&(T=Math.acos(T),M=A*Math.cos(T)+N,P=k*Math.sin(T),Y=M*M+P*P,Y<et&&(ts=T,et=Y,Re=M,ss=P),Y>tt&&(rs=T,tt=Y,Pe=M,is=P)),U<=(et+tt)*.5?($=Z-Math.atan2(ss*a,Re),j=ts*a):($=Z-Math.atan2(is*a,Pe),j=rs*a)}let ie=Math.atan2(v,b)*g,te=e.arotation;$=($-ie)*E.radDeg+p-te,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(n,h,te+$*l,f,m,0,0),te=t.arotation,j=((j+ie)*E.radDeg-t.ashearX)*g+w-te,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(b,v,te+j*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ut=class extends Ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},zt=class extends Ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=He.Fixed;spacingMode=$e.Fixed;rotateMode=je.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},He=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(He||{}),$e=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))($e||{}),je=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(je||{}),ge=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,a=e.bones.length;i<a;i++){let c=t.findBone(e.bones[i].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(c)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ie))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(s==0&&i==0&&a==0)return;let c=this.data,o=c.rotateMode==0,r=c.rotateMode==2,l=this.bones,n=l.length,h=o?n:n+1,u=R.setArraySize(this.spaces,h),d=r?this.lengths=R.setArraySize(this.lengths,n):[],f=this.spacing;switch(c.spacingMode){case 2:if(r)for(let y=0,S=h-1;y<S;y++){let A=l[y],k=A.data.length,T=k*A.a,Y=k*A.c;d[y]=Math.sqrt(T*T+Y*Y)}R.arrayFill(u,1,h,f);break;case 3:let b=0;for(let y=0,S=h-1;y<S;){let A=l[y],k=A.data.length;if(k<ge.epsilon)r&&(d[y]=0),u[++y]=f;else{let T=k*A.a,Y=k*A.c,F=Math.sqrt(T*T+Y*Y);r&&(d[y]=F),u[++y]=F,b+=F}}if(b>0){b=h/b*f;for(let y=1;y<h;y++)u[y]*=b}break;default:let v=c.spacingMode==0;for(let y=0,S=h-1;y<S;){let A=l[y],k=A.data.length;if(k<ge.epsilon)r&&(d[y]=0),u[++y]=f;else{let T=k*A.a,Y=k*A.c,F=Math.sqrt(T*T+Y*Y);r&&(d[y]=F),u[++y]=(v?k+f:f)*F/k}}}let m=this.computeWorldPositions(t,h,o),x=m[0],p=m[1],w=c.offsetRotation,g=!1;if(w==0)g=c.rotateMode==1;else{g=!1;let b=this.target.bone;w*=b.a*b.d-b.b*b.c>0?E.degRad:-E.degRad}for(let b=0,v=3;b<n;b++,v+=3){let y=l[b];y.worldX+=(x-y.worldX)*i,y.worldY+=(p-y.worldY)*a;let S=m[v],A=m[v+1],k=S-x,T=A-p;if(r){let Y=d[b];if(Y!=0){let F=(Math.sqrt(k*k+T*T)/Y-1)*s+1;y.a*=F,y.c*=F}}if(x=S,p=A,s>0){let Y=y.a,F=y.b,X=y.c,C=y.d,M=0,P=0,O=0;if(o?M=m[v-1]:u[b+1]==0?M=m[v+2]:M=Math.atan2(T,k),M-=Math.atan2(X,Y),g){P=Math.cos(M),O=Math.sin(M);let _=y.data.length;x+=(_*(P*Y-O*X)-k)*s,p+=(_*(O*Y+P*X)-T)*s}else M+=w;M>E.PI?M-=E.PI2:M<-E.PI&&(M+=E.PI2),M*=s,P=Math.cos(M),O=Math.sin(M),y.a=P*Y-O*X,y.b=P*F-O*C,y.c=O*Y+P*X,y.d=O*F+P*C}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,a=this.position,c=this.spaces,o=R.setArraySize(this.positions,t*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,h=n/6,u=ge.NONE;if(!e.constantSpeed){let _=e.lengths;h-=l?1:2;let N=_[h];this.data.positionMode==1&&(a*=N);let G;switch(this.data.spacingMode){case 2:G=N;break;case 3:G=N/t;break;default:G=1}r=R.setArraySize(this.world,8);for(let $=0,j=0,L=0;$<t;$++,j+=3){let W=c[$]*G;a+=W;let U=a;if(l)U%=N,U<0&&(U+=N),L=0;else if(U<0){u!=ge.BEFORE&&(u=ge.BEFORE,e.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(U,r,0,o,j);continue}else if(U>N){u!=ge.AFTER&&(u=ge.AFTER,e.computeWorldVertices(i,n-6,4,r,0,2)),this.addAfterPosition(U-N,r,0,o,j);continue}for(;;L++){let ie=_[L];if(!(U>ie)){if(L==0)U/=ie;else{let te=_[L-1];U=(U-te)/(ie-te)}break}}L!=u&&(u=L,l&&L==h?(e.computeWorldVertices(i,n-4,4,r,0,2),e.computeWorldVertices(i,0,4,r,4,2)):e.computeWorldVertices(i,L*6+2,8,r,0,2)),this.addCurvePosition(U,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],o,j,s||$>0&&W==0)}return o}l?(n+=2,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n-4,r,0,2),e.computeWorldVertices(i,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(h--,n-=4,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n,r,0,2));let d=R.setArraySize(this.curves,h),f=0,m=r[0],x=r[1],p=0,w=0,g=0,b=0,v=0,y=0,S=0,A=0,k=0,T=0,Y=0,F=0,X=0,C=0;for(let _=0,N=2;_<h;_++,N+=6)p=r[N],w=r[N+1],g=r[N+2],b=r[N+3],v=r[N+4],y=r[N+5],S=(m-p*2+g)*.1875,A=(x-w*2+b)*.1875,k=((p-g)*3-m+v)*.09375,T=((w-b)*3-x+y)*.09375,Y=S*2+k,F=A*2+T,X=(p-m)*.75+S+k*.16666667,C=(w-x)*.75+A+T*.16666667,f+=Math.sqrt(X*X+C*C),X+=Y,C+=F,Y+=k,F+=T,f+=Math.sqrt(X*X+C*C),X+=Y,C+=F,f+=Math.sqrt(X*X+C*C),X+=Y+k,C+=F+T,f+=Math.sqrt(X*X+C*C),d[_]=f,m=v,x=y;this.data.positionMode==1&&(a*=f);let M;switch(this.data.spacingMode){case 2:M=f;break;case 3:M=f/t;break;default:M=1}let P=this.segments,O=0;for(let _=0,N=0,G=0,$=0;_<t;_++,N+=3){let j=c[_]*M;a+=j;let L=a;if(l)L%=f,L<0&&(L+=f),G=0;else if(L<0){this.addBeforePosition(L,r,0,o,N);continue}else if(L>f){this.addAfterPosition(L-f,r,n-4,o,N);continue}for(;;G++){let W=d[G];if(!(L>W)){if(G==0)L/=W;else{let U=d[G-1];L=(L-U)/(W-U)}break}}if(G!=u){u=G;let W=G*6;for(m=r[W],x=r[W+1],p=r[W+2],w=r[W+3],g=r[W+4],b=r[W+5],v=r[W+6],y=r[W+7],S=(m-p*2+g)*.03,A=(x-w*2+b)*.03,k=((p-g)*3-m+v)*.006,T=((w-b)*3-x+y)*.006,Y=S*2+k,F=A*2+T,X=(p-m)*.3+S+k*.16666667,C=(w-x)*.3+A+T*.16666667,O=Math.sqrt(X*X+C*C),P[0]=O,W=1;W<8;W++)X+=Y,C+=F,Y+=k,F+=T,O+=Math.sqrt(X*X+C*C),P[W]=O;X+=Y,C+=F,O+=Math.sqrt(X*X+C*C),P[8]=O,X+=Y+k,C+=F+T,O+=Math.sqrt(X*X+C*C),P[9]=O,$=0}for(L*=O;;$++){let W=P[$];if(!(L>W)){if($==0)L/=W;else{let U=P[$-1];L=$+(L-U)/(W-U)}break}}this.addCurvePosition(L*.1,m,x,p,w,g,b,v,y,o,N,s||_>0&&j==0)}return o}addBeforePosition(e,t,s,i,a){let c=t[s],o=t[s+1],r=t[s+2]-c,l=t[s+3]-o,n=Math.atan2(l,r);i[a]=c+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addAfterPosition(e,t,s,i,a){let c=t[s+2],o=t[s+3],r=c-t[s],l=o-t[s+1],n=Math.atan2(l,r);i[a]=c+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addCurvePosition(e,t,s,i,a,c,o,r,l,n,h,u){if(e==0||isNaN(e)){n[h]=t,n[h+1]=s,n[h+2]=Math.atan2(a-s,i-t);return}let d=e*e,f=d*e,m=1-e,x=m*m,p=x*m,w=m*e,g=w*3,b=m*g,v=g*e,y=t*p+i*b+c*v+r*f,S=s*p+a*b+o*v+l*f;n[h]=y,n[h+1]=S,u&&(e<.001?n[h+2]=Math.atan2(a-s,i-t):n[h+2]=Math.atan2(S-(s*x+a*w*2+o*d),y-(t*x+i*w*2+c*d)))}},Ce=ge;B(Ce,"NONE",-1),B(Ce,"BEFORE",-2),B(Ce,"AFTER",-3),B(Ce,"epsilon",1e-5);var Gs=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],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}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;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}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,c=this.data.scaleX>0,o=this.bone,r=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const l=this.skeleton,n=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=n,this.lastTime=l.time;const h=o.worldX,u=o.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=u;else{let d=this.remaining,f=this.inertia,m=this.data.step,x=this.skeleton.data.referenceScale,p=-1,w=this.data.limit*n,g=w*Math.abs(l.scaleY);if(w*=Math.abs(l.scaleX),s||i){if(s){const b=(this.ux-h)*f;this.xOffset+=b>w?w:b<-w?-w:b,this.ux=h}if(i){const b=(this.uy-u)*f;this.yOffset+=b>g?g:b<-g?-g:b,this.uy=u}if(d>=m){p=Math.pow(this.damping,60*m);const b=this.massInverse*m,v=this.strength,y=this.wind*x*l.scaleX,S=this.gravity*x*l.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*b,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),i&&(this.yVelocity-=(S+this.yOffset*v)*b,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m;while(d>=m)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a||c){let b=Math.atan2(o.c,o.a),v=0,y=0,S=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),a){S=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(k+this.ty,A+this.tx)-b-this.rotateOffset*S;this.rotateOffset+=(T-Math.ceil(T*E.invPI2-.5)*E.PI2)*f,T=this.rotateOffset*S+b,v=Math.cos(T),y=Math.sin(T),c&&(T=r*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(A*v+k*y)*f/T))}else{v=Math.cos(b),y=Math.sin(b);const T=r*o.getWorldScaleX();T>0&&(this.scaleOffset+=(A*v+k*y)*f/T)}if(d=this.remaining,d>=m){p==-1&&(p=Math.pow(this.damping,60*m));const T=this.massInverse*m,Y=this.strength,F=this.wind,X=Je.yDown?-this.gravity:this.gravity,C=r/x;for(;;)if(d-=m,c&&(this.scaleVelocity+=(F*v-X*y-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),a){if(this.rotateVelocity-=((F*y+X*v)*C+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const M=this.rotateOffset*S+b;v=Math.cos(M),y=Math.sin(M)}else if(d<m)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a){let l=this.rotateOffset*t,n=0,h=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,n=Math.sin(d),h=Math.cos(d),u=o.b,o.b=h*u-n*o.d,o.d=n*u+h*o.d),d+=l*this.data.shearX,n=Math.sin(d),h=Math.cos(d),u=o.a,o.a=h*u-n*o.c,o.c=n*u+h*o.c}else l*=this.data.rotate,n=Math.sin(l),h=Math.cos(l),u=o.a,o.a=h*u-n*o.c,o.c=n*u+h*o.c,u=o.b,o.b=h*u-n*o.d,o.d=n*u+h*o.d}if(c){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=r*o.a,this.ty=r*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*E.degRad,a=Math.cos(i),c=Math.sin(i),o=this.cx-e,r=this.cy-t;this.translate(o*a-r*c-o,o*c+r*a-r)}},Ts=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof le)||!(this.attachment instanceof le)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Ms=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ve;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,h=r.c,u=r.d,d=l*u-n*h>0?E.degRad:-E.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(h,l)-Math.atan2(y,b)+f;A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*t,g.worldY+=(b.y-g.worldY)*s}if(i!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(l*l+h*h)-b+this.data.offsetScaleX)*i)/b),g.a*=b,g.c*=b}if(a!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(n*n+u*u)-b+this.data.offsetScaleY)*a)/b),g.b*=b,g.d*=b}if(c>0){let b=g.b,v=g.d,y=Math.atan2(v,b),S=Math.atan2(u,n)-Math.atan2(h,l)-(y-Math.atan2(g.c,g.a));S>E.PI?S-=E.PI2:S<-E.PI&&(S+=E.PI2),S=y+(S+m)*c;let A=Math.sqrt(b*b+v*v);g.b=Math.cos(S)*A,g.d=Math.sin(S)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,h=r.c,u=r.d,d=l*u-n*h>0?E.degRad:-E.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(h,l)+f;A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*t,g.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*i+1;g.a*=b,g.c*=b}if(a!=0){let b=(Math.sqrt(n*n+u*u)-1+this.data.offsetScaleY)*a+1;g.b*=b,g.d*=b}if(c>0){let b=Math.atan2(u,n)-Math.atan2(h,l);b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2);let v=g.b,y=g.d;b=Math.atan2(y,v)+(b-E.PI/2+m)*c;let S=Math.sqrt(v*v+y*y);g.b=Math.cos(b)*S,g.d=Math.sin(b)*S}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],u=h.arotation;e!=0&&(u+=(o.arotation-u+this.data.offsetRotation)*e);let d=h.ax,f=h.ay;d+=(o.ax-d+this.data.offsetX)*t,f+=(o.ay-f+this.data.offsetY)*s;let m=h.ascaleX,x=h.ascaleY;i!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*i)/m),a!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*a)/x);let p=h.ashearY;c!=0&&(p+=(o.ashearY-p+this.data.offsetShearY)*c),h.updateWorldTransformWith(d,f,u,m,x,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],u=h.arotation+(o.arotation+this.data.offsetRotation)*e,d=h.ax+(o.ax+this.data.offsetX)*t,f=h.ay+(o.ay+this.data.offsetY)*s,m=h.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),x=h.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*a+1),p=h.ashearY+(o.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(d,f,u,m,x,h.ashearX,p)}}},Gt=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Gt.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Dt(s,this,null);else{let a=this.bones[s.parent.index];i=new Dt(s,this,a),a.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],a=new Ts(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new Ys(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new Ms(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ce(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new Gs(s,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let u=0,d=t.length;u<d;u++){let f=t[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let d=0,f=this.skin.bones.length;d<f;d++){let m=this.bones[u[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,a=this.pathConstraints,c=this.physicsConstraints,o=s.length,r=i.length,l=a.length,n=this.physicsConstraints.length,h=o+r+l+n;e:for(let u=0;u<h;u++){for(let d=0;d<o;d++){let f=s[d];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let d=0;d<r;d++){let f=i[d];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let d=0;d<l;d++){let f=a[d];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let d=0;d<n;d++){const f=c[d];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,d=t.length;u<d;u++)this.sortBone(t[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let a=s[s.length-1];this.sortBone(a),this._updateCache.push(e),this.sortReset(i.children),a.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let a=t.getAttachment();a instanceof Ie&&this.sortPathConstraintAttachmentWith(a,i);let c=e.bones,o=c.length;for(let r=0;r<o;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(c[r].children);for(let r=0;r<o;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let a=t[i];this.sortBone(a.parent),this.sortBone(a)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let a in i)this.sortPathConstraintAttachmentWith(i[a],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ie))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let a=0,c=s.length;a<c;){let o=s[a++];for(o+=a;a<o;)this.sortBone(i[s[a++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let i=0,a=t.length;i<a;i++){let c=t[i];c.ax=c.x,c.ay=c.y,c.arotation=c.rotation,c.ascaleX=c.scaleX,c.ascaleY=c.scaleY,c.ashearX=c.shearX,c.ashearY=c.shearY}let s=this._updateCache;for(let i=0,a=s.length;i<a;i++)s[i].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let s=this.bones;for(let x=1,p=s.length;x<p;x++){let w=s[x];w.ax=w.x,w.ay=w.y,w.arotation=w.rotation,w.ascaleX=w.scaleX,w.ascaleY=w.scaleY,w.ashearX=w.shearX,w.ashearY=w.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let a=t.a,c=t.b,o=t.c,r=t.d;i.worldX=a*this.x+c*this.y+t.worldX,i.worldY=o*this.x+r*this.y+t.worldY;const l=(i.rotation+i.shearX)*E.degRad,n=(i.rotation+90+i.shearY)*E.degRad,h=Math.cos(l)*i.scaleX,u=Math.cos(n)*i.scaleY,d=Math.sin(l)*i.scaleX,f=Math.sin(n)*i.scaleY;i.a=(a*h+c*d)*this.scaleX,i.b=(a*u+c*f)*this.scaleX,i.c=(o*h+r*d)*this.scaleY,i.d=(o*u+r*f)*this.scaleY;let m=this._updateCache;for(let x=0,p=m.length;x<p;x++){let w=m[x];w!=i&&w.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s],c=a.data.attachmentName;if(c){let o=e.getAttachment(s,c);o&&a.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let c=s[i];if(c.data.name==e){let o=null;if(t&&(o=this.getAttachment(i,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);c.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new Ve,s=new Ve;return this.getBounds(t,s,void 0,e),{x:t.x,y:t.y,width:s.x,height:s.y}}getBounds(e,t,s=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let a=this.drawOrder,c=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let n=0,h=a.length;n<h;n++){let u=a[n];if(!u.bone.active)continue;let d=0,f=null,m=null,x=u.getAttachment();if(x instanceof V)d=8,f=R.setArraySize(s,d,0),x.computeWorldVertices(u,f,0,2),m=Gt.quadTriangles;else if(x instanceof ye){let p=x;d=p.worldVerticesLength,f=R.setArraySize(s,d,0),p.computeWorldVertices(u,0,d,f,0,2),m=p.triangles}else if(x instanceof ze&&i!=null){i.clipStart(u,x);continue}if(f&&m){i!=null&&i.isClipping()&&(i.clipTriangles(f,m,m.length),f=i.clippedVertices,d=i.clippedVertices.length);for(let p=0,w=f.length;p<w;p+=2){let g=f[p],b=f[p+1];c=Math.min(c,g),o=Math.min(o,b),r=Math.max(r,g),l=Math.max(l,b)}}i?.clipEndWithSlot(u)}i?.clipEnd(),e.set(c,o),t.set(r-c,l-o)}update(e){this.time+=e}physicsTranslate(e,t){const s=this.physicsConstraints;for(let i=0,a=s.length;i<a;i++)s[i].translate(e,t)}physicsRotate(e,t,s){const i=this.physicsConstraints;for(let a=0,c=i.length;a<c;a++)i[a].rotate(e,t,s)}},Je=Gt;B(Je,"quadTriangles",[0,1,2,2,3,0]),B(Je,"yDown",!1);var Xs=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Xs||{}),Fs=class extends Ee{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Ht=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}},$t=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Ke=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new D(.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.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){c=!0;break}c||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){c=!0;break}c||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){c=!0;break}c||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){c=!0;break}c||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof ye?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new $t(t,i,a))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new $t(e,i,a))}}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++){let a=e.slots[i],c=a.getAttachment();if(c&&s<t.attachments.length){let o=t.attachments[s];for(let r in o){let l=o[r];if(c==l){let n=this.getAttachment(s,r);n&&a.setAttachment(n);break}}}s++}}},jt=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Qe.Normal;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Qe=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Qe||{}),Jt=class extends Ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ht;s.name="";let i=new Es(e),a=i.readInt32(),c=i.readInt32();s.hash=c==0&&a==0?null:c.toString(16)+a.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;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("String in string table must not be null.");i.strings.push(h)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Bone name must not be null.");let u=n==0?null:s.bones[i.readInt(!0)],d=new Ot(n,h,u);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.inherit=i.readByte(),d.skinRequired=i.readBoolean(),o&&(D.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Slot name must not be null.");let u=s.bones[i.readInt(!0)],d=new jt(n,h,u);D.rgba8888ToColor(d.color,i.readInt32());let f=i.readInt32();f!=-1&&D.rgb888ToColor(d.darkColor=new D,f),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let u=i.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new Ut(u);d.order=i.readInt(!0),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let f=i.readByte();d.skinRequired=(f&1)!=0,d.bendDirection=f&2?1:-1,d.compress=(f&4)!=0,d.stretch=(f&8)!=0,d.uniform=(f&16)!=0,f&32&&(d.mix=f&64?i.readFloat():1),f&128&&(d.softness=i.readFloat()*t),s.ikConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let u=i.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new Jt(u);d.order=i.readInt(!0),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let f=i.readByte();d.skinRequired=(f&1)!=0,d.local=(f&2)!=0,d.relative=(f&4)!=0,f&8&&(d.offsetRotation=i.readFloat()),f&16&&(d.offsetX=i.readFloat()*t),f&32&&(d.offsetY=i.readFloat()*t),f&64&&(d.offsetScaleX=i.readFloat()),f&128&&(d.offsetScaleY=i.readFloat()),f=i.readByte(),f&1&&(d.offsetShearY=i.readFloat()),f&2&&(d.mixRotate=i.readFloat()),f&4&&(d.mixX=i.readFloat()),f&8&&(d.mixY=i.readFloat()),f&16&&(d.mixScaleX=i.readFloat()),f&32&&(d.mixScaleY=i.readFloat()),f&64&&(d.mixShearY=i.readFloat()),s.transformConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let u=i.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new zt(u);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)];const f=i.readByte();d.positionMode=f&1,d.spacingMode=f>>1&3,d.rotateMode=f>>3&3,f&128&&(d.offsetRotation=i.readFloat()),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){const u=i.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Fs(u);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let f=i.readByte();d.skinRequired=(f&1)!=0,f&2&&(d.x=i.readFloat()),f&4&&(d.y=i.readFloat()),f&8&&(d.rotate=i.readFloat()),f&16&&(d.scaleX=i.readFloat()),f&32&&(d.shearX=i.readFloat()),d.limit=(f&64?i.readFloat():5e3)*t,d.step=1/i.readUnsignedByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=f&128?i.readFloat():1,d.wind=i.readFloat(),d.gravity=i.readFloat(),f=i.readByte(),f&1&&(d.inertiaGlobal=!0),f&2&&(d.strengthGlobal=!0),f&4&&(d.dampingGlobal=!0),f&8&&(d.massGlobal=!0),f&16&&(d.windGlobal=!0),f&32&&(d.gravityGlobal=!0),f&64&&(d.mixGlobal=!0),d.mix=f&128?i.readFloat():1,s.physicsConstraints.push(d)}let l=this.readSkin(i,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let n=s.skins.length;for(R.setArraySize(s.skins,r=n+i.readInt(!0));n<r;n++){let h=this.readSkin(i,s,!1,o);if(!h)throw new Error("readSkin() should not have returned null.");s.skins[n]=h}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let h=this.linkedMeshes[n];const u=s.skins[h.skinIndex];if(!h.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(h.slotIndex,h.parent);if(!d)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?d:h.mesh,h.mesh.setParentMesh(d),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Event data name must not be null");let u=new Wt(h);u.intValue=i.readInt(!1),u.floatValue=i.readFloat(),u.stringValue=i.readString(),u.audioPath=i.readString(),u.audioPath&&(u.volume=i.readFloat(),u.balance=i.readFloat()),s.events.push(u)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,h,s))}return s}readSkin(e,t,s,i){let a=null,c=0;if(s){if(c=e.readInt(!0),c==0)return null;a=new Ke("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");a=new Ke(o),i&&D.rgba8888ToColor(a.color,e.readInt32()),a.bones.length=e.readInt(!0);for(let r=0,l=a.bones.length;r<l;r++)a.bones[r]=t.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.physicsConstraints[e.readInt(!0)]);c=e.readInt(!0)}for(let o=0;o<c;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let u=this.readAttachment(e,t,a,r,h,i);u&&a.setAttachment(r,h,u)}}return a}readAttachment(e,t,s,i,a,c){let o=this.scale,r=e.readByte();const l=r&8?e.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(r&7){case xe.Region:{let n=r&16?e.readStringRef():null;const h=r&32?e.readInt32():4294967295,u=r&64?this.readSequence(e):null;let d=r&128?e.readFloat():0,f=e.readFloat(),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat();n||(n=l);let b=this.attachmentLoader.newRegionAttachment(s,l,n,u);return b?(b.path=n,b.x=f*o,b.y=m*o,b.scaleX=x,b.scaleY=p,b.rotation=d,b.width=w*o,b.height=g*o,D.rgba8888ToColor(b.color,h),b.sequence=u,u==null&&b.updateRegion(),b):null}case xe.BoundingBox:{let n=this.readVertices(e,(r&16)!=0),h=c?e.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,l);return u?(u.worldVerticesLength=n.length,u.vertices=n.vertices,u.bones=n.bones,c&&D.rgba8888ToColor(u.color,h),u):null}case xe.Mesh:{let n=r&16?e.readStringRef():l;const h=r&32?e.readInt32():4294967295,u=r&64?this.readSequence(e):null,d=e.readInt(!0),f=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,f.length,1),x=this.readShortArray(e,(f.length-d-2)*3);let p=[],w=0,g=0;c&&(p=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),n||(n=l);let b=this.attachmentLoader.newMeshAttachment(s,l,n,u);return b?(b.path=n,D.rgba8888ToColor(b.color,h),b.bones=f.bones,b.vertices=f.vertices,b.worldVerticesLength=f.length,b.triangles=x,b.regionUVs=m,u==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=u,c&&(b.edges=p,b.width=w*o,b.height=g*o),b):null}case xe.LinkedMesh:{const n=r&16?e.readStringRef():l;if(n==null)throw new Error("Path of linked mesh must not be null");const h=r&32?e.readInt32():4294967295,u=r&64?this.readSequence(e):null,d=(r&128)!=0,f=e.readInt(!0),m=e.readStringRef();let x=0,p=0;c&&(x=e.readFloat(),p=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,l,n,u);return w?(w.path=n,D.rgba8888ToColor(w.color,h),w.sequence=u,c&&(w.width=x*o,w.height=p*o),this.linkedMeshes.push(new $s(w,f,i,m,d)),w):null}case xe.Path:{const n=(r&16)!=0,h=(r&32)!=0,u=this.readVertices(e,(r&64)!=0),d=R.newArray(u.length/6,0);for(let x=0,p=d.length;x<p;x++)d[x]=e.readFloat()*o;const f=c?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=n,m.constantSpeed=h,m.worldVerticesLength=u.length,m.vertices=u.vertices,m.bones=u.bones,m.lengths=d,c&&D.rgba8888ToColor(m.color,f),m):null}case xe.Point:{const n=e.readFloat(),h=e.readFloat(),u=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,l);return f?(f.x=h*o,f.y=u*o,f.rotation=n,c&&D.rgba8888ToColor(f.color,d),f):null}case xe.Clipping:{const n=e.readInt(!0),h=this.readVertices(e,(r&16)!=0);let u=c?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[n],d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,c&&D.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(e){let t=new it(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),a=new js;if(a.length=i<<1,!t)return a.vertices=this.readFloatArray(e,a.length,s),a;let c=new Array,o=new Array;for(let r=0;r<i;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),c.push(e.readFloat()*s),c.push(e.readFloat()*s),c.push(e.readFloat())}return a.vertices=R.toFloatArray(c),a.bones=o,a}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let a=0;a<t;a++)i[a]=e.readFloat();else for(let a=0;a<t;a++)i[a]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,a=this.scale;for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0),x=m-1;switch(f){case lr:{let p=new we(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readStringRef());i.push(p);break}case or:{let p=e.readInt(!0),w=new gt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,b,v,y,S),A!=x;A++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(A);break;case de:z(e,w,k++,A,0,g,T,b,Y,1),z(e,w,k++,A,1,g,T,v,F,1),z(e,w,k++,A,2,g,T,y,X,1),z(e,w,k++,A,3,g,T,S,C,1)}g=T,b=Y,v=F,y=X,S=C}i.push(w);break}case hr:{let p=e.readInt(!0),w=new xt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,A=0;w.setFrame(S,g,b,v,y),S!=x;S++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(S);break;case de:z(e,w,A++,S,0,g,k,b,T,1),z(e,w,A++,S,1,g,k,v,Y,1),z(e,w,A++,S,2,g,k,y,F,1)}g=k,b=T,v=Y,y=F}i.push(w);break}case cr:{let p=e.readInt(!0),w=new wt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,F=0;w.setFrame(Y,g,b,v,y,S,A,k,T),Y!=x;Y++){let X=e.readFloat(),C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(Y);break;case de:z(e,w,F++,Y,0,g,X,b,C,1),z(e,w,F++,Y,1,g,X,v,M,1),z(e,w,F++,Y,2,g,X,y,P,1),z(e,w,F++,Y,3,g,X,S,O,1),z(e,w,F++,Y,4,g,X,A,_,1),z(e,w,F++,Y,5,g,X,k,N,1),z(e,w,F++,Y,6,g,X,T,G,1)}g=X,b=C,v=M,y=P,S=O,A=_,k=N,T=G}i.push(w);break}case dr:{let p=e.readInt(!0),w=new pt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,b,v,y,S,A,k),T!=x;T++){let F=e.readFloat(),X=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(T);break;case de:z(e,w,Y++,T,0,g,F,b,X,1),z(e,w,Y++,T,1,g,F,v,C,1),z(e,w,Y++,T,2,g,F,y,M,1),z(e,w,Y++,T,3,g,F,S,P,1),z(e,w,Y++,T,4,g,F,A,O,1),z(e,w,Y++,T,5,g,F,k,_,1)}g=F,b=X,v=C,y=M,S=P,A=O,k=_}i.push(w);break}case fr:{let p=new bt(m,e.readInt(!0),h),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,v=0;p.setFrame(b,w,g),b!=x;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case ce:p.setStepped(b);break;case de:z(e,p,v++,b,0,w,y,g,S,1)}w=y,g=S}i.push(p)}}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0);if(f==nr){let p=new mt(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readByte());i.push(p);continue}let x=e.readInt(!0);switch(f){case Js:i.push(ee(e,new Me(m,x,h),1));break;case Ks:i.push(Kt(e,new at(m,x,h),a));break;case Qs:i.push(ee(e,new nt(m,x,h),a));break;case Zs:i.push(ee(e,new lt(m,x,h),a));break;case er:i.push(Kt(e,new ot(m,x,h),1));break;case tr:i.push(ee(e,new ht(m,x,h),1));break;case sr:i.push(ee(e,new ct(m,x,h),1));break;case rr:i.push(Kt(e,new dt(m,x,h),1));break;case ir:i.push(ee(e,new ft(m,x,h),1));break;case ar:i.push(ee(e,new ut(m,x,h),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new vt(u,e.readInt(!0),h),m=e.readByte(),x=e.readFloat(),p=m&1?m&2?e.readFloat():1:0,w=m&4?e.readFloat()*a:0;for(let g=0,b=0;f.setFrame(g,x,p,w,m&8?1:-1,(m&16)!=0,(m&32)!=0),g!=d;g++){m=e.readByte();const v=e.readFloat(),y=m&1?m&2?e.readFloat():1:0,S=m&4?e.readFloat()*a:0;m&64?f.setStepped(g):m&128&&(z(e,f,b++,g,0,x,v,p,y,1),z(e,f,b++,g,1,x,v,w,S,a)),x=v,p=y,w=S}i.push(f)}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new St(u,e.readInt(!0),h),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;f.setFrame(y,m,x,p,w,g,b,v),y!=d;y++){let A=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),X=e.readFloat(),C=e.readFloat();switch(e.readByte()){case ce:f.setStepped(y);break;case de:z(e,f,S++,y,0,m,A,x,k,1),z(e,f,S++,y,1,m,A,p,T,1),z(e,f,S++,y,2,m,A,w,Y,1),z(e,f,S++,y,3,m,A,g,F,1),z(e,f,S++,y,4,m,A,b,X,1),z(e,f,S++,y,5,m,A,v,C,1)}m=A,x=k,p=T,w=Y,g=F,b=X,v=C}i.push(f)}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),u=s.pathConstraints[h];for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),x=e.readInt(!0),p=e.readInt(!0);switch(m){case gr:i.push(ee(e,new At(x,p,h),u.positionMode==0?a:1));break;case xr:i.push(ee(e,new It(x,p,h),u.spacingMode==0||u.spacingMode==1?a:1));break;case br:let w=new Ct(x,p,h),g=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,A=0,k=w.getFrameCount()-1;w.setFrame(S,g,b,v,y),S!=k;S++){let T=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),X=e.readFloat();switch(e.readByte()){case ce:w.setStepped(S);break;case de:z(e,w,A++,S,0,g,T,b,Y,1),z(e,w,A++,S,1,g,T,v,F,1),z(e,w,A++,S,2,g,T,y,X,1)}g=T,b=Y,v=F,y=X}i.push(w)}}}for(let l=0,n=e.readInt(!0);l<n;l++){const h=e.readInt(!0)-1;for(let u=0,d=e.readInt(!0);u<d;u++){const f=e.readByte(),m=e.readInt(!0);if(f==Cr){const p=new De(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat());i.push(p);continue}const x=e.readInt(!0);switch(f){case wr:i.push(ee(e,new kt(m,x,h),1));break;case pr:i.push(ee(e,new Yt(m,x,h),1));break;case yr:i.push(ee(e,new Tt(m,x,h),1));break;case vr:i.push(ee(e,new Mt(m,x,h),1));break;case Sr:i.push(ee(e,new Xt(m,x,h),1));break;case Ar:i.push(ee(e,new Ft(m,x,h),1));break;case Ir:i.push(ee(e,new Et(m,x,h),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=s.skins[e.readInt(!0)];for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readInt(!0);for(let m=0,x=e.readInt(!0);m<x;m++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let w=h.getAttachment(f,p),g=e.readByte(),b=e.readInt(!0),v=b-1;switch(g){case ur:{let y=w,S=y.bones,A=y.vertices,k=S?A.length/3*2:A.length,T=e.readInt(!0),Y=new yt(b,T,f,y),F=e.readFloat();for(let X=0,C=0;;X++){let M,P=e.readInt(!0);if(P==0)M=S?R.newFloatArray(k):A;else{M=R.newFloatArray(k);let _=e.readInt(!0);if(P+=_,a==1)for(let N=_;N<P;N++)M[N]=e.readFloat();else for(let N=_;N<P;N++)M[N]=e.readFloat()*a;if(!S)for(let N=0,G=M.length;N<G;N++)M[N]+=A[N]}if(Y.setFrame(X,F,M),X==v)break;let O=e.readFloat();switch(e.readByte()){case ce:Y.setStepped(X);break;case de:z(e,Y,C++,X,0,F,O,0,1,1)}F=O}i.push(Y);break}case mr:{let y=new Ae(b,f,w);for(let S=0;S<b;S++){let A=e.readFloat(),k=e.readInt32();y.setFrame(S,A,cs[k&15],k>>4,e.readFloat())}i.push(y);break}}}}}let c=e.readInt(!0);if(c>0){let l=new pe(c),n=s.slots.length;for(let h=0;h<c;h++){let u=e.readFloat(),d=e.readInt(!0),f=R.newArray(n,0);for(let w=n-1;w>=0;w--)f[w]=-1;let m=R.newArray(n-d,0),x=0,p=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;x!=g;)m[p++]=x++;f[x+e.readInt(!0)]=x++}for(;x<n;)m[p++]=x++;for(let w=n-1;w>=0;w--)f[w]==-1&&(f[w]=m[--p]);l.setFrame(h,u,f)}i.push(l)}let o=e.readInt(!0);if(o>0){let l=new Xe(o);for(let n=0;n<o;n++){let h=e.readFloat(),u=s.events[e.readInt(!0)],d=new _t(h,u);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(n,d)}i.push(l)}let r=0;for(let l=0,n=i.length;l<n;l++)r=Math.max(r,i[l].getDuration());return new Ne(t,i,r)}},Es=class{constructor(e,t=new Array,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(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let 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="",s=0;for(let i=0;i<e;){let a=this.readUnsignedByte();switch(a>>4){case 12:case 13:t+=String.fromCharCode((a&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((a&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(a),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},$s=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}},js=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}},xe=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(xe||{});function ee(e,t,s){let i=e.readFloat(),a=e.readFloat()*s;for(let c=0,o=0,r=t.getFrameCount()-1;t.setFrame(c,i,a),c!=r;c++){let l=e.readFloat(),n=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(c);break;case de:z(e,t,o++,c,0,i,l,a,n,s)}i=l,a=n}return t}function Kt(e,t,s){let i=e.readFloat(),a=e.readFloat()*s,c=e.readFloat()*s;for(let o=0,r=0,l=t.getFrameCount()-1;t.setFrame(o,i,a,c),o!=l;o++){let n=e.readFloat(),h=e.readFloat()*s,u=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(o);break;case de:z(e,t,r++,o,0,i,n,a,h,s),z(e,t,r++,o,1,i,n,c,u,s)}i=n,a=h,c=u}return t}function z(e,t,s,i,a,c,o,r,l,n){t.setBezier(s,i,a,c,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var Js=0,Ks=1,Qs=2,Zs=3,er=4,tr=5,sr=6,rr=7,ir=8,ar=9,nr=10,lr=0,or=1,hr=2,cr=3,dr=4,fr=5,ur=0,mr=1,gr=0,xr=1,br=2,wr=0,pr=1,yr=2,vr=4,Sr=5,Ar=6,Ir=7,Cr=8,ce=1,de=2,kr=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Te(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,c=e.slots,o=c.length;s.length=0,a.freeAll(i),i.length=0;for(let r=0;r<o;r++){let l=c[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof Ue){let h=n;s.push(h);let u=a.obtain();u.length!=h.worldVerticesLength&&(u=R.newFloatArray(h.worldVerticesLength)),i.push(u),h.computeWorldVertices(l,0,h.worldVerticesLength,u,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,a=this.polygons;for(let c=0,o=a.length;c<o;c++){let r=a[c],l=r;for(let n=0,h=r.length;n<h;n+=2){let u=l[n],d=l[n+1];e=Math.min(e,u),t=Math.min(t,d),s=Math.max(s,u),i=Math.max(i,d)}}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){let a=this.minX,c=this.minY,o=this.maxX,r=this.maxY;if(e<=a&&s<=a||t<=c&&i<=c||e>=o&&s>=o||t>=r&&i>=r)return!1;let l=(i-t)/(s-e),n=l*(a-e)+t;if(n>c&&n<r||(n=l*(o-e)+t,n>c&&n<r))return!0;let h=(c-t)/l+e;return h>a&&h<o||(h=(r-t)/l+e,h>a&&h<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,a=e.length,c=a-2,o=!1;for(let r=0;r<a;r+=2){let l=i[r+1],n=i[c+1];if(l<s&&n>=s||n<s&&l>=s){let h=i[r];h+(s-l)/(n-l)*(i[c]-h)<t&&(o=!o)}c=r}return o}intersectsSegment(e,t,s,i){let a=this.polygons;for(let c=0,o=a.length;c<o;c++)if(this.intersectsSegmentPolygon(a[c],e,t,s,i))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,t,s,i,a){let c=e,o=e.length,r=t-i,l=s-a,n=t*a-s*i,h=c[o-2],u=c[o-1];for(let d=0;d<o;d+=2){let f=c[d],m=c[d+1],x=h*m-u*f,p=h-f,w=u-m,g=r*w-l*p,b=(n*p-r*x)/g;if((b>=h&&b<=f||b>=f&&b<=h)&&(b>=t&&b<=i||b>=i&&b<=t)){let v=(n*w-l*x)/g;if((v>=u&&v<=m||v>=m&&v<=u)&&(v>=s&&v<=a||v>=a&&v<=s))return!0}h=f,u=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},re=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Te(()=>new Array);polygonIndicesPool=new Te(()=>new Array);triangulate(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let o=0;o<s;o++)i[o]=o;let a=this.isConcaveArray;a.length=0;for(let o=0,r=s;o<r;++o)a[o]=re.isConcave(o,s,t,i);let c=this.triangles;for(c.length=0;s>3;){let o=s-1,r=0,l=1;for(;;){e:if(!a[r]){let u=i[o]<<1,d=i[r]<<1,f=i[l]<<1,m=t[u],x=t[u+1],p=t[d],w=t[d+1],g=t[f],b=t[f+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!a[v])continue;let y=i[v]<<1,S=t[y],A=t[y+1];if(re.positiveArea(g,b,m,x,S,A)&&re.positiveArea(m,x,p,w,S,A)&&re.positiveArea(p,w,g,b,S,A))break e}break}if(l==0){do{if(!a[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%s}c.push(i[(s+r-1)%s]),c.push(i[r]),c.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let n=(s+r-1)%s,h=r==s?0:r;a[n]=re.isConcave(n,s,t,i),a[h]=re.isConcave(h,s,t,i)}return s==3&&(c.push(i[2]),c.push(i[0]),c.push(i[1])),c}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,h=t.length;n<h;n+=3){let u=t[n]<<1,d=t[n+1]<<1,f=t[n+2]<<1,m=s[u],x=s[u+1],p=s[d],w=s[d+1],g=s[f],b=s[f+1],v=!1;if(r==u){let y=o.length-4,S=re.winding(o[y],o[y+1],o[y+2],o[y+3],g,b),A=re.winding(g,b,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(g),o.push(b),c.push(f),v=!0)}v||(o.length>0?(i.push(o),a.push(c)):(this.polygonPool.free(o),this.polygonIndicesPool.free(c)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(x),o.push(p),o.push(w),o.push(g),o.push(b),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(u),c.push(d),c.push(f),l=re.winding(m,x,p,w,g,b),r=u)}o.length>0&&(i.push(o),a.push(c));for(let n=0,h=i.length;n<h;n++){if(c=a[n],c.length==0)continue;let u=c[0],d=c[c.length-1];o=i[n];let f=o.length-4,m=o[f],x=o[f+1],p=o[f+2],w=o[f+3],g=o[0],b=o[1],v=o[2],y=o[3],S=re.winding(m,x,p,w,g,b);for(let A=0;A<h;A++){if(A==n)continue;let k=a[A];if(k.length!=3)continue;let T=k[0],Y=k[1],F=k[2],X=i[A],C=X[X.length-2],M=X[X.length-1];if(T!=u||Y!=d)continue;let P=re.winding(m,x,p,w,C,M),O=re.winding(C,M,g,b,v,y);P==S&&O==S&&(X.length=0,k.length=0,o.push(C),o.push(M),c.push(F),m=p,x=w,p=C,w=M,A=0)}}for(let n=i.length-1;n>=0;n--)o=i[n],o.length==0&&(i.splice(n,1),this.polygonPool.free(o),c=a[n],a.splice(n,1),this.polygonIndicesPool.free(c));return i}static isConcave(e,t,s,i){let a=i[(t+e-1)%t]<<1,c=i[e]<<1,o=i[(e+1)%t]<<1;return!this.positiveArea(s[a],s[a+1],s[c],s[c+1],s[o],s[o+1])}static positiveArea(e,t,s,i,a,c){return e*(c-i)+s*(t-c)+a*(i-t)>=0}static winding(e,t,s,i,a,c){let o=s-e,r=i-t;return a*r-c*o+o*t-e*r>=0?1:-1}},Qt=class{triangulator=new re;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let a=this.clippingPolygon;Qt.makeClockwise(a);let c=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let o=0,r=c.length;o<r;o++){let l=c[o];Qt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return c.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,a,c,o,r){let l,n,h,u,d,f;typeof t=="number"?(l=s,n=i,h=a,u=c,d=o,f=r):(l=t,n=s,h=i,u=a,d=c,f=o),h&&u&&d&&typeof f=="boolean"?this.clipTrianglesRender(e,l,n,h,u,d,f):this.clipTrianglesNoRender(e,l,n)}clipTrianglesNoRender(e,t,s){let i=this.clipOutput,a=this.clippedVertices,c=this.clippedTriangles,o=this.clippingPolygons,r=o.length,l=0;a.length=0,c.length=0;for(let n=0;n<s;n+=3){let h=t[n]<<1,u=e[h],d=e[h+1];h=t[n+1]<<1;let f=e[h],m=e[h+1];h=t[n+2]<<1;let x=e[h],p=e[h+1];for(let w=0;w<r;w++){let g=a.length;if(this.clip(u,d,f,m,x,p,o[w],i)){let b=i.length;if(b==0)continue;let v=b>>1,y=this.clipOutput,S=R.setArraySize(a,g+v*2);for(let k=0;k<b;k+=2,g+=2){let T=y[k],Y=y[k+1];S[g]=T,S[g+1]=Y}g=c.length;let A=R.setArraySize(c,g+3*(v-2));v--;for(let k=1;k<v;k++,g+=3)A[g]=l,A[g+1]=l+k,A[g+2]=l+k+1;l+=v+1}else{let b=R.setArraySize(a,g+6);b[g]=u,b[g+1]=d,b[g+2]=f,b[g+3]=m,b[g+4]=x,b[g+5]=p,g=c.length;let v=R.setArraySize(c,g+3);v[g]=l,v[g+1]=l+1,v[g+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,s,i,a,c,o){let r=this.clipOutput,l=this.clippedVertices,n=this.clippedTriangles,h=this.clippingPolygons,u=h.length,d=o?12:8,f=0;l.length=0,n.length=0;for(let m=0;m<s;m+=3){let x=t[m]<<1,p=e[x],w=e[x+1],g=i[x],b=i[x+1];x=t[m+1]<<1;let v=e[x],y=e[x+1],S=i[x],A=i[x+1];x=t[m+2]<<1;let k=e[x],T=e[x+1],Y=i[x],F=i[x+1];for(let X=0;X<u;X++){let C=l.length;if(this.clip(p,w,v,y,k,T,h[X],r)){let M=r.length;if(M==0)continue;let P=y-T,O=k-v,_=p-k,N=T-w,G=1/(P*_+O*(w-T)),$=M>>1,j=this.clipOutput,L=R.setArraySize(l,C+$*d);for(let U=0;U<M;U+=2,C+=d){let ie=j[U],te=j[U+1];L[C]=ie,L[C+1]=te,L[C+2]=a.r,L[C+3]=a.g,L[C+4]=a.b,L[C+5]=a.a;let K=ie-k,Q=te-T,Z=(P*K+O*Q)*G,fe=(N*K+_*Q)*G,ke=1-Z-fe;L[C+6]=g*Z+S*fe+Y*ke,L[C+7]=b*Z+A*fe+F*ke,o&&(L[C+8]=c.r,L[C+9]=c.g,L[C+10]=c.b,L[C+11]=c.a)}C=n.length;let W=R.setArraySize(n,C+3*($-2));$--;for(let U=1;U<$;U++,C+=3)W[C]=f,W[C+1]=f+U,W[C+2]=f+U+1;f+=$+1}else{let M=R.setArraySize(l,C+3*d);M[C]=p,M[C+1]=w,M[C+2]=a.r,M[C+3]=a.g,M[C+4]=a.b,M[C+5]=a.a,o?(M[C+6]=g,M[C+7]=b,M[C+8]=c.r,M[C+9]=c.g,M[C+10]=c.b,M[C+11]=c.a,M[C+12]=v,M[C+13]=y,M[C+14]=a.r,M[C+15]=a.g,M[C+16]=a.b,M[C+17]=a.a,M[C+18]=S,M[C+19]=A,M[C+20]=c.r,M[C+21]=c.g,M[C+22]=c.b,M[C+23]=c.a,M[C+24]=k,M[C+25]=T,M[C+26]=a.r,M[C+27]=a.g,M[C+28]=a.b,M[C+29]=a.a,M[C+30]=Y,M[C+31]=F,M[C+32]=c.r,M[C+33]=c.g,M[C+34]=c.b,M[C+35]=c.a):(M[C+6]=g,M[C+7]=b,M[C+8]=v,M[C+9]=y,M[C+10]=a.r,M[C+11]=a.g,M[C+12]=a.b,M[C+13]=a.a,M[C+14]=S,M[C+15]=A,M[C+16]=k,M[C+17]=T,M[C+18]=a.r,M[C+19]=a.g,M[C+20]=a.b,M[C+21]=a.a,M[C+22]=Y,M[C+23]=F),C=n.length;let P=R.setArraySize(n,C+3);P[C]=f,P[C+1]=f+1,P[C+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,t,s,i){let a=this.clipOutput,c=this.clippedVertices,o=this.clippedUVs,r=this.clippedTriangles,l=this.clippingPolygons,n=l.length,h=0;c.length=0,o.length=0,r.length=0;for(let u=0;u<s;u+=3){let d=t[u]<<1,f=e[d],m=e[d+1],x=i[d],p=i[d+1];d=t[u+1]<<1;let w=e[d],g=e[d+1],b=i[d],v=i[d+1];d=t[u+2]<<1;let y=e[d],S=e[d+1],A=i[d],k=i[d+1];for(let T=0;T<n;T++){let Y=c.length;if(this.clip(f,m,w,g,y,S,l[T],a)){let F=a.length;if(F==0)continue;let X=g-S,C=y-w,M=f-y,P=S-m,O=1/(X*M+C*(m-S)),_=F>>1,N=this.clipOutput,G=R.setArraySize(c,Y+_*2),$=R.setArraySize(o,Y+_*2);for(let L=0;L<F;L+=2,Y+=2){let W=N[L],U=N[L+1];G[Y]=W,G[Y+1]=U;let ie=W-y,te=U-S,K=(X*ie+C*te)*O,Q=(P*ie+M*te)*O,Z=1-K-Q;$[Y]=x*K+b*Q+A*Z,$[Y+1]=p*K+v*Q+k*Z}Y=r.length;let j=R.setArraySize(r,Y+3*(_-2));_--;for(let L=1;L<_;L++,Y+=3)j[Y]=h,j[Y+1]=h+L,j[Y+2]=h+L+1;h+=_+1}else{let F=R.setArraySize(c,Y+6);F[Y]=f,F[Y+1]=m,F[Y+2]=w,F[Y+3]=g,F[Y+4]=y,F[Y+5]=S;let X=R.setArraySize(o,Y+3*2);X[Y]=x,X[Y+1]=p,X[Y+2]=b,X[Y+3]=v,X[Y+4]=A,X[Y+5]=k,Y=r.length;let C=R.setArraySize(r,Y+3);C[Y]=h,C[Y+1]=h+1,C[Y+2]=h+2,h+=3;break}}}}clip(e,t,s,i,a,c,o,r){let l=r,n=!1,h;o.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(s),h.push(i),h.push(a),h.push(c),h.push(e),h.push(t),r.length=0;let u=o.length-4,d=o;for(let f=0;;f+=2){let m=d[f],x=d[f+1],p=m-d[f+2],w=x-d[f+3],g=r.length,b=h;for(let y=0,S=h.length-2;y<S;){let A=b[y],k=b[y+1];y+=2;let T=b[y],Y=b[y+1],F=w*(m-T)>p*(x-Y),X=w*(m-A)-p*(x-k);if(X>0){if(F){r.push(T),r.push(Y);continue}let C=T-A,M=Y-k,P=X/(C*w-M*p);if(P>=0&&P<=1)r.push(A+C*P),r.push(k+M*P);else{r.push(T),r.push(Y);continue}}else if(F){let C=T-A,M=Y-k,P=X/(C*w-M*p);if(P>=0&&P<=1)r.push(A+C*P),r.push(k+M*P),r.push(T),r.push(Y);else{r.push(T),r.push(Y);continue}}n=!0}if(g==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),f==u)break;let v=r;r=h,r.length=0,h=v}if(l!=r){l.length=0;for(let f=0,m=r.length-2;f<m;f++)l[f]=r[f]}else l.length=l.length-2;return n}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],a=0,c=0,o=0,r=0;for(let l=0,n=s-3;l<n;l+=2)a=t[l],c=t[l+1],o=t[l+2],r=t[l+3],i+=a*r-o*c;if(!(i<0))for(let l=0,n=s-2,h=s>>1;l<h;l+=2){let u=t[l],d=t[l+1],f=n-l;t[l]=t[f],t[l+1]=t[f+1],t[f]=u,t[f+1]=d}}},Yr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ht,i=typeof e=="string"?JSON.parse(e):e,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.referenceScale=I(a,"referenceScale",100)*t,s.fps=a.fps,s.imagesPath=a.images??null,s.audioPath=a.audio??null),i.bones)for(let c=0;c<i.bones.length;c++){let o=i.bones[c],r=null,l=I(o,"parent",null);l&&(r=s.findBone(l));let n=new Ot(s.bones.length,o.name,r);n.length=I(o,"length",0)*t,n.x=I(o,"x",0)*t,n.y=I(o,"y",0)*t,n.rotation=I(o,"rotation",0),n.scaleX=I(o,"scaleX",1),n.scaleY=I(o,"scaleY",1),n.shearX=I(o,"shearX",0),n.shearY=I(o,"shearY",0),n.inherit=R.enumValue(Fe,I(o,"inherit","Normal")),n.skinRequired=I(o,"skin",!1);let h=I(o,"color",null);h&&n.color.setFromString(h),s.bones.push(n)}if(i.slots)for(let c=0;c<i.slots.length;c++){let o=i.slots[c],r=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${r}`);let n=new jt(s.slots.length,r,l),h=I(o,"color",null);h&&n.color.setFromString(h);let u=I(o,"dark",null);u&&(n.darkColor=D.fromString(u)),n.attachmentName=I(o,"attachment",null),n.blendMode=R.enumValue(Qe,I(o,"blend","normal")),n.visible=I(o,"visible",!0),s.slots.push(n)}if(i.ik)for(let c=0;c<i.ik.length;c++){let o=i.ik[c],r=new Ut(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let h=s.findBone(o.bones[n]);if(!h)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(h)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);r.target=l,r.mix=I(o,"mix",1),r.softness=I(o,"softness",0)*t,r.bendDirection=I(o,"bendPositive",!0)?1:-1,r.compress=I(o,"compress",!1),r.stretch=I(o,"stretch",!1),r.uniform=I(o,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let c=0;c<i.transform.length;c++){let o=i.transform[c],r=new Jt(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let u=o.bones[h],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=I(o,"local",!1),r.relative=I(o,"relative",!1),r.offsetRotation=I(o,"rotation",0),r.offsetX=I(o,"x",0)*t,r.offsetY=I(o,"y",0)*t,r.offsetScaleX=I(o,"scaleX",0),r.offsetScaleY=I(o,"scaleY",0),r.offsetShearY=I(o,"shearY",0),r.mixRotate=I(o,"mixRotate",1),r.mixX=I(o,"mixX",1),r.mixY=I(o,"mixY",r.mixX),r.mixScaleX=I(o,"mixScaleX",1),r.mixScaleY=I(o,"mixScaleY",r.mixScaleX),r.mixShearY=I(o,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let c=0;c<i.path.length;c++){let o=i.path[c],r=new zt(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let u=o.bones[h],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=R.enumValue(He,I(o,"positionMode","Percent")),r.spacingMode=R.enumValue($e,I(o,"spacingMode","Length")),r.rotateMode=R.enumValue(je,I(o,"rotateMode","Tangent")),r.offsetRotation=I(o,"rotation",0),r.position=I(o,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=I(o,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=I(o,"mixRotate",1),r.mixX=I(o,"mixX",1),r.mixY=I(o,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let c=0;c<i.physics.length;c++){const o=i.physics[c],r=new Fs(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);const l=o.bone,n=s.findBone(l);if(n==null)throw new Error("Physics bone not found: "+l);r.bone=n,r.x=I(o,"x",0),r.y=I(o,"y",0),r.rotate=I(o,"rotate",0),r.scaleX=I(o,"scaleX",0),r.shearX=I(o,"shearX",0),r.limit=I(o,"limit",5e3)*t,r.step=1/I(o,"fps",60),r.inertia=I(o,"inertia",1),r.strength=I(o,"strength",100),r.damping=I(o,"damping",1),r.massInverse=1/I(o,"mass",1),r.wind=I(o,"wind",0),r.gravity=I(o,"gravity",0),r.mix=I(o,"mix",1),r.inertiaGlobal=I(o,"inertiaGlobal",!1),r.strengthGlobal=I(o,"strengthGlobal",!1),r.dampingGlobal=I(o,"dampingGlobal",!1),r.massGlobal=I(o,"massGlobal",!1),r.windGlobal=I(o,"windGlobal",!1),r.gravityGlobal=I(o,"gravityGlobal",!1),r.mixGlobal=I(o,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let c=0;c<i.skins.length;c++){let o=i.skins[c],r=new Ke(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],h=s.findBone(n);if(!h)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],h=s.findIkConstraint(n);if(!h)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],h=s.findTransformConstraint(n);if(!h)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],h=s.findPathConstraint(n);if(!h)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.physics)for(let l=0;l<o.physics.length;l++){let n=o.physics[l],h=s.findPhysicsConstraint(n);if(!h)throw new Error(`Couldn't find physics constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}for(let l in o.attachments){let n=s.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let h=o.attachments[l];for(let u in h){let d=this.readAttachment(h[u],r,n.index,u,s);d&&r.setAttachment(n.index,u,d)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let c=0,o=this.linkedMeshes.length;c<o;c++){let r=this.linkedMeshes[c],l=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${r.skin}`);let n=l.getAttachment(r.slotIndex,r.parent);if(!n)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let c in i.events){let o=i.events[c],r=new Wt(c);r.intValue=I(o,"int",0),r.floatValue=I(o,"float",0),r.stringValue=I(o,"string",""),r.audioPath=I(o,"audio",null),r.audioPath&&(r.volume=I(o,"volume",1),r.balance=I(o,"balance",0)),s.events.push(r)}if(i.animations)for(let c in i.animations){let o=i.animations[c];this.readAnimation(o,c,s)}return s}readAttachment(e,t,s,i,a){let c=this.scale;switch(i=I(e,"name",i),I(e,"type","region")){case"region":{let o=I(e,"path",i),r=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,i,o,r);if(!l)return null;l.path=o,l.x=I(e,"x",0)*c,l.y=I(e,"y",0)*c,l.scaleX=I(e,"scaleX",1),l.scaleY=I(e,"scaleY",1),l.rotation=I(e,"rotation",0),l.width=e.width*c,l.height=e.height*c,l.sequence=r;let n=I(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=I(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=I(e,"path",i),r=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,i,o,r);if(!l)return null;l.path=o;let n=I(e,"color",null);n&&l.color.setFromString(n),l.width=I(e,"width",0)*c,l.height=I(e,"height",0)*c,l.sequence=r;let h=I(e,"parent",null);if(h)return this.linkedMeshes.push(new Tr(l,I(e,"skin",null),s,h,I(e,"timelines",!0))),l;let u=e.uvs;return this.readVertices(e,l,u.length),l.triangles=e.triangles,l.regionUVs=u,l.region!=null&&l.updateRegion(),l.edges=I(e,"edges",null),l.hullLength=I(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=I(e,"closed",!1),o.constantSpeed=I(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=R.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)l[h]=e.lengths[h]*c;o.lengths=l;let n=I(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=I(e,"x",0)*c,o.y=I(e,"y",0)*c,o.rotation=I(e,"rotation",0);let r=I(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let r=I(e,"end",null);r&&(o.endSlot=a.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=I(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let t=new it(I(e,"count",0));return t.start=I(e,"start",1),t.digits=I(e,"digits",0),t.setupIndex=I(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let a=e.vertices;if(s==a.length){let r=R.toFloatArray(a);if(i!=1)for(let l=0,n=a.length;l<n;l++)r[l]*=i;t.vertices=r;return}let c=new Array,o=new Array;for(let r=0,l=a.length;r<l;){let n=a[r++];o.push(n);for(let h=r+n*4;r<h;r+=4)o.push(a[r]),c.push(a[r+1]*i),c.push(a[r+2]*i),c.push(a[r+3])}t.bones=o,t.vertices=R.toFloatArray(c)}readAnimation(e,t,s){let i=this.scale,a=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let h in r){let u=r[h];if(!u)continue;let d=u.length;if(h=="attachment"){let f=new we(d,n);for(let m=0;m<d;m++){let x=u[m];f.setFrame(m,I(x,"time",0),I(x,"name",null))}a.push(f)}else if(h=="rgba"){let f=new gt(d,d<<2,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.color);for(let w=0,g=0;;w++){f.setFrame(w,x,p.r,p.g,p.b,p.a);let b=u[w+1];if(!b){f.shrink(g);break}let v=I(b,"time",0),y=D.fromString(b.color),S=m.curve;S&&(g=H(S,f,g,w,0,x,v,p.r,y.r,1),g=H(S,f,g,w,1,x,v,p.g,y.g,1),g=H(S,f,g,w,2,x,v,p.b,y.b,1),g=H(S,f,g,w,3,x,v,p.a,y.a,1)),x=v,p=y,m=b}a.push(f)}else if(h=="rgb"){let f=new xt(d,d*3,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.color);for(let w=0,g=0;;w++){f.setFrame(w,x,p.r,p.g,p.b);let b=u[w+1];if(!b){f.shrink(g);break}let v=I(b,"time",0),y=D.fromString(b.color),S=m.curve;S&&(g=H(S,f,g,w,0,x,v,p.r,y.r,1),g=H(S,f,g,w,1,x,v,p.g,y.g,1),g=H(S,f,g,w,2,x,v,p.b,y.b,1)),x=v,p=y,m=b}a.push(f)}else if(h=="alpha")a.push(he(u,new bt(d,d,n),0,1));else if(h=="rgba2"){let f=new wt(d,d*7,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.light),w=D.fromString(m.dark);for(let g=0,b=0;;g++){f.setFrame(g,x,p.r,p.g,p.b,p.a,w.r,w.g,w.b);let v=u[g+1];if(!v){f.shrink(b);break}let y=I(v,"time",0),S=D.fromString(v.light),A=D.fromString(v.dark),k=m.curve;k&&(b=H(k,f,b,g,0,x,y,p.r,S.r,1),b=H(k,f,b,g,1,x,y,p.g,S.g,1),b=H(k,f,b,g,2,x,y,p.b,S.b,1),b=H(k,f,b,g,3,x,y,p.a,S.a,1),b=H(k,f,b,g,4,x,y,w.r,A.r,1),b=H(k,f,b,g,5,x,y,w.g,A.g,1),b=H(k,f,b,g,6,x,y,w.b,A.b,1)),x=y,p=S,w=A,m=v}a.push(f)}else if(h=="rgb2"){let f=new pt(d,d*6,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.light),w=D.fromString(m.dark);for(let g=0,b=0;;g++){f.setFrame(g,x,p.r,p.g,p.b,w.r,w.g,w.b);let v=u[g+1];if(!v){f.shrink(b);break}let y=I(v,"time",0),S=D.fromString(v.light),A=D.fromString(v.dark),k=m.curve;k&&(b=H(k,f,b,g,0,x,y,p.r,S.r,1),b=H(k,f,b,g,1,x,y,p.g,S.g,1),b=H(k,f,b,g,2,x,y,p.b,S.b,1),b=H(k,f,b,g,3,x,y,w.r,A.r,1),b=H(k,f,b,g,4,x,y,w.g,A.g,1),b=H(k,f,b,g,5,x,y,w.b,A.b,1)),x=y,p=S,w=A,m=v}a.push(f)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let h in r){let u=r[h],d=u.length;if(d!=0){if(h==="rotate")a.push(he(u,new Me(d,d,n),0,1));else if(h==="translate"){let f=new at(d,d<<1,n);a.push(Zt(u,f,"x","y",0,i))}else if(h==="translatex"){let f=new nt(d,d,n);a.push(he(u,f,0,i))}else if(h==="translatey"){let f=new lt(d,d,n);a.push(he(u,f,0,i))}else if(h==="scale"){let f=new ot(d,d<<1,n);a.push(Zt(u,f,"x","y",1,1))}else if(h==="scalex"){let f=new ht(d,d,n);a.push(he(u,f,1,1))}else if(h==="scaley"){let f=new ct(d,d,n);a.push(he(u,f,1,1))}else if(h==="shear"){let f=new dt(d,d<<1,n);a.push(Zt(u,f,"x","y",0,1))}else if(h==="shearx"){let f=new ft(d,d,n);a.push(he(u,f,0,1))}else if(h==="sheary"){let f=new ut(d,d,n);a.push(he(u,f,0,1))}else if(h==="inherit"){let f=new mt(d,l.index);for(let m=0;m<u.length;m++){let x=u[m];f.setFrame(m,I(x,"time",0),R.enumValue(Fe,I(x,"inherit","Normal")))}a.push(f)}}}}if(e.ik)for(let o in e.ik){let r=e.ik[o],l=r[0];if(!l)continue;let n=s.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let h=s.ikConstraints.indexOf(n),u=new vt(r.length,r.length<<1,h),d=I(l,"time",0),f=I(l,"mix",1),m=I(l,"softness",0)*i;for(let x=0,p=0;;x++){u.setFrame(x,d,f,m,I(l,"bendPositive",!0)?1:-1,I(l,"compress",!1),I(l,"stretch",!1));let w=r[x+1];if(!w){u.shrink(p);break}let g=I(w,"time",0),b=I(w,"mix",1),v=I(w,"softness",0)*i,y=l.curve;y&&(p=H(y,u,p,x,0,d,g,f,b,1),p=H(y,u,p,x,1,d,g,m,v,i)),d=g,f=b,m=v,l=w}a.push(u)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=s.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let h=s.transformConstraints.indexOf(n),u=new St(r.length,r.length*6,h),d=I(l,"time",0),f=I(l,"mixRotate",1),m=I(l,"mixX",1),x=I(l,"mixY",m),p=I(l,"mixScaleX",1),w=I(l,"mixScaleY",p),g=I(l,"mixShearY",1);for(let b=0,v=0;;b++){u.setFrame(b,d,f,m,x,p,w,g);let y=r[b+1];if(!y){u.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),T=I(y,"mixY",k),Y=I(y,"mixScaleX",1),F=I(y,"mixScaleY",Y),X=I(y,"mixShearY",1),C=l.curve;C&&(v=H(C,u,v,b,0,d,S,f,A,1),v=H(C,u,v,b,1,d,S,m,k,1),v=H(C,u,v,b,2,d,S,x,T,1),v=H(C,u,v,b,3,d,S,p,Y,1),v=H(C,u,v,b,4,d,S,w,F,1),v=H(C,u,v,b,5,d,S,g,X,1)),d=S,f=A,m=k,x=T,p=Y,w=F,p=Y,l=y}a.push(u)}if(e.path)for(let o in e.path){let r=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=s.pathConstraints.indexOf(l);for(let h in r){let u=r[h],d=u[0];if(!d)continue;let f=u.length;if(h==="position"){let m=new At(f,f,n);a.push(he(u,m,0,l.positionMode==0?i:1))}else if(h==="spacing"){let m=new It(f,f,n);a.push(he(u,m,0,l.spacingMode==0||l.spacingMode==1?i:1))}else if(h==="mix"){let m=new Ct(f,f*3,n),x=I(d,"time",0),p=I(d,"mixRotate",1),w=I(d,"mixX",1),g=I(d,"mixY",w);for(let b=0,v=0;;b++){m.setFrame(b,x,p,w,g);let y=u[b+1];if(!y){m.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),T=I(y,"mixY",k),Y=d.curve;Y&&(v=H(Y,m,v,b,0,x,S,p,A,1),v=H(Y,m,v,b,1,x,S,w,k,1),v=H(Y,m,v,b,2,x,S,g,T,1)),x=S,p=A,w=k,g=T,d=y}a.push(m)}}}if(e.physics)for(let o in e.physics){let r=e.physics[o],l=-1;if(o.length>0){let n=s.findPhysicsConstraint(o);if(!n)throw new Error("Physics constraint not found: "+o);l=s.physicsConstraints.indexOf(n)}for(let n in r){let h=r[n],u=h[0];if(!u)continue;let d=h.length;if(n=="reset"){const m=new De(d,l);for(let x=0;u!=null;u=h[x+1],x++)m.setFrame(x,I(u,"time",0));a.push(m);continue}let f;if(n=="inertia")f=new kt(d,d,l);else if(n=="strength")f=new Yt(d,d,l);else if(n=="damping")f=new Tt(d,d,l);else if(n=="mass")f=new Mt(d,d,l);else if(n=="wind")f=new Xt(d,d,l);else if(n=="gravity")f=new Ft(d,d,l);else if(n=="mix")f=new Et(d,d,l);else continue;a.push(he(h,f,0,1))}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let h=r[n],u=s.findSlot(n);if(!u)throw new Error("Slot not found: "+n);let d=u.index;for(let f in h){let m=h[f],x=l.getAttachment(d,f);for(let p in m){let w=m[p],g=w[0];if(g){if(p=="deform"){let b=x.bones,v=x.vertices,y=b?v.length/3*2:v.length,S=new yt(w.length,w.length,d,x),A=I(g,"time",0);for(let k=0,T=0;;k++){let Y,F=I(g,"vertices",null);if(!F)Y=b?R.newFloatArray(y):v;else{Y=R.newFloatArray(y);let P=I(g,"offset",0);if(R.arrayCopy(F,0,Y,P,F.length),i!=1)for(let O=P,_=O+F.length;O<_;O++)Y[O]*=i;if(!b)for(let O=0;O<y;O++)Y[O]+=v[O]}S.setFrame(k,A,Y);let X=w[k+1];if(!X){S.shrink(T);break}let C=I(X,"time",0),M=g.curve;M&&(T=H(M,S,T,k,0,A,C,0,1,1)),A=C,g=X}a.push(S)}else if(p=="sequence"){let b=new Ae(w.length,d,x),v=0;for(let y=0;y<w.length;y++){let S=I(g,"delay",v),A=I(g,"time",0),k=hs[I(g,"mode","hold")],T=I(g,"index",0);b.setFrame(y,A,k,T,S),v=S,g=w[y+1]}a.push(b)}}}}}}if(e.drawOrder){let o=new pe(e.drawOrder.length),r=s.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let h=e.drawOrder[n],u=null,d=I(h,"offsets",null);if(d){u=R.newArray(r,-1);let f=R.newArray(r-d.length,0),m=0,x=0;for(let p=0;p<d.length;p++){let w=d[p],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;m!=b;)f[x++]=m++;u[m+w.offset]=m++}for(;m<r;)f[x++]=m++;for(let p=r-1;p>=0;p--)u[p]==-1&&(u[p]=f[--x])}o.setFrame(l,I(h,"time",0),u)}a.push(o)}if(e.events){let o=new Xe(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],h=s.findEvent(n.name);if(!h)throw new Error("Event not found: "+n.name);let u=new _t(R.toSinglePrecision(I(n,"time",0)),h);u.intValue=I(n,"int",h.intValue),u.floatValue=I(n,"float",h.floatValue),u.stringValue=I(n,"string",h.stringValue),u.data.audioPath&&(u.volume=I(n,"volume",1),u.balance=I(n,"balance",0)),o.setFrame(r,u)}a.push(o)}let c=0;for(let o=0,r=a.length;o<r;o++)c=Math.max(c,a[o].getDuration());s.animations.push(new Ne(t,a,c))}},Tr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}};function he(e,t,s,i){let a=e[0],c=I(a,"time",0),o=I(a,"value",s)*i,r=0;for(let l=0;;l++){t.setFrame(l,c,o);let n=e[l+1];if(!n)return t.shrink(r),t;let h=I(n,"time",0),u=I(n,"value",s)*i;a.curve&&(r=H(a.curve,t,r,l,0,c,h,o,u,i)),c=h,o=u,a=n}}function Zt(e,t,s,i,a,c){let o=e[0],r=I(o,"time",0),l=I(o,s,a)*c,n=I(o,i,a)*c,h=0;for(let u=0;;u++){t.setFrame(u,r,l,n);let d=e[u+1];if(!d)return t.shrink(h),t;let f=I(d,"time",0),m=I(d,s,a)*c,x=I(d,i,a)*c,p=o.curve;p&&(h=H(p,t,h,u,0,r,f,l,m,c),h=H(p,t,h,u,1,r,f,n,x,c)),r=f,l=m,n=x,o=d}}function H(e,t,s,i,a,c,o,r,l,n){if(e=="stepped")return t.setStepped(i),s;let h=a<<2,u=e[h],d=e[h+1]*n,f=e[h+2],m=e[h+3]*n;return t.setBezier(s,i,a,c,r,u,d,f,m,o,l),s+1}function I(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var Rs=class extends Vt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Mr=class extends ks{constructor(e="",t=new qt){super(s=>new Rs(s),e,t)}},Xr=R.newFloatArray(8),Ze=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=R.newFloatArray(8*1024);tempColor=new D;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder;this.debugRendering&&(t.strokeStyle="green");for(let c=0,o=a.length;c<o;c++){let r=a[c],l=r.bone;if(!l.active)continue;let n=r.getAttachment();if(!(n instanceof V))continue;n.computeWorldVertices(r,Xr,0,2);let h=n.region,u=h.texture.getImage(),d=r.color,f=n.color;s.set(i.r*d.r*f.r,i.g*d.g*f.g,i.b*d.b*f.b,i.a*d.a*f.a),t.save(),t.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),t.translate(n.offset[0],n.offset[1]),t.rotate(n.rotation*Math.PI/180);let m=n.width/h.originalWidth;t.scale(m*n.scaleX,m*n.scaleY);let x=h.width,p=h.height;if(t.translate(x/2,p/2),n.region.degrees==90){let w=x;x=p,p=w,t.rotate(-Math.PI/2)}t.scale(1,-1),t.translate(-x/2,-p/2),t.globalAlpha=s.a,t.drawImage(u,u.width*h.u,u.height*h.v,x,p,0,0,x,p),this.debugRendering&&t.strokeRect(0,0,x,p),t.restore()}}drawTriangles(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder,c=null,o=this.vertices,r=null;for(let n=0,h=a.length;n<h;n++){let u=a[n],d=u.getAttachment(),f,m;if(d instanceof V){let x=d;o=this.computeRegionVertices(u,x,!1),r=Ze.QUAD_TRIANGLES,f=x.region.texture.getImage()}else if(d instanceof ye){let x=d;o=this.computeMeshVertices(u,x,!1),r=x.triangles,f=x.region.texture.getImage()}else continue;if(f){u.data.blendMode!=c&&(c=u.data.blendMode);let x=u.color,p=d.color;s.set(i.r*x.r*p.r,i.g*x.g*p.g,i.b*x.b*p.b,i.a*x.a*p.a),t.globalAlpha=s.a;for(var l=0;l<r.length;l+=3){let w=r[l]*8,g=r[l+1]*8,b=r[l+2]*8,v=o[w],y=o[w+1],S=o[w+6],A=o[w+7],k=o[g],T=o[g+1],Y=o[g+6],F=o[g+7],X=o[b],C=o[b+1],M=o[b+6],P=o[b+7];this.drawTriangle(f,v,y,S,A,k,T,Y,F,X,C,M,P),this.debugRendering&&(t.strokeStyle="green",t.beginPath(),t.moveTo(v,y),t.lineTo(k,T),t.lineTo(X,C),t.lineTo(v,y),t.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,t,s,i,a,c,o,r,l,n,h,u,d){let f=this.ctx;const m=e.width-1,x=e.height-1;i*=m,a*=x,r*=m,l*=x,u*=m,d*=x,f.beginPath(),f.moveTo(t,s),f.lineTo(c,o),f.lineTo(n,h),f.closePath(),c-=t,o-=s,n-=t,h-=s,r-=i,l-=a,u-=i,d-=a;let p=r*d-u*l;if(p==0)return;p=1/p;const w=(d*c-l*n)*p,g=(d*o-l*h)*p,b=(r*n-u*c)*p,v=(r*h-u*o)*p,y=t-w*i-b*a,S=s-g*i-v*a;f.save(),f.transform(w,g,b,v,y,S),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,c=t.color,o=i.a*a.a*c.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*c.r*r,i.g*a.g*c.g*r,i.b*a.b*c.b*r,o),t.computeWorldVertices(e,this.vertices,0,Ze.VERTEX_SIZE);let n=this.vertices,h=t.uvs;return n[V.C1R]=l.r,n[V.C1G]=l.g,n[V.C1B]=l.b,n[V.C1A]=l.a,n[V.U1]=h[0],n[V.V1]=h[1],n[V.C2R]=l.r,n[V.C2G]=l.g,n[V.C2B]=l.b,n[V.C2A]=l.a,n[V.U2]=h[2],n[V.V2]=h[3],n[V.C3R]=l.r,n[V.C3G]=l.g,n[V.C3B]=l.b,n[V.C3A]=l.a,n[V.U3]=h[4],n[V.V3]=h[5],n[V.C4R]=l.r,n[V.C4G]=l.g,n[V.C4B]=l.b,n[V.C4A]=l.a,n[V.U4]=h[6],n[V.V4]=h[7],n}computeMeshVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,c=t.color,o=i.a*a.a*c.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*c.r*r,i.g*a.g*c.g*r,i.b*a.b*c.b*r,o);let n=t.worldVerticesLength/2,h=this.vertices;h.length<t.worldVerticesLength&&(this.vertices=h=R.newFloatArray(t.worldVerticesLength)),t.computeWorldVertices(e,0,t.worldVerticesLength,h,0,Ze.VERTEX_SIZE);let u=t.uvs;for(let d=0,f=0,m=2;d<n;d++)h[m++]=l.r,h[m++]=l.g,h[m++]=l.b,h[m++]=l.a,h[m++]=u[f++],h[m++]=u[f++],m+=2;return h}},es=Ze;B(es,"QUAD_TRIANGLES",[0,1,2,2,3,0]),B(es,"VERTEX_SIZE",2+2+4);export{bt as AlphaTimeline,Ne as Animation,xs as AnimationState,qs as AnimationStateAdapter,_s as AnimationStateData,Mr as AssetManager,ks as AssetManagerBase,zs as AtlasAttachmentLoader,rt as Attachment,we as AttachmentTimeline,Es as BinaryInput,Qe as BlendMode,Dt as Bone,Ot as BoneData,Ue as BoundingBoxAttachment,ys as CURRENT,Rs as CanvasTexture,ze as ClippingAttachment,D as Color,Ee as ConstraintData,oe as CurveTimeline,ae as CurveTimeline1,Oe as CurveTimeline2,Ns as DebugUtils,yt as DeformTimeline,qt as Downloader,pe as DrawOrderTimeline,_t as Event,Wt as EventData,ws as EventQueue,Xe as EventTimeline,se as EventType,Rt as FIRST,Ws as FakeTexture,We as HOLD_FIRST,ps as HOLD_MIX,Pt as HOLD_SUBSEQUENT,Ys as IkConstraint,Ut as IkConstraintData,vt as IkConstraintTimeline,Fe as Inherit,mt as InheritTimeline,Vs as IntSet,ns as Interpolation,E as MathUtils,ye as MeshAttachment,ds as MixBlend,fs as MixDirection,Ie as PathAttachment,Ce as PathConstraint,zt as PathConstraintData,Ct as PathConstraintMixTimeline,At as PathConstraintPositionTimeline,It as PathConstraintSpacingTimeline,Xs as Physics,Tt as PhysicsConstraintDampingTimeline,Ft as PhysicsConstraintGravityTimeline,kt as PhysicsConstraintInertiaTimeline,Mt as PhysicsConstraintMassTimeline,Et as PhysicsConstraintMixTimeline,De as PhysicsConstraintResetTimeline,Yt as PhysicsConstraintStrengthTimeline,ue as PhysicsConstraintTimeline,Xt as PhysicsConstraintWindTimeline,Nt as PointAttachment,Te as Pool,He as PositionMode,ls as Pow,Ls as PowOut,pt as RGB2Timeline,wt as RGBA2Timeline,gt as RGBATimeline,xt as RGBTimeline,V as RegionAttachment,je as RotateMode,Me as RotateTimeline,Bt as SETUP,_e as SUBSEQUENT,ot as ScaleTimeline,ht as ScaleXTimeline,ct as ScaleYTimeline,Ae as SequenceTimeline,dt as ShearTimeline,ft as ShearXTimeline,ut as ShearYTimeline,Je as Skeleton,Hs as SkeletonBinary,kr as SkeletonBounds,Qt as SkeletonClipping,Ht as SkeletonData,Yr as SkeletonJson,es as SkeletonRenderer,Ke as Skin,$t as SkinEntry,Ts as Slot,jt as SlotData,$e as SpacingMode,st as StringSet,Vt as Texture,As as TextureAtlas,Is as TextureAtlasPage,Lt as TextureAtlasRegion,Ge as TextureFilter,Ss as TextureRegion,vs as TextureWrap,Os as TimeKeeper,J as Timeline,bs as TrackEntry,Ms as TransformConstraint,Jt as TransformConstraintData,St as TransformConstraintTimeline,at as TranslateTimeline,nt as TranslateXTimeline,lt as TranslateYTimeline,re as Triangulator,R as Utils,Ve as Vector2,le as VertexAttachment,Ds as WindowedMean};
1
+ "use strict";var Vs=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},zt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},D=class gt{constructor(e=0,s=0,r=0,i=0){this.r=e,this.g=s,this.b=r,this.a=i}static WHITE=new gt(1,1,1,1);static RED=new gt(1,0,0,1);static GREEN=new gt(0,1,0,1);static BLUE=new gt(0,0,1,1);static MAGENTA=new gt(1,0,1,1);set(e,s,r,i){return this.r=e,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,r,i){return this.r+=e,this.g+=s,this.b+=r,this.a+=i,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(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new gt){return s.setFromString(e)}},E=class lt{static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(e,s,r){return e<s?s:e>r?r:e}static cosDeg(e){return Math.cos(e*lt.degRad)}static sinDeg(e){return Math.sin(e*lt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*lt.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return lt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,r){let i=Math.random(),h=s-e;return i<=(r-e)/h?e+Math.sqrt(i*h*(r-e)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},ts=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},es=class extends ts{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Ls=class extends es{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},P=class pt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,r,i,h){for(let o=s,a=i;o<s+h;o++,a++)r[a]=e[o]}static arrayFill(e,s,r,i){for(let h=s;h<r;h++)e[h]=i}static setArraySize(e,s,r=0){let i=e.length;if(i==s)return e;if(e.length=s,i<s)for(let h=i;h<s;h++)e[h]=r;return e}static ensureArrayCapacity(e,s,r=0){return e.length>=s?e:pt.setArraySize(e,s,r)}static newArray(e,s){let r=new Array(e);for(let i=0;i<e;i++)r[i]=s;return r}static newFloatArray(e){if(pt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(e){if(pt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(e){return pt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return pt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,r=!0){for(var i=0;i<e.length;i++)if(e[i]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Ns=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},At=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Xt=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Os=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ds=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},_t=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},ot=class Ts extends _t{static nextID=0;id=Ts.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,r,i,h,o){r=h+(r>>1)*o;let a=e.bone.skeleton,n=e.deform,l=this.vertices,c=this.bones;if(!c){n.length>0&&(l=n);let u=e.bone,x=u.worldX,w=u.worldY,p=u.a,g=u.b,b=u.c,y=u.d;for(let v=s,A=h;A<r;v+=2,A+=o){let S=l[v],I=l[v+1];i[A]=S*p+I*g+x,i[A+1]=S*b+I*y+w}return}let d=0,f=0;for(let u=0;u<s;u+=2){let x=c[d];d+=x+1,f+=x}let m=a.bones;if(n.length==0)for(let u=h,x=f*3;u<r;u+=o){let w=0,p=0,g=c[d++];for(g+=d;d<g;d++,x+=3){let b=m[c[d]],y=l[x],v=l[x+1],A=l[x+2];w+=(y*b.a+v*b.b+b.worldX)*A,p+=(y*b.c+v*b.d+b.worldY)*A}i[u]=w,i[u+1]=p}else{let u=n;for(let x=h,w=f*3,p=f<<1;x<r;x+=o){let g=0,b=0,y=c[d++];for(y+=d;d<y;d++,w+=3,p+=2){let v=m[c[d]],A=l[w]+u[p],S=l[w+1]+u[p+1],I=l[w+2];g+=(A*v.a+S*v.b+v.worldX)*I,b+=(A*v.c+S*v.d+v.worldY)*I}i[x]=g,i[x+1]=b}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ss=class Ot{static _nextID=0;id=Ot.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Ot(this.regions.length);return P.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let r=e.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(e,s){let r=e,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return Ot._nextID++}},is=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(is||{}),rs=[0,1,2,3,4,5,6],Ft=class{name;timelines=[];timelineIds=new zt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,i,h,o,a){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let n=this.timelines;for(let l=0,c=n.length;l<c;l++)n[l].apply(t,e,s,i,h,o,a)}},as=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(as||{}),ns=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(ns||{}),q={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},J=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=P.newFloatArray(t*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 search1(t,e){let s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}},at=class extends J{curves;constructor(t,e,s){super(t,s),this.curves=P.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=P.newFloatArray(e);P.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,i,h,o,a,n,l,c){let d=this.curves,f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);let m=(r-h*2+a)*.03,u=(i-o*2+n)*.03,x=((h-a)*3-r+l)*.006,w=((o-n)*3-i+c)*.006,p=m*2+x,g=u*2+w,b=(h-r)*.3+m+x*.16666667,y=(o-i)*.3+u+w*.16666667,v=r+b,A=i+y;for(let S=f+18;f<S;f+=2)d[f]=v,d[f+1]=A,b+=p,y+=g,p+=x,g+=w,v+=b,A+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],l=this.frames[e+s];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=t){let n=i[r-2],l=i[r-1];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}e+=this.getFrameEntries();let o=i[h-2],a=i[h-1];return a+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-a)}},it=class extends at{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=e[s],h=e[s+1];return h+(t-i)/(e[s+2]-i)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);switch(s){case 0:return i+h*e;case 1:case 2:h+=i-r}return r+h*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);return s==0?i+(h-i)*e:r+(h-r)*e}getAbsoluteValue2(t,e,s,r,i,h){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}return s==0?i+(h-i)*e:r+(h-r)*e}getScaleValue(t,e,s,r,i,h){const o=this.frames;if(t<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*e}return i}let a=this.getCurveValue(t)*h;if(e==1)return s==3?i+a-h:a;if(r==1)switch(s){case 0:return h+(Math.abs(a)*E.signum(h)-h)*e;case 1:case 2:return i+(Math.abs(a)*E.signum(i)-i)*e}else{let n=0;switch(s){case 0:return n=Math.abs(h)*E.signum(a),n+(a-n)*e;case 1:case 2:return n=Math.abs(i)*E.signum(a),n+(a-n)*e}}return i+(a-h)*e}},Rt=class extends at{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}},St=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,i,h,a.rotation,a.data.rotation))}},Gt=class extends Rt{boneIndex=0;constructor(t,e,s){super(t,e,q.x+"|"+s,q.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*i,a.y+=(a.data.y-a.y)*i}return}let l=0,c=0,d=J.search(n,s,3),f=this.curves[d/3];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+3]-m);l+=(n[d+3+1]-l)*u,c+=(n[d+3+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(h){case 0:a.x=a.data.x+l*i,a.y=a.data.y+c*i;break;case 1:case 2:a.x+=(a.data.x+l-a.x)*i,a.y+=(a.data.y+c-a.y)*i;break;case 3:a.x+=l*i,a.y+=c*i}}},$t=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,i,h,a.x,a.data.x))}},Ht=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,i,h,a.y,a.data.y))}},Jt=class extends Rt{boneIndex=0;constructor(t,e,s){super(t,e,q.scaleX+"|"+s,q.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*i,a.scaleY+=(a.data.scaleY-a.scaleY)*i}return}let l,c,d=J.search(n,s,3),f=this.curves[d/3];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+3]-m);l+=(n[d+3+1]-l)*u,c+=(n[d+3+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(l*=a.data.scaleX,c*=a.data.scaleY,i==1)h==3?(a.scaleX+=l-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=l,a.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 3:a.scaleX+=(l-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}else switch(h){case 0:m=Math.abs(a.data.scaleX)*E.signum(l),u=Math.abs(a.data.scaleY)*E.signum(c),a.scaleX=m+(l-m)*i,a.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(a.scaleX)*E.signum(l),u=Math.abs(a.scaleY)*E.signum(c),a.scaleX=m+(l-m)*i,a.scaleY=u+(c-u)*i;break;case 3:a.scaleX+=(l-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}}}},jt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,i,h,o,a.scaleX,a.data.scaleX))}},Kt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,i,h,o,a.scaleY,a.data.scaleY))}},Qt=class extends Rt{boneIndex=0;constructor(t,e,s){super(t,e,q.shearX+"|"+s,q.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*i,a.shearY+=(a.data.shearY-a.shearY)*i}return}let l=0,c=0,d=J.search(n,s,3),f=this.curves[d/3];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+3]-m);l+=(n[d+3+1]-l)*u,c+=(n[d+3+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(h){case 0:a.shearX=a.data.shearX+l*i,a.shearY=a.data.shearY+c*i;break;case 1:case 2:a.shearX+=(a.data.shearX+l-a.shearX)*i,a.shearY+=(a.data.shearY+c-a.shearY)*i;break;case 3:a.shearX+=l*i,a.shearY+=c*i}}},Zt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,i,h,a.shearX,a.data.shearX))}},te=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,q.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,i,h,a.shearY,a.data.shearY))}},ee=class extends J{boneIndex=0;constructor(t,e){super(t,[q.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;if(o==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[J.search(n,s,2)+1]}},se=class extends at{slotIndex=0;constructor(t,e,s){super(t,e,[q.rgb+"|"+s,q.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let w=a.data.color;switch(h){case 0:l.setFromColor(w);return;case 1:l.add((w.r-l.r)*i,(w.g-l.g)*i,(w.b-l.b)*i,(w.a-l.a)*i)}return}let c=0,d=0,f=0,m=0,u=J.search(n,s,5),x=this.curves[u/5];switch(x){case 0:let w=n[u];c=n[u+1],d=n[u+2],f=n[u+3],m=n[u+4];let p=(s-w)/(n[u+5]-w);c+=(n[u+5+1]-c)*p,d+=(n[u+5+2]-d)*p,f+=(n[u+5+3]-f)*p,m+=(n[u+5+4]-m)*p;break;case 1:c=n[u+1],d=n[u+2],f=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,x-2),d=this.getBezierValue(s,u,2,x+18-2),f=this.getBezierValue(s,u,3,x+18*2-2),m=this.getBezierValue(s,u,4,x+18*3-2)}i==1?l.set(c,d,f,m):(h==0&&l.setFromColor(a.data.color),l.add((c-l.r)*i,(d-l.g)*i,(f-l.b)*i,(m-l.a)*i))}},ie=class extends at{slotIndex=0;constructor(t,e,s){super(t,e,[q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let x=a.data.color;switch(h){case 0:l.r=x.r,l.g=x.g,l.b=x.b;return;case 1:l.r+=(x.r-l.r)*i,l.g+=(x.g-l.g)*i,l.b+=(x.b-l.b)*i}return}let c=0,d=0,f=0,m=J.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let x=n[m];c=n[m+1],d=n[m+2],f=n[m+3];let w=(s-x)/(n[m+4]-x);c+=(n[m+4+1]-c)*w,d+=(n[m+4+2]-d)*w,f+=(n[m+4+3]-f)*w;break;case 1:c=n[m+1],d=n[m+2],f=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(i==1)l.r=c,l.g=d,l.b=f;else{if(h==0){let x=a.data.color;l.r=x.r,l.g=x.g,l.b=x.b}l.r+=(c-l.r)*i,l.g+=(d-l.g)*i,l.b+=(f-l.b)*i}}},re=class extends it{slotIndex=0;constructor(t,e,s){super(t,e,q.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*i}return}let l=this.getCurveValue(s);i==1?n.a=l:(h==0&&(n.a=a.data.color.a),n.a+=(l-n.a)*i)}},ae=class extends at{slotIndex=0;constructor(t,e,s){super(t,e,[q.rgb+"|"+s,q.alpha+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,h,o,a,n){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=a,this.frames[t+7]=n}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*i,(y.g-l.g)*i,(y.b-l.b)*i,(y.a-l.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let d=0,f=0,m=0,u=0,x=0,w=0,p=0,g=J.search(n,s,8),b=this.curves[g>>3];switch(b){case 0:let y=n[g];d=n[g+1],f=n[g+2],m=n[g+3],u=n[g+4],x=n[g+5],w=n[g+6],p=n[g+7];let v=(s-y)/(n[g+8]-y);d+=(n[g+8+1]-d)*v,f+=(n[g+8+2]-f)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,x+=(n[g+8+5]-x)*v,w+=(n[g+8+6]-w)*v,p+=(n[g+8+7]-p)*v;break;case 1:d=n[g+1],f=n[g+2],m=n[g+3],u=n[g+4],x=n[g+5],w=n[g+6],p=n[g+7];break;default:d=this.getBezierValue(s,g,1,b-2),f=this.getBezierValue(s,g,2,b+18-2),m=this.getBezierValue(s,g,3,b+18*2-2),u=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2),p=this.getBezierValue(s,g,7,b+18*6-2)}if(i==1)l.set(d,f,m,u),c.r=x,c.g=w,c.b=p;else{if(h==0){l.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*i,(f-l.g)*i,(m-l.b)*i,(u-l.a)*i),c.r+=(x-c.r)*i,c.g+=(w-c.g)*i,c.b+=(p-c.b)*i}}},ne=class extends at{slotIndex=0;constructor(t,e,s){super(t,e,[q.rgb+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,o,a){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=a}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*i,l.g+=(y.g-l.g)*i,l.b+=(y.b-l.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let d=0,f=0,m=0,u=0,x=0,w=0,p=0,g=J.search(n,s,7),b=this.curves[g/7];switch(b){case 0:let y=n[g];d=n[g+1],f=n[g+2],m=n[g+3],x=n[g+4],w=n[g+5],p=n[g+6];let v=(s-y)/(n[g+7]-y);d+=(n[g+7+1]-d)*v,f+=(n[g+7+2]-f)*v,m+=(n[g+7+3]-m)*v,x+=(n[g+7+4]-x)*v,w+=(n[g+7+5]-w)*v,p+=(n[g+7+6]-p)*v;break;case 1:d=n[g+1],f=n[g+2],m=n[g+3],x=n[g+4],w=n[g+5],p=n[g+6];break;default:d=this.getBezierValue(s,g,1,b-2),f=this.getBezierValue(s,g,2,b+18-2),m=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),w=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2)}if(i==1)l.r=d,l.g=f,l.b=m,c.r=x,c.g=w,c.b=p;else{if(h==0){let y=a.data.color,v=a.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(d-l.r)*i,l.g+=(f-l.g)*i,l.b+=(m-l.b)*i,c.r+=(x-c.r)*i,c.g+=(w-c.g)*i,c.b+=(p-c.b)*i}}},mt=class extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[q.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(a.bone.active){if(o==1){h==0&&this.setAttachment(t,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,a,a.data.attachmentName);return}this.setAttachment(t,a,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},le=class extends at{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[q.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,i,h,o,a,n,l,c){let d=this.curves,f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);let m=(r-h*2+a)*.03,u=n*.03-o*.06,x=((h-a)*3-r+l)*.006,w=(o-n+.33333333)*.018,p=m*2+x,g=u*2+w,b=(h-r)*.3+m+x*.16666667,y=o*.3+u+w*.16666667,v=r+b,A=y;for(let S=f+18;f<S;f+=2)d[f]=v,d[f+1]=A,b+=p,y+=g,p+=x,g+=w,v+=b,A+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let a=this.frames[e];return(t-a)/(this.frames[e+this.getFrameEntries()]-a);case 1:return 0}if(r-=2,s[r]>t){let a=this.frames[e];return s[r+1]*(t-a)/(s[r]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let a=s[r-2],n=s[r-1];return n+(t-a)/(s[r]-a)*(s[r+1]-n)}let h=s[i-2],o=s[i-1];return o+(1-o)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof ot)||n.timelineAttachment!=this.attachment)return;let l=a.deform;l.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(h){case 0:l.length=0;return;case 1:if(i==1){l.length=0;return}l.length=d;let g=n;if(g.bones){i=1-i;for(var m=0;m<d;m++)l[m]*=i}else{let b=g.vertices;for(var m=0;m<d;m++)l[m]+=(b[m]-l[m])*i}}return}if(l.length=d,s>=f[f.length-1]){let g=c[f.length-1];if(i==1)if(h==3){let b=n;if(b.bones)for(let y=0;y<d;y++)l[y]+=g[y];else{let y=b.vertices;for(let v=0;v<d;v++)l[v]+=g[v]-y[v]}}else P.arrayCopy(g,0,l,0,d);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<d;v++)l[v]=g[v]*i;else{let v=y.vertices;for(let A=0;A<d;A++){let S=v[A];l[A]=S+(g[A]-S)*i}}break}case 1:case 2:for(let y=0;y<d;y++)l[y]+=(g[y]-l[y])*i;break;case 3:let b=n;if(b.bones)for(let y=0;y<d;y++)l[y]+=g[y]*i;else{let y=b.vertices;for(let v=0;v<d;v++)l[v]+=(g[v]-y[v])*i}}return}let u=J.search1(f,s),x=this.getCurvePercent(s,u),w=c[u],p=c[u+1];if(i==1)if(h==3){let g=n;if(g.bones)for(let b=0;b<d;b++){let y=w[b];l[b]+=y+(p[b]-y)*x}else{let b=g.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=v+(p[y]-v)*x-b[y]}}}else for(let g=0;g<d;g++){let b=w[g];l[g]=b+(p[g]-b)*x}else switch(h){case 0:{let b=n;if(b.bones)for(let y=0;y<d;y++){let v=w[y];l[y]=(v+(p[y]-v)*x)*i}else{let y=b.vertices;for(let v=0;v<d;v++){let A=w[v],S=y[v];l[v]=S+(A+(p[v]-A)*x-S)*i}}break}case 1:case 2:for(let b=0;b<d;b++){let y=w[b];l[b]+=(y+(p[b]-y)*x-l[b])*i}break;case 3:let g=n;if(g.bones)for(let b=0;b<d;b++){let y=w[b];l[b]+=(y+(p[b]-y)*x)*i}else{let b=g.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=(v+(p[y]-v)*x-b[y])*i}}}}},Et=class Ys extends J{static propertyIds=[""+q.event];events;constructor(e){super(e,Ys.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,r,i,h,o,a){if(!i)return;let n=this.frames,l=this.frames.length;if(s>r)this.apply(e,s,Number.MAX_VALUE,i,h,o,a),s=-1;else if(s>=n[l-1])return;if(r<n[0])return;let c=0;if(s<n[0])c=0;else{c=J.search1(n,s)+1;let d=n[c];for(;c>0&&n[c-1]==d;)c--}for(;c<l&&r>=n[c];c++)i.push(this.events[c])}},wt=class Ms extends J{static propertyIds=[""+q.drawOrder];drawOrders;constructor(e){super(e,Ms.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,r){this.frames[e]=s,this.drawOrders[e]=r}apply(e,s,r,i,h,o,a){if(a==1){o==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let n=J.search1(this.frames,r),l=this.drawOrders[n];if(!l)P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let f=0,m=l.length;f<m;f++)c[f]=d[l[f]]}}},oe=class extends at{constraintIndex=0;constructor(t,e,s){super(t,e,[q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,h,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,r,i,h,o){let a=t.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*i,a.softness+=(a.data.softness-a.softness)*i,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let l=0,c=0,d=J.search(n,s,6),f=this.curves[d/6];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+6]-m);l+=(n[d+6+1]-l)*u,c+=(n[d+6+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}h==0?(a.mix=a.data.mix+(l-a.data.mix)*i,a.softness=a.data.softness+(c-a.data.softness)*i,o==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[d+3],a.compress=n[d+4]!=0,a.stretch=n[d+5]!=0)):(a.mix+=(l-a.mix)*i,a.softness+=(c-a.softness)*i,o==0&&(a.bendDirection=n[d+3],a.compress=n[d+4]!=0,a.stretch=n[d+5]!=0))}},he=class extends at{constraintIndex=0;constructor(t,e,s){super(t,e,[q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,o,a){let n=this.frames;t*=7,n[t]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i,n[t+4]=h,n[t+5]=o,n[t+6]=a}apply(t,e,s,r,i,h,o){let a=t.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let p=a.data;switch(h){case 0:a.mixRotate=p.mixRotate,a.mixX=p.mixX,a.mixY=p.mixY,a.mixScaleX=p.mixScaleX,a.mixScaleY=p.mixScaleY,a.mixShearY=p.mixShearY;return;case 1:a.mixRotate+=(p.mixRotate-a.mixRotate)*i,a.mixX+=(p.mixX-a.mixX)*i,a.mixY+=(p.mixY-a.mixY)*i,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*i,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*i,a.mixShearY+=(p.mixShearY-a.mixShearY)*i}return}let l,c,d,f,m,u,x=J.search(n,s,7),w=this.curves[x/7];switch(w){case 0:let p=n[x];l=n[x+1],c=n[x+2],d=n[x+3],f=n[x+4],m=n[x+5],u=n[x+6];let g=(s-p)/(n[x+7]-p);l+=(n[x+7+1]-l)*g,c+=(n[x+7+2]-c)*g,d+=(n[x+7+3]-d)*g,f+=(n[x+7+4]-f)*g,m+=(n[x+7+5]-m)*g,u+=(n[x+7+6]-u)*g;break;case 1:l=n[x+1],c=n[x+2],d=n[x+3],f=n[x+4],m=n[x+5],u=n[x+6];break;default:l=this.getBezierValue(s,x,1,w-2),c=this.getBezierValue(s,x,2,w+18-2),d=this.getBezierValue(s,x,3,w+18*2-2),f=this.getBezierValue(s,x,4,w+18*3-2),m=this.getBezierValue(s,x,5,w+18*4-2),u=this.getBezierValue(s,x,6,w+18*5-2)}if(h==0){let p=a.data;a.mixRotate=p.mixRotate+(l-p.mixRotate)*i,a.mixX=p.mixX+(c-p.mixX)*i,a.mixY=p.mixY+(d-p.mixY)*i,a.mixScaleX=p.mixScaleX+(f-p.mixScaleX)*i,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*i,a.mixShearY=p.mixShearY+(u-p.mixShearY)*i}else a.mixRotate+=(l-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(d-a.mixY)*i,a.mixScaleX+=(f-a.mixScaleX)*i,a.mixScaleY+=(m-a.mixScaleY)*i,a.mixShearY+=(u-a.mixShearY)*i}},ce=class extends it{constraintIndex=0;constructor(t,e,s){super(t,e,q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,i,h,a.position,a.data.position))}},de=class extends it{constraintIndex=0;constructor(t,e,s){super(t,e,q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,i,h,a.spacing,a.data.spacing))}},fe=class extends at{constraintIndex=0;constructor(t,e,s){super(t,e,[q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=r,h[t+3]=i}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*i,a.mixX+=(a.data.mixX-a.mixX)*i,a.mixY+=(a.data.mixY-a.mixY)*i}return}let l,c,d,f=J.search(n,s,4),m=this.curves[f>>2];switch(m){case 0:let u=n[f];l=n[f+1],c=n[f+2],d=n[f+3];let x=(s-u)/(n[f+4]-u);l+=(n[f+4+1]-l)*x,c+=(n[f+4+2]-c)*x,d+=(n[f+4+3]-d)*x;break;case 1:l=n[f+1],c=n[f+2],d=n[f+3];break;default:l=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(l-u.mixRotate)*i,a.mixX=u.mixX+(c-u.mixX)*i,a.mixY=u.mixY+(d-u.mixY)*i}else a.mixRotate+=(l-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(d-a.mixY)*i}},dt=class extends it{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),n))}else a=t.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,i,h,this.get(a),this.setup(a)))}},ue=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},me=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ge=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},xe=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},be=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},we=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},pe=class extends dt{constructor(t,e,s){super(t,e,s,q.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},ye=class Xs extends J{static propertyIds=[q.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,Xs.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,r,i,h,o,a){let n;if(this.constraintIndex!=-1&&(n=e.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>r)this.apply(e,s,Number.MAX_VALUE,[],h,o,a),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[J.search1(l,s)+1]))if(n!=null)n.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},ve=class ft extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,r){super(e,[q.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return ft.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,r,i,h){let o=this.frames;e*=ft.ENTRIES,o[e]=s,o[e+ft.MODE]=r|i<<4,o[e+ft.DELAY]=h}apply(e,s,r,i,h,o,a){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,c=this.attachment;if(l!=c&&(!(l instanceof ot)||l.timelineAttachment!=c))return;if(a==1){o==0&&(n.sequenceIndex=-1);return}let d=this.frames;if(r<d[0]){(o==0||o==1)&&(n.sequenceIndex=-1);return}let f=J.search(d,r,ft.ENTRIES),m=d[f],u=d[f+ft.MODE],x=d[f+ft.DELAY];if(!this.attachment.sequence)return;let w=u>>4,p=this.attachment.sequence.regions.length,g=rs[u&15];if(g!=0)switch(w+=(r-m)/x+1e-5|0,g){case 1:w=Math.min(p-1,w);break;case 2:w%=p;break;case 3:{let b=(p<<1)-2;w=b==0?0:w%b,w>=p&&(w=b-w);break}case 4:w=Math.max(p-1-w,0);break;case 5:w=p-1-w%p;break;case 6:{let b=(p<<1)-2;w=b==0?0:(w+p-1)%b,w>=p&&(w=b-w)}}n.sequenceIndex=w}},qs=class Dt{static _emptyAnimation=new Ft("<empty>",[],0);static emptyAnimation(){return Dt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new os(this);propertyIDs=new zt;animationsChanged=!1;trackEntryPool=new At(()=>new ls);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=e*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+e)*a.timeScale,h.trackTime+=o,this.setCurrent(r,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(e,s){let r=e.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((r.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=e),e.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let f=0,m=r.length;f<m;f++){let u=r[f];if(!u||u.delay>0)continue;i=!0;let x=f==0?1:u.mixBlend,w=u.alpha;u.mixingFrom?w*=this.applyMixingFrom(u,e,x):u.trackTime>=u.trackEnd&&!u.next&&(w=0);let p=w>=u.alphaAttachmentThreshold,g=u.animationLast,b=u.getAnimationTime(),y=b,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,S=A.length;if(f==0&&w==1||x==3){f==0&&(p=!0);for(let I=0;I<S;I++){P.webkit602BugfixHelper(w,x);var h=A[I];h instanceof mt?this.applyAttachmentTimeline(h,e,y,x,p):h.apply(e,g,y,v,w,x,0)}}else{let I=u.timelineMode,T=u.shortestRotation,M=!T&&u.timelinesRotation.length!=S<<1;M&&(u.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let F=A[Y],R=I[Y]==Pt?x:0;!T&&F instanceof St?this.applyRotateTimeline(F,e,y,w,R,u.timelinesRotation,Y<<1,M):F instanceof mt?this.applyAttachmentTimeline(F,e,y,x,p):(P.webkit602BugfixHelper(w,x),F.apply(e,g,y,v,w,R,0))}}this.queueEvents(u,b),s.length=0,u.nextAnimationLast=b,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Ce,a=e.slots,n=0,l=e.slots.length;n<l;n++){var c=a[n];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s,r){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;e.mixDuration==0?(h=1,r==1&&(r=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let o=h<i.mixAttachmentThreshold,a=h<i.mixDrawOrderThreshold,n=i.animation.timelines,l=n.length,c=i.alpha*e.interruptAlpha,d=c*(1-h),f=i.animationLast,m=i.getAnimationTime(),u=m,x=null;if(i.reverse?u=i.animation.duration-u:h<i.eventThreshold&&(x=this.events),r==3)for(let w=0;w<l;w++)n[w].apply(s,f,u,x,d,r,1);else{let w=i.timelineMode,p=i.timelineHoldMix,g=i.shortestRotation,b=!g&&i.timelinesRotation.length!=l<<1;b&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let y=0;y<l;y++){let v=n[y],A=1,S,I=0;switch(w[y]){case Pt:if(!a&&v instanceof wt)continue;S=r,I=d;break;case Ae:S=0,I=d;break;case Se:S=r,I=c;break;case Bt:S=0,I=c;break;default:S=0;let T=p[y];I=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=I,!g&&v instanceof St?this.applyRotateTimeline(v,s,u,I,S,i.timelinesRotation,y<<1,b):v instanceof mt?this.applyAttachmentTimeline(v,s,u,S,o&&I>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(I,r),a&&v instanceof wt&&S==0&&(A=0),v.apply(s,f,u,x,I,S,A))}}return e.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(e,s,r,i,h){var o=s.slots[e.slotIndex];o.bone.active&&(r<e.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,e.attachmentNames[J.search1(e.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Ce))}setAttachment(e,s,r,i){s.setAttachment(r?e.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+ds)}applyRotateTimeline(e,s,r,i,h,o,a,n){if(n&&(o[a]=0),i==1){e.apply(s,0,r,null,1,h,0);return}let l=s.bones[e.boneIndex];if(!l.active)return;let c=e.frames,d=0,f=0;if(r<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:d=l.rotation,f=l.data.rotation}else d=h==0?l.data.rotation:l.rotation,f=l.data.rotation+e.getCurveValue(r);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[a];else{let x=0,w=0;n?(x=0,w=u):(x=o[a],w=o[a+1]);let p=x-x%360;m=u+p;let g=u>=0,b=x>=0;Math.abs(w)<=90&&E.signum(w)!=E.signum(u)&&(Math.abs(x-p)>180?(m+=360*E.signum(x),b=g):p!=0?m-=360*E.signum(x):b=g),b!=g&&(m+=360*E.signum(x)),o[a]=m}o[a+1]=u,l.rotation=d+m*i}queueEvents(e,s){let r=e.animationStart,i=e.animationEnd,h=i-r,o=e.trackLast%h,a=this.events,n=0,l=a.length;for(;n<l;n++){let d=a[n];if(d.time<o)break;d.time>i||this.queue.event(e,d)}let c=!1;if(e.loop)if(h==0)c=!0;else{const d=Math.floor(e.trackTime/h);c=d>0&&d>Math.floor(e.trackLast/h)}else c=s>=i&&e.animationLast<i;for(c&&this.queue.complete(e);n<l;n++){let d=a[n];d.time<r||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,r){let i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,i,r)}setAnimationWith(e,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let o=this.trackEntry(e,s,r,h);return this.setCurrent(e,o,i),this.queue.drain(),o}addAnimation(e,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,r,i)}addAnimationWith(e,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(e,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(e,s=0){let r=this.setAnimationWith(e,Dt.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(e,s=0,r=0){let i=this.addAnimationWith(e,Dt.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(P.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let s=e.mixingTo,r=e.animation.timelines,i=e.animation.timelines.length,h=e.timelineMode;h.length=i;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<i;n++)h[n]=a.addAll(r[n].getPropertyIds())?Bt:Se;return}t:for(let n=0;n<i;n++){let l=r[n],c=l.getPropertyIds();if(!a.addAll(c))h[n]=Pt;else if(!s||l instanceof mt||l instanceof wt||l instanceof Et||!s.animation.hasTimeline(c))h[n]=Ae;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){h[n]=cs,o[n]=d;continue t}break}h[n]=Bt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},ls=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!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;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},os=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<e.length;o++){let a=e[o];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<e.length;o++){let a=e[o];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<e.length;o++){let a=e[o];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<e.length;o++){let a=e[o];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<e.length;o++){let a=e[o];a.complete&&a.complete(i)}break;case 5:let h=t[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<e.length;o++){let a=e[o];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},hs=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(hs||{}),Ws=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Pt=0,Ae=1,Se=2,Bt=3,cs=4,Ce=1,ds=2,Us=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ie=class Fs extends ot{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Fs(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},ke=class Rs extends ot{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Rs(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Te=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Vt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Vt||{}),fs=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(fs||{}),us=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},zs=class extends Te{setFilters(t,e){}setWraps(t,e){}dispose(){}},Ye=class{pages=new Array;regions=new Array;constructor(t){let e=new _s(t),s=new Array(4),r={};r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.format=()=>{},r.filter=l=>{l.minFilter=P.enumValue(Vt,s[1]),l.magFilter=P.enumValue(Vt,s[2])},r.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},r.pma=l=>{l.pma=s[1]=="true"};var i={};i.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},i.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},i.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},i.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},i.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},i.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let o=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)o=null,h=e.readLine();else if(o){let l=new Me(o,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=i[s[0]];if(d)d(l);else{a||(a=[]),n||(n=[]),a.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));n.push(f)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),a&&a.length>0&&n&&n.length>0&&(l.names=a,l.values=n,a=null,n=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new ms(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},_s=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=e.indexOf(",",i);if(h==-1)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},ms=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Me=class extends us{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Ct=class $e extends ot{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=P.newFloatArray(e.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,a=0;if(this.region instanceof Me){let n=this.region,l=n.page,c=l.width,d=l.height;switch(n.degrees){case 90:i-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/d,o=n.originalHeight/c,a=n.originalWidth/d;for(let f=0;f<r;f+=2)s[f]=i+e[f+1]*o,s[f+1]=h+(1-e[f])*a;return;case 180:i-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/d,o=n.originalWidth/c,a=n.originalHeight/d;for(let f=0;f<r;f+=2)s[f]=i+(1-e[f])*o,s[f+1]=h+(1-e[f+1])*a;return;case 270:i-=n.offsetY/c,h-=n.offsetX/d,o=n.originalHeight/c,a=n.originalWidth/d;for(let f=0;f<r;f+=2)s[f]=i+(1-e[f+1])*o,s[f+1]=h+e[f]*a;return}i-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/d,o=n.originalWidth/c,a=n.originalHeight/d}else this.region?(o=this.region.u2-i,a=this.region.v2-h):(i=h=0,o=a=1);for(let n=0;n<r;n+=2)s[n]=i+e[n]*o,s[n+1]=h+e[n+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new $e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),P.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,r,i,h,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,r,i,h,o)}newLinkedMesh(){let e=new $e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},It=class Es extends ot{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Es(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},gs=class Ps extends ot{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*E.degRad,r=Math.cos(s),i=Math.sin(s),h=r*e.a+i*e.b,o=r*e.c+i*e.d;return E.atan2Deg(o,h)}copy(){let e=new Ps(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},H=class Bs extends _t{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,a=h+this.region.width*r,n=o+this.region.height*i,l=this.rotation*E.degRad,c=Math.cos(l),d=Math.sin(l),f=this.x,m=this.y,u=h*c+f,x=h*d,w=o*c+m,p=o*d,g=a*c+f,b=a*d,y=n*c+m,v=n*d,A=this.offset;A[0]=u-p,A[1]=w+x,A[2]=u-v,A[3]=y+x,A[4]=g-v,A[5]=y+b,A[6]=g-p,A[7]=w+b,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,r,i){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,o=this.offset,a=h.worldX,n=h.worldY,l=h.a,c=h.b,d=h.c,f=h.d,m=0,u=0;m=o[0],u=o[1],s[r]=m*l+u*c+a,s[r+1]=m*d+u*f+n,r+=i,m=o[2],u=o[3],s[r]=m*l+u*c+a,s[r+1]=m*d+u*f+n,r+=i,m=o[4],u=o[5],s[r]=m*l+u*c+a,s[r+1]=m*d+u*f+n,r+=i,m=o[6],u=o[7],s[r]=m*l+u*c+a,s[r+1]=m*d+u*f+n}copy(){let e=new Bs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,P.arrayCopy(this.uvs,0,e.uvs,0,8),P.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}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},Gs=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let o=s.getPath(e,i),a=this.atlas.findRegion(o);if(a==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new H(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=h}return i}newMeshAttachment(t,e,s,r){let i=new Ct(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=h}return i}newBoundingBoxAttachment(t,e){return new Ie(e)}newPathAttachment(t,e){return new It(e)}newPointAttachment(t,e){return new gs(e)}newClippingAttachment(t,e){return new ke(e)}},Xe=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new D;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Lt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Lt||{}),Fe=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,h,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let a=this.parent;if(!a){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,x=(s+h)*E.degRad,w=(s+90+o)*E.degRad;this.a=Math.cos(x)*r*m,this.b=Math.cos(w)*i*m,this.c=Math.sin(x)*r*u,this.d=Math.sin(w)*i*u,this.worldX=t*m+f.x,this.worldY=e*u+f.y;return}let n=a.a,l=a.b,c=a.c,d=a.d;switch(this.worldX=n*t+l*e+a.worldX,this.worldY=c*t+d*e+a.worldY,this.inherit){case 0:{const f=(s+h)*E.degRad,m=(s+90+o)*E.degRad,u=Math.cos(f)*r,x=Math.cos(m)*i,w=Math.sin(f)*r,p=Math.sin(m)*i;this.a=n*u+l*w,this.b=n*x+l*p,this.c=c*u+d*w,this.d=c*x+d*p;return}case 1:{const f=(s+h)*E.degRad,m=(s+90+o)*E.degRad;this.a=Math.cos(f)*r,this.b=Math.cos(m)*i,this.c=Math.sin(f)*r,this.d=Math.sin(m)*i;break}case 2:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=f,c*=m;let u=n*n+c*c,x=0;u>1e-4?(u=Math.abs(n*d*m-l*f*c)/u,l=c*u,d=n*u,x=Math.atan2(c,n)*E.radDeg):(n=0,c=0,x=90-Math.atan2(d,l)*E.radDeg);const w=(s+h-x)*E.degRad,p=(s+o-x+90)*E.degRad,g=Math.cos(w)*r,b=Math.cos(p)*i,y=Math.sin(w)*r,v=Math.sin(p)*i;this.a=n*g-l*y,this.b=n*b-l*v,this.c=c*g+d*y,this.d=c*b+d*v;break}case 3:case 4:{s*=E.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(n*f+l*m)/this.skeleton.scaleX,x=(c*f+d*m)/this.skeleton.scaleY,w=Math.sqrt(u*u+x*x);w>1e-5&&(w=1/w),u*=w,x*=w,w=Math.sqrt(u*u+x*x),this.inherit==3&&n*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(x,u);const p=Math.cos(s)*w,g=Math.sin(s)*w;h*=E.degRad,o=(90+o)*E.degRad;const b=Math.cos(h)*r,y=Math.cos(o)*i,v=Math.sin(h)*r,A=Math.sin(o)*i;this.a=u*b+p*v,this.b=u*y+p*A,this.c=x*b+g*v,this.d=x*y+g*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let e=t.a,s=t.b,r=t.c,i=t.d,h=1/(e*i-s*r),o=i*h,a=s*h,n=r*h,l=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*o-d*a,this.ay=d*l-c*n;let f,m,u,x;if(this.inherit==1)f=this.a,m=this.b,u=this.c,x=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(e*i-s*r)/(e*e+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*i-s*r),o=i*h,a=s*h;break}case 3:case 4:let w=E.cosDeg(this.rotation),p=E.sinDeg(this.rotation);e=(e*w+s*p)/this.skeleton.scaleX,r=(r*w+i*p)/this.skeleton.scaleY;let g=Math.sqrt(e*e+r*r);g>1e-5&&(g=1/g),e*=g,r*=g,g=Math.sqrt(e*e+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=E.PI/2+Math.atan2(r,e);s=Math.cos(b)*g,i=Math.sin(b)*g,h=1/(e*i-s*r),o=i*h,a=s*h,n=r*h,l=e*h}f=o*this.a-a*this.c,m=o*this.b-a*this.d,u=l*this.c-n*this.a,x=l*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let w=f*x-m*u;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*x,w)*E.radDeg,this.arotation=Math.atan2(u,f)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,m)*E.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*E.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*E.radDeg}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(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=E.sinDeg(t),s=E.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=E.sinDeg(t),s=E.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*E.radDeg}rotateWorld(t){t*=E.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}},kt=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},xs=class{pathPrefix="";textureLoader;downloader;assets={};assetsRefCount={};assetsLoaded={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Re){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,this.assetsRefCount[e]=(this.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),r(h)},(h,o)=>{const a=`Couldn't load binary ${t}: status ${h}, ${o}`;this.error(s,t,a),i(a)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,r=>{this.success(e,t,r)},(r,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${r}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),r(h)},(h,o)=>{const a=`Couldn't load JSON ${t}: status ${h}, ${o}`;this.error(s,t,a),i(a)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const r=this.assetsLoaded[t],i=r!==void 0;return i&&r.then(h=>this.success(e,t,h)).catch(h=>this.error(s,t,h)),i}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.assetsLoaded[t]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),i(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.textureLoader(a);this.success(e,t,n),r(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.textureLoader(a);this.success(e,t,n),r(n)},a.onerror=()=>{const n=`Couldn't load image: ${t}`;this.error(s,t,n),i(n)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.assetsLoaded[t]=new Promise((o,a)=>{this.downloader.downloadText(t,n=>{try{let l=new Ye(n),c=l.pages.length,d=!1;for(let f of l.pages)this.loadTexture(r?r[f.name]:h+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(e,t,l),o(l)))},(m,u)=>{if(!d){const x=`Couldn't load texture atlas ${t} page image: ${m}`;this.error(s,t,x),a(x)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),a(c)}},(n,l)=>{const c=`Couldn't load texture atlas ${t}: status ${n}, ${l}`;this.error(s,t,c),a(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},r){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.assetsLoaded[t]=new Promise((i,h)=>{this.downloader.downloadText(t,o=>{try{const a=new Ye(o);this.success(e,t,a),i(a)}catch(a){const n=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,n),h(n)}},(o,a)=>{const n=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,n),h(n)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(r,i)=>e(i),(r,i)=>s(i))})}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
2
+ `+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],delete this.assetsRefCount[t],delete this.assetsLoaded[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={},this.assetsLoaded={},this.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){--this.assetsRefCount[t]===0&&this.remove(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Re=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToString(r))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||t,!0);let h=()=>{this.finish(t,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(t,e,s){this.downloadText(t,r=>{e(JSON.parse(r))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(r))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||t,!0),i.responseType="arraybuffer";let h=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(t,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=e==200||e==0?[s]:[e,s];for(let h=i.length-1,o=r.length;h<o;h+=2)r[h].apply(null,i)}},Ee=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Pe=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},bs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,r,i,h,o){let a=t.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,l=a.b,c=a.c,d=a.d,f=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case 1:m=(e-t.worldX)*E.signum(t.skeleton.scaleX),u=(s-t.worldY)*E.signum(t.skeleton.scaleY);break;case 2:let p=Math.abs(n*d-l*c)/Math.max(1e-4,n*n+c*c),g=n/t.skeleton.scaleX,b=c/t.skeleton.scaleY;l=-b*p*t.skeleton.scaleX,d=g*p*t.skeleton.scaleY,f+=Math.atan2(b,g)*E.radDeg;default:let y=e-a.worldX,v=s-a.worldY,A=n*d-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*d-v*l)/A-t.ax,u=(v*n-y*c)/A-t.ay)}f+=Math.atan2(u,m)*E.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=t.ascaleX,w=t.ascaleY;if(r||i){switch(t.inherit){case 3:case 4:m=e-t.worldX,u=s-t.worldY}const p=t.data.length*x;if(p>1e-4){const g=m*m+u*u;if(r&&g<p*p||i&&g>p*p){const b=(Math.sqrt(g)/p-1)*o+1;x*=b,h&&(w*=b)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,x,w,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,h,o,a,n){if(t.inherit!=0||e.inherit!=0)return;let l=t.ax,c=t.ay,d=t.ascaleX,f=t.ascaleY,m=d,u=f,x=e.ascaleX,w=0,p=0,g=0;d<0?(d=-d,w=180,g=-1):(w=0,g=1),f<0&&(f=-f,g=-g),x<0?(x=-x,p=180):p=0;let b=e.ax,y=0,v=0,A=0,S=t.a,I=t.b,T=t.c,M=t.d,Y=Math.abs(d-f)<=1e-4;!Y||h?(y=0,v=S*b+t.worldX,A=T*b+t.worldY):(y=e.ay,v=S*b+I*y+t.worldX,A=T*b+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,I=F.b,T=F.c,M=F.d;let R=S*M-I*T,k=v-F.worldX,X=A-F.worldY;R=Math.abs(R)<=1e-4?0:1/R;let B=(k*M-X*I)*R-l,N=(X*S-k*T)*R-c,L=Math.sqrt(B*B+N*N),O=e.data.length*x,$,z;if(L<1e-4){this.apply1(t,s,r,!1,h,!1,n),e.updateWorldTransformWith(b,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}k=s-F.worldX,X=r-F.worldY;let j=(k*M-X*I)*R-l,V=(X*S-k*T)*R-c,W=j*j+V*V;if(a!=0){a*=d*(x+1)*.5;let K=Math.sqrt(W),Q=K-L-O*d+a;if(Q>0){let Z=Math.min(1,Q/(a*2))-1;Z=(Q-a*(1-Z*Z))/K,j-=Z*j,V-=Z*V,W=j*j+V*V}}t:if(Y){O*=d;let K=(W-L*L-O*O)/(2*L*O);K<-1?(K=-1,z=Math.PI*i):K>1?(K=1,z=0,h&&(S=(Math.sqrt(W)/(L+O)-1)*n+1,m*=S,o&&(u*=S))):z=Math.acos(K)*i,S=L+O*K,I=O*Math.sin(z),$=Math.atan2(V*S-j*I,j*S+V*I)}else{S=d*O,I=f*O;let K=S*S,Q=I*I,Z=Math.atan2(V,j);T=Q*L*L+K*W-K*Q;let rt=-2*Q*L,xt=Q-K;if(M=rt*rt-4*xt*T,M>=0){let bt=Math.sqrt(M);rt<0&&(bt=-bt),bt=-(rt+bt)*.5;let vt=bt/xt,Ze=T/bt,Mt=Math.abs(vt)<Math.abs(Ze)?vt:Ze;if(vt=W-Mt*Mt,vt>=0){X=Math.sqrt(vt)*i,$=Z-Math.atan2(X,Mt),z=Math.atan2(X/f,(Mt-L)/d);break t}}let yt=E.PI,Tt=L-S,Wt=Tt*Tt,je=0,Ke=0,Yt=L+S,Ut=Yt*Yt,Qe=0;T=-S*L/(K-Q),T>=-1&&T<=1&&(T=Math.acos(T),k=S*Math.cos(T)+L,X=I*Math.sin(T),M=k*k+X*X,M<Wt&&(yt=T,Wt=M,Tt=k,je=X),M>Ut&&(Ke=T,Ut=M,Yt=k,Qe=X)),W<=(Wt+Ut)*.5?($=Z-Math.atan2(je*i,Tt),z=yt*i):($=Z-Math.atan2(Qe*i,Yt),z=Ke*i)}let G=Math.atan2(y,b)*g,et=t.arotation;$=($-G)*E.radDeg+w-et,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(l,c,et+$*n,m,u,0,0),et=e.arotation,z=((z+G)*E.radDeg-e.ashearX)*g+p-et,z>180?z-=360:z<-180&&(z+=360),e.updateWorldTransformWith(b,y,et+z*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Be=class extends kt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},Ve=class extends kt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Le=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Le||{}),Ne=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ne||{}),Oe=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Oe||{}),ws=class ut{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,h=e.bones.length;i<h;i++){let o=s.findBone(e.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(e.target.name);if(!r)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=r,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof It))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,a=o.rotateMode==0,n=o.rotateMode==2,l=this.bones,c=l.length,d=a?c:c+1,f=P.setArraySize(this.spaces,d),m=n?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(n)for(let A=0,S=d-1;A<S;A++){let I=l[A],T=I.data.length,M=T*I.a,Y=T*I.c;m[A]=Math.sqrt(M*M+Y*Y)}P.arrayFill(f,1,d,u);break;case 3:let y=0;for(let A=0,S=d-1;A<S;){let I=l[A],T=I.data.length;if(T<ut.epsilon)n&&(m[A]=0),f[++A]=u;else{let M=T*I.a,Y=T*I.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),f[++A]=F,y+=F}}if(y>0){y=d/y*u;for(let A=1;A<d;A++)f[A]*=y}break;default:let v=o.spacingMode==0;for(let A=0,S=d-1;A<S;){let I=l[A],T=I.data.length;if(T<ut.epsilon)n&&(m[A]=0),f[++A]=u;else{let M=T*I.a,Y=T*I.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),f[++A]=(v?T+u:u)*F/T}}}let x=this.computeWorldPositions(s,d,a),w=x[0],p=x[1],g=o.offsetRotation,b=!1;if(g==0)b=o.rotateMode==1;else{b=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?E.degRad:-E.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(w-A.worldX)*i,A.worldY+=(p-A.worldY)*h;let S=x[v],I=x[v+1],T=S-w,M=I-p;if(n){let Y=m[y];if(Y!=0){let F=(Math.sqrt(T*T+M*M)/Y-1)*r+1;A.a*=F,A.c*=F}}if(w=S,p=I,r>0){let Y=A.a,F=A.b,R=A.c,k=A.d,X=0,B=0,N=0;if(a?X=x[v-1]:f[y+1]==0?X=x[v+2]:X=Math.atan2(M,T),X-=Math.atan2(R,Y),b){B=Math.cos(X),N=Math.sin(X);let L=A.data.length;w+=(L*(B*Y-N*R)-T)*r,p+=(L*(N*Y+B*R)-M)*r}else X+=g;X>E.PI?X-=E.PI2:X<-E.PI&&(X+=E.PI2),X*=r,B=Math.cos(X),N=Math.sin(X),A.a=B*Y-N*R,A.b=B*F-N*k,A.c=N*Y+B*R,A.d=N*F+B*k}A.updateAppliedTransform()}}computeWorldPositions(e,s,r){let i=this.target,h=this.position,o=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,l=e.closed,c=e.worldVerticesLength,d=c/6,f=ut.NONE;if(!e.constantSpeed){let L=e.lengths;d-=l?1:2;let O=L[d];this.data.positionMode==1&&(h*=O);let $;switch(this.data.spacingMode){case 2:$=O;break;case 3:$=O/s;break;default:$=1}n=P.setArraySize(this.world,8);for(let z=0,j=0,V=0;z<s;z++,j+=3){let W=o[z]*$;h+=W;let G=h;if(l)G%=O,G<0&&(G+=O),V=0;else if(G<0){f!=ut.BEFORE&&(f=ut.BEFORE,e.computeWorldVertices(i,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>O){f!=ut.AFTER&&(f=ut.AFTER,e.computeWorldVertices(i,c-6,4,n,0,2)),this.addAfterPosition(G-O,n,0,a,j);continue}for(;;V++){let et=L[V];if(!(G>et)){if(V==0)G/=et;else{let K=L[V-1];G=(G-K)/(et-K)}break}}V!=f&&(f=V,l&&V==d?(e.computeWorldVertices(i,c-4,4,n,0,2),e.computeWorldVertices(i,0,4,n,4,2)):e.computeWorldVertices(i,V*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,j,r||z>0&&W==0)}return a}l?(c+=2,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c-4,n,0,2),e.computeWorldVertices(i,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(d--,c-=4,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c,n,0,2));let m=P.setArraySize(this.curves,d),u=0,x=n[0],w=n[1],p=0,g=0,b=0,y=0,v=0,A=0,S=0,I=0,T=0,M=0,Y=0,F=0,R=0,k=0;for(let L=0,O=2;L<d;L++,O+=6)p=n[O],g=n[O+1],b=n[O+2],y=n[O+3],v=n[O+4],A=n[O+5],S=(x-p*2+b)*.1875,I=(w-g*2+y)*.1875,T=((p-b)*3-x+v)*.09375,M=((g-y)*3-w+A)*.09375,Y=S*2+T,F=I*2+M,R=(p-x)*.75+S+T*.16666667,k=(g-w)*.75+I+M*.16666667,u+=Math.sqrt(R*R+k*k),R+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(R*R+k*k),R+=Y,k+=F,u+=Math.sqrt(R*R+k*k),R+=Y+T,k+=F+M,u+=Math.sqrt(R*R+k*k),m[L]=u,x=v,w=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let B=this.segments,N=0;for(let L=0,O=0,$=0,z=0;L<s;L++,O+=3){let j=o[L]*X;h+=j;let V=h;if(l)V%=u,V<0&&(V+=u),$=0;else if(V<0){this.addBeforePosition(V,n,0,a,O);continue}else if(V>u){this.addAfterPosition(V-u,n,c-4,a,O);continue}for(;;$++){let W=m[$];if(!(V>W)){if($==0)V/=W;else{let G=m[$-1];V=(V-G)/(W-G)}break}}if($!=f){f=$;let W=$*6;for(x=n[W],w=n[W+1],p=n[W+2],g=n[W+3],b=n[W+4],y=n[W+5],v=n[W+6],A=n[W+7],S=(x-p*2+b)*.03,I=(w-g*2+y)*.03,T=((p-b)*3-x+v)*.006,M=((g-y)*3-w+A)*.006,Y=S*2+T,F=I*2+M,R=(p-x)*.3+S+T*.16666667,k=(g-w)*.3+I+M*.16666667,N=Math.sqrt(R*R+k*k),B[0]=N,W=1;W<8;W++)R+=Y,k+=F,Y+=T,F+=M,N+=Math.sqrt(R*R+k*k),B[W]=N;R+=Y,k+=F,N+=Math.sqrt(R*R+k*k),B[8]=N,R+=Y+T,k+=F+M,N+=Math.sqrt(R*R+k*k),B[9]=N,z=0}for(V*=N;;z++){let W=B[z];if(!(V>W)){if(z==0)V/=W;else{let G=B[z-1];V=z+(V-G)/(W-G)}break}}this.addCurvePosition(V*.1,x,w,p,g,b,y,v,A,a,O,r||L>0&&j==0)}return a}addBeforePosition(e,s,r,i,h){let o=s[r],a=s[r+1],n=s[r+2]-o,l=s[r+3]-a,c=Math.atan2(l,n);i[h]=o+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addAfterPosition(e,s,r,i,h){let o=s[r+2],a=s[r+3],n=o-s[r],l=a-s[r+1],c=Math.atan2(l,n);i[h]=o+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addCurvePosition(e,s,r,i,h,o,a,n,l,c,d,f){if(e==0||isNaN(e)){c[d]=s,c[d+1]=r,c[d+2]=Math.atan2(h-r,i-s);return}let m=e*e,u=m*e,x=1-e,w=x*x,p=w*x,g=x*e,b=g*3,y=x*b,v=b*e,A=s*p+i*y+o*v+n*u,S=r*p+h*y+a*v+l*u;c[d]=A,c[d+1]=S,f&&(e<.001?c[d+2]=Math.atan2(h-r,i-s):c[d+2]=Math.atan2(S-(r*w+h*g*2+a*m),A-(s*w+i*g*2+o*m)))}},$s=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=n.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let f=this.remaining,m=this.inertia,u=this.data.step,x=this.skeleton.data.referenceScale,w=-1,p=this.data.limit*l,g=p*Math.abs(n.scaleY);if(p*=Math.abs(n.scaleX),s||r){if(s){const b=(this.ux-c)*m;this.xOffset+=b>p?p:b<-p?-p:b,this.ux=c}if(r){const b=(this.uy-d)*m;this.yOffset+=b>g?g:b<-g?-g:b,this.uy=d}if(f>=u){w=Math.pow(this.damping,60*u);const b=this.massInverse*u,y=this.strength,v=this.wind*x*n.scaleX,A=this.gravity*x*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*b,this.xOffset+=this.xVelocity*u,this.xVelocity*=w),r&&(this.yVelocity-=(A+this.yOffset*y)*b,this.yOffset+=this.yVelocity*u,this.yVelocity*=w),f-=u;while(f>=u)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||h){let b=Math.atan2(o.c,o.a),y=0,v=0,A=0,S=this.cx-o.worldX,I=this.cy-o.worldY;if(S>p?S=p:S<-p&&(S=-p),I>g?I=g:I<-g&&(I=-g),i){A=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(I+this.ty,S+this.tx)-b-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*E.invPI2-.5)*E.PI2)*m,T=this.rotateOffset*A+b,y=Math.cos(T),v=Math.sin(T),h&&(T=a*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(S*y+I*v)*m/T))}else{y=Math.cos(b),v=Math.sin(b);const T=a*o.getWorldScaleX();T>0&&(this.scaleOffset+=(S*y+I*v)*m/T)}if(f=this.remaining,f>=u){w==-1&&(w=Math.pow(this.damping,60*u));const T=this.massInverse*u,M=this.strength,Y=this.wind,F=vs.yDown?-this.gravity:this.gravity,R=a/x;for(;;)if(f-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=w),i){if(this.rotateVelocity-=((Y*v+F*y)*R+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=w,f<u)break;const k=this.rotateOffset*A+b;y=Math.cos(k),v=Math.sin(k)}else if(f<u)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let n=this.rotateOffset*e,l=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=n*this.data.rotate,l=Math.sin(f),c=Math.cos(f),d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d),f+=n*this.data.shearX,l=Math.sin(f),c=Math.cos(f),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c}else n*=this.data.rotate,l=Math.sin(n),c=Math.cos(n),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c,d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d}if(h){const n=1+this.scaleOffset*e*this.data.scaleX;o.a*=n,o.c*=n}t!=3&&(this.tx=a*o.a,this.ty=a*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*E.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-t,a=this.cy-e;this.translate(o*i-a*h-o,o*h+a*i-a)}},ps=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new D,this.darkColor=t.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof ot)||!(this.attachment instanceof ot)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Xt;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,d=a.d,f=n*d-l*c>0?E.degRad:-E.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,x=this.bones;for(let w=0,p=x.length;w<p;w++){let g=x[w];if(t!=0){let b=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)-Math.atan2(v,b)+m;S>E.PI?S-=E.PI2:S<-E.PI&&(S+=E.PI2),S*=t;let I=Math.cos(S),T=Math.sin(S);g.a=I*b-T*v,g.b=I*y-T*A,g.c=T*b+I*v,g.d=T*y+I*A}if(o){let b=this.temp;a.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*e,g.worldY+=(b.y-g.worldY)*s}if(r!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(n*n+c*c)-b+this.data.offsetScaleX)*r)/b),g.a*=b,g.c*=b}if(i!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(l*l+d*d)-b+this.data.offsetScaleY)*i)/b),g.b*=b,g.d*=b}if(h>0){let b=g.b,y=g.d,v=Math.atan2(y,b),A=Math.atan2(d,l)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A=v+(A+u)*h;let S=Math.sqrt(b*b+y*y);g.b=Math.cos(A)*S,g.d=Math.sin(A)*S}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,d=a.d,f=n*d-l*c>0?E.degRad:-E.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,x=this.bones;for(let w=0,p=x.length;w<p;w++){let g=x[w];if(t!=0){let b=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)+m;S>E.PI?S-=E.PI2:S<-E.PI&&(S+=E.PI2),S*=t;let I=Math.cos(S),T=Math.sin(S);g.a=I*b-T*v,g.b=I*y-T*A,g.c=T*b+I*v,g.d=T*y+I*A}if(o){let b=this.temp;a.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*e,g.worldY+=b.y*s}if(r!=0){let b=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=b,g.c*=b}if(i!=0){let b=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*i+1;g.b*=b,g.d*=b}if(h>0){let b=Math.atan2(d,l)-Math.atan2(c,n);b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2);let y=g.b,v=g.d;b=Math.atan2(v,y)+(b-E.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(b)*A,g.d=Math.sin(b)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],d=c.arotation;t!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*t);let f=c.ax,m=c.ay;f+=(o.ax-f+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,x=c.ascaleY;r!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*r)/u),i!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*i)/x);let w=c.ashearY;h!=0&&(w+=(o.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,w)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],d=c.arotation+(o.arotation+this.data.offsetRotation)*t,f=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),x=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),w=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,w)}}},vs=class He{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return He.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let r=e.bones[s],i;if(!r.parent)i=new Fe(r,this,null);else{let h=this.bones[r.parent.index];i=new Fe(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let r=e.slots[s],i=this.bones[r.boneData.index],h=new ps(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let r=e.ikConstraints[s];this.ikConstraints.push(new bs(r,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let r=e.transformConstraints[s];this.transformConstraints.push(new ys(r,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let r=e.pathConstraints[s];this.pathConstraints.push(new ws(r,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let r=e.physicsConstraints[s];this.physicsConstraints.push(new $s(r,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let f=0,m=s.length;f<m;f++){let u=s[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let x=this.bones[f[m].index];do x.sorted=!1,x.active=!0,x=x.parent;while(x)}}let r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,a=r.length,n=i.length,l=h.length,c=this.physicsConstraints.length,d=a+n+l+c;t:for(let f=0;f<d;f++){for(let m=0;m<a;m++){let u=r[m];if(u.data.order==f){this.sortIkConstraint(u);continue t}}for(let m=0;m<n;m++){let u=i[m];if(u.data.order==f){this.sortTransformConstraint(u);continue t}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==f){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue t}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let r=e.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let n=0,l=this.data.skins.length;n<l;n++)this.sortPathConstraintAttachment(this.data.skins[n],r,i);let h=s.getAttachment();h instanceof It&&this.sortPathConstraintAttachmentWith(h,i);let o=e.bones,a=o.length;for(let n=0;n<a;n++)this.sortBone(o[n]);this._updateCache.push(e);for(let n=0;n<a;n++)this.sortReset(o[n].children);for(let n=0;n<a;n++)o[n].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,r=s.length;if(e.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(e);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(e,s,r){let i=e.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof It))return;let r=e.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let a=r[h++];for(a+=h;h<a;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,r=e.length;s<r;s++){let i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let w=1,p=r.length;w<p;w++){let g=r[w];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,a=s.c,n=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=a*this.x+n*this.y+s.worldY;const l=(i.rotation+i.shearX)*E.degRad,c=(i.rotation+90+i.shearY)*E.degRad,d=Math.cos(l)*i.scaleX,f=Math.cos(c)*i.scaleY,m=Math.sin(l)*i.scaleX,u=Math.sin(c)*i.scaleY;i.a=(h*d+o*m)*this.scaleX,i.b=(h*f+o*u)*this.scaleX,i.c=(a*d+n*m)*this.scaleY,i.d=(a*f+n*u)*this.scaleY;let x=this._updateCache;for(let w=0,p=x.length;w<p;w++){let g=x[w];g!=i&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;P.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,r=e.length;s<r;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],o=h.data.attachmentName;if(o){let a=e.getAttachment(r,o);a&&h.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let r=this.data.findSlot(e);if(!r)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(r.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(e,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let o=r[i];if(o.data.name==e){let a=null;if(s&&(a=this.getAttachment(i,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Xt,r=new Xt;return this.getBounds(s,r,void 0,e),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(e,s,r=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let f=h[c];if(!f.bone.active)continue;let m=0,u=null,x=null,w=f.getAttachment();if(w instanceof H)m=8,u=P.setArraySize(r,m,0),w.computeWorldVertices(f,u,0,2),x=He.quadTriangles;else if(w instanceof Ct){let p=w;m=p.worldVerticesLength,u=P.setArraySize(r,m,0),p.computeWorldVertices(f,0,m,u,0,2),x=p.triangles}else if(w instanceof ke&&i!=null){i.clipStart(f,w);continue}if(u&&x){i!=null&&i.isClipping()&&(i.clipTriangles(u,x,x.length),u=i.clippedVertices,m=i.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let b=u[p],y=u[p+1];o=Math.min(o,b),a=Math.min(a,y),n=Math.max(n,b),l=Math.max(l,y)}}i?.clipEndWithSlot(f)}i?.clipEnd(),e.set(o,a),s.set(n-o,l-a)}update(e){this.time+=e}physicsTranslate(e,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(e,s)}physicsRotate(e,s,r){const i=this.physicsConstraints;for(let h=0,o=i.length;h<o;h++)i[h].rotate(e,s,r)}},As=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(As||{}),Ss=class extends kt{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},De=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}},qe=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Nt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new D(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];s.attachment&&(s.attachment instanceof Ct?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new qe(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new qe(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],h=i.getAttachment();if(h&&s<e.attachments.length){let o=e.attachments[s];for(let a in o){let n=o[a];if(h==n){let l=this.getAttachment(s,a);l&&i.setAttachment(l);break}}}s++}}},We=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Ue=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Ue||{}),ze=class extends kt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new De;s.name="";let r=new Cs(t),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let a=0;a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[r.readInt(!0)],f=new Xe(l,c,d);f.rotation=r.readFloat(),f.x=r.readFloat()*e,f.y=r.readFloat()*e,f.scaleX=r.readFloat(),f.scaleY=r.readFloat(),f.shearX=r.readFloat(),f.shearY=r.readFloat(),f.length=r.readFloat()*e,f.inherit=r.readByte(),f.skinRequired=r.readBoolean(),o&&(D.rgba8888ToColor(f.color,r.readInt32()),f.icon=r.readString()??void 0,f.visible=r.readBoolean()),s.bones.push(f)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[r.readInt(!0)],f=new We(l,c,d);D.rgba8888ToColor(f.color,r.readInt32());let m=r.readInt32();m!=-1&&D.rgb888ToColor(f.darkColor=new D,m),f.attachmentName=r.readStringRef(),f.blendMode=r.readInt(!0),o&&(f.visible=r.readBoolean()),s.slots.push(f)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let d=r.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Be(d);f.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[r.readInt(!0)]);f.target=s.bones[r.readInt(!0)];let m=r.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(f.softness=r.readFloat()*e),s.ikConstraints.push(f)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let d=r.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new ze(d);f.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[r.readInt(!0)]);f.target=s.bones[r.readInt(!0)];let m=r.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=r.readFloat()),(m&16)!=0&&(f.offsetX=r.readFloat()*e),(m&32)!=0&&(f.offsetY=r.readFloat()*e),(m&64)!=0&&(f.offsetScaleX=r.readFloat()),(m&128)!=0&&(f.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(f.offsetShearY=r.readFloat()),(m&2)!=0&&(f.mixRotate=r.readFloat()),(m&4)!=0&&(f.mixX=r.readFloat()),(m&8)!=0&&(f.mixY=r.readFloat()),(m&16)!=0&&(f.mixScaleX=r.readFloat()),(m&32)!=0&&(f.mixScaleY=r.readFloat()),(m&64)!=0&&(f.mixShearY=r.readFloat()),s.transformConstraints.push(f)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let d=r.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Ve(d);f.order=r.readInt(!0),f.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[r.readInt(!0)]);f.target=s.slots[r.readInt(!0)];const m=r.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=r.readFloat()),f.position=r.readFloat(),f.positionMode==0&&(f.position*=e),f.spacing=r.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=e),f.mixRotate=r.readFloat(),f.mixX=r.readFloat(),f.mixY=r.readFloat(),s.pathConstraints.push(f)}a=r.readInt(!0);for(let l=0,c;l<a;l++){const d=r.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Ss(d);f.order=r.readInt(!0),f.bone=s.bones[r.readInt(!0)];let m=r.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=r.readFloat()),(m&4)!=0&&(f.y=r.readFloat()),(m&8)!=0&&(f.rotate=r.readFloat()),(m&16)!=0&&(f.scaleX=r.readFloat()),(m&32)!=0&&(f.shearX=r.readFloat()),f.limit=((m&64)!=0?r.readFloat():5e3)*e,f.step=1/r.readUnsignedByte(),f.inertia=r.readFloat(),f.strength=r.readFloat(),f.damping=r.readFloat(),f.massInverse=(m&128)!=0?r.readFloat():1,f.wind=r.readFloat(),f.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(f)}let n=this.readSkin(r,s,!0,o);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(P.setArraySize(s.skins,a=l+r.readInt(!0));l<a;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}a=this.linkedMeshes.length;for(let l=0;l<a;l++){let c=this.linkedMeshes[l];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let d=new Pe(c);d.intValue=r.readInt(!1),d.floatValue=r.readFloat(),d.stringValue=r.readString(),d.audioPath=r.readString(),d.audioPath&&(d.volume=r.readFloat(),d.balance=r.readFloat()),s.events.push(d)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(t,e,s,r){let i=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;i=new Nt("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");i=new Nt(o),r&&D.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let a=0,n=i.bones.length;a<n;a++)i.bones[a]=e.bones[t.readInt(!0)];for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let o=0;o<h;o++){let a=t.readInt(!0);for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,i,a,c,r);d&&i.setAttachment(a,c,d)}}return i}readAttachment(t,e,s,r,i,h){let o=this.scale,a=t.readByte();const n=(a&8)!=0?t.readStringRef():i;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let l=(a&16)!=0?t.readStringRef():null;const c=(a&32)!=0?t.readInt32():4294967295,d=(a&64)!=0?this.readSequence(t):null;let f=(a&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),x=t.readFloat(),w=t.readFloat(),p=t.readFloat(),g=t.readFloat();l||(l=n);let b=this.attachmentLoader.newRegionAttachment(s,n,l,d);return b?(b.path=l,b.x=m*o,b.y=u*o,b.scaleX=x,b.scaleY=w,b.rotation=f,b.width=p*o,b.height=g*o,D.rgba8888ToColor(b.color,c),b.sequence=d,d==null&&b.updateRegion(),b):null}case 1:{let l=this.readVertices(t,(a&16)!=0),c=h?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,n);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&D.rgba8888ToColor(d.color,c),d):null}case 2:{let l=(a&16)!=0?t.readStringRef():n;const c=(a&32)!=0?t.readInt32():4294967295,d=(a&64)!=0?this.readSequence(t):null,f=t.readInt(!0),m=this.readVertices(t,(a&128)!=0),u=this.readFloatArray(t,m.length,1),x=this.readShortArray(t,(m.length-f-2)*3);let w=[],p=0,g=0;h&&(w=this.readShortArray(t,t.readInt(!0)),p=t.readFloat(),g=t.readFloat()),l||(l=n);let b=this.attachmentLoader.newMeshAttachment(s,n,l,d);return b?(b.path=l,D.rgba8888ToColor(b.color,c),b.bones=m.bones,b.vertices=m.vertices,b.worldVerticesLength=m.length,b.triangles=x,b.regionUVs=u,d==null&&b.updateRegion(),b.hullLength=f<<1,b.sequence=d,h&&(b.edges=w,b.width=p*o,b.height=g*o),b):null}case 3:{const l=(a&16)!=0?t.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?t.readInt32():4294967295,d=(a&64)!=0?this.readSequence(t):null,f=(a&128)!=0,m=t.readInt(!0),u=t.readStringRef();let x=0,w=0;h&&(x=t.readFloat(),w=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,n,l,d);return p?(p.path=l,D.rgba8888ToColor(p.color,c),p.sequence=d,h&&(p.width=x*o,p.height=w*o),this.linkedMeshes.push(new Js(p,m,r,u,f)),p):null}case 4:{const l=(a&16)!=0,c=(a&32)!=0,d=this.readVertices(t,(a&64)!=0),f=P.newArray(d.length/6,0);for(let x=0,w=f.length;x<w;x++)f[x]=t.readFloat()*o;const m=h?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=l,u.constantSpeed=c,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,h&&D.rgba8888ToColor(u.color,m),u):null}case 5:{const l=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*o,m.y=d*o,m.rotation=l,h&&D.rgba8888ToColor(m.color,f),m):null}case 6:{const l=t.readInt(!0),c=this.readVertices(t,(a&16)!=0);let d=h?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,n);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,h&&D.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){let e=new ss(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),i=new js;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let h=new Array,o=new Array;for(let a=0;a<r;a++){let n=t.readInt(!0);o.push(n);for(let l=0;l<n;l++)o.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=o,i}readFloatArray(t,e,s){let r=new Array(e);if(s==1)for(let i=0;i<e;i++)r[i]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readByte(),u=t.readInt(!0),x=u-1;switch(m){case oi:{let w=new mt(u,c);for(let p=0;p<u;p++)w.setFrame(p,t.readFloat(),t.readStringRef());r.push(w);break}case hi:{let w=t.readInt(!0),p=new se(u,w,c),g=t.readFloat(),b=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let S=0,I=0;p.setFrame(S,g,b,y,v,A),S!=x;S++){let T=t.readFloat(),M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case ht:p.setStepped(S);break;case ct:U(t,p,I++,S,0,g,T,b,M,1),U(t,p,I++,S,1,g,T,y,Y,1),U(t,p,I++,S,2,g,T,v,F,1),U(t,p,I++,S,3,g,T,A,R,1)}g=T,b=M,y=Y,v=F,A=R}r.push(p);break}case ci:{let w=t.readInt(!0),p=new ie(u,w,c),g=t.readFloat(),b=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,S=0;p.setFrame(A,g,b,y,v),A!=x;A++){let I=t.readFloat(),T=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case ht:p.setStepped(A);break;case ct:U(t,p,S++,A,0,g,I,b,T,1),U(t,p,S++,A,1,g,I,y,M,1),U(t,p,S++,A,2,g,I,v,Y,1)}g=I,b=T,y=M,v=Y}r.push(p);break}case di:{let w=t.readInt(!0),p=new ae(u,w,c),g=t.readFloat(),b=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let M=0,Y=0;p.setFrame(M,g,b,y,v,A,S,I,T),M!=x;M++){let F=t.readFloat(),R=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case ht:p.setStepped(M);break;case ct:U(t,p,Y++,M,0,g,F,b,R,1),U(t,p,Y++,M,1,g,F,y,k,1),U(t,p,Y++,M,2,g,F,v,X,1),U(t,p,Y++,M,3,g,F,A,B,1),U(t,p,Y++,M,4,g,F,S,N,1),U(t,p,Y++,M,5,g,F,I,L,1),U(t,p,Y++,M,6,g,F,T,O,1)}g=F,b=R,y=k,v=X,A=B,S=N,I=L,T=O}r.push(p);break}case fi:{let w=t.readInt(!0),p=new ne(u,w,c),g=t.readFloat(),b=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let T=0,M=0;p.setFrame(T,g,b,y,v,A,S,I),T!=x;T++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255;switch(t.readByte()){case ht:p.setStepped(T);break;case ct:U(t,p,M++,T,0,g,Y,b,F,1),U(t,p,M++,T,1,g,Y,y,R,1),U(t,p,M++,T,2,g,Y,v,k,1),U(t,p,M++,T,3,g,Y,A,X,1),U(t,p,M++,T,4,g,Y,S,B,1),U(t,p,M++,T,5,g,Y,I,N,1)}g=Y,b=F,y=R,v=k,A=X,S=B,I=N}r.push(p);break}case ui:{let w=new re(u,t.readInt(!0),c),p=t.readFloat(),g=t.readUnsignedByte()/255;for(let b=0,y=0;w.setFrame(b,p,g),b!=x;b++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case ht:w.setStepped(b);break;case ct:U(t,w,y++,b,0,p,v,g,A,1)}p=v,g=A}r.push(w)}}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readByte(),u=t.readInt(!0);if(m==li){let w=new ee(u,c);for(let p=0;p<u;p++)w.setFrame(p,t.readFloat(),t.readByte());r.push(w);continue}let x=t.readInt(!0);switch(m){case Ks:r.push(tt(t,new St(u,x,c),1));break;case Qs:r.push(_e(t,new Gt(u,x,c),i));break;case Zs:r.push(tt(t,new $t(u,x,c),i));break;case ti:r.push(tt(t,new Ht(u,x,c),i));break;case ei:r.push(_e(t,new Jt(u,x,c),1));break;case si:r.push(tt(t,new jt(u,x,c),1));break;case ii:r.push(tt(t,new Kt(u,x,c),1));break;case ri:r.push(_e(t,new Qt(u,x,c),1));break;case ai:r.push(tt(t,new Zt(u,x,c),1));break;case ni:r.push(tt(t,new te(u,x,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),d=t.readInt(!0),f=d-1,m=new oe(d,t.readInt(!0),c),u=t.readByte(),x=t.readFloat(),w=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,p=(u&4)!=0?t.readFloat()*i:0;for(let g=0,b=0;m.setFrame(g,x,w,p,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=f;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,A=(u&4)!=0?t.readFloat()*i:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(U(t,m,b++,g,0,x,y,w,v,1),U(t,m,b++,g,1,x,y,p,A,i)),x=y,w=v,p=A}r.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),d=t.readInt(!0),f=d-1,m=new he(d,t.readInt(!0),c),u=t.readFloat(),x=t.readFloat(),w=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat(),y=t.readFloat();for(let v=0,A=0;m.setFrame(v,u,x,w,p,g,b,y),v!=f;v++){let S=t.readFloat(),I=t.readFloat(),T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),R=t.readFloat();switch(t.readByte()){case ht:m.setStepped(v);break;case ct:U(t,m,A++,v,0,u,S,x,I,1),U(t,m,A++,v,1,u,S,w,T,1),U(t,m,A++,v,2,u,S,p,M,1),U(t,m,A++,v,3,u,S,g,Y,1),U(t,m,A++,v,4,u,S,b,F,1),U(t,m,A++,v,5,u,S,y,R,1)}u=S,x=I,w=T,p=M,g=Y,b=F,y=R}r.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readByte(),x=t.readInt(!0),w=t.readInt(!0);switch(u){case xi:r.push(tt(t,new ce(x,w,c),d.positionMode==0?i:1));break;case bi:r.push(tt(t,new de(x,w,c),d.spacingMode==0||d.spacingMode==1?i:1));break;case wi:let p=new fe(x,w,c),g=t.readFloat(),b=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,S=0,I=p.getFrameCount()-1;p.setFrame(A,g,b,y,v),A!=I;A++){let T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case ht:p.setStepped(A);break;case ct:U(t,p,S++,A,0,g,T,b,M,1),U(t,p,S++,A,1,g,T,y,Y,1),U(t,p,S++,A,2,g,T,v,F,1)}g=T,b=M,y=Y,v=F}r.push(p)}}}for(let n=0,l=t.readInt(!0);n<l;n++){const c=t.readInt(!0)-1;for(let d=0,f=t.readInt(!0);d<f;d++){const m=t.readByte(),u=t.readInt(!0);if(m==ki){const w=new ye(u,c);for(let p=0;p<u;p++)w.setFrame(p,t.readFloat());r.push(w);continue}const x=t.readInt(!0);switch(m){case pi:r.push(tt(t,new ue(u,x,c),1));break;case yi:r.push(tt(t,new me(u,x,c),1));break;case vi:r.push(tt(t,new ge(u,x,c),1));break;case Ai:r.push(tt(t,new xe(u,x,c),1));break;case Si:r.push(tt(t,new be(u,x,c),1));break;case Ci:r.push(tt(t,new we(u,x,c),1));break;case Ii:r.push(tt(t,new pe(u,x,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readInt(!0);for(let u=0,x=t.readInt(!0);u<x;u++){let w=t.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,w),g=t.readByte(),b=t.readInt(!0),y=b-1;switch(g){case mi:{let v=p,A=v.bones,S=v.vertices,I=A?S.length/3*2:S.length,T=t.readInt(!0),M=new le(b,T,m,v),Y=t.readFloat();for(let F=0,R=0;;F++){let k,X=t.readInt(!0);if(X==0)k=A?P.newFloatArray(I):S;else{k=P.newFloatArray(I);let N=t.readInt(!0);if(X+=N,i==1)for(let L=N;L<X;L++)k[L]=t.readFloat();else for(let L=N;L<X;L++)k[L]=t.readFloat()*i;if(!A)for(let L=0,O=k.length;L<O;L++)k[L]+=S[L]}if(M.setFrame(F,Y,k),F==y)break;let B=t.readFloat();switch(t.readByte()){case ht:M.setStepped(F);break;case ct:U(t,M,R++,F,0,Y,B,0,1,1)}Y=B}r.push(M);break}case gi:{let v=new ve(b,m,p);for(let A=0;A<b;A++){let S=t.readFloat(),I=t.readInt32();v.setFrame(A,S,rs[I&15],I>>4,t.readFloat())}r.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let n=new wt(h),l=s.slots.length;for(let c=0;c<h;c++){let d=t.readFloat(),f=t.readInt(!0),m=P.newArray(l,0);for(let p=l-1;p>=0;p--)m[p]=-1;let u=P.newArray(l-f,0),x=0,w=0;for(let p=0;p<f;p++){let g=t.readInt(!0);for(;x!=g;)u[w++]=x++;m[x+t.readInt(!0)]=x++}for(;x<l;)u[w++]=x++;for(let p=l-1;p>=0;p--)m[p]==-1&&(m[p]=u[--w]);n.setFrame(c,d,m)}r.push(n)}let o=t.readInt(!0);if(o>0){let n=new Et(o);for(let l=0;l<o;l++){let c=t.readFloat(),d=s.events[t.readInt(!0)],f=new Ee(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),n.setFrame(l,f)}r.push(n)}let a=0;for(let n=0,l=r.length;n<l;n++)a=Math.max(a,r[n].getDuration());return new Ft(e,r,a)}},Cs=class{constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let r=0;r<t;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:e+=String.fromCharCode(i),r++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Js=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},js=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function tt(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let h=0,o=0,a=e.getFrameCount()-1;e.setFrame(h,r,i),h!=a;h++){let n=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ht:e.setStepped(h);break;case ct:U(t,e,o++,h,0,r,n,i,l,s)}r=n,i=l}return e}function _e(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,h=t.readFloat()*s;for(let o=0,a=0,n=e.getFrameCount()-1;e.setFrame(o,r,i,h),o!=n;o++){let l=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case ht:e.setStepped(o);break;case ct:U(t,e,a++,o,0,r,l,i,c,s),U(t,e,a++,o,1,r,l,h,d,s)}r=l,i=c,h=d}return e}function U(t,e,s,r,i,h,o,a,n,l){e.setBezier(s,r,i,h,a,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,o,n)}var Ks=0,Qs=1,Zs=2,ti=3,ei=4,si=5,ii=6,ri=7,ai=8,ni=9,li=10,oi=0,hi=1,ci=2,di=3,fi=4,ui=5,mi=0,gi=1,xi=0,bi=1,wi=2,pi=0,yi=1,vi=2,Ai=4,Si=5,Ci=6,Ii=7,ki=8,ht=1,ct=2,Ti=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new At(()=>P.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=t.slots,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let a=0;a<o;a++){let n=h[a];if(!n.bone.active)continue;let l=n.getAttachment();if(l instanceof Ie){let c=l;s.push(c);let d=i.obtain();d.length!=c.worldVerticesLength&&(d=P.newFloatArray(c.worldVerticesLength)),r.push(d),c.computeWorldVertices(n,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,o=i.length;h<o;h++){let a=i[h],n=a;for(let l=0,c=a.length;l<c;l+=2){let d=n[l],f=n[l+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),r=Math.max(r,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,h=this.minY,o=this.maxX,a=this.maxY;if(t<=i&&s<=i||e<=h&&r<=h||t>=o&&s>=o||e>=a&&r>=a)return!1;let n=(r-e)/(s-t),l=n*(i-t)+e;if(l>h&&l<a||(l=n*(o-t)+e,l>h&&l<a))return!0;let c=(h-e)/n+t;return c>i&&c<o||(c=(a-e)/n+t,c>i&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,h=i-2,o=!1;for(let a=0;a<i;a+=2){let n=r[a+1],l=r[h+1];if(n<s&&l>=s||l<s&&n>=s){let c=r[a];c+(s-n)/(l-n)*(r[h]-c)<e&&(o=!o)}h=a}return o}intersectsSegment(t,e,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;h++)if(this.intersectsSegmentPolygon(i[h],t,e,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,r,i){let h=t,o=t.length,a=e-r,n=s-i,l=e*i-s*r,c=h[o-2],d=h[o-1];for(let f=0;f<o;f+=2){let m=h[f],u=h[f+1],x=c*u-d*m,w=c-m,p=d-u,g=a*p-n*w,b=(l*w-a*x)/g;if((b>=c&&b<=m||b>=m&&b<=c)&&(b>=e&&b<=r||b>=r&&b<=e)){let y=(l*p-n*x)/g;if((y>=d&&y<=u||y>=u&&y<=d)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Is=class st{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new At(()=>new Array);polygonIndicesPool=new At(()=>new Array);triangulate(e){let s=e,r=e.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<r;a++)i[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=r;a<n;++a)h[a]=st.isConcave(a,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let a=r-1,n=0,l=1;for(;;){t:if(!h[n]){let f=i[a]<<1,m=i[n]<<1,u=i[l]<<1,x=s[f],w=s[f+1],p=s[m],g=s[m+1],b=s[u],y=s[u+1];for(let v=(l+1)%r;v!=a;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,S=s[A],I=s[A+1];if(st.positiveArea(b,y,x,w,S,I)&&st.positiveArea(x,w,p,g,S,I)&&st.positiveArea(p,g,b,y,S,I))break t}break}if(l==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=l,l=(l+1)%r}o.push(i[(r+n-1)%r]),o.push(i[n]),o.push(i[(n+1)%r]),i.splice(n,1),h.splice(n,1),r--;let c=(r+n-1)%r,d=n==r?0:n;h[c]=st.isConcave(c,r,s,i),h[d]=st.isConcave(d,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(e,s){let r=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,l=0;for(let c=0,d=s.length;c<d;c+=3){let f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,x=r[f],w=r[f+1],p=r[m],g=r[m+1],b=r[u],y=r[u+1],v=!1;if(n==f){let A=a.length-4,S=st.winding(a[A],a[A+1],a[A+2],a[A+3],b,y),I=st.winding(b,y,a[0],a[1],a[2],a[3]);S==l&&I==l&&(a.push(b),a.push(y),o.push(u),v=!0)}v||(a.length>0?(i.push(a),h.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(x),a.push(w),a.push(p),a.push(g),a.push(b),a.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(m),o.push(u),l=st.winding(x,w,p,g,b,y),n=f)}a.length>0&&(i.push(a),h.push(o));for(let c=0,d=i.length;c<d;c++){if(o=h[c],o.length==0)continue;let f=o[0],m=o[o.length-1];a=i[c];let u=a.length-4,x=a[u],w=a[u+1],p=a[u+2],g=a[u+3],b=a[0],y=a[1],v=a[2],A=a[3],S=st.winding(x,w,p,g,b,y);for(let I=0;I<d;I++){if(I==c)continue;let T=h[I];if(T.length!=3)continue;let M=T[0],Y=T[1],F=T[2],R=i[I],k=R[R.length-2],X=R[R.length-1];if(M!=f||Y!=m)continue;let B=st.winding(x,w,p,g,k,X),N=st.winding(k,X,b,y,v,A);B==S&&N==S&&(R.length=0,T.length=0,a.push(k),a.push(X),o.push(F),x=p,w=g,p=k,g=X,I=0)}}for(let c=i.length-1;c>=0;c--)a=i[c],a.length==0&&(i.splice(c,1),this.polygonPool.free(a),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(e,s,r,i){let h=i[(s+e-1)%s]<<1,o=i[e]<<1,a=i[(e+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[a],r[a+1])}static positiveArea(e,s,r,i,h,o){return e*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(e,s,r,i,h,o){let a=r-e,n=i-s;return h*n-o*a+a*s-e*n>=0?1:-1}},Yi=class Je{triangulator=new Is;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(e,0,r,i,0,2);let h=this.clippingPolygon;Je.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=o.length;a<n;a++){let l=o[a];Je.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,r,i,h,o,a,n){let l,c,d,f,m,u;typeof s=="number"?(l=r,c=i,d=h,f=o,m=a,u=n):(l=s,c=r,d=i,f=h,m=o,u=a),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,l,c,d,f,m,u):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,n=a.length,l=0;h.length=0,o.length=0;for(let c=0;c<r;c+=3){let d=s[c]<<1,f=e[d],m=e[d+1];d=s[c+1]<<1;let u=e[d],x=e[d+1];d=s[c+2]<<1;let w=e[d],p=e[d+1];for(let g=0;g<n;g++){let b=h.length;if(this.clip(f,m,u,x,w,p,a[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,S=P.setArraySize(h,b+v*2);for(let T=0;T<y;T+=2,b+=2){let M=A[T],Y=A[T+1];S[b]=M,S[b+1]=Y}b=o.length;let I=P.setArraySize(o,b+3*(v-2));v--;for(let T=1;T<v;T++,b+=3)I[b]=l,I[b+1]=l+T,I[b+2]=l+T+1;l+=v+1}else{let y=P.setArraySize(h,b+6);y[b]=f,y[b+1]=m,y[b+2]=u,y[b+3]=x,y[b+4]=w,y[b+5]=p,b=o.length;let v=P.setArraySize(o,b+3);v[b]=l,v[b+1]=l+1,v[b+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,s,r,i,h,o,a){let n=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=a?12:8,u=0;l.length=0,c.length=0;for(let x=0;x<r;x+=3){let w=s[x]<<1,p=e[w],g=e[w+1],b=i[w],y=i[w+1];w=s[x+1]<<1;let v=e[w],A=e[w+1],S=i[w],I=i[w+1];w=s[x+2]<<1;let T=e[w],M=e[w+1],Y=i[w],F=i[w+1];for(let R=0;R<f;R++){let k=l.length;if(this.clip(p,g,v,A,T,M,d[R],n)){let X=n.length;if(X==0)continue;let B=A-M,N=T-v,L=p-T,O=M-g,$=1/(B*L+N*(g-M)),z=X>>1,j=this.clipOutput,V=P.setArraySize(l,k+z*m);for(let G=0;G<X;G+=2,k+=m){let et=j[G],K=j[G+1];V[k]=et,V[k+1]=K,V[k+2]=h.r,V[k+3]=h.g,V[k+4]=h.b,V[k+5]=h.a;let Q=et-T,Z=K-M,rt=(B*Q+N*Z)*$,xt=(O*Q+L*Z)*$,yt=1-rt-xt;V[k+6]=b*rt+S*xt+Y*yt,V[k+7]=y*rt+I*xt+F*yt,a&&(V[k+8]=o.r,V[k+9]=o.g,V[k+10]=o.b,V[k+11]=o.a)}k=c.length;let W=P.setArraySize(c,k+3*(z-2));z--;for(let G=1;G<z;G++,k+=3)W[k]=u,W[k+1]=u+G,W[k+2]=u+G+1;u+=z+1}else{let X=P.setArraySize(l,k+3*m);X[k]=p,X[k+1]=g,X[k+2]=h.r,X[k+3]=h.g,X[k+4]=h.b,X[k+5]=h.a,a?(X[k+6]=b,X[k+7]=y,X[k+8]=o.r,X[k+9]=o.g,X[k+10]=o.b,X[k+11]=o.a,X[k+12]=v,X[k+13]=A,X[k+14]=h.r,X[k+15]=h.g,X[k+16]=h.b,X[k+17]=h.a,X[k+18]=S,X[k+19]=I,X[k+20]=o.r,X[k+21]=o.g,X[k+22]=o.b,X[k+23]=o.a,X[k+24]=T,X[k+25]=M,X[k+26]=h.r,X[k+27]=h.g,X[k+28]=h.b,X[k+29]=h.a,X[k+30]=Y,X[k+31]=F,X[k+32]=o.r,X[k+33]=o.g,X[k+34]=o.b,X[k+35]=o.a):(X[k+6]=b,X[k+7]=y,X[k+8]=v,X[k+9]=A,X[k+10]=h.r,X[k+11]=h.g,X[k+12]=h.b,X[k+13]=h.a,X[k+14]=S,X[k+15]=I,X[k+16]=T,X[k+17]=M,X[k+18]=h.r,X[k+19]=h.g,X[k+20]=h.b,X[k+21]=h.a,X[k+22]=Y,X[k+23]=F),k=c.length;let B=P.setArraySize(c,k+3);B[k]=u,B[k+1]=u+1,B[k+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,r,i){let h=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,l=this.clippingPolygons,c=l.length,d=0;o.length=0,a.length=0,n.length=0;for(let f=0;f<r;f+=3){let m=s[f]<<1,u=e[m],x=e[m+1],w=i[m],p=i[m+1];m=s[f+1]<<1;let g=e[m],b=e[m+1],y=i[m],v=i[m+1];m=s[f+2]<<1;let A=e[m],S=e[m+1],I=i[m],T=i[m+1];for(let M=0;M<c;M++){let Y=o.length;if(this.clip(u,x,g,b,A,S,l[M],h)){let F=h.length;if(F==0)continue;let R=b-S,k=A-g,X=u-A,B=S-x,N=1/(R*X+k*(x-S)),L=F>>1,O=this.clipOutput,$=P.setArraySize(o,Y+L*2),z=P.setArraySize(a,Y+L*2);for(let V=0;V<F;V+=2,Y+=2){let W=O[V],G=O[V+1];$[Y]=W,$[Y+1]=G;let et=W-A,K=G-S,Q=(R*et+k*K)*N,Z=(B*et+X*K)*N,rt=1-Q-Z;z[Y]=w*Q+y*Z+I*rt,z[Y+1]=p*Q+v*Z+T*rt}Y=n.length;let j=P.setArraySize(n,Y+3*(L-2));L--;for(let V=1;V<L;V++,Y+=3)j[Y]=d,j[Y+1]=d+V,j[Y+2]=d+V+1;d+=L+1}else{let F=P.setArraySize(o,Y+6);F[Y]=u,F[Y+1]=x,F[Y+2]=g,F[Y+3]=b,F[Y+4]=A,F[Y+5]=S;let R=P.setArraySize(a,Y+3*2);R[Y]=w,R[Y+1]=p,R[Y+2]=y,R[Y+3]=v,R[Y+4]=I,R[Y+5]=T,Y=n.length;let k=P.setArraySize(n,Y+3);k[Y]=d,k[Y+1]=d+1,k[Y+2]=d+2,d+=3;break}}}}clip(e,s,r,i,h,o,a,n){let l=n,c=!1,d;a.length%4>=2?(d=n,n=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(r),d.push(i),d.push(h),d.push(o),d.push(e),d.push(s),n.length=0;let f=a.length-4,m=a;for(let u=0;;u+=2){let x=m[u],w=m[u+1],p=x-m[u+2],g=w-m[u+3],b=n.length,y=d;for(let A=0,S=d.length-2;A<S;){let I=y[A],T=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(x-M)>p*(w-Y),R=g*(x-I)-p*(w-T);if(R>0){if(F){n.push(M),n.push(Y);continue}let k=M-I,X=Y-T,B=R/(k*g-X*p);if(B>=0&&B<=1)n.push(I+k*B),n.push(T+X*B);else{n.push(M),n.push(Y);continue}}else if(F){let k=M-I,X=Y-T,B=R/(k*g-X*p);if(B>=0&&B<=1)n.push(I+k*B),n.push(T+X*B),n.push(M),n.push(Y);else{n.push(M),n.push(Y);continue}}c=!0}if(b==n.length)return l.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==f)break;let v=n;n=d,n.length=0,d=v}if(l!=n){l.length=0;for(let u=0,x=n.length-2;u<x;u++)l[u]=n[u]}else l.length=l.length-2;return c}static makeClockwise(e){let s=e,r=e.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,o=0,a=0,n=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],a=s[l+2],n=s[l+3],i+=h*n-a*o;if(!(i<0))for(let l=0,c=r-2,d=r>>1;l<d;l+=2){let f=s[l],m=s[l+1],u=c-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=f,s[u+1]=m}}},Mi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new De,r=typeof t=="string"?JSON.parse(t):t,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=C(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let o=r.bones[h],a=null,n=C(o,"parent",null);n&&(a=s.findBone(n));let l=new Xe(s.bones.length,o.name,a);l.length=C(o,"length",0)*e,l.x=C(o,"x",0)*e,l.y=C(o,"y",0)*e,l.rotation=C(o,"rotation",0),l.scaleX=C(o,"scaleX",1),l.scaleY=C(o,"scaleY",1),l.shearX=C(o,"shearX",0),l.shearY=C(o,"shearY",0),l.inherit=P.enumValue(Lt,C(o,"inherit","Normal")),l.skinRequired=C(o,"skin",!1);let c=C(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(r.slots)for(let h=0;h<r.slots.length;h++){let o=r.slots[h],a=o.name,n=s.findBone(o.bone);if(!n)throw new Error(`Couldn't find bone ${o.bone} for slot ${a}`);let l=new We(s.slots.length,a,n),c=C(o,"color",null);c&&l.color.setFromString(c);let d=C(o,"dark",null);d&&(l.darkColor=D.fromString(d)),l.attachmentName=C(o,"attachment",null),l.blendMode=P.enumValue(Ue,C(o,"blend","normal")),l.visible=C(o,"visible",!0),s.slots.push(l)}if(r.ik)for(let h=0;h<r.ik.length;h++){let o=r.ik[h],a=new Be(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);a.bones.push(c)}let n=s.findBone(o.target);if(!n)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);a.target=n,a.mix=C(o,"mix",1),a.softness=C(o,"softness",0)*e,a.bendDirection=C(o,"bendPositive",!0)?1:-1,a.compress=C(o,"compress",!1),a.stretch=C(o,"stretch",!1),a.uniform=C(o,"uniform",!1),s.ikConstraints.push(a)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],a=new ze(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);a.bones.push(f)}let n=o.target,l=s.findBone(n);if(!l)throw new Error(`Couldn't find target bone ${n} for transform constraint ${o.name}.`);a.target=l,a.local=C(o,"local",!1),a.relative=C(o,"relative",!1),a.offsetRotation=C(o,"rotation",0),a.offsetX=C(o,"x",0)*e,a.offsetY=C(o,"y",0)*e,a.offsetScaleX=C(o,"scaleX",0),a.offsetScaleY=C(o,"scaleY",0),a.offsetShearY=C(o,"shearY",0),a.mixRotate=C(o,"mixRotate",1),a.mixX=C(o,"mixX",1),a.mixY=C(o,"mixY",a.mixX),a.mixScaleX=C(o,"mixScaleX",1),a.mixScaleY=C(o,"mixScaleY",a.mixScaleX),a.mixShearY=C(o,"mixShearY",1),s.transformConstraints.push(a)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],a=new Ve(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);a.bones.push(f)}let n=o.target,l=s.findSlot(n);if(!l)throw new Error(`Couldn't find target slot ${n} for path constraint ${o.name}.`);a.target=l,a.positionMode=P.enumValue(Le,C(o,"positionMode","Percent")),a.spacingMode=P.enumValue(Ne,C(o,"spacingMode","Length")),a.rotateMode=P.enumValue(Oe,C(o,"rotateMode","Tangent")),a.offsetRotation=C(o,"rotation",0),a.position=C(o,"position",0),a.positionMode==0&&(a.position*=e),a.spacing=C(o,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=e),a.mixRotate=C(o,"mixRotate",1),a.mixX=C(o,"mixX",1),a.mixY=C(o,"mixY",a.mixX),s.pathConstraints.push(a)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],a=new Ss(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);const n=o.bone,l=s.findBone(n);if(l==null)throw new Error("Physics bone not found: "+n);a.bone=l,a.x=C(o,"x",0),a.y=C(o,"y",0),a.rotate=C(o,"rotate",0),a.scaleX=C(o,"scaleX",0),a.shearX=C(o,"shearX",0),a.limit=C(o,"limit",5e3)*e,a.step=1/C(o,"fps",60),a.inertia=C(o,"inertia",1),a.strength=C(o,"strength",100),a.damping=C(o,"damping",1),a.massInverse=1/C(o,"mass",1),a.wind=C(o,"wind",0),a.gravity=C(o,"gravity",0),a.mix=C(o,"mix",1),a.inertiaGlobal=C(o,"inertiaGlobal",!1),a.strengthGlobal=C(o,"strengthGlobal",!1),a.dampingGlobal=C(o,"dampingGlobal",!1),a.massGlobal=C(o,"massGlobal",!1),a.windGlobal=C(o,"windGlobal",!1),a.gravityGlobal=C(o,"gravityGlobal",!1),a.mixGlobal=C(o,"mixGlobal",!1),s.physicsConstraints.push(a)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],a=new Nt(o.name);if(o.bones)for(let n=0;n<o.bones.length;n++){let l=o.bones[n],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);a.bones.push(c)}if(o.ik)for(let n=0;n<o.ik.length;n++){let l=o.ik[n],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.transform)for(let n=0;n<o.transform.length;n++){let l=o.transform[n],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.path)for(let n=0;n<o.path.length;n++){let l=o.path[n],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.physics)for(let n=0;n<o.physics.length;n++){let l=o.physics[n],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}for(let n in o.attachments){let l=s.findSlot(n);if(!l)throw new Error(`Couldn't find slot ${n} for skin ${o.name}.`);let c=o.attachments[n];for(let d in c){let f=this.readAttachment(c[d],a,l.index,d,s);f&&a.setAttachment(l.index,d,f)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let l=n.getAttachment(a.slotIndex,a.parent);if(!l)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?l:a.mesh,a.mesh.setParentMesh(l),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],a=new Pe(h);a.intValue=C(o,"int",0),a.floatValue=C(o,"float",0),a.stringValue=C(o,"string",""),a.audioPath=C(o,"audio",null),a.audioPath&&(a.volume=C(o,"volume",1),a.balance=C(o,"balance",0)),s.events.push(a)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(t,e,s,r,i){let h=this.scale;switch(r=C(t,"name",r),C(t,"type","region")){case"region":{let o=C(t,"path",r),a=this.readSequence(C(t,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(e,r,o,a);if(!n)return null;n.path=o,n.x=C(t,"x",0)*h,n.y=C(t,"y",0)*h,n.scaleX=C(t,"scaleX",1),n.scaleY=C(t,"scaleY",1),n.rotation=C(t,"rotation",0),n.width=t.width*h,n.height=t.height*h,n.sequence=a;let l=C(t,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let a=C(t,"color",null);return a&&o.color.setFromString(a),o}case"mesh":case"linkedmesh":{let o=C(t,"path",r),a=this.readSequence(C(t,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(e,r,o,a);if(!n)return null;n.path=o;let l=C(t,"color",null);l&&n.color.setFromString(l),n.width=C(t,"width",0)*h,n.height=C(t,"height",0)*h,n.sequence=a;let c=C(t,"parent",null);if(c)return this.linkedMeshes.push(new Xi(n,C(t,"skin",null),s,c,C(t,"timelines",!0))),n;let d=t.uvs;return this.readVertices(t,n,d.length),n.triangles=t.triangles,n.regionUVs=d,n.region!=null&&n.updateRegion(),n.edges=C(t,"edges",null),n.hullLength=C(t,"hull",0)*2,n}case"path":{let o=this.attachmentLoader.newPathAttachment(e,r);if(!o)return null;o.closed=C(t,"closed",!1),o.constantSpeed=C(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,o,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<t.lengths.length;c++)n[c]=t.lengths[c]*h;o.lengths=n;let l=C(t,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,r);if(!o)return null;o.x=C(t,"x",0)*h,o.y=C(t,"y",0)*h,o.rotation=C(t,"rotation",0);let a=C(t,"color",null);return a&&o.color.setFromString(a),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,r);if(!o)return null;let a=C(t,"end",null);a&&(o.endSlot=i.findSlot(a));let n=t.vertexCount;this.readVertices(t,o,n<<1);let l=C(t,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(t){if(t==null)return null;let e=new ss(C(t,"count",0));return e.start=C(t,"start",1),e.digits=C(t,"digits",0),e.setupIndex=C(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let a=P.toFloatArray(i);if(r!=1)for(let n=0,l=i.length;n<l;n++)a[n]*=r;e.vertices=a;return}let h=new Array,o=new Array;for(let a=0,n=i.length;a<n;){let l=i[a++];o.push(l);for(let c=a+l*4;a<c;a+=4)o.push(i[a]),h.push(i[a+1]*r),h.push(i[a+2]*r),h.push(i[a+3])}e.bones=o,e.vertices=P.toFloatArray(h)}readAnimation(t,e,s){let r=this.scale,i=new Array;if(t.slots)for(let o in t.slots){let a=t.slots[o],n=s.findSlot(o);if(!n)throw new Error("Slot not found: "+o);let l=n.index;for(let c in a){let d=a[c];if(!d)continue;let f=d.length;if(c=="attachment"){let m=new mt(f,l);for(let u=0;u<f;u++){let x=d[u];m.setFrame(u,C(x,"time",0),C(x,"name",null))}i.push(m)}else if(c=="rgba"){let m=new se(f,f<<2,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,x,w.r,w.g,w.b,w.a);let b=d[p+1];if(!b){m.shrink(g);break}let y=C(b,"time",0),v=D.fromString(b.color),A=u.curve;A&&(g=_(A,m,g,p,0,x,y,w.r,v.r,1),g=_(A,m,g,p,1,x,y,w.g,v.g,1),g=_(A,m,g,p,2,x,y,w.b,v.b,1),g=_(A,m,g,p,3,x,y,w.a,v.a,1)),x=y,w=v,u=b}i.push(m)}else if(c=="rgb"){let m=new ie(f,f*3,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,x,w.r,w.g,w.b);let b=d[p+1];if(!b){m.shrink(g);break}let y=C(b,"time",0),v=D.fromString(b.color),A=u.curve;A&&(g=_(A,m,g,p,0,x,y,w.r,v.r,1),g=_(A,m,g,p,1,x,y,w.g,v.g,1),g=_(A,m,g,p,2,x,y,w.b,v.b,1)),x=y,w=v,u=b}i.push(m)}else if(c=="alpha")i.push(nt(d,new re(f,f,l),0,1));else if(c=="rgba2"){let m=new ae(f,f*7,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.light),p=D.fromString(u.dark);for(let g=0,b=0;;g++){m.setFrame(g,x,w.r,w.g,w.b,w.a,p.r,p.g,p.b);let y=d[g+1];if(!y){m.shrink(b);break}let v=C(y,"time",0),A=D.fromString(y.light),S=D.fromString(y.dark),I=u.curve;I&&(b=_(I,m,b,g,0,x,v,w.r,A.r,1),b=_(I,m,b,g,1,x,v,w.g,A.g,1),b=_(I,m,b,g,2,x,v,w.b,A.b,1),b=_(I,m,b,g,3,x,v,w.a,A.a,1),b=_(I,m,b,g,4,x,v,p.r,S.r,1),b=_(I,m,b,g,5,x,v,p.g,S.g,1),b=_(I,m,b,g,6,x,v,p.b,S.b,1)),x=v,w=A,p=S,u=y}i.push(m)}else if(c=="rgb2"){let m=new ne(f,f*6,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.light),p=D.fromString(u.dark);for(let g=0,b=0;;g++){m.setFrame(g,x,w.r,w.g,w.b,p.r,p.g,p.b);let y=d[g+1];if(!y){m.shrink(b);break}let v=C(y,"time",0),A=D.fromString(y.light),S=D.fromString(y.dark),I=u.curve;I&&(b=_(I,m,b,g,0,x,v,w.r,A.r,1),b=_(I,m,b,g,1,x,v,w.g,A.g,1),b=_(I,m,b,g,2,x,v,w.b,A.b,1),b=_(I,m,b,g,3,x,v,p.r,S.r,1),b=_(I,m,b,g,4,x,v,p.g,S.g,1),b=_(I,m,b,g,5,x,v,p.b,S.b,1)),x=v,w=A,p=S,u=y}i.push(m)}}}if(t.bones)for(let o in t.bones){let a=t.bones[o],n=s.findBone(o);if(!n)throw new Error("Bone not found: "+o);let l=n.index;for(let c in a){let d=a[c],f=d.length;if(f!=0){if(c==="rotate")i.push(nt(d,new St(f,f,l),0,1));else if(c==="translate"){let m=new Gt(f,f<<1,l);i.push(Ge(d,m,"x","y",0,r))}else if(c==="translatex"){let m=new $t(f,f,l);i.push(nt(d,m,0,r))}else if(c==="translatey"){let m=new Ht(f,f,l);i.push(nt(d,m,0,r))}else if(c==="scale"){let m=new Jt(f,f<<1,l);i.push(Ge(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new jt(f,f,l);i.push(nt(d,m,1,1))}else if(c==="scaley"){let m=new Kt(f,f,l);i.push(nt(d,m,1,1))}else if(c==="shear"){let m=new Qt(f,f<<1,l);i.push(Ge(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Zt(f,f,l);i.push(nt(d,m,0,1))}else if(c==="sheary"){let m=new te(f,f,l);i.push(nt(d,m,0,1))}else if(c==="inherit"){let m=new ee(f,n.index);for(let u=0;u<d.length;u++){let x=d[u];m.setFrame(u,C(x,"time",0),P.enumValue(Lt,C(x,"inherit","Normal")))}i.push(m)}}}}if(t.ik)for(let o in t.ik){let a=t.ik[o],n=a[0];if(!n)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),d=new oe(a.length,a.length<<1,c),f=C(n,"time",0),m=C(n,"mix",1),u=C(n,"softness",0)*r;for(let x=0,w=0;;x++){d.setFrame(x,f,m,u,C(n,"bendPositive",!0)?1:-1,C(n,"compress",!1),C(n,"stretch",!1));let p=a[x+1];if(!p){d.shrink(w);break}let g=C(p,"time",0),b=C(p,"mix",1),y=C(p,"softness",0)*r,v=n.curve;v&&(w=_(v,d,w,x,0,f,g,m,b,1),w=_(v,d,w,x,1,f,g,u,y,r)),f=g,m=b,u=y,n=p}i.push(d)}if(t.transform)for(let o in t.transform){let a=t.transform[o],n=a[0];if(!n)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),d=new he(a.length,a.length*6,c),f=C(n,"time",0),m=C(n,"mixRotate",1),u=C(n,"mixX",1),x=C(n,"mixY",u),w=C(n,"mixScaleX",1),p=C(n,"mixScaleY",w),g=C(n,"mixShearY",1);for(let b=0,y=0;;b++){d.setFrame(b,f,m,u,x,w,p,g);let v=a[b+1];if(!v){d.shrink(y);break}let A=C(v,"time",0),S=C(v,"mixRotate",1),I=C(v,"mixX",1),T=C(v,"mixY",I),M=C(v,"mixScaleX",1),Y=C(v,"mixScaleY",M),F=C(v,"mixShearY",1),R=n.curve;R&&(y=_(R,d,y,b,0,f,A,m,S,1),y=_(R,d,y,b,1,f,A,u,I,1),y=_(R,d,y,b,2,f,A,x,T,1),y=_(R,d,y,b,3,f,A,w,M,1),y=_(R,d,y,b,4,f,A,p,Y,1),y=_(R,d,y,b,5,f,A,g,F,1)),f=A,m=S,u=I,x=T,w=M,p=Y,w=M,n=v}i.push(d)}if(t.path)for(let o in t.path){let a=t.path[o],n=s.findPathConstraint(o);if(!n)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(n);for(let c in a){let d=a[c],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new ce(m,m,l);i.push(nt(d,u,0,n.positionMode==0?r:1))}else if(c==="spacing"){let u=new de(m,m,l);i.push(nt(d,u,0,n.spacingMode==0||n.spacingMode==1?r:1))}else if(c==="mix"){let u=new fe(m,m*3,l),x=C(f,"time",0),w=C(f,"mixRotate",1),p=C(f,"mixX",1),g=C(f,"mixY",p);for(let b=0,y=0;;b++){u.setFrame(b,x,w,p,g);let v=d[b+1];if(!v){u.shrink(y);break}let A=C(v,"time",0),S=C(v,"mixRotate",1),I=C(v,"mixX",1),T=C(v,"mixY",I),M=f.curve;M&&(y=_(M,u,y,b,0,x,A,w,S,1),y=_(M,u,y,b,1,x,A,p,I,1),y=_(M,u,y,b,2,x,A,g,T,1)),x=A,w=S,p=I,g=T,f=v}i.push(u)}}}if(t.physics)for(let o in t.physics){let a=t.physics[o],n=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);n=s.physicsConstraints.indexOf(l)}for(let l in a){let c=a[l],d=c[0];if(!d)continue;let f=c.length;if(l=="reset"){const u=new ye(f,n);for(let x=0;d!=null;d=c[x+1],x++)u.setFrame(x,C(d,"time",0));i.push(u);continue}let m;if(l=="inertia")m=new ue(f,f,n);else if(l=="strength")m=new me(f,f,n);else if(l=="damping")m=new ge(f,f,n);else if(l=="mass")m=new xe(f,f,n);else if(l=="wind")m=new be(f,f,n);else if(l=="gravity")m=new we(f,f,n);else if(l=="mix")m=new pe(f,f,n);else continue;i.push(nt(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let a=t.attachments[o],n=s.findSkin(o);if(!n)throw new Error("Skin not found: "+o);for(let l in a){let c=a[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let f=d.index;for(let m in c){let u=c[m],x=n.getAttachment(f,m);for(let w in u){let p=u[w],g=p[0];if(g){if(w=="deform"){let b=x.bones,y=x.vertices,v=b?y.length/3*2:y.length,A=new le(p.length,p.length,f,x),S=C(g,"time",0);for(let I=0,T=0;;I++){let M,Y=C(g,"vertices",null);if(!Y)M=b?P.newFloatArray(v):y;else{M=P.newFloatArray(v);let X=C(g,"offset",0);if(P.arrayCopy(Y,0,M,X,Y.length),r!=1)for(let B=X,N=B+Y.length;B<N;B++)M[B]*=r;if(!b)for(let B=0;B<v;B++)M[B]+=y[B]}A.setFrame(I,S,M);let F=p[I+1];if(!F){A.shrink(T);break}let R=C(F,"time",0),k=g.curve;k&&(T=_(k,A,T,I,0,S,R,0,1,1)),S=R,g=F}i.push(A)}else if(w=="sequence"){let b=new ve(p.length,f,x),y=0;for(let v=0;v<p.length;v++){let A=C(g,"delay",y),S=C(g,"time",0),I=is[C(g,"mode","hold")],T=C(g,"index",0);b.setFrame(v,S,I,T,A),y=A,g=p[v+1]}i.push(b)}}}}}}if(t.drawOrder){let o=new wt(t.drawOrder.length),a=s.slots.length,n=0;for(let l=0;l<t.drawOrder.length;l++,n++){let c=t.drawOrder[l],d=null,f=C(c,"offsets",null);if(f){d=P.newArray(a,-1);let m=P.newArray(a-f.length,0),u=0,x=0;for(let w=0;w<f.length;w++){let p=f[w],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;u!=b;)m[x++]=u++;d[u+p.offset]=u++}for(;u<a;)m[x++]=u++;for(let w=a-1;w>=0;w--)d[w]==-1&&(d[w]=m[--x])}o.setFrame(n,C(c,"time",0),d)}i.push(o)}if(t.events){let o=new Et(t.events.length),a=0;for(let n=0;n<t.events.length;n++,a++){let l=t.events[n],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Ee(P.toSinglePrecision(C(l,"time",0)),c);d.intValue=C(l,"int",c.intValue),d.floatValue=C(l,"float",c.floatValue),d.stringValue=C(l,"string",c.stringValue),d.data.audioPath&&(d.volume=C(l,"volume",1),d.balance=C(l,"balance",0)),o.setFrame(a,d)}i.push(o)}let h=0;for(let o=0,a=i.length;o<a;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new Ft(e,i,h))}},Xi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function nt(t,e,s,r){let i=t[0],h=C(i,"time",0),o=C(i,"value",s)*r,a=0;for(let n=0;;n++){e.setFrame(n,h,o);let l=t[n+1];if(!l)return e.shrink(a),e;let c=C(l,"time",0),d=C(l,"value",s)*r;i.curve&&(a=_(i.curve,e,a,n,0,h,c,o,d,r)),h=c,o=d,i=l}}function Ge(t,e,s,r,i,h){let o=t[0],a=C(o,"time",0),n=C(o,s,i)*h,l=C(o,r,i)*h,c=0;for(let d=0;;d++){e.setFrame(d,a,n,l);let f=t[d+1];if(!f)return e.shrink(c),e;let m=C(f,"time",0),u=C(f,s,i)*h,x=C(f,r,i)*h,w=o.curve;w&&(c=_(w,e,c,d,0,a,m,n,u,h),c=_(w,e,c,d,1,a,m,l,x,h)),a=m,n=u,l=x,o=f}}function _(t,e,s,r,i,h,o,a,n,l){if(t=="stepped")return e.setStepped(r),s;let c=i<<2,d=t[c],f=t[c+1]*l,m=t[c+2],u=t[c+3]*l;return e.setBezier(s,r,i,h,a,d,f,m,u,o,n),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var ks=class extends Te{constructor(t){super(t)}setFilters(t,e){}setWraps(t,e){}dispose(){}},Fi=class extends xs{constructor(t="",e=new Re){super(s=>new ks(s),t,e)}},Ri=P.newFloatArray(8),Ei=class qt{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=P.newFloatArray(8*1024);tempColor=new D;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,r=this.tempColor,i=e.color,h=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,a=h.length;o<a;o++){let n=h[o],l=n.bone;if(!l.active)continue;let c=n.getAttachment();if(!(c instanceof H))continue;c.computeWorldVertices(n,Ri,0,2);let d=c.region,f=d.texture.getImage(),m=n.color,u=c.color;r.set(i.r*m.r*u.r,i.g*m.g*u.g,i.b*m.b*u.b,i.a*m.a*u.a),s.save(),s.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let x=c.width/d.originalWidth;s.scale(x*c.scaleX,x*c.scaleY);let w=d.width,p=d.height;if(s.translate(w/2,p/2),c.region.degrees==90){let g=w;w=p,p=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-w/2,-p/2),s.globalAlpha=r.a,s.drawImage(f,f.width*d.u,f.height*d.v,w,p,0,0,w,p),this.debugRendering&&s.strokeRect(0,0,w,p),s.restore()}}drawTriangles(e){let s=this.ctx,r=this.tempColor,i=e.color,h=e.drawOrder,o=null,a=this.vertices,n=null;for(let c=0,d=h.length;c<d;c++){let f=h[c],m=f.getAttachment(),u,x;if(m instanceof H){let w=m;a=this.computeRegionVertices(f,w,!1),n=qt.QUAD_TRIANGLES,u=w.region.texture.getImage()}else if(m instanceof Ct){let w=m;a=this.computeMeshVertices(f,w,!1),n=w.triangles,u=w.region.texture.getImage()}else continue;if(u){f.data.blendMode!=o&&(o=f.data.blendMode);let w=f.color,p=m.color;r.set(i.r*w.r*p.r,i.g*w.g*p.g,i.b*w.b*p.b,i.a*w.a*p.a),s.globalAlpha=r.a;for(var l=0;l<n.length;l+=3){let g=n[l]*8,b=n[l+1]*8,y=n[l+2]*8,v=a[g],A=a[g+1],S=a[g+6],I=a[g+7],T=a[b],M=a[b+1],Y=a[b+6],F=a[b+7],R=a[y],k=a[y+1],X=a[y+6],B=a[y+7];this.drawTriangle(u,v,A,S,I,T,M,Y,F,R,k,X,B),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,A),s.lineTo(T,M),s.lineTo(R,k),s.lineTo(v,A),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,r,i,h,o,a,n,l,c,d,f,m){let u=this.ctx;const x=e.width-1,w=e.height-1;i*=x,h*=w,n*=x,l*=w,f*=x,m*=w,u.beginPath(),u.moveTo(s,r),u.lineTo(o,a),u.lineTo(c,d),u.closePath(),o-=s,a-=r,c-=s,d-=r,n-=i,l-=h,f-=i,m-=h;let p=n*m-f*l;if(p==0)return;p=1/p;const g=(m*o-l*c)*p,b=(m*a-l*d)*p,y=(n*c-f*o)*p,v=(n*d-f*a)*p,A=s-g*i-y*h,S=r-b*i-v*h;u.save(),u.transform(g,b,y,v,A,S),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,r){let i=e.bone.skeleton.color,h=e.color,o=s.color,a=i.a*h.a*o.a,n=r?a:1,l=this.tempColor;l.set(i.r*h.r*o.r*n,i.g*h.g*o.g*n,i.b*h.b*o.b*n,a),s.computeWorldVertices(e,this.vertices,0,qt.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[H.C1R]=l.r,c[H.C1G]=l.g,c[H.C1B]=l.b,c[H.C1A]=l.a,c[H.U1]=d[0],c[H.V1]=d[1],c[H.C2R]=l.r,c[H.C2G]=l.g,c[H.C2B]=l.b,c[H.C2A]=l.a,c[H.U2]=d[2],c[H.V2]=d[3],c[H.C3R]=l.r,c[H.C3G]=l.g,c[H.C3B]=l.b,c[H.C3A]=l.a,c[H.U3]=d[4],c[H.V3]=d[5],c[H.C4R]=l.r,c[H.C4G]=l.g,c[H.C4B]=l.b,c[H.C4A]=l.a,c[H.U4]=d[6],c[H.V4]=d[7],c}computeMeshVertices(e,s,r){let i=e.bone.skeleton.color,h=e.color,o=s.color,a=i.a*h.a*o.a,n=r?a:1,l=this.tempColor;l.set(i.r*h.r*o.r*n,i.g*h.g*o.g*n,i.b*h.b*o.b*n,a);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=P.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,qt.VERTEX_SIZE);let f=s.uvs;for(let m=0,u=0,x=2;m<c;m++)d[x++]=l.r,d[x++]=l.g,d[x++]=l.b,d[x++]=l.a,d[x++]=f[u++],d[x++]=f[u++],x+=2;return d}};export{re as AlphaTimeline,Ft as Animation,qs as AnimationState,Ws as AnimationStateAdapter,Us as AnimationStateData,Fi as AssetManager,xs as AssetManagerBase,Gs as AtlasAttachmentLoader,_t as Attachment,mt as AttachmentTimeline,Cs as BinaryInput,Ue as BlendMode,Fe as Bone,Xe as BoneData,Ie as BoundingBoxAttachment,ds as CURRENT,ks as CanvasTexture,ke as ClippingAttachment,D as Color,kt as ConstraintData,at as CurveTimeline,it as CurveTimeline1,Rt as CurveTimeline2,Ns as DebugUtils,le as DeformTimeline,Re as Downloader,wt as DrawOrderTimeline,Ee as Event,Pe as EventData,os as EventQueue,Et as EventTimeline,hs as EventType,Ae as FIRST,zs as FakeTexture,Bt as HOLD_FIRST,cs as HOLD_MIX,Se as HOLD_SUBSEQUENT,bs as IkConstraint,Be as IkConstraintData,oe as IkConstraintTimeline,Lt as Inherit,ee as InheritTimeline,Vs as IntSet,ts as Interpolation,E as MathUtils,Ct as MeshAttachment,as as MixBlend,ns as MixDirection,It as PathAttachment,ws as PathConstraint,Ve as PathConstraintData,fe as PathConstraintMixTimeline,ce as PathConstraintPositionTimeline,de as PathConstraintSpacingTimeline,As as Physics,ge as PhysicsConstraintDampingTimeline,we as PhysicsConstraintGravityTimeline,ue as PhysicsConstraintInertiaTimeline,xe as PhysicsConstraintMassTimeline,pe as PhysicsConstraintMixTimeline,ye as PhysicsConstraintResetTimeline,me as PhysicsConstraintStrengthTimeline,dt as PhysicsConstraintTimeline,be as PhysicsConstraintWindTimeline,gs as PointAttachment,At as Pool,Le as PositionMode,es as Pow,Ls as PowOut,ne as RGB2Timeline,ae as RGBA2Timeline,se as RGBATimeline,ie as RGBTimeline,H as RegionAttachment,Oe as RotateMode,St as RotateTimeline,Ce as SETUP,Pt as SUBSEQUENT,Jt as ScaleTimeline,jt as ScaleXTimeline,Kt as ScaleYTimeline,ve as SequenceTimeline,Qt as ShearTimeline,Zt as ShearXTimeline,te as ShearYTimeline,vs as Skeleton,Hs as SkeletonBinary,Ti as SkeletonBounds,Yi as SkeletonClipping,De as SkeletonData,Mi as SkeletonJson,Ei as SkeletonRenderer,Nt as Skin,qe as SkinEntry,ps as Slot,We as SlotData,Ne as SpacingMode,zt as StringSet,Te as Texture,Ye as TextureAtlas,ms as TextureAtlasPage,Me as TextureAtlasRegion,Vt as TextureFilter,us as TextureRegion,fs as TextureWrap,Os as TimeKeeper,J as Timeline,ls as TrackEntry,ys as TransformConstraint,ze as TransformConstraintData,he as TransformConstraintTimeline,Gt as TranslateTimeline,$t as TranslateXTimeline,Ht as TranslateYTimeline,Is as Triangulator,P as Utils,Xt as Vector2,ot as VertexAttachment,Ds as WindowedMean};