@esotericsoftware/spine-canvas 4.2.116 → 4.3.0

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 Ns=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}},_e=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}},D=class ge{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new ge(1,1,1,1);static RED=new ge(1,0,0,1);static GREEN=new ge(0,1,0,1);static BLUE=new ge(0,0,1,1);static MAGENTA=new ge(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,r){return this.r+=t,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new ge){return s.setFromString(t)}},R=class le{static PI=3.1415927;static PI2=le.PI*2;static invPI2=1/le.PI2;static radiansToDegrees=180/le.PI;static radDeg=le.radiansToDegrees;static degreesToRadians=le.PI/180;static degRad=le.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*le.degRad)}static sinDeg(t){return Math.sin(t*le.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*le.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return le.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),h=s-t;return r<=(i-t)/h?t+Math.sqrt(r*h*(i-t)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ts=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ss=class extends ts{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}},Os=class extends ss{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},P=class pe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,r,h){for(let o=s,a=r;o<s+h;o++,a++)i[a]=t[o]}static arrayFill(t,s,i,r){for(let h=s;h<i;h++)t[h]=r}static setArraySize(t,s,i=0){let r=t.length;if(r==s)return t;if(t.length=s,r<s)for(let h=r;h<s;h++)t[h]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:pe.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r<t;r++)i[r]=s;return i}static newFloatArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return pe.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return pe.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,i=!0){for(var r=0;r<t.length;r++)if(t[r]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Ds=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)}}},Ae=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}},Xe=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}},qs=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)}},Ws=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}},Ge=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},oe=class Ms extends Ge{static nextID=0;id=Ms.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,i,r,h,o){i=h+(i>>1)*o;let a=t.bone.skeleton,n=t.deform,l=this.vertices,c=this.bones;if(!c){n.length>0&&(l=n);let u=t.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<i;v+=2,A+=o){let S=l[v],I=l[v+1];r[A]=S*p+I*g+x,r[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<i;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}r[u]=w,r[u+1]=p}else{let u=n;for(let x=h,w=f*3,p=f<<1;x<i;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}r[x]=g,r[x+1]=b}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},is=class Oe{static _nextID=0;id=Oe.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Oe(this.regions.length);return P.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(t,s){let i=t,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return Oe._nextID++}},rs=(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))(rs||{}),as=[0,1,2,3,4,5,6],Fe=class{name;timelines=[];timelineIds=new _e;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,r,h,o,a){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let n=this.timelines;for(let l=0,c=n.length;l<c;l++)n[l].apply(e,t,s,r,h,o,a)}},ns=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(ns||{}),ls=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ls||{}),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=P.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 r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}},ae=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=P.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=P.newFloatArray(t);P.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,r,h,o,a,n,l,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+a)*.03,u=(r-o*2+n)*.03,x=((h-a)*3-i+l)*.006,w=((o-n)*3-r+c)*.006,p=m*2+x,g=u*2+w,b=(h-i)*.3+m+x*.16666667,y=(o-r)*.3+u+w*.16666667,v=i+b,A=r+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(e,t,s,i){let r=this.curves;if(r[i]>e){let n=this.frames[t],l=this.frames[t+s];return l+(e-n)/(r[i]-n)*(r[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=e){let n=r[i-2],l=r[i-1];return l+(e-n)/(r[i]-n)*(r[i+1]-l)}t+=this.getFrameEntries();let o=r[h-2],a=r[h-1];return a+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-a)}},ie=class extends ae{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 r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],h=t[s+1];return h+(e-r)/(t[s+2]-r)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return r+h*t;case 1:case 2:h+=r-i}return i+h*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);return s==0?r+(h-r)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,r,h){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}return s==0?r+(h-r)*t:i+(h-i)*t}getScaleValue(e,t,s,i,r,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return r+(h-r)*t}return r}let a=this.getCurveValue(e)*h;if(t==1)return s==3?r+a-h:a;if(i==1)switch(s){case 0:return h+(Math.abs(a)*R.signum(h)-h)*t;case 1:case 2:return r+(Math.abs(a)*R.signum(r)-r)*t}else{let n=0;switch(s){case 0:return n=Math.abs(h)*R.signum(a),n+(a-n)*t;case 1:case 2:return n=Math.abs(r)*R.signum(a),n+(a-n)*t}}return r+(a-h)*t}},Ee=class extends ae{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}},Se=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,r,h,a.rotation,a.data.rotation))}},$e=class extends Ee{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.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)*r,a.y+=(a.data.y-a.y)*r}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*r,a.y=a.data.y+c*r;break;case 1:case 2:a.x+=(a.data.x+l-a.x)*r,a.y+=(a.data.y+c-a.y)*r;break;case 3:a.x+=l*r,a.y+=c*r}}},He=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,r,h,a.x,a.data.x))}},Je=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,r,h,a.y,a.data.y))}},je=class extends Ee{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.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)*r,a.scaleY+=(a.data.scaleY-a.scaleY)*r}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,r==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)*R.signum(m)-m)*r,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*r;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*r,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*r;break;case 3:a.scaleX+=(l-a.data.scaleX)*r,a.scaleY+=(c-a.data.scaleY)*r}else switch(h){case 0:m=Math.abs(a.data.scaleX)*R.signum(l),u=Math.abs(a.data.scaleY)*R.signum(c),a.scaleX=m+(l-m)*r,a.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(a.scaleX)*R.signum(l),u=Math.abs(a.scaleY)*R.signum(c),a.scaleX=m+(l-m)*r,a.scaleY=u+(c-u)*r;break;case 3:a.scaleX+=(l-a.data.scaleX)*r,a.scaleY+=(c-a.data.scaleY)*r}}}},Ke=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,r,h,o,a.scaleX,a.data.scaleX))}},Qe=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,r,h,o,a.scaleY,a.data.scaleY))}},Ze=class extends Ee{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.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)*r,a.shearY+=(a.data.shearY-a.shearY)*r}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*r,a.shearY=a.data.shearY+c*r;break;case 1:case 2:a.shearX+=(a.data.shearX+l-a.shearX)*r,a.shearY+=(a.data.shearY+c-a.shearY)*r;break;case 3:a.shearX+=l*r,a.shearY+=c*r}}},et=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,r,h,a.shearX,a.data.shearX))}},tt=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,r,h,a.shearY,a.data.shearY))}},st=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,r,h,o){let a=e.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]}},it=class extends ae{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,r,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h}apply(e,t,s,i,r,h,o){let a=e.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)*r,(w.g-l.g)*r,(w.b-l.b)*r,(w.a-l.a)*r)}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)}r==1?l.set(c,d,f,m):(h==0&&l.setFromColor(a.data.color),l.add((c-l.r)*r,(d-l.g)*r,(f-l.b)*r,(m-l.a)*r))}},rt=class extends ae{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r}apply(e,t,s,i,r,h,o){let a=e.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)*r,l.g+=(x.g-l.g)*r,l.b+=(x.b-l.b)*r}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(r==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)*r,l.g+=(d-l.g)*r,l.b+=(f-l.b)*r}}},at=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,q.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,h,o){let a=e.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)*r}return}let l=this.getCurveValue(s);r==1?n.a=l:(h==0&&(n.a=a.data.color.a),n.a+=(l-n.a)*r)}},nt=class extends ae{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,r,h,o,a,n){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=a,this.frames[e+7]=n}apply(e,t,s,i,r,h,o){let a=e.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)*r,(y.g-l.g)*r,(y.b-l.b)*r,(y.a-l.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}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(r==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)*r,(f-l.g)*r,(m-l.b)*r,(u-l.a)*r),c.r+=(x-c.r)*r,c.g+=(w-c.g)*r,c.b+=(p-c.b)*r}}},lt=class extends ae{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,r,h,o,a){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=a}apply(e,t,s,i,r,h,o){let a=e.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)*r,l.g+=(y.g-l.g)*r,l.b+=(y.b-l.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}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(r==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)*r,l.g+=(f-l.g)*r,l.b+=(m-l.b)*r,c.r+=(x-c.r)*r,c.g+=(w-c.g)*r,c.b+=(p-c.b)*r}}},me=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,r,h,o){let a=e.slots[this.slotIndex];if(a.bone.active){if(o==1){h==0&&this.setAttachment(e,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,a,a.data.attachmentName);return}this.setAttachment(e,a,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ot=class extends ae{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,r,h,o,a,n,l,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+a)*.03,u=n*.03-o*.06,x=((h-a)*3-i+l)*.006,w=(o-n+.33333333)*.018,p=m*2+x,g=u*2+w,b=(h-i)*.3+m+x*.16666667,y=o*.3+u+w*.16666667,v=i+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(e,t){let s=this.curves,i=s[t];switch(i){case 0:let a=this.frames[t];return(e-a)/(this.frames[t+this.getFrameEntries()]-a);case 1:return 0}if(i-=2,s[i]>e){let a=this.frames[t];return s[i+1]*(e-a)/(s[i]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=e){let a=s[i-2],n=s[i-1];return n+(e-a)/(s[i]-a)*(s[i+1]-n)}let h=s[r-2],o=s[r-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof oe)||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(r==1){l.length=0;return}l.length=d;let g=n;if(g.bones){r=1-r;for(var m=0;m<d;m++)l[m]*=r}else{let b=g.vertices;for(var m=0;m<d;m++)l[m]+=(b[m]-l[m])*r}}return}if(l.length=d,s>=f[f.length-1]){let g=c[f.length-1];if(r==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]*r;else{let v=y.vertices;for(let A=0;A<d;A++){let S=v[A];l[A]=S+(g[A]-S)*r}}break}case 1:case 2:for(let y=0;y<d;y++)l[y]+=(g[y]-l[y])*r;break;case 3:let b=n;if(b.bones)for(let y=0;y<d;y++)l[y]+=g[y]*r;else{let y=b.vertices;for(let v=0;v<d;v++)l[v]+=(g[v]-y[v])*r}}return}let u=J.search1(f,s),x=this.getCurvePercent(s,u),w=c[u],p=c[u+1];if(r==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)*r}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)*r}}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])*r}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)*r}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])*r}}}}},Re=class Xs extends J{static propertyIds=[""+q.event];events;constructor(t){super(t,Xs.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,r,h,o,a){if(!r)return;let n=this.frames,l=this.frames.length;if(s>i)this.apply(t,s,Number.MAX_VALUE,r,h,o,a),s=-1;else if(s>=n[l-1])return;if(i<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&&i>=n[c];c++)r.push(this.events[c])}},we=class Fs extends J{static propertyIds=[""+q.drawOrder];drawOrders;constructor(t){super(t,Fs.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,h,o,a){if(a==1){o==0&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(o==0||o==1)&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let n=J.search1(this.frames,i),l=this.drawOrders[n];if(!l)P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,d=t.slots;for(let f=0,m=l.length;f<m;f++)c[f]=d[l[f]]}}},ht=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,[q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,r,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,r,h,o){let a=e.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)*r,a.softness+=(a.data.softness-a.softness)*r,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)*r,a.softness=a.data.softness+(c-a.data.softness)*r,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)*r,a.softness+=(c-a.softness)*r,o==0&&(a.bendDirection=n[d+3],a.compress=n[d+4]!=0,a.stretch=n[d+5]!=0))}},ct=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,[q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,o,a){let n=this.frames;e*=7,n[e]=t,n[e+1]=s,n[e+2]=i,n[e+3]=r,n[e+4]=h,n[e+5]=o,n[e+6]=a}apply(e,t,s,i,r,h,o){let a=e.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)*r,a.mixX+=(p.mixX-a.mixX)*r,a.mixY+=(p.mixY-a.mixY)*r,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*r,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*r,a.mixShearY+=(p.mixShearY-a.mixShearY)*r}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)*r,a.mixX=p.mixX+(c-p.mixX)*r,a.mixY=p.mixY+(d-p.mixY)*r,a.mixScaleX=p.mixScaleX+(f-p.mixScaleX)*r,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*r,a.mixShearY=p.mixShearY+(u-p.mixShearY)*r}else a.mixRotate+=(l-a.mixRotate)*r,a.mixX+=(c-a.mixX)*r,a.mixY+=(d-a.mixY)*r,a.mixScaleX+=(f-a.mixScaleX)*r,a.mixScaleY+=(m-a.mixScaleY)*r,a.mixShearY+=(u-a.mixShearY)*r}},dt=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,o){let a=e.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,r,h,a.position,a.data.position))}},ft=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,o){let a=e.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,r,h,a.spacing,a.data.spacing))}},ut=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,[q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=r}apply(e,t,s,i,r,h,o){let a=e.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)*r,a.mixX+=(a.data.mixX-a.mixX)*r,a.mixY+=(a.data.mixY-a.mixY)*r}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)*r,a.mixX=u.mixX+(c-u.mixX)*r,a.mixY=u.mixY+(d-u.mixY)*r}else a.mixRotate+=(l-a.mixRotate)*r,a.mixX+=(c-a.mixX)*r,a.mixY+=(d-a.mixY)*r}},de=class extends ie{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,o){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,r,h,this.get(l),this.setup(l),n))}else a=e.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,r,h,this.get(a),this.setup(a)))}},mt=class extends de{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}},gt=class extends de{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}},xt=class extends de{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}},bt=class extends de{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}},wt=class extends de{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}},pt=class extends de{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}},yt=class extends de{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}},vt=class Es extends J{static propertyIds=[q.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Es.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,h,o,a){let n;if(this.constraintIndex!=-1&&(n=t.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],h,o,a),s=-1;else if(s>=l[l.length-1])return;if(!(i<l[0])&&(s<l[0]||i>=l[J.search1(l,s)+1]))if(n!=null)n.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},At=class fe extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[q.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return fe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,h){let o=this.frames;t*=fe.ENTRIES,o[t]=s,o[t+fe.MODE]=i|r<<4,o[t+fe.DELAY]=h}apply(t,s,i,r,h,o,a){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,c=this.attachment;if(l!=c&&(!(l instanceof oe)||l.timelineAttachment!=c))return;if(a==1){o==0&&(n.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==0||o==1)&&(n.sequenceIndex=-1);return}let f=J.search(d,i,fe.ENTRIES),m=d[f],u=d[f+fe.MODE],x=d[f+fe.DELAY];if(!this.attachment.sequence)return;let w=u>>4,p=this.attachment.sequence.regions.length,g=as[u&15];if(g!=0)switch(w+=(i-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}},Us=class De{static _emptyAnimation=new Fe("<empty>",[],0);static emptyAnimation(){return De._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new hs(this);propertyIDs=new _e;animationsChanged=!1;trackEntryPool=new Ae(()=>new os);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=t*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+t)*a.timeScale,h.trackTime+=o,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){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(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;r=!0;let x=f==0?1:u.mixBlend,w=u.alpha;u.mixingFrom?w*=this.applyMixingFrom(u,t,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 me?this.applyAttachmentTimeline(h,t,y,x,p):h.apply(t,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],E=I[Y]==Pe?x:0;!T&&F instanceof Se?this.applyRotateTimeline(F,t,y,w,E,u.timelinesRotation,Y<<1,M):F instanceof me?this.applyAttachmentTimeline(F,t,y,x,p):(P.webkit602BugfixHelper(w,x),F.apply(t,g,y,v,w,E,0))}}this.queueEvents(u,b),s.length=0,u.nextAnimationLast=b,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+It,a=t.slots,n=0,l=t.slots.length;n<l;n++){var c=a[n];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,s,i){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;t.mixDuration==0?(h=1,i==1&&(i=0)):(h=t.mixTime/t.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let o=h<r.mixAttachmentThreshold,a=h<r.mixDrawOrderThreshold,n=r.animation.timelines,l=n.length,c=r.alpha*t.interruptAlpha,d=c*(1-h),f=r.animationLast,m=r.getAnimationTime(),u=m,x=null;if(r.reverse?u=r.animation.duration-u:h<r.eventThreshold&&(x=this.events),i==3)for(let w=0;w<l;w++)n[w].apply(s,f,u,x,d,i,1);else{let w=r.timelineMode,p=r.timelineHoldMix,g=r.shortestRotation,b=!g&&r.timelinesRotation.length!=l<<1;b&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let y=0;y<l;y++){let v=n[y],A=1,S,I=0;switch(w[y]){case Pe:if(!a&&v instanceof we)continue;S=i,I=d;break;case St:S=0,I=d;break;case Ct:S=i,I=c;break;case Be:S=0,I=c;break;default:S=0;let T=p[y];I=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=I,!g&&v instanceof Se?this.applyRotateTimeline(v,s,u,I,S,r.timelinesRotation,y<<1,b):v instanceof me?this.applyAttachmentTimeline(v,s,u,S,o&&I>=r.alphaAttachmentThreshold):(P.webkit602BugfixHelper(I,i),a&&v instanceof we&&S==0&&(A=0),v.apply(s,f,u,x,I,S,A))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(t,s,i,r,h){var o=s.slots[t.slotIndex];o.bone.active&&(i<t.frames[0]?(r==0||r==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,t.attachmentNames[J.search1(t.frames,i)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+It))}setAttachment(t,s,i,r){s.setAttachment(i?t.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+fs)}applyRotateTimeline(t,s,i,r,h,o,a,n){if(n&&(o[a]=0),r==1){t.apply(s,0,i,null,1,h,0);return}let l=s.bones[t.boneIndex];if(!l.active)return;let c=t.frames,d=0,f=0;if(i<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+t.getCurveValue(i);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&&R.signum(w)!=R.signum(u)&&(Math.abs(x-p)>180?(m+=360*R.signum(x),b=g):p!=0?m-=360*R.signum(x):b=g),b!=g&&(m+=360*R.signum(x)),o[a]=m}o[a+1]=u,l.rotation=d+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,h=r-i,o=t.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>r||this.queue.event(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=r&&t.animationLast<r;for(c&&this.queue.complete(t);n<l;n++){let d=a[n];d.time<i||this.queue.event(t,d)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let o=this.trackEntry(t,s,i,h);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,i,r)}addAnimationWith(t,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(t,s,i,h);return h?(h.next=o,o.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,De.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,De.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let h=this.tracks[i];h&&this.setEmptyAnimation(h.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(P.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,h.animation=s,h.loop=i,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=r?this.data.getMix(r.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let s=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,h=t.timelineMode;h.length=r;let o=t.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<r;n++)h[n]=a.addAll(i[n].getPropertyIds())?Be:Ct;return}e:for(let n=0;n<r;n++){let l=i[n],c=l.getPropertyIds();if(!a.addAll(c))h[n]=Pe;else if(!s||l instanceof me||l instanceof we||l instanceof Re||!s.animation.hasTimeline(c))h[n]=St;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(t.mixDuration>0){h[n]=ds,o[n]=d;continue e}break}h[n]=Be}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},os=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}},hs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t<e.length;t+=2){let s=e[t],i=e[t+1],r=this.animState.listeners.slice();switch(s){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<r.length;o++){let a=r[o];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<r.length;o++){let a=r[o];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<r.length;o++){let a=r[o];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<r.length;o++){let a=r[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<r.length;o++){let a=r[o];a.complete&&a.complete(i)}break;case 5:let h=e[t+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<r.length;o++){let a=r[o];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},cs=(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))(cs||{}),zs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Pe=0,St=1,Ct=2,Be=3,ds=4,It=1,fs=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 r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,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}},kt=class Rs extends oe{color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Rs(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Tt=class Ps extends oe{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ps(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Yt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ve=(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))(Ve||{}),us=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(us||{}),ms=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Gs=class extends Yt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Mt=class{pages=new Array;regions=new Array;constructor(e){let t=new $s(e),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=P.enumValue(Ve,s[1]),l.magFilter=P.enumValue(Ve,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},i.pma=l=>{l.pma=s[1]=="true"};var r={};r.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},r.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},r.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},r.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},r.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},r.index=l=>{l.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let o=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let l=new Xt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=r[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 gs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=i[s[0]];l&&l(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()}},$s=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,r=s+1;;i++){let h=t.indexOf(",",r);if(h==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},gs=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}},Xt=class extends ms{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)}},Ce=class Ht extends oe{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(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=P.newFloatArray(t.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,o=0,a=0;if(this.region instanceof Xt){let n=this.region,l=n.page,c=l.width,d=l.height;switch(n.degrees){case 90:r-=(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<i;f+=2)s[f]=r+t[f+1]*o,s[f+1]=h+(1-t[f])*a;return;case 180:r-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/d,o=n.originalWidth/c,a=n.originalHeight/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f])*o,s[f+1]=h+(1-t[f+1])*a;return;case 270:r-=n.offsetY/c,h-=n.offsetX/d,o=n.originalHeight/c,a=n.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f+1])*o,s[f+1]=h+t[f]*a;return}r-=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-r,a=this.region.v2-h):(r=h=0,o=a=1);for(let n=0;n<i;n+=2)s[n]=r+t[n]*o,s[n+1]=h+t[n+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Ht(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,i,r,h,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,h,o)}newLinkedMesh(){let t=new Ht(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},Ie=class Bs extends oe{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Bs(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},xs=class Vs extends oe{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*R.degRad,i=Math.cos(s),r=Math.sin(s),h=i*t.a+r*t.b,o=i*t.c+r*t.d;return R.atan2Deg(o,h)}copy(){let t=new Vs(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},H=class Ls extends Ge{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(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==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 i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,a=h+this.region.width*i,n=o+this.region.height*r,l=this.rotation*R.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,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,i,r){this.sequence!=null&&this.sequence.apply(t,this);let h=t.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[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n,i+=r,m=o[2],u=o[3],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n,i+=r,m=o[4],u=o[5],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n,i+=r,m=o[6],u=o[7],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n}copy(){let t=new Ls(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,P.arrayCopy(this.uvs,0,t.uvs,0,8),P.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}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},Hs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let o=s.getPath(t,r),a=this.atlas.findRegion(o);if(a==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[r]=a}}newRegionAttachment(e,t,s,i){let r=new H(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=h}return r}newMeshAttachment(e,t,s,i){let r=new Ce(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=h}return r}newBoundingBoxAttachment(e,t){return new kt(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new xs(t)}newClippingAttachment(e,t){return new Tt(t)}},Ft=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(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}},Le=(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))(Le||{}),Et=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,r,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,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)*R.degRad,w=(s+90+o)*R.degRad;this.a=Math.cos(x)*i*m,this.b=Math.cos(w)*r*m,this.c=Math.sin(x)*i*u,this.d=Math.sin(w)*r*u,this.worldX=e*m+f.x,this.worldY=t*u+f.y;return}let n=a.a,l=a.b,c=a.c,d=a.d;switch(this.worldX=n*e+l*t+a.worldX,this.worldY=c*e+d*t+a.worldY,this.inherit){case 0:{const f=(s+h)*R.degRad,m=(s+90+o)*R.degRad,u=Math.cos(f)*i,x=Math.cos(m)*r,w=Math.sin(f)*i,p=Math.sin(m)*r;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)*R.degRad,m=(s+90+o)*R.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;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)*R.radDeg):(n=0,c=0,x=90-Math.atan2(d,l)*R.radDeg);const w=(s+h-x)*R.degRad,p=(s+o-x+90)*R.degRad,g=Math.cos(w)*i,b=Math.cos(p)*r,y=Math.sin(w)*i,v=Math.sin(p)*r;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*=R.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*=R.degRad,o=(90+o)*R.degRad;const b=Math.cos(h)*i,y=Math.cos(o)*r,v=Math.sin(h)*i,A=Math.sin(o)*r;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 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)*R.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)*R.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,h=1/(t*r-s*i),o=r*h,a=s*h,n=i*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.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(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*r-s*i),o=r*h,a=s*h;break}case 3:case 4:let w=R.cosDeg(this.rotation),p=R.sinDeg(this.rotation);t=(t*w+s*p)/this.skeleton.scaleX,i=(i*w+r*p)/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&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=R.PI/2+Math.atan2(i,t);s=Math.cos(b)*g,r=Math.sin(b)*g,h=1/(t*r-s*i),o=r*h,a=s*h,n=i*h,l=t*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)*R.radDeg,this.arotation=Math.atan2(u,f)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,m)*R.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*R.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=R.sinDeg(e),s=R.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*R.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=R.sinDeg(e),s=R.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*R.radDeg}rotateWorld(e){e*=R.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},ke=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},bs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Rt,i=new ws){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{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.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),i(h)},(h,o)=>{const a=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,a),r(a)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),i(h)},(h,o)=>{const a=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,a),r(a)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[e],r=i!==void 0;return r&&(this.cache.assetsLoaded[e]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(t,e,h),h)).catch(h=>this.error(s,e,h))),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.createTexture(e,a);this.success(t,e,n),i(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.createTexture(e,a);this.success(t,e,n),i(n)},a.onerror=()=>{const n=`Couldn't load image: ${e}`;this.error(s,e,n),r(n)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),a.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),h=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,a)=>{this.downloader.downloadText(e,n=>{try{const l=this.createTextureAtlas(e,n);let c=l.pages.length,d=!1;if(c===0){this.success(t,e,l),o(l);return}for(let f of l.pages)this.loadTexture(i?i[f.name]:h+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(t,e,l),o(l)))},(m,u)=>{if(!d){const x=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,x),a(x)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),a(c)}},(n,l)=>{const c=`Couldn't load texture atlas ${e}: status ${n}, ${l}`;this.error(s,e,c),a(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,h)=>{this.downloader.downloadText(e,o=>{try{const a=this.createTextureAtlas(e,o);this.success(t,e,a),r(a)}catch(a){const n=`Couldn't parse texture atlas ${e}: ${a.message}`;this.error(s,e,n),h(n)}},(o,a)=>{const n=`Couldn't load texture atlas ${e}: status ${o}, ${a}`;this.error(s,e,n),h(n)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(r))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.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.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof Mt){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new Mt(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&i()},s}},ws=class qe{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=qe.AVAILABLE_CACHES.get(t);if(s)return s;const i=new qe;return qe.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Rt=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),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let h=()=>{this.finish(e,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let h=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):h()},r.onerror=h,r.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 r=t==200||t==0?[s]:[t,s];for(let h=r.length-1,o=i.length;h<o;h+=2)i[h].apply(null,r)}},Pt=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}},Bt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ps=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 r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}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,r,h,o){let a=e.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=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*R.signum(e.skeleton.scaleX),u=(s-e.worldY)*R.signum(e.skeleton.scaleY);break;case 2:let p=Math.abs(n*d-l*c)/Math.max(1e-4,n*n+c*c),g=n/e.skeleton.scaleX,b=c/e.skeleton.scaleY;l=-b*p*e.skeleton.scaleX,d=g*p*e.skeleton.scaleY,f+=Math.atan2(b,g)*R.radDeg;default:let y=t-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-e.ax,u=(v*n-y*c)/A-e.ay)}f+=Math.atan2(u,m)*R.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=e.ascaleX,w=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const p=e.data.length*x;if(p>1e-4){const g=m*m+u*u;if(i&&g<p*p||r&&g>p*p){const b=(Math.sqrt(g)/p-1)*o+1;x*=b,h&&(w*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,x,w,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,h,o,a,n){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,u=f,x=t.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=t.ax,y=0,v=0,A=0,S=e.a,I=e.b,T=e.c,M=e.d,Y=Math.abs(d-f)<=1e-4;!Y||h?(y=0,v=S*b+e.worldX,A=T*b+e.worldY):(y=t.ay,v=S*b+I*y+e.worldX,A=T*b+M*y+e.worldY);let F=e.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 E=S*M-I*T,k=v-F.worldX,X=A-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let B=(k*M-X*I)*E-l,N=(X*S-k*T)*E-c,L=Math.sqrt(B*B+N*N),O=t.data.length*x,$,z;if(L<1e-4){this.apply1(e,s,i,!1,h,!1,n),t.updateWorldTransformWith(b,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}k=s-F.worldX,X=i-F.worldY;let j=(k*M-X*I)*E-l,V=(X*S-k*T)*E-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}}e:if(Y){O*=d;let K=(W-L*L-O*O)/(2*L*O);K<-1?(K=-1,z=Math.PI*r):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)*r,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 re=-2*Q*L,xe=Q-K;if(M=re*re-4*xe*T,M>=0){let be=Math.sqrt(M);re<0&&(be=-be),be=-(re+be)*.5;let ve=be/xe,es=T/be,Me=Math.abs(ve)<Math.abs(es)?ve:es;if(ve=W-Me*Me,ve>=0){X=Math.sqrt(ve)*r,$=Z-Math.atan2(X,Me),z=Math.atan2(X/f,(Me-L)/d);break e}}let ye=R.PI,Te=L-S,Ue=Te*Te,Kt=0,Qt=0,Ye=L+S,ze=Ye*Ye,Zt=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<Ue&&(ye=T,Ue=M,Te=k,Kt=X),M>ze&&(Qt=T,ze=M,Ye=k,Zt=X)),W<=(Ue+ze)*.5?($=Z-Math.atan2(Kt*r,Te),z=ye*r):($=Z-Math.atan2(Zt*r,Ye),z=Qt*r)}let G=Math.atan2(y,b)*g,te=e.arotation;$=($-G)*R.radDeg+w-te,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(l,c,te+$*n,m,u,0,0),te=t.arotation,z=((z+G)*R.radDeg-t.ashearX)*g+p-te,z>180?z-=360:z<-180&&(z+=360),t.updateWorldTransformWith(b,y,te+z*n,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Vt=class extends ke{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)}},Lt=class extends ke{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=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Nt=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Nt||{}),Ot=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Ot||{}),Dt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Dt||{}),ys=class ue{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(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0,h=t.bones.length;r<h;r++){let o=s.findBone(t.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof Ie))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==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<ue.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<ue.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?R.degRad:-R.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(w-A.worldX)*r,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)*i+1;A.a*=F,A.c*=F}}if(w=S,p=I,i>0){let Y=A.a,F=A.b,E=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(E,Y),b){B=Math.cos(X),N=Math.sin(X);let L=A.data.length;w+=(L*(B*Y-N*E)-T)*i,p+=(L*(N*Y+B*E)-M)*i}else X+=g;X>R.PI?X-=R.PI2:X<-R.PI&&(X+=R.PI2),X*=i,B=Math.cos(X),N=Math.sin(X),A.a=B*Y-N*E,A.b=B*F-N*k,A.c=N*Y+B*E,A.d=N*F+B*k}A.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,h=this.position,o=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,l=t.closed,c=t.worldVerticesLength,d=c/6,f=ue.NONE;if(!t.constantSpeed){let L=t.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!=ue.BEFORE&&(f=ue.BEFORE,t.computeWorldVertices(r,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>O){f!=ue.AFTER&&(f=ue.AFTER,t.computeWorldVertices(r,c-6,4,n,0,2)),this.addAfterPosition(G-O,n,0,a,j);continue}for(;;V++){let te=L[V];if(!(G>te)){if(V==0)G/=te;else{let K=L[V-1];G=(G-K)/(te-K)}break}}V!=f&&(f=V,l&&V==d?(t.computeWorldVertices(r,c-4,4,n,0,2),t.computeWorldVertices(r,0,4,n,4,2)):t.computeWorldVertices(r,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,i||z>0&&W==0)}return a}l?(c+=2,n=P.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,n,0,2),t.computeWorldVertices(r,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),t.computeWorldVertices(r,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,E=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,E=(p-x)*.75+S+T*.16666667,k=(g-w)*.75+I+M*.16666667,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,u+=Math.sqrt(E*E+k*k),E+=Y+T,k+=F+M,u+=Math.sqrt(E*E+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,E=(p-x)*.3+S+T*.16666667,k=(g-w)*.3+I+M*.16666667,N=Math.sqrt(E*E+k*k),B[0]=N,W=1;W<8;W++)E+=Y,k+=F,Y+=T,F+=M,N+=Math.sqrt(E*E+k*k),B[W]=N;E+=Y,k+=F,N+=Math.sqrt(E*E+k*k),B[8]=N,E+=Y+T,k+=F+M,N+=Math.sqrt(E*E+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,i||L>0&&j==0)}return a}addBeforePosition(t,s,i,r,h){let o=s[i],a=s[i+1],n=s[i+2]-o,l=s[i+3]-a,c=Math.atan2(l,n);r[h]=o+t*Math.cos(c),r[h+1]=a+t*Math.sin(c),r[h+2]=c}addAfterPosition(t,s,i,r,h){let o=s[i+2],a=s[i+3],n=o-s[i],l=a-s[i+1],c=Math.atan2(l,n);r[h]=o+t*Math.cos(c),r[h+1]=a+t*Math.sin(c),r[h+2]=c}addCurvePosition(t,s,i,r,h,o,a,n,l,c,d,f){if(t==0||isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=t*t,u=m*t,x=1-t,w=x*x,p=w*x,g=x*t,b=g*3,y=x*b,v=b*t,A=s*p+r*y+o*v+n*u,S=i*p+h*y+a*v+l*u;c[d]=A,c[d+1]=S,f&&(t<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(S-(i*w+h*g*2+a*m),A-(s*w+r*g*2+o*m)))}},Js=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,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(e){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||i){if(s){const b=(this.ux-c)*m;this.xOffset+=b>p?p:b<-p?-p:b,this.ux=c}if(i){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),i&&(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*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r||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),r){A=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(I+this.ty,S+this.tx)-b-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*R.invPI2-.5)*R.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=Ss.yDown?-this.gravity:this.gravity,E=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),r){if(this.rotateVelocity-=((Y*v+F*y)*E+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*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r){let n=this.rotateOffset*t,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*t*this.data.scaleX;o.a*=n,o.c*=n}e!=3&&(this.tx=a*o.a,this.ty=a*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*R.degRad,r=Math.cos(i),h=Math.sin(i),o=this.cx-e,a=this.cy-t;this.translate(o*r-a*h-o,o*h+a*r-a)}},vs=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 oe)||!(this.attachment instanceof oe)||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}},As=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Xe;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 r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}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,r=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,d=a.d,f=n*d-l*c>0?R.degRad:-R.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(e!=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>R.PI?S-=R.PI2:S<-R.PI&&(S+=R.PI2),S*=e;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)*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(n*n+c*c)-b+this.data.offsetScaleX)*i)/b),g.a*=b,g.c*=b}if(r!=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)*r)/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>R.PI?A-=R.PI2:A<-R.PI&&(A+=R.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 e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,d=a.d,f=n*d-l*c>0?R.degRad:-R.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(e!=0){let b=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)+m;S>R.PI?S-=R.PI2:S<-R.PI&&(S+=R.PI2),S*=e;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*t,g.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=b,g.c*=b}if(r!=0){let b=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=b,g.d*=b}if(h>0){let b=Math.atan2(d,l)-Math.atan2(c,n);b>R.PI?b-=R.PI2:b<-R.PI&&(b+=R.PI2);let y=g.b,v=g.d;b=Math.atan2(v,y)+(b-R.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 e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=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;e!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*e);let f=c.ax,m=c.ay;f+=(o.ax-f+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,x=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*r)/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 e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=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)*e,f=c.ax+(o.ax+this.data.offsetX)*t,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),x=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),w=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,w)}}},Ss=class Jt{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 Jt.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=t.bones[s],r;if(!i.parent)r=new Et(i,this,null);else{let h=this.bones[i.parent.index];r=new Et(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let i=t.slots[s],r=this.bones[i.boneData.index],h=new vs(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let i=t.ikConstraints[s];this.ikConstraints.push(new ps(i,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let i=t.transformConstraints[s];this.transformConstraints.push(new As(i,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let i=t.pathConstraints[s];this.pathConstraints.push(new ys(i,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let i=t.physicsConstraints[s];this.physicsConstraints.push(new Js(i,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.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 i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,a=i.length,n=r.length,l=h.length,c=this.physicsConstraints.length,d=a+n+l+c;e:for(let f=0;f<d;f++){for(let m=0;m<a;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let m=0;m<n;m++){let u=r[m];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let i=t.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let n=0,l=this.data.skins.length;n<l;n++)this.sortPathConstraintAttachment(this.data.skins[n],i,r);let h=s.getAttachment();h instanceof Ie&&this.sortPathConstraintAttachmentWith(h,r);let o=t.bones,a=o.length;for(let n=0;n<a;n++)this.sortBone(o[n]);this._updateCache.push(t);for(let n=0;n<a;n++)this.sortReset(o[n].children);for(let n=0;n<a;n++)o[n].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,i=s.length;if(t.data.local)for(let r=0;r<i;r++){let h=s[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(t);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(t,s,i){let r=t.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Ie))return;let i=t.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,o=i.length;h<o;){let a=i[h++];for(a+=h;h<a;)this.sortBone(r[i[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){let r=t[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,h=s.length;r<h;r++){let o=s[r];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 i=this._updateCache;for(let r=0,h=i.length;r<h;r++)i[r].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let w=1,p=i.length;w<p;w++){let g=i[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 r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,a=s.c,n=s.d;r.worldX=h*this.x+o*this.y+s.worldX,r.worldY=a*this.x+n*this.y+s.worldY;const l=(r.rotation+r.shearX)*R.degRad,c=(r.rotation+90+r.shearY)*R.degRad,d=Math.cos(l)*r.scaleX,f=Math.cos(c)*r.scaleY,m=Math.sin(l)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(h*d+o*m)*this.scaleX,r.b=(h*f+o*u)*this.scaleX,r.c=(a*d+n*m)*this.scaleY,r.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!=r&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;P.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,i=t.length;s<i;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==t)return h}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==t)return h}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i],o=h.data.attachmentName;if(o){let a=t.getAttachment(i,o);a&&h.setAttachment(a)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,h=i.length;r<h;r++){let o=i[r];if(o.data.name==t){let a=null;if(s&&(a=this.getAttachment(r,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(a);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Xe,i=new Xe;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=null){if(!t)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(i,m,0),w.computeWorldVertices(f,u,0,2),x=Jt.quadTriangles;else if(w instanceof Ce){let p=w;m=p.worldVerticesLength,u=P.setArraySize(i,m,0),p.computeWorldVertices(f,0,m,u,0,2),x=p.triangles}else if(w instanceof Tt&&r!=null){r.clipStart(f,w);continue}if(u&&x){r!=null&&r.isClipping()&&(r.clipTriangles(u,x,x.length),u=r.clippedVertices,m=r.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)}}r?.clipEndWithSlot(f)}r?.clipEnd(),t.set(o,a),s.set(n-o,l-a)}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(t,s)}physicsRotate(t,s,i){const r=this.physicsConstraints;for(let h=0,o=r.length;h<o;h++)r[h].rotate(t,s,i)}},Cs=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Cs||{}),Is=class extends ke{_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)}},qt=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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}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 r=t[s];if(r.name==e)return r}return null}},Wt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Ne=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 r=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||this.constraints.push(r)}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 r=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof Ce?(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 r=s[i];r&&e.push(new Wt(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Wt(e,i,r))}}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 r=e.slots[i],h=r.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let a in o){let n=o[a];if(h==n){let l=this.getAttachment(s,a);l&&r.setAttachment(l);break}}}s++}}},Ut=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;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}},zt=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(zt||{}),_t=class extends ke{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)}},js=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new qt;s.name="";let i=new ks(e),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.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 a=0;a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[i.readInt(!0)],f=new Ft(l,c,d);f.rotation=i.readFloat(),f.x=i.readFloat()*t,f.y=i.readFloat()*t,f.scaleX=i.readFloat(),f.scaleY=i.readFloat(),f.shearX=i.readFloat(),f.shearY=i.readFloat(),f.length=i.readFloat()*t,f.inherit=i.readByte(),f.skinRequired=i.readBoolean(),o&&(D.rgba8888ToColor(f.color,i.readInt32()),f.icon=i.readString()??void 0,f.visible=i.readBoolean()),s.bones.push(f)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],f=new Ut(l,c,d);D.rgba8888ToColor(f.color,i.readInt32());let m=i.readInt32();m!=-1&&D.rgb888ToColor(f.darkColor=new D,m),f.attachmentName=i.readStringRef(),f.blendMode=i.readInt(!0),o&&(f.visible=i.readBoolean()),s.slots.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Vt(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.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?i.readFloat():1),(m&128)!=0&&(f.softness=i.readFloat()*t),s.ikConstraints.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new _t(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=i.readFloat()),(m&16)!=0&&(f.offsetX=i.readFloat()*t),(m&32)!=0&&(f.offsetY=i.readFloat()*t),(m&64)!=0&&(f.offsetScaleX=i.readFloat()),(m&128)!=0&&(f.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(f.offsetShearY=i.readFloat()),(m&2)!=0&&(f.mixRotate=i.readFloat()),(m&4)!=0&&(f.mixX=i.readFloat()),(m&8)!=0&&(f.mixY=i.readFloat()),(m&16)!=0&&(f.mixScaleX=i.readFloat()),(m&32)!=0&&(f.mixScaleY=i.readFloat()),(m&64)!=0&&(f.mixShearY=i.readFloat()),s.transformConstraints.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Lt(d);f.order=i.readInt(!0),f.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.slots[i.readInt(!0)];const m=i.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=i.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Is(d);f.order=i.readInt(!0),f.bone=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=i.readFloat()),(m&4)!=0&&(f.y=i.readFloat()),(m&8)!=0&&(f.rotate=i.readFloat()),(m&16)!=0&&(f.scaleX=i.readFloat()),(m&32)!=0&&(f.shearX=i.readFloat()),f.limit=((m&64)!=0?i.readFloat():5e3)*t,f.step=1/i.readUnsignedByte(),f.inertia=i.readFloat(),f.strength=i.readFloat(),f.damping=i.readFloat(),f.massInverse=(m&128)!=0?i.readFloat():1,f.wind=i.readFloat(),f.gravity=i.readFloat(),m=i.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?i.readFloat():1,s.physicsConstraints.push(f)}let n=this.readSkin(i,s,!0,o);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(P.setArraySize(s.skins,a=l+i.readInt(!0));l<a;l++){let c=this.readSkin(i,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=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new Bt(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let r=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;r=new Ne("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Ne(o),i&&D.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let a=0,n=r.bones.length;a<n;a++)r.bones[a]=t.bones[e.readInt(!0)];for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let a=e.readInt(!0);for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,r,a,c,i);d&&r.setAttachment(a,c,d)}}return r}readAttachment(e,t,s,i,r,h){let o=this.scale,a=e.readByte();const n=(a&8)!=0?e.readStringRef():r;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let l=(a&16)!=0?e.readStringRef():null;const c=(a&32)!=0?e.readInt32():4294967295,d=(a&64)!=0?this.readSequence(e):null;let f=(a&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),x=e.readFloat(),w=e.readFloat(),p=e.readFloat(),g=e.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(e,(a&16)!=0),c=h?e.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?e.readStringRef():n;const c=(a&32)!=0?e.readInt32():4294967295,d=(a&64)!=0?this.readSequence(e):null,f=e.readInt(!0),m=this.readVertices(e,(a&128)!=0),u=this.readFloatArray(e,m.length,1),x=this.readShortArray(e,(m.length-f-2)*3);let w=[],p=0,g=0;h&&(w=this.readShortArray(e,e.readInt(!0)),p=e.readFloat(),g=e.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?e.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?e.readInt32():4294967295,d=(a&64)!=0?this.readSequence(e):null,f=(a&128)!=0,m=e.readInt(!0),u=e.readStringRef();let x=0,w=0;h&&(x=e.readFloat(),w=e.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 Ks(p,m,i,u,f)),p):null}case 4:{const l=(a&16)!=0,c=(a&32)!=0,d=this.readVertices(e,(a&64)!=0),f=P.newArray(d.length/6,0);for(let x=0,w=f.length;x<w;x++)f[x]=e.readFloat()*o;const m=h?e.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=e.readFloat(),c=e.readFloat(),d=e.readFloat(),f=h?e.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=e.readInt(!0),c=this.readVertices(e,(a&16)!=0);let d=h?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,n);return f?(f.endSlot=t.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(e){let t=new is(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),r=new Qs;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let h=new Array,o=new Array;for(let a=0;a<i;a++){let n=e.readInt(!0);o.push(n);for(let l=0;l<n;l++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return r.vertices=P.toFloatArray(h),r.bones=o,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=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,r=this.scale;for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0),x=u-1;switch(m){case ci:{let w=new me(u,c);for(let p=0;p<u;p++)w.setFrame(p,e.readFloat(),e.readStringRef());i.push(w);break}case di:{let w=e.readInt(!0),p=new it(u,w,c),g=e.readFloat(),b=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let S=0,I=0;p.setFrame(S,g,b,y,v,A),S!=x;S++){let T=e.readFloat(),M=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(S);break;case ce:U(e,p,I++,S,0,g,T,b,M,1),U(e,p,I++,S,1,g,T,y,Y,1),U(e,p,I++,S,2,g,T,v,F,1),U(e,p,I++,S,3,g,T,A,E,1)}g=T,b=M,y=Y,v=F,A=E}i.push(p);break}case fi:{let w=e.readInt(!0),p=new rt(u,w,c),g=e.readFloat(),b=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,S=0;p.setFrame(A,g,b,y,v),A!=x;A++){let I=e.readFloat(),T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(A);break;case ce:U(e,p,S++,A,0,g,I,b,T,1),U(e,p,S++,A,1,g,I,y,M,1),U(e,p,S++,A,2,g,I,v,Y,1)}g=I,b=T,y=M,v=Y}i.push(p);break}case ui:{let w=e.readInt(!0),p=new nt(u,w,c),g=e.readFloat(),b=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let M=0,Y=0;p.setFrame(M,g,b,y,v,A,S,I,T),M!=x;M++){let F=e.readFloat(),E=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(M);break;case ce:U(e,p,Y++,M,0,g,F,b,E,1),U(e,p,Y++,M,1,g,F,y,k,1),U(e,p,Y++,M,2,g,F,v,X,1),U(e,p,Y++,M,3,g,F,A,B,1),U(e,p,Y++,M,4,g,F,S,N,1),U(e,p,Y++,M,5,g,F,I,L,1),U(e,p,Y++,M,6,g,F,T,O,1)}g=F,b=E,y=k,v=X,A=B,S=N,I=L,T=O}i.push(p);break}case mi:{let w=e.readInt(!0),p=new lt(u,w,c),g=e.readFloat(),b=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let T=0,M=0;p.setFrame(T,g,b,y,v,A,S,I),T!=x;T++){let Y=e.readFloat(),F=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(T);break;case ce:U(e,p,M++,T,0,g,Y,b,F,1),U(e,p,M++,T,1,g,Y,y,E,1),U(e,p,M++,T,2,g,Y,v,k,1),U(e,p,M++,T,3,g,Y,A,X,1),U(e,p,M++,T,4,g,Y,S,B,1),U(e,p,M++,T,5,g,Y,I,N,1)}g=Y,b=F,y=E,v=k,A=X,S=B,I=N}i.push(p);break}case gi:{let w=new at(u,e.readInt(!0),c),p=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,y=0;w.setFrame(b,p,g),b!=x;b++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(b);break;case ce:U(e,w,y++,b,0,p,v,g,A,1)}p=v,g=A}i.push(w)}}}}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0);if(m==hi){let w=new st(u,c);for(let p=0;p<u;p++)w.setFrame(p,e.readFloat(),e.readByte());i.push(w);continue}let x=e.readInt(!0);switch(m){case Zs:i.push(ee(e,new Se(u,x,c),1));break;case ei:i.push(Gt(e,new $e(u,x,c),r));break;case ti:i.push(ee(e,new He(u,x,c),r));break;case si:i.push(ee(e,new Je(u,x,c),r));break;case ii:i.push(Gt(e,new je(u,x,c),1));break;case ri:i.push(ee(e,new Ke(u,x,c),1));break;case ai:i.push(ee(e,new Qe(u,x,c),1));break;case ni:i.push(Gt(e,new Ze(u,x,c),1));break;case li:i.push(ee(e,new et(u,x,c),1));break;case oi:i.push(ee(e,new tt(u,x,c),1))}}}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new ht(d,e.readInt(!0),c),u=e.readByte(),x=e.readFloat(),w=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,p=(u&4)!=0?e.readFloat()*r: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=e.readByte();const y=e.readFloat(),v=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,A=(u&4)!=0?e.readFloat()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(U(e,m,b++,g,0,x,y,w,v,1),U(e,m,b++,g,1,x,y,p,A,r)),x=y,w=v,p=A}i.push(m)}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new ct(d,e.readInt(!0),c),u=e.readFloat(),x=e.readFloat(),w=e.readFloat(),p=e.readFloat(),g=e.readFloat(),b=e.readFloat(),y=e.readFloat();for(let v=0,A=0;m.setFrame(v,u,x,w,p,g,b,y),v!=f;v++){let S=e.readFloat(),I=e.readFloat(),T=e.readFloat(),M=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),E=e.readFloat();switch(e.readByte()){case he:m.setStepped(v);break;case ce:U(e,m,A++,v,0,u,S,x,I,1),U(e,m,A++,v,1,u,S,w,T,1),U(e,m,A++,v,2,u,S,p,M,1),U(e,m,A++,v,3,u,S,g,Y,1),U(e,m,A++,v,4,u,S,b,F,1),U(e,m,A++,v,5,u,S,y,E,1)}u=S,x=I,w=T,p=M,g=Y,b=F,y=E}i.push(m)}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=e.readInt(!0);f<m;f++){const u=e.readByte(),x=e.readInt(!0),w=e.readInt(!0);switch(u){case wi:i.push(ee(e,new dt(x,w,c),d.positionMode==0?r:1));break;case pi:i.push(ee(e,new ft(x,w,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case yi:let p=new ut(x,w,c),g=e.readFloat(),b=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,S=0,I=p.getFrameCount()-1;p.setFrame(A,g,b,y,v),A!=I;A++){let T=e.readFloat(),M=e.readFloat(),Y=e.readFloat(),F=e.readFloat();switch(e.readByte()){case he:p.setStepped(A);break;case ce:U(e,p,S++,A,0,g,T,b,M,1),U(e,p,S++,A,1,g,T,y,Y,1),U(e,p,S++,A,2,g,T,v,F,1)}g=T,b=M,y=Y,v=F}i.push(p)}}}for(let n=0,l=e.readInt(!0);n<l;n++){const c=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),u=e.readInt(!0);if(m==Yi){const w=new vt(u,c);for(let p=0;p<u;p++)w.setFrame(p,e.readFloat());i.push(w);continue}const x=e.readInt(!0);switch(m){case vi:i.push(ee(e,new mt(u,x,c),1));break;case Ai:i.push(ee(e,new gt(u,x,c),1));break;case Si:i.push(ee(e,new xt(u,x,c),1));break;case Ci:i.push(ee(e,new bt(u,x,c),1));break;case Ii:i.push(ee(e,new wt(u,x,c),1));break;case ki:i.push(ee(e,new pt(u,x,c),1));break;case Ti:i.push(ee(e,new yt(u,x,c),1))}}}for(let n=0,l=e.readInt(!0);n<l;n++){let c=s.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readInt(!0);for(let u=0,x=e.readInt(!0);u<x;u++){let w=e.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,w),g=e.readByte(),b=e.readInt(!0),y=b-1;switch(g){case xi:{let v=p,A=v.bones,S=v.vertices,I=A?S.length/3*2:S.length,T=e.readInt(!0),M=new ot(b,T,m,v),Y=e.readFloat();for(let F=0,E=0;;F++){let k,X=e.readInt(!0);if(X==0)k=A?P.newFloatArray(I):S;else{k=P.newFloatArray(I);let N=e.readInt(!0);if(X+=N,r==1)for(let L=N;L<X;L++)k[L]=e.readFloat();else for(let L=N;L<X;L++)k[L]=e.readFloat()*r;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=e.readFloat();switch(e.readByte()){case he:M.setStepped(F);break;case ce:U(e,M,E++,F,0,Y,B,0,1,1)}Y=B}i.push(M);break}case bi:{let v=new At(b,m,p);for(let A=0;A<b;A++){let S=e.readFloat(),I=e.readInt32();v.setFrame(A,S,as[I&15],I>>4,e.readFloat())}i.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let n=new we(h),l=s.slots.length;for(let c=0;c<h;c++){let d=e.readFloat(),f=e.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=e.readInt(!0);for(;x!=g;)u[w++]=x++;m[x+e.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)}i.push(n)}let o=e.readInt(!0);if(o>0){let n=new Re(o);for(let l=0;l<o;l++){let c=e.readFloat(),d=s.events[e.readInt(!0)],f=new Pt(c,d);f.intValue=e.readInt(!1),f.floatValue=e.readFloat(),f.stringValue=e.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=e.readFloat(),f.balance=e.readFloat()),n.setFrame(l,f)}i.push(n)}let a=0;for(let n=0,l=i.length;n<l;n++)a=Math.max(a,i[n].getDuration());return new Fe(t,i,a)}},ks=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)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){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 r=this.readUnsignedByte();switch(r>>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ks=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Qs=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function ee(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let h=0,o=0,a=t.getFrameCount()-1;t.setFrame(h,i,r),h!=a;h++){let n=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case he:t.setStepped(h);break;case ce:U(e,t,o++,h,0,i,n,r,l,s)}i=n,r=l}return t}function Gt(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,a=0,n=t.getFrameCount()-1;t.setFrame(o,i,r,h),o!=n;o++){let l=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case he:t.setStepped(o);break;case ce:U(e,t,a++,o,0,i,l,r,c,s),U(e,t,a++,o,1,i,l,h,d,s)}i=l,r=c,h=d}return t}function U(e,t,s,i,r,h,o,a,n,l){t.setBezier(s,i,r,h,a,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,n)}var Zs=0,ei=1,ti=2,si=3,ii=4,ri=5,ai=6,ni=7,li=8,oi=9,hi=10,ci=0,di=1,fi=2,ui=3,mi=4,gi=5,xi=0,bi=1,wi=0,pi=1,yi=2,vi=0,Ai=1,Si=2,Ci=4,Ii=5,ki=6,Ti=7,Yi=8,he=1,ce=2,Mi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ae(()=>P.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=e.slots,o=h.length;s.length=0,r.freeAll(i),i.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 kt){let c=l;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=P.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(n,0,c.worldVerticesLength,d,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,r=this.polygons;for(let h=0,o=r.length;h<o;h++){let a=r[h],n=a;for(let l=0,c=a.length;l<c;l+=2){let d=n[l],f=n[l+1];e=Math.min(e,d),t=Math.min(t,f),s=Math.max(s,d),i=Math.max(i,f)}}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 r=this.minX,h=this.minY,o=this.maxX,a=this.maxY;if(e<=r&&s<=r||t<=h&&i<=h||e>=o&&s>=o||t>=a&&i>=a)return!1;let n=(i-t)/(s-e),l=n*(r-e)+t;if(l>h&&l<a||(l=n*(o-e)+t,l>h&&l<a))return!0;let c=(h-t)/n+e;return c>r&&c<o||(c=(a-t)/n+e,c>r&&c<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,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.length,h=r-2,o=!1;for(let a=0;a<r;a+=2){let n=i[a+1],l=i[h+1];if(n<s&&l>=s||l<s&&n>=s){let c=i[a];c+(s-n)/(l-n)*(i[h]-c)<t&&(o=!o)}h=a}return o}intersectsSegment(e,t,s,i){let r=this.polygons;for(let h=0,o=r.length;h<o;h++)if(this.intersectsSegmentPolygon(r[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,r){let h=e,o=e.length,a=t-i,n=s-r,l=t*r-s*i,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>=t&&b<=i||b>=i&&b<=t)){let y=(l*p-n*x)/g;if((y>=d&&y<=u||y>=u&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=u}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}},Ts=class se{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ae(()=>new Array);polygonIndicesPool=new Ae(()=>new Array);triangulate(t){let s=t,i=t.length>>1,r=this.indicesArray;r.length=0;for(let a=0;a<i;a++)r[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=i;a<n;++a)h[a]=se.isConcave(a,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let a=i-1,n=0,l=1;for(;;){e:if(!h[n]){let f=r[a]<<1,m=r[n]<<1,u=r[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)%i;v!=a;v=(v+1)%i){if(!h[v])continue;let A=r[v]<<1,S=s[A],I=s[A+1];if(se.positiveArea(b,y,x,w,S,I)&&se.positiveArea(x,w,p,g,S,I)&&se.positiveArea(p,g,b,y,S,I))break e}break}if(l==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=l,l=(l+1)%i}o.push(r[(i+n-1)%i]),o.push(r[n]),o.push(r[(n+1)%i]),r.splice(n,1),h.splice(n,1),i--;let c=(i+n-1)%i,d=n==i?0:n;h[c]=se.isConcave(c,i,s,r),h[d]=se.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(t,s){let i=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.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=i[f],w=i[f+1],p=i[m],g=i[m+1],b=i[u],y=i[u+1],v=!1;if(n==f){let A=a.length-4,S=se.winding(a[A],a[A+1],a[A+2],a[A+3],b,y),I=se.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?(r.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=se.winding(x,w,p,g,b,y),n=f)}a.length>0&&(r.push(a),h.push(o));for(let c=0,d=r.length;c<d;c++){if(o=h[c],o.length==0)continue;let f=o[0],m=o[o.length-1];a=r[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=se.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],E=r[I],k=E[E.length-2],X=E[E.length-1];if(M!=f||Y!=m)continue;let B=se.winding(x,w,p,g,k,X),N=se.winding(k,X,b,y,v,A);B==S&&N==S&&(E.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=r.length-1;c>=0;c--)a=r[c],a.length==0&&(r.splice(c,1),this.polygonPool.free(a),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(t,s,i,r){let h=r[(s+t-1)%s]<<1,o=r[t]<<1,a=r[(t+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[o],i[o+1],i[a],i[a+1])}static positiveArea(t,s,i,r,h,o){return t*(o-r)+i*(s-o)+h*(r-s)>=0}static winding(t,s,i,r,h,o){let a=i-t,n=r-s;return h*n-o*a+a*s-t*n>=0?1:-1}},Xi=class jt{triangulator=new Ts;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=P.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let h=this.clippingPolygon;jt.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];jt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.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(t,s,i,r,h,o,a,n){let l,c,d,f,m,u;typeof s=="number"?(l=i,c=r,d=h,f=o,m=a,u=n):(l=s,c=i,d=r,f=h,m=o,u=a),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,l,c,d,f,m,u):this.clipTrianglesNoRender(t,l,c)}clipTrianglesNoRender(t,s,i){let r=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<i;c+=3){let d=s[c]<<1,f=t[d],m=t[d+1];d=s[c+1]<<1;let u=t[d],x=t[d+1];d=s[c+2]<<1;let w=t[d],p=t[d+1];for(let g=0;g<n;g++){let b=h.length;if(this.clip(f,m,u,x,w,p,a[g],r)){let y=r.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(t,s,i,r,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<i;x+=3){let w=s[x]<<1,p=t[w],g=t[w+1],b=r[w],y=r[w+1];w=s[x+1]<<1;let v=t[w],A=t[w+1],S=r[w],I=r[w+1];w=s[x+2]<<1;let T=t[w],M=t[w+1],Y=r[w],F=r[w+1];for(let E=0;E<f;E++){let k=l.length;if(this.clip(p,g,v,A,T,M,d[E],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 te=j[G],K=j[G+1];V[k]=te,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=te-T,Z=K-M,re=(B*Q+N*Z)*$,xe=(O*Q+L*Z)*$,ye=1-re-xe;V[k+6]=b*re+S*xe+Y*ye,V[k+7]=y*re+I*xe+F*ye,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(t,s,i,r){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<i;f+=3){let m=s[f]<<1,u=t[m],x=t[m+1],w=r[m],p=r[m+1];m=s[f+1]<<1;let g=t[m],b=t[m+1],y=r[m],v=r[m+1];m=s[f+2]<<1;let A=t[m],S=t[m+1],I=r[m],T=r[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 E=b-S,k=A-g,X=u-A,B=S-x,N=1/(E*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 te=W-A,K=G-S,Q=(E*te+k*K)*N,Z=(B*te+X*K)*N,re=1-Q-Z;z[Y]=w*Q+y*Z+I*re,z[Y+1]=p*Q+v*Z+T*re}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 E=P.setArraySize(a,Y+3*2);E[Y]=w,E[Y+1]=p,E[Y+2]=y,E[Y+3]=v,E[Y+4]=I,E[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(t,s,i,r,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(t),d.push(s),d.push(i),d.push(r),d.push(h),d.push(o),d.push(t),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),E=g*(x-I)-p*(w-T);if(E>0){if(F){n.push(M),n.push(Y);continue}let k=M-I,X=Y-T,B=E/(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=E/(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(t){let s=t,i=t.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,o=0,a=0,n=0;for(let l=0,c=i-3;l<c;l+=2)h=s[l],o=s[l+1],a=s[l+2],n=s[l+3],r+=h*n-a*o;if(!(r<0))for(let l=0,c=i-2,d=i>>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}}},Fi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new qt,i=typeof e=="string"?JSON.parse(e):e,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=C(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let o=i.bones[h],a=null,n=C(o,"parent",null);n&&(a=s.findBone(n));let l=new Ft(s.bones.length,o.name,a);l.length=C(o,"length",0)*t,l.x=C(o,"x",0)*t,l.y=C(o,"y",0)*t,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(Le,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(i.slots)for(let h=0;h<i.slots.length;h++){let o=i.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 Ut(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(zt,C(o,"blend","normal")),l.visible=C(o,"visible",!0),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let o=i.ik[h],a=new Vt(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)*t,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(i.transform)for(let h=0;h<i.transform.length;h++){let o=i.transform[h],a=new _t(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)*t,a.offsetY=C(o,"y",0)*t,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(i.path)for(let h=0;h<i.path.length;h++){let o=i.path[h],a=new Lt(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(Nt,C(o,"positionMode","Percent")),a.spacingMode=P.enumValue(Ot,C(o,"spacingMode","Length")),a.rotateMode=P.enumValue(Dt,C(o,"rotateMode","Tangent")),a.offsetRotation=C(o,"rotation",0),a.position=C(o,"position",0),a.positionMode==0&&(a.position*=t),a.spacing=C(o,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=t),a.mixRotate=C(o,"mixRotate",1),a.mixX=C(o,"mixX",1),a.mixY=C(o,"mixY",a.mixX),s.pathConstraints.push(a)}if(i.physics)for(let h=0;h<i.physics.length;h++){const o=i.physics[h],a=new Is(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)*t,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(i.skins)for(let h=0;h<i.skins.length;h++){let o=i.skins[h],a=new Ne(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,i.events)for(let h in i.events){let o=i.events[h],a=new Bt(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(i.animations)for(let h in i.animations){let o=i.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,i,r){let h=this.scale;switch(i=C(e,"name",i),C(e,"type","region")){case"region":{let o=C(e,"path",i),a=this.readSequence(C(e,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(t,i,o,a);if(!n)return null;n.path=o,n.x=C(e,"x",0)*h,n.y=C(e,"y",0)*h,n.scaleX=C(e,"scaleX",1),n.scaleY=C(e,"scaleY",1),n.rotation=C(e,"rotation",0),n.width=e.width*h,n.height=e.height*h,n.sequence=a;let l=C(e,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let a=C(e,"color",null);return a&&o.color.setFromString(a),o}case"mesh":case"linkedmesh":{let o=C(e,"path",i),a=this.readSequence(C(e,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(t,i,o,a);if(!n)return null;n.path=o;let l=C(e,"color",null);l&&n.color.setFromString(l),n.width=C(e,"width",0)*h,n.height=C(e,"height",0)*h,n.sequence=a;let c=C(e,"parent",null);if(c)return this.linkedMeshes.push(new Ei(n,C(e,"skin",null),s,c,C(e,"timelines",!0))),n;let d=e.uvs;return this.readVertices(e,n,d.length),n.triangles=e.triangles,n.regionUVs=d,n.region!=null&&n.updateRegion(),n.edges=C(e,"edges",null),n.hullLength=C(e,"hull",0)*2,n}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=C(e,"closed",!1),o.constantSpeed=C(e,"constantSpeed",!0);let a=e.vertexCount;this.readVertices(e,o,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<e.lengths.length;c++)n[c]=e.lengths[c]*h;o.lengths=n;let l=C(e,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=C(e,"x",0)*h,o.y=C(e,"y",0)*h,o.rotation=C(e,"rotation",0);let a=C(e,"color",null);return a&&o.color.setFromString(a),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let a=C(e,"end",null);a&&(o.endSlot=r.findSlot(a));let n=e.vertexCount;this.readVertices(e,o,n<<1);let l=C(e,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(e){if(e==null)return null;let t=new is(C(e,"count",0));return t.start=C(e,"start",1),t.digits=C(e,"digits",0),t.setupIndex=C(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let a=P.toFloatArray(r);if(i!=1)for(let n=0,l=r.length;n<l;n++)a[n]*=i;t.vertices=a;return}let h=new Array,o=new Array;for(let a=0,n=r.length;a<n;){let l=r[a++];o.push(l);for(let c=a+l*4;a<c;a+=4)o.push(r[a]),h.push(r[a+1]*i),h.push(r[a+2]*i),h.push(r[a+3])}t.bones=o,t.vertices=P.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let o in e.slots){let a=e.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 me(f,l);for(let u=0;u<f;u++){let x=d[u];m.setFrame(u,C(x,"time",0),C(x,"name",null))}r.push(m)}else if(c=="rgba"){let m=new it(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}r.push(m)}else if(c=="rgb"){let m=new rt(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}r.push(m)}else if(c=="alpha")r.push(ne(d,new at(f,f,l),0,1));else if(c=="rgba2"){let m=new nt(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}r.push(m)}else if(c=="rgb2"){let m=new lt(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}r.push(m)}}}if(e.bones)for(let o in e.bones){let a=e.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")r.push(ne(d,new Se(f,f,l),0,1));else if(c==="translate"){let m=new $e(f,f<<1,l);r.push($t(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new He(f,f,l);r.push(ne(d,m,0,i))}else if(c==="translatey"){let m=new Je(f,f,l);r.push(ne(d,m,0,i))}else if(c==="scale"){let m=new je(f,f<<1,l);r.push($t(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Ke(f,f,l);r.push(ne(d,m,1,1))}else if(c==="scaley"){let m=new Qe(f,f,l);r.push(ne(d,m,1,1))}else if(c==="shear"){let m=new Ze(f,f<<1,l);r.push($t(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new et(f,f,l);r.push(ne(d,m,0,1))}else if(c==="sheary"){let m=new tt(f,f,l);r.push(ne(d,m,0,1))}else if(c==="inherit"){let m=new st(f,n.index);for(let u=0;u<d.length;u++){let x=d[u];m.setFrame(u,C(x,"time",0),P.enumValue(Le,C(x,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let o in e.ik){let a=e.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 ht(a.length,a.length<<1,c),f=C(n,"time",0),m=C(n,"mix",1),u=C(n,"softness",0)*i;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)*i,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,i)),f=g,m=b,u=y,n=p}r.push(d)}if(e.transform)for(let o in e.transform){let a=e.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 ct(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),E=n.curve;E&&(y=_(E,d,y,b,0,f,A,m,S,1),y=_(E,d,y,b,1,f,A,u,I,1),y=_(E,d,y,b,2,f,A,x,T,1),y=_(E,d,y,b,3,f,A,w,M,1),y=_(E,d,y,b,4,f,A,p,Y,1),y=_(E,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}r.push(d)}if(e.path)for(let o in e.path){let a=e.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 dt(m,m,l);r.push(ne(d,u,0,n.positionMode==0?i:1))}else if(c==="spacing"){let u=new ft(m,m,l);r.push(ne(d,u,0,n.spacingMode==0||n.spacingMode==1?i:1))}else if(c==="mix"){let u=new ut(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}r.push(u)}}}if(e.physics)for(let o in e.physics){let a=e.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 vt(f,n);for(let x=0;d!=null;d=c[x+1],x++)u.setFrame(x,C(d,"time",0));r.push(u);continue}let m;if(l=="inertia")m=new mt(f,f,n);else if(l=="strength")m=new gt(f,f,n);else if(l=="damping")m=new xt(f,f,n);else if(l=="mass")m=new bt(f,f,n);else if(l=="wind")m=new wt(f,f,n);else if(l=="gravity")m=new pt(f,f,n);else if(l=="mix")m=new yt(f,f,n);else continue;r.push(ne(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let a=e.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 ot(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),i!=1)for(let B=X,N=B+Y.length;B<N;B++)M[B]*=i;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 E=C(F,"time",0),k=g.curve;k&&(T=_(k,A,T,I,0,S,E,0,1,1)),S=E,g=F}r.push(A)}else if(w=="sequence"){let b=new At(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=rs[C(g,"mode","hold")],T=C(g,"index",0);b.setFrame(v,S,I,T,A),y=A,g=p[v+1]}r.push(b)}}}}}}if(e.drawOrder){let o=new we(e.drawOrder.length),a=s.slots.length,n=0;for(let l=0;l<e.drawOrder.length;l++,n++){let c=e.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)}r.push(o)}if(e.events){let o=new Re(e.events.length),a=0;for(let n=0;n<e.events.length;n++,a++){let l=e.events[n],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Pt(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)}r.push(o)}let h=0;for(let o=0,a=r.length;o<a;o++)h=Math.max(h,r[o].getDuration());s.animations.push(new Fe(t,r,h))}},Ei=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function ne(e,t,s,i){let r=e[0],h=C(r,"time",0),o=C(r,"value",s)*i,a=0;for(let n=0;;n++){t.setFrame(n,h,o);let l=e[n+1];if(!l)return t.shrink(a),t;let c=C(l,"time",0),d=C(l,"value",s)*i;r.curve&&(a=_(r.curve,t,a,n,0,h,c,o,d,i)),h=c,o=d,r=l}}function $t(e,t,s,i,r,h){let o=e[0],a=C(o,"time",0),n=C(o,s,r)*h,l=C(o,i,r)*h,c=0;for(let d=0;;d++){t.setFrame(d,a,n,l);let f=e[d+1];if(!f)return t.shrink(c),t;let m=C(f,"time",0),u=C(f,s,r)*h,x=C(f,i,r)*h,w=o.curve;w&&(c=_(w,t,c,d,0,a,m,n,u,h),c=_(w,t,c,d,1,a,m,l,x,h)),a=m,n=u,l=x,o=f}}function _(e,t,s,i,r,h,o,a,n,l){if(e=="stepped")return t.setStepped(i),s;let c=r<<2,d=e[c],f=e[c+1]*l,m=e[c+2],u=e[c+3]*l;return t.setBezier(s,i,r,h,a,d,f,m,u,o,n),s+1}function C(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 Ys=class extends Yt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Ri=class extends bs{constructor(e="",t=new Rt){super(s=>new Ys(s),e,t)}},Pi=P.newFloatArray(8),Bi=class We{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(t){this.ctx=t}draw(t){this.triangleRendering?this.drawTriangles(t):this.drawImages(t)}drawImages(t){let s=this.ctx,i=this.tempColor,r=t.color,h=t.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,Pi,0,2);let d=c.region,f=d.texture.getImage(),m=n.color,u=c.color;i.set(r.r*m.r*u.r,r.g*m.g*u.g,r.b*m.b*u.b,r.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=i.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(t){let s=this.ctx,i=this.tempColor,r=t.color,h=t.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=We.QUAD_TRIANGLES,u=w.region.texture.getImage()}else if(m instanceof Ce){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;i.set(r.r*w.r*p.r,r.g*w.g*p.g,r.b*w.b*p.b,r.a*w.a*p.a),s.globalAlpha=i.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],E=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,E,k,X,B),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,A),s.lineTo(T,M),s.lineTo(E,k),s.lineTo(v,A),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,s,i,r,h,o,a,n,l,c,d,f,m){let u=this.ctx;const x=t.width-1,w=t.height-1;r*=x,h*=w,n*=x,l*=w,f*=x,m*=w,u.beginPath(),u.moveTo(s,i),u.lineTo(o,a),u.lineTo(c,d),u.closePath(),o-=s,a-=i,c-=s,d-=i,n-=r,l-=h,f-=r,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*r-y*h,S=i-b*r-v*h;u.save(),u.transform(g,b,y,v,A,S),u.clip(),u.drawImage(t,0,0),u.restore()}computeRegionVertices(t,s,i){let r=t.bone.skeleton.color,h=t.color,o=s.color,a=r.a*h.a*o.a,n=i?a:1,l=this.tempColor;l.set(r.r*h.r*o.r*n,r.g*h.g*o.g*n,r.b*h.b*o.b*n,a),s.computeWorldVertices(t,this.vertices,0,We.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(t,s,i){let r=t.bone.skeleton.color,h=t.color,o=s.color,a=r.a*h.a*o.a,n=i?a:1,l=this.tempColor;l.set(r.r*h.r*o.r*n,r.g*h.g*o.g*n,r.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(t,0,s.worldVerticesLength,d,0,We.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{at as AlphaTimeline,Fe as Animation,Us as AnimationState,zs as AnimationStateAdapter,_s as AnimationStateData,ws as AssetCache,Ri as AssetManager,bs as AssetManagerBase,Hs as AtlasAttachmentLoader,Ge as Attachment,me as AttachmentTimeline,ks as BinaryInput,zt as BlendMode,Et as Bone,Ft as BoneData,kt as BoundingBoxAttachment,fs as CURRENT,Ys as CanvasTexture,Tt as ClippingAttachment,D as Color,ke as ConstraintData,ae as CurveTimeline,ie as CurveTimeline1,Ee as CurveTimeline2,Ds as DebugUtils,ot as DeformTimeline,Rt as Downloader,we as DrawOrderTimeline,Pt as Event,Bt as EventData,hs as EventQueue,Re as EventTimeline,cs as EventType,St as FIRST,Gs as FakeTexture,Be as HOLD_FIRST,ds as HOLD_MIX,Ct as HOLD_SUBSEQUENT,ps as IkConstraint,Vt as IkConstraintData,ht as IkConstraintTimeline,Le as Inherit,st as InheritTimeline,Ns as IntSet,ts as Interpolation,R as MathUtils,Ce as MeshAttachment,ns as MixBlend,ls as MixDirection,Ie as PathAttachment,ys as PathConstraint,Lt as PathConstraintData,ut as PathConstraintMixTimeline,dt as PathConstraintPositionTimeline,ft as PathConstraintSpacingTimeline,Cs as Physics,xt as PhysicsConstraintDampingTimeline,pt as PhysicsConstraintGravityTimeline,mt as PhysicsConstraintInertiaTimeline,bt as PhysicsConstraintMassTimeline,yt as PhysicsConstraintMixTimeline,vt as PhysicsConstraintResetTimeline,gt as PhysicsConstraintStrengthTimeline,de as PhysicsConstraintTimeline,wt as PhysicsConstraintWindTimeline,xs as PointAttachment,Ae as Pool,Nt as PositionMode,ss as Pow,Os as PowOut,lt as RGB2Timeline,nt as RGBA2Timeline,it as RGBATimeline,rt as RGBTimeline,H as RegionAttachment,Dt as RotateMode,Se as RotateTimeline,It as SETUP,Pe as SUBSEQUENT,je as ScaleTimeline,Ke as ScaleXTimeline,Qe as ScaleYTimeline,At as SequenceTimeline,Ze as ShearTimeline,et as ShearXTimeline,tt as ShearYTimeline,Ss as Skeleton,js as SkeletonBinary,Mi as SkeletonBounds,Xi as SkeletonClipping,qt as SkeletonData,Fi as SkeletonJson,Bi as SkeletonRenderer,Ne as Skin,Wt as SkinEntry,vs as Slot,Ut as SlotData,Ot as SpacingMode,_e as StringSet,Yt as Texture,Mt as TextureAtlas,gs as TextureAtlasPage,Xt as TextureAtlasRegion,Ve as TextureFilter,ms as TextureRegion,us as TextureWrap,qs as TimeKeeper,J as Timeline,os as TrackEntry,As as TransformConstraint,_t as TransformConstraintData,ct as TransformConstraintTimeline,$e as TranslateTimeline,He as TranslateXTimeline,Je as TranslateYTimeline,Ts as Triangulator,P as Utils,Xe as Vector2,oe as VertexAttachment,Ws as WindowedMean};
1
+ "use strict";var kn=class{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ae=class{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,n=t.length;s<n;s++)this.add(t[s]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},z=class Ft{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Ft(1,1,1,1);static RED=new Ft(1,0,0,1);static GREEN=new Ft(0,1,0,1);static BLUE=new Ft(0,0,1,1);static MAGENTA=new Ft(1,0,1,1);set(e,s,n,i){return this.r=e,this.g=s,this.b=n,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,n,i){return this.r+=e,this.g+=s,this.b+=n,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 Ft){return s.setFromString(e)}},$=class ft{static PI=3.1415927;static PI2=ft.PI*2;static invPI2=1/ft.PI2;static radiansToDegrees=180/ft.PI;static radDeg=ft.radiansToDegrees;static degreesToRadians=ft.PI/180;static degRad=ft.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*ft.degRad)}static sinDeg(e){return Math.sin(e*ft.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ft.radDeg}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){const s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ft.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,n){const i=Math.random(),r=s-e;return i<=(n-e)/r?e+Math.sqrt(i*r*(n-e)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Bt=class Vt{static linear=new class extends Vt{applyInternal(e){return e}};static smooth=new class extends Vt{applyInternal(e){return e*e*(3-2*e)}};static slowFast=new class extends Vt{applyInternal(e){return e*e}};static fastSlow=new class extends Vt{applyInternal(e){return(e-1)*(e-1)*-1+1}};static circle=new class extends Vt{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}};apply(e,s,n){return s===void 0||n===void 0?this.applyInternal(e):e+(s-e)*this.applyInternal(n)}},Ns=class extends Bt{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}},En=class extends Ns{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},R=class Rt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,n,i,r){for(let l=s,c=i;l<s+r;l++,c++)n[c]=e[l]}static arrayFill(e,s,n,i){for(let r=s;r<n;r++)e[r]=i}static setArraySize(e,s,n=0){const i=e.length;if(i===s)return e;if(e.length=s,i<s)for(let r=i;r<s;r++)e[r]=n;return e}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:Rt.setArraySize(e,s,n)}static newArray(e,s){const n=[];for(let i=0;i<e;i++)n[i]=s;return n}static newFloatArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(e){return Rt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Rt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,s,n=!0){for(let 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)]}},Xn=class{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Ot=class{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){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}},Ce=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}},Vn=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const 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)}},Rn=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}},Me=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Kt=(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))(Kt||{}),Us=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Us||{}),$s=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ln=class extends Me{setFilters(t,e){}setWraps(t,e){}dispose(){}},Fe=class{pages=[];regions=[];constructor(t){const e=new Bn(t),s=new Array(4),n={};n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.format=()=>{},n.filter=a=>{a.minFilter=R.enumValue(Kt,s[1]),a.magFilter=R.enumValue(Kt,s[2])},n.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},n.pma=a=>{a.pma=s[1]==="true"};var i={};i.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},i.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},i.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},i.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},i.rotate=a=>{const h=s[1];h==="true"?a.degrees=90:h!=="false"&&(a.degrees=parseInt(h))},i.index=a=>{a.index=parseInt(s[1])};let r=e.readLine();for(;r&&r.trim().length===0;)r=e.readLine();for(;!(!r||r.trim().length===0||e.readEntry(s,r)===0);)r=e.readLine();let l=null,c=null,o=null;for(;r!==null;)if(r.trim().length===0)l=null,r=e.readLine();else if(l){const a=new Ye(l,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{c||(c=[]),o||(o=[]),c.push(s[0]);const f=[];for(let m=0;m<h;m++)f.push(parseInt(s[m+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),c&&c.length>0&&o&&o.length>0&&(a.names=c,a.values=o,c=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees===90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new qs(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(l)}this.pages.push(l)}}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(const 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()}},Bn=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;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=e.indexOf(",",i);if(r===-1)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},qs=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}},Ye=class extends $s{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)}},Pe=class pn{static empty=[];name;timelineAttachment;timelineSlots=pn.empty;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,s,n){let i=e[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,l=this.timelineSlots.length;r<l;r++){if(i=e[this.timelineSlots[r]],!i.bone.isActive())continue;const c=(n?i.getAppliedPose():i.getPose()).getAttachment();if(c!=null&&c.timelineAttachment===this)return!0}return!1}},wt=class bn extends Pe{static nextID=0;id=bn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,l,c){i=l+(i>>1)*c;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,b=u.a,x=u.b,w=u.c,v=u.d;for(let y=n,S=l;S<i;y+=2,S+=c){const I=a[y],T=a[y+1];r[S]=I*b+T*x+p,r[S+1]=I*w+T*v+g}return}let d=0,f=0;for(let u=0;u<n;u+=2){const p=h[d];d+=p+1,f+=p}const m=e.bones;if(o.length===0)for(let u=l,p=f*3;u<i;u+=c){let g=0,b=0,x=h[d++];for(x+=d;d<x;d++,p+=3){const w=m[h[d]].appliedPose,v=a[p],y=a[p+1],S=a[p+2];g+=(v*w.a+y*w.b+w.worldX)*S,b+=(v*w.c+y*w.d+w.worldY)*S}r[u]=g,r[u+1]=b}else{const u=o;for(let p=l,g=f*3,b=f<<1;p<i;p+=c){let x=0,w=0,v=h[d++];for(v+=d;d<v;d++,g+=3,b+=2){const y=m[h[d]].appliedPose,S=a[g]+u[b],I=a[g+1]+u[b+1],T=a[g+2];x+=(S*y.a+I*y.b+y.worldX)*T,w+=(S*y.c+I*y.d+y.worldY)*T}r[p]=x,r[p+1]=w}}}copyTo(e){this.bones?(e.bones=[],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,e.timelineSlots=this.timelineSlots}},yt=class Rs extends wt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new z(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new z(0,0,0,0);constructor(e,s){super(e),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const e=new Rs(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=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,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){const e=new Rs(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,s,n){if(!e)throw new Error("Region not set.");const i=n.length;let r=e.u,l=e.v,c=0,o=0;if(e instanceof Ye){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,l-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*c,n[f+1]=l+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,l-=e.offsetY/d,c=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*c,n[f+1]=l+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,l-=e.offsetX/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*c,n[f+1]=l+s[f]*o;return;default:r-=e.offsetX/h,l-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,o=e.originalHeight/d}}else e?(c=e.u2-r,o=e.v2-l):(r=l=0,c=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*c,n[a+1]=l+s[a+1]*o}},j=class xn extends Pe{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new z(1,1,1,1);tempColor=new z(1,1,1,1);constructor(e,s){super(e),this.sequence=s}copy(){const e=new xn(this.name,this.sequence.copy());return e.path=this.path,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,e.color.setFromColor(this.color),e}computeWorldVertices(e,s,n,i,r){const l=e.bone.appliedPose,c=l.worldX,o=l.worldY,a=l.a,h=l.b,d=l.c,f=l.d;let m=s[0],u=s[1];n[i]=m*a+u*h+c,n[i+1]=m*d+u*f+o,i+=r,m=s[2],u=s[3],n[i]=m*a+u*h+c,n[i+1]=m*d+u*f+o,i+=r,m=s[4],u=s[5],n[i]=m*a+u*h+c,n[i+1]=m*d+u*f+o,i+=r,m=s[6],u=s[7],n[i]=m*a+u*h+c,n[i+1]=m*d+u*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,l,c,o,a,h){if(!e)throw new Error("Region not set.");const d=c/e.originalWidth*i,f=o/e.originalHeight*r,m=-c/2*i+e.offsetX*d,u=-o/2*r+e.offsetY*f,p=m+e.width*d,g=u+e.height*f,b=l*$.degRad,x=Math.cos(b),w=Math.sin(b),v=m*x+s,y=m*w,S=u*x+n,I=u*w,T=p*x+s,A=p*w,M=g*x+n,F=g*w;a[0]=v-I,a[1]=S+y,a[2]=v-F,a[3]=M+y,a[4]=T-F,a[5]=M+A,a[6]=T-I,a[7]=S+A,e==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Nt=class ve{static _nextID=0;id=ve.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(e,s){this.regions=new Array(e),this.pathSuffix=s}copy(){const e=this.regions.length,s=new ve(e,this.pathSuffix);if(R.arrayCopy(this.regions,0,s.regions,0,e),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const n=this.uvs[0].length;s.uvs=[];for(let i=0;i<e;i++)s.uvs[i]=R.newFloatArray(n),R.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<e;n++)s.offsets[n]=[],R.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(e){const s=this.regions.length;if(e instanceof j){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=R.newFloatArray(8),this.offsets[n]=[],j.computeUVs(this.regions[n],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[n],this.uvs[n])}else if(e instanceof yt){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=R.newFloatArray(n.length),yt.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(e){let s=e.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,s){if(!this.pathSuffix)return e;let n=e;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return ve._nextID++}},ke=(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))(ke||{}),Ee=[0,1,2,3,4,5,6],Qt=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new Ae,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=t;for(let i=0;i<e;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),zs(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,n,i,r,l,c,o,a){if(!t)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const h=this.timelines;for(let d=0,f=h.length;d<f;d++)h[d].apply(t,e,s,i,r,l,c,o,a)}},Ds=(t=>(t[t.rotate=0]="rotate",t[t.x=1]="x",t[t.y=2]="y",t[t.scaleX=3]="scaleX",t[t.scaleY=4]="scaleY",t[t.shearX=5]="shearX",t[t.shearY=6]="shearY",t[t.inherit=7]="inherit",t[t.rgb=8]="rgb",t[t.alpha=9]="alpha",t[t.rgb2=10]="rgb2",t[t.attachment=11]="attachment",t[t.deform=12]="deform",t[t.event=13]="event",t[t.drawOrder=14]="drawOrder",t[t.ikConstraint=15]="ikConstraint",t[t.transformConstraint=16]="transformConstraint",t[t.pathConstraintPosition=17]="pathConstraintPosition",t[t.pathConstraintSpacing=18]="pathConstraintSpacing",t[t.pathConstraintMix=19]="pathConstraintMix",t[t.physicsConstraintInertia=20]="physicsConstraintInertia",t[t.physicsConstraintStrength=21]="physicsConstraintStrength",t[t.physicsConstraintDamping=22]="physicsConstraintDamping",t[t.physicsConstraintMass=23]="physicsConstraintMass",t[t.physicsConstraintWind=24]="physicsConstraintWind",t[t.physicsConstraintGravity=25]="physicsConstraintGravity",t[t.physicsConstraintMix=26]="physicsConstraintMix",t[t.physicsConstraintReset=27]="physicsConstraintReset",t[t.sequence=28]="sequence",t[t.sliderTime=29]="sliderTime",t[t.sliderMix=30]="sliderMix",t))(Ds||{}),Z=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=R.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 search(t,e,s=1){const n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}};function _s(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var vt=class extends Z{curves;constructor(t,e,...s){super(t,...s),this.curves=R.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=R.newFloatArray(e);R.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const m=(n-r*2+c)*.03,u=(i-l*2+o)*.03,p=((r-c)*3-n+a)*.006,g=((l-o)*3-i+h)*.006;let b=m*2+p,x=u*2+g,w=(r-n)*.3+m+p*.16666667,v=(l-i)*.3+u+g*.16666667,y=n+w,S=i+v;for(let I=f+18;f<I;f+=2)d[f]=y,d[f+1]=S,w+=b,v+=x,b+=p,x+=g,y+=w,S+=v}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const o=this.frames[e],a=this.frames[e+s];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const o=i[n-2],a=i[n-1];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}e+=this.getFrameEntries();const l=i[r-2],c=i[r-1];return c+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-c)}},Ut=class extends vt{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){const e=this.frames;let s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=e[s],r=e[s+1];return r+(t-i)/(e[s+2]-i)*(e[s+2+1]-r)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+l*e:i+(n?l:l+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,l){return l===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,l)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getAbsoluteValue2(t,e,s,n,i,r,l){return t<this.frames[0]?s?r:i:s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getScaleValue(t,e,s,n,i,r,l){if(t<this.frames[0])return s?l:r;const c=this.getCurveValue(t)*l;if(e===1&&!n)return c;let o=s?l:r;return n?o+(c-l)*e:i?o+(Math.abs(c)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(c),o+(c-o)*e)}};function zs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var St=class extends Ut{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Zt=class extends vt{boneIndex;constructor(t,e,s,n,i){super(t,e,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},$t=class extends St{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,l){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Xe=class extends Zt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Z.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const m=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*m,a+=(c[h+3+2]-a)*m;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.x=e.x+o*n,t.y=e.y+a*n):r?(t.x+=o*n,t.y+=a*n):(t.x+=(e.x+o-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Ve=class extends St{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,l){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Re=class extends St{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,l){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Le=class extends Zt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Z.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const m=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*m,a+=(c[h+3+2]-a)*m;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(o*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=o,t.scaleY=a;else{let f=0,m=0;i?(f=e.scaleX,m=e.scaleY):(f=t.scaleX,m=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=m+(a-e.scaleY)*n):l?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=m+(Math.abs(a)*Math.sign(m)-m)*n):(f=Math.abs(f)*Math.sign(o),m=Math.abs(m)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=m+(a-m)*n)}}},Be=class extends St{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,l){t.scaleX=this.getScaleValue(s,n,i,r,l,t.scaleX,e.scaleX)}},Oe=class extends St{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,l){t.scaleY=this.getScaleValue(s,n,i,r,l,t.scaleY,e.scaleY)}},Ne=class extends Zt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Z.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const m=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*m,a+=(c[h+3+2]-a)*m;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.shearX=e.shearX+o*n,t.shearY=e.shearY+a*n):r?(t.shearX+=o*n,t.shearY+=a*n):(t.shearX+=(e.shearX+o-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},Ue=class extends St{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,l){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},$e=class extends St{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,l){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},qe=class extends Z{boneIndex;constructor(t,e){super(t,`7|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(c)r&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Z.search(d,s,2)+1]}}},qt=class extends vt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,l)}},De=class extends qt{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,n,i,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r}apply1(t,e,s,n,i,r){const l=e.color,c=this.frames;if(s<c[0]){i&&l.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Z.search(c,s,5),m=this.curves[f/5];switch(m){case 0:{const u=c[f];o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];const p=(s-u)/(c[f+5]-u);o+=(c[f+5+1]-o)*p,a+=(c[f+5+2]-a)*p,h+=(c[f+5+3]-h)*p,d+=(c[f+5+4]-d)*p;break}case 1:o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];break;default:o=this.getBezierValue(s,f,1,m-2),a=this.getBezierValue(s,f,2,m+18-2),h=this.getBezierValue(s,f,3,m+18*2-2),d=this.getBezierValue(s,f,4,m+18*3-2)}if(n===1)l.set(o,a,h,d);else if(i){const u=t.data.setupPose.color;l.set(u.r+(o-u.r)*n,u.g+(a-u.g)*n,u.b+(h-u.b)*n,u.a+(d-u.a)*n)}else l.add((o-l.r)*n,(a-l.g)*n,(h-l.b)*n,(d-l.a)*n)}},_e=class extends qt{constructor(t,e,s){super(t,e,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(t,e,s,n,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i}apply1(t,e,s,n,i,r){const l=e.color;let c=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const m=t.data.setupPose.color;l.r=m.r,l.g=m.g,l.b=m.b}return}const d=Z.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const m=h[d];c=h[d+1],o=h[d+2],a=h[d+3];const u=(s-m)/(h[d+4]-m);c+=(h[d+4+1]-c)*u,o+=(h[d+4+2]-o)*u,a+=(h[d+4+3]-a)*u;break}case 1:c=h[d+1],o=h[d+2],a=h[d+3];break;default:c=this.getBezierValue(s,d,1,f-2),o=this.getBezierValue(s,d,2,f+18-2),a=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const m=t.data.setupPose.color;c=m.r+(c-m.r)*n,o=m.g+(o-m.g)*n,a=m.b+(a-m.b)*n}else c=l.r+(c-l.r)*n,o=l.g+(o-l.g)*n,a=l.b+(a-l.b)*n;l.r=c<0?0:c>1?1:c,l.g=o<0?0:o>1?1:o,l.b=a<0?0:a>1?1:a}},ze=class extends Ut{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(o?a.appliedPose:a.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const m=a.data.setupPose.color;d=m.a+(d-m.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},We=class extends qt{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,l,c,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=l,this.frames[t+6]=c,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const x=t.data.setupPose;l.setFromColor(x.color);const w=x.darkColor;c.r=w.r,c.g=w.g,c.b=w.b}return}let f=0,m=0,u=0,p=0;const g=Z.search(d,s,8),b=this.curves[g>>3];switch(b){case 0:{const x=d[g];f=d[g+1],m=d[g+2],u=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];const w=(s-x)/(d[g+8]-x);f+=(d[g+8+1]-f)*w,m+=(d[g+8+2]-m)*w,u+=(d[g+8+3]-u)*w,p+=(d[g+8+4]-p)*w,o+=(d[g+8+5]-o)*w,a+=(d[g+8+6]-a)*w,h+=(d[g+8+7]-h)*w;break}case 1:f=d[g+1],m=d[g+2],u=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];break;default:f=this.getBezierValue(s,g,1,b-2),m=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),p=this.getBezierValue(s,g,4,b+18*3-2),o=this.getBezierValue(s,g,5,b+18*4-2),a=this.getBezierValue(s,g,6,b+18*5-2),h=this.getBezierValue(s,g,7,b+18*6-2)}if(n===1)l.set(f,m,u,p);else if(i){const x=t.data.setupPose;let w=x.color;l.set(w.r+(f-w.r)*n,w.g+(m-w.g)*n,w.b+(u-w.b)*n,w.a+(p-w.a)*n),w=x.darkColor,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else l.add((f-l.r)*n,(m-l.g)*n,(u-l.b)*n,(p-l.a)*n),o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n;c.r=o<0?0:o>1?1:o,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h}},He=class extends qt{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=l,this.frames[t+6]=c}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0,d=0,f=0,m=0;const u=this.frames;if(s<u[0]){if(i){const b=t.data.setupPose,x=b.color,w=b.darkColor;l.r=x.r,l.g=x.g,l.b=x.b,c.r=w.r,c.g=w.g,c.b=w.b}return}const p=Z.search(u,s,7),g=this.curves[p/7];switch(g){case 0:{const b=u[p];o=u[p+1],a=u[p+2],h=u[p+3],d=u[p+4],f=u[p+5],m=u[p+6];const x=(s-b)/(u[p+7]-b);o+=(u[p+7+1]-o)*x,a+=(u[p+7+2]-a)*x,h+=(u[p+7+3]-h)*x,d+=(u[p+7+4]-d)*x,f+=(u[p+7+5]-f)*x,m+=(u[p+7+6]-m)*x;break}case 1:o=u[p+1],a=u[p+2],h=u[p+3],d=u[p+4],f=u[p+5],m=u[p+6];break;default:o=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),f=this.getBezierValue(s,p,5,g+18*4-2),m=this.getBezierValue(s,p,6,g+18*5-2)}if(n!==1)if(i){const b=t.data.setupPose;let x=b.color;o=x.r+(o-x.r)*n,a=x.g+(a-x.g)*n,h=x.b+(h-x.b)*n,x=b.darkColor,d=x.r+(d-x.r)*n,f=x.g+(f-x.g)*n,m=x.b+(m-x.b)*n}else o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n,d=c.r+(d-c.r)*n,f=c.g+(f-c.g)*n,m=c.b+(m-c.b)*n;l.r=o<0?0:o>1?1:o,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=f<0?0:f>1?1:f,c.b=m<0?0:m>1?1:m}},Pt=class extends Z{slotIndex=0;attachmentNames;constructor(t,e){super(t,`11|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;c||s<this.frames[0]?r&&this.setAttachment(t,h,a.data.attachmentName):this.setAttachment(t,h,this.attachmentNames[Z.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Ge=class extends vt{slotIndex;attachment;vertices;constructor(t,e,s,n){super(t,e,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const m=(n-r*2+c)*.03,u=o*.03-l*.06,p=((r-c)*3-n+a)*.006,g=(l-o+.33333333)*.018;let b=m*2+p,x=u*2+g,w=(r-n)*.3+m+p*.16666667,v=l*.3+u+g*.16666667,y=n+w,S=v;for(let I=f+18;f<I;f+=2)d[f]=y,d[f+1]=S,w+=b,v+=x,b+=p,x+=g,y+=w,S+=v}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const c=this.frames[e];return(t-c)/(this.frames[e+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>t){const c=this.frames[e];return s[n+1]*(t-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const c=s[n-2],o=s[n-1];return o+(t-c)/(s[n]-c)*(s[n+1]-o)}const r=s[i-2],l=s[i-1];return l+(1-l)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,l,c,o){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,o))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],o,r);for(const g of h)this.applyBeforeFirst(a[g],o,r);return}let f,m,u;if(s>=d[d.length-1])u=0,f=this.vertices[d.length-1],m=null;else{const g=Z.search(d,s);u=this.getCurvePercent(s,g),f=this.vertices[g],m=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],o,f,m,u,p,i,r,l);for(const g of h)this.applyToSlot(a[g],o,f,m,u,p,i,r,l)}applyToSlot(t,e,s,n,i,r,l,c,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const h=a.attachment,d=a.deform;if(d.length===0&&(c=!0),d.length=r,n===null)if(l===1)if(o&&!c)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let m=0;m<r;m++)d[m]+=s[m]-f[m]}else R.arrayCopy(s,0,d,0,r);else if(c)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*l;else{const f=h.vertices;for(let m=0;m<r;m++){const u=f[m];d[m]=u+(s[m]-u)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*l;else{const f=h.vertices;for(let m=0;m<r;m++)d[m]+=(s[m]-f[m])*l}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*l;else if(l===1)if(o&&!c)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]+=m+(n[f]-m)*i}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m];d[m]+=u+(n[m]-u)*i-f[m]}}else if(i===0)R.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const m=s[f];d[f]=m+(n[f]-m)*i}else if(c)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]=(m+(n[f]-m)*i)*l}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m],p=f[m];d[m]=p+(u+(n[m]-u)*i-p)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(n[f]-m)*i)*l}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m];d[m]+=(u+(n[m]-u)*i-f[m])*l}}else for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(n[f]-m)*i-d[f])*l}}applyBeforeFirst(t,e,s){if(!t.bone.active)return;const n=e?t.appliedPose:t.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},je=class Tt extends Z{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`28|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return Tt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const l=this.frames;e*=Tt.ENTRIES,l[e]=s,l[e+Tt.MODE]=n|i<<4,l[e+Tt.DELAY]=r}apply(e,s,n,i,r,l,c,o,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,f=this.frames;if(o||n<f[0]){if(l){this.setupPose(h[this.slotIndex],a);for(const b of d)this.setupPose(h[b],a)}return}const m=Z.search(f,n,Tt.ENTRIES),u=f[m],p=f[m+Tt.MODE],g=f[m+Tt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,u,p,g);for(const b of d)this.applyToSlot(h[b],a,n,u,p,g)}setupPose(e,s){if(!e.bone.active)return;const n=s?e.appliedPose:e.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(e,s,n,i,r,l){if(!e.bone.active)return;const c=s?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=c.attachment.sequence.regions.length;const h=Ee[r&15];if(h!==0)switch(o+=(n-i)/l+1e-5|0,h){case 1:o=Math.min(a-1,o);break;case 2:o%=a;break;case 3:{const d=(a<<1)-2;o=d===0?0:o%d,o>=a&&(o=d-o);break}case 4:o=Math.max(a-1-o,0);break;case 5:o=a-1-o%a;break;case 6:{const d=(a<<1)-2;o=d===0?0:(o+a-1)%d,o>=a&&(o=d-o)}}c.sequenceIndex=o}},te=class wn extends Z{static propertyIds=["13"];events;constructor(e){super(e,...wn.propertyIds),this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,n,i,r,l,c,o,a){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,!1,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let f=0;if(s<h[0])f=0;else{f=Z.search(h,s)+1;const m=h[f];for(;f>0&&h[f-1]===m;)f--}for(;f<d&&n>=h[f];f++)i.push(this.events[f])}},At=class Ls extends Z{static propertyID="14";static propertyIds=[Ls.propertyID];drawOrders;constructor(e){super(e,...Ls.propertyIds),this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){l&&R.arrayCopy(d,0,h,0,e.slots.length);return}const f=this.drawOrders[Z.search(this.frames,n)];if(!f)R.arrayCopy(d,0,h,0,e.slots.length);else for(let m=0,u=f.length;m<u;m++)h[m]=d[f[m]]}},Dt=class yn extends Z{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...yn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(e),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(e){const s=e.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`d${e[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])l&&this.setup(h,d);else{const f=this.drawOrders[Z.search(this.frames,n)];if(!f)this.setup(h,d);else{const m=this.inFolder,u=this.slots;for(let p=0,g=0,b=u.length;!(m[h[p].data.index]&&(h[p]=d[u[f[g]]],++g===b));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,l=0,c=i.length;!(n[e[r].data.index]&&(e[r]=s[i[l]],++l===c));r++);}};function Ws(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Je=class extends vt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,l){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;h.mix=b.mix,h.softness=b.softness,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch}return}let f=0,m=0;const u=Z.search(d,s,6),p=this.curves[u/6];switch(p){case 0:{const b=d[u];f=d[u+1],m=d[u+2];const x=(s-b)/(d[u+6]-b);f+=(d[u+6+1]-f)*x,m+=(d[u+6+2]-m)*x;break}case 1:f=d[u+1],m=d[u+2];break;default:f=this.getBezierValue(s,u,1,p-2),m=this.getBezierValue(s,u,2,p+18-2)}const g=r?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(m-g.softness)*i,c?r&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[u+3],h.compress=d[u+4]!==0,h.stretch=d[u+5]!==0)}},Ke=class extends vt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){const o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=n,o[t+3]=i,o[t+4]=r,o[t+5]=l,o[t+6]=c}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.data.setupPose;h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY}return}let f,m,u,p,g,b;const x=Z.search(d,s,7),w=this.curves[x/7];switch(w){case 0:{const y=d[x];f=d[x+1],m=d[x+2],u=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];const S=(s-y)/(d[x+7]-y);f+=(d[x+7+1]-f)*S,m+=(d[x+7+2]-m)*S,u+=(d[x+7+3]-u)*S,p+=(d[x+7+4]-p)*S,g+=(d[x+7+5]-g)*S,b+=(d[x+7+6]-b)*S;break}case 1:f=d[x+1],m=d[x+2],u=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];break;default:f=this.getBezierValue(s,x,1,w-2),m=this.getBezierValue(s,x,2,w+18-2),u=this.getBezierValue(s,x,3,w+18*2-2),p=this.getBezierValue(s,x,4,w+18*3-2),g=this.getBezierValue(s,x,5,w+18*4-2),b=this.getBezierValue(s,x,6,w+18*5-2)}const v=r?a.data.setupPose:h;l?(h.mixRotate=v.mixRotate+f*i,h.mixX=v.mixX+m*i,h.mixY=v.mixY+u*i,h.mixScaleX=v.mixScaleX+p*i,h.mixScaleY=v.mixScaleY+g*i,h.mixShearY=v.mixShearY+b*i):(h.mixRotate=v.mixRotate+(f-v.mixRotate)*i,h.mixX=v.mixX+(m-v.mixX)*i,h.mixY=v.mixY+(u-v.mixY)*i,h.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*i,h.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*i,h.mixShearY=v.mixShearY+(b-v.mixShearY)*i)}},kt=class extends Ut{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Qe=class extends kt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,l,h.position,a.data.setupPose.position)}}},Ze=class extends kt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},ts=class extends vt{constraintIndex;constructor(t,e,s){super(t,e,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){const r=this.frames;t<<=2,r[t]=e,r[t+1]=s,r[t+2]=n,r[t+3]=i}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.data.setupPose;h.mixRotate=x.mixRotate,h.mixX=x.mixX,h.mixY=x.mixY}return}let f,m,u;const p=Z.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const x=d[p];f=d[p+1],m=d[p+2],u=d[p+3];const w=(s-x)/(d[p+4]-x);f+=(d[p+4+1]-f)*w,m+=(d[p+4+2]-m)*w,u+=(d[p+4+3]-u)*w;break}case 1:f=d[p+1],m=d[p+2],u=d[p+3];break;default:f=this.getBezierValue(s,p,1,g-2),m=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+18*2-2)}const b=r?a.data.setupPose:h;l?(h.mixRotate=b.mixRotate+f*i,h.mixX=b.mixX+m*i,h.mixY=b.mixY+u*i):(h.mixRotate=b.mixRotate+(f-b.mixRotate)*i,h.mixX=b.mixX+(m-b.mixX)*i,h.mixY=b.mixY+(u-b.mixY)*i)}},bt=class extends kt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,l,c,o){if(l&&!this.additive&&(l=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,h=t.physics;for(const d of h)if(d.active&&this.global(d.data)){const f=o?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,l,this.get(f),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,l,this.get(h),this.get(a.data.setupPose)))}}}},es=class extends bt{constructor(t,e,s){super(t,e,s,20)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ss=class extends bt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ns=class extends bt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},is=class extends bt{constructor(t,e,s){super(t,e,s,23)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},rs=class extends bt{constructor(t,e,s){super(t,e,s,24),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},as=class extends bt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},os=class extends bt{constructor(t,e,s){super(t,e,s,26)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},cs=class vn extends Z{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...vn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,n,i,r,l,c,o,a){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(e,s,Number.MAX_VALUE,[],r,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[Z.search(d,s)+1]))if(h!=null)h.reset(e);else for(const f of e.physics)f.active&&f.reset(e)}},ls=class extends kt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,l,h.time,a.data.setupPose.time)}}},hs=class extends kt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,l,h.mix,a.data.setupPose.mix)}}},On=class Bs{static emptyAnimation=new Qt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Gs(this);propertyIds=new Ae;animationsChanged=!1;trackEntryPool=new Ot(()=>new Hs);constructor(e){this.data=e}update(e){e*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n<i;n++){const r=s[n];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let l=e*r.timeScale;if(r.delay>0){if(r.delay-=l,r.delay>0)continue;l=-r.delay,r.delay=0}let c=r.next;if(c){const o=r.trackLast-c.delay;if(o>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*c.timeScale,r.trackTime+=l,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=e,c=c.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){const n=e.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(n.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=e),n.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,e.mixTime+=s,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,o=n.length;c<o;c++){const a=n[c];if(!a||a.delay>0)continue;i=!0;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,e):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,f=a.getAnimationTime(),m=f,u=s;a.reverse&&(m=a.animation.duration-m,u=null);const p=a.animation.timelines,g=p.length;if(c===0&&h===1)for(let b=0;b<g;b++){R.webkit602BugfixHelper(h);const x=p[b];x instanceof Pt?this.applyAttachmentTimeline(x,e,m,!0,!0):x.apply(e,d,m,u,h,!0,!1,!1,!1)}else{const b=a.timelineMode,x=h>=a.alphaAttachmentThreshold,w=a.additive,v=w||a.shortestRotation,y=!v&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let S=0;S<g;S++){const I=p[S],T=(b[S]&_t)!==0;!v&&I instanceof $t?this.applyRotateTimeline(I,e,m,h,T,a.timelinesRotation,S<<1,y):I instanceof Pt?this.applyAttachmentTimeline(I,e,m,T,x):(R.webkit602BugfixHelper(h),I.apply(e,d,m,u,h,T,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,f),this.queueEvents(a,f),s.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+ds,l=e.slots;for(let c=0,o=e.slots.length;c<o;c++){const a=l[c];if(a.attachmentState===r){const h=a.data.attachmentName;a.pose.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s){const n=e.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=e.mix(),l=n.alpha*i,c=1-r*e.alpha,o=l*(1-r),a=c>0?o/c:l,h=n.animation.timelines,d=h.length,f=n.timelineMode,m=n.timelineHoldMix,u=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,b=g||n.shortestRotation,x=!b&&n.timelinesRotation.length!==d<<1;x&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let v=n.animationLast,y=n.getAnimationTime(),S=y,I=null;n.reverse?S=n.animation.duration-S:r<n.eventThreshold&&(I=this.events),n.totalAlpha=0;for(let T=0;T<d;T++){const A=h[T],M=f[T];let F=0;if((M&zt)!==0){const E=m[T];F=E==null?a:a*(1-E.mix())}else{if(!p&&A instanceof At)continue;F=o}n.totalAlpha+=F;const k=(M&_t)!==0;if(!b&&A instanceof $t)this.applyRotateTimeline(A,s,S,F,k,w,T<<1,x);else if(A instanceof Pt)this.applyAttachmentTimeline(A,s,S,k,u&&F>=n.alphaAttachmentThreshold);else{const E=!p||!(A instanceof At)||!k;A.apply(s,v,S,I,F,k,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,v,y),e.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,s,n,i,r){const l=s.slots[e.slotIndex];if(!l.bone.active||!r&&l.attachmentState===this.unkeyedState+fs)return;let c=n<e.frames[0],o=null;if(c||(o=e.attachmentNames[Z.search(e.frames,n)],c=!r&&o==null),c){if(!i)return;o=l.data.attachmentName}l.pose.setAttachment(o==null?null:s.getAttachment(l.data.index,o)),r?l.attachmentState=this.unkeyedState+fs:c||(l.attachmentState=this.unkeyedState+ds)}applyRotateTimeline(e,s,n,i,r,l,c,o){if(o&&(l[c]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,f=e.frames;if(n<f[0]){r&&(h.rotation=d.rotation);return}const m=r?d.rotation:h.rotation,u=d.rotation+e.getCurveValue(n);let p=0,g=u-m;if(g-=Math.ceil(g/360-.5)*360,g===0)p=l[c];else{let b=0,x=0;o?(b=0,x=g):(b=l[c],x=l[c+1]);const w=b-b%360;p=g+w;let v=g>=0,y=b>=0;Math.abs(x)<=90&&$.signum(x)!==$.signum(g)&&(Math.abs(b-w)>180?(p+=360*$.signum(b),y=v):w!==0?p-=360*$.signum(b):y=v),y!==v&&(p+=360*$.signum(b)),l[c]=p}l[c+1]=g,h.rotation=m+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,l=e.reverse;let c=e.trackLast%r;l&&(c=r-c);const o=this.events;let a=0,h=o.length;for(;a<h;a++){const f=o[a];if(f.time<c!==l)break;f.time>=n&&f.time<=i&&this.queue.event(e,f)}let d=!1;if(e.loop)if(r===0)d=!0;else{const f=Math.floor(e.trackTime/r);d=f>0&&f>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const f=o[a];f.time>=n&&f.time<=i&&this.queue.event(e,f)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,l=i-n,c=e.animation.timelines;for(let o=0,a=e.animation.timelines.length;o<a;o++){const h=c[o];if(!(h instanceof te))continue;const d=h.events,f=h.frames,m=f.length;if(r>=l){for(let u=0;u<m;u++)if(!(f[u]<l)){if(f[u]>=r)break;this.events.push(d[u])}}else{for(let p=0;p<m&&!(f[p]>=r);p++)this.events.push(d[p]);let u=0;for(;u<m&&!(f[u]>=l);u++);for(;u<m;u++)this.events.push(d[u])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const l=this.trackEntry(e,s,n,r);return this.setTrack(e,l,i),this.queue.drain(),l}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const l=this.trackEntry(e,s,n,r);return r?(r.next=l,l.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-l.mixDuration,0))):(this.setTrack(e,l,!0),this.queue.drain(),i<0&&(i=0)),l.delay=i,l}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Bs.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Bs.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,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,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do this.computeHold(i),i=i.mixingTo;while(i)}}this.propertyIds.clear()}computeHold(e){const s=e.animation.timelines,n=e.animation.timelines.length,i=e.timelineMode;i.length=n;const r=e.timelineHoldMix;r.length=0;const l=this.propertyIds,c=e.additive,o=e.keepHold,a=e.mixingTo;t:for(let h=0;h<n;h++){const d=s[h],f=d.propertyIds,m=l.addAll(f)&&!(d instanceof Dt&&l.contains(At.propertyID));if(c&&d.additive){i[h]=m?_t:ee;continue}for(let p=e.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(f)){i[h]=ee;continue t}let u;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(f))u=m?_t:ee;else{u=m?Js:zt;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(f)){p.mixDuration>0&&(r[h]=p);break}}o&&(u=u&~zt|i[h]&zt),i[h]=u}}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");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){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Hs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=Bt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Bt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Bt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const 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}},Gs=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){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const l=i[r];l.start&&l.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const l=i[r];l.interrupt&&l.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const l=i[r];l.end&&l.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const l=i[r];l.dispose&&l.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const l=i[r];l.complete&&l.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let l=0;l<i.length;l++){const c=i[l];c.event&&c.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},js=(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))(js||{}),Nn=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},ee=0,_t=1,zt=2,Js=3,ds=1,fs=2,Un=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Ks=class{constructor(t,e="",s=new us,n=new Qs){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.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)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,l)=>{const c=`Couldn't load binary ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,l)=>{const c=`Couldn't load JSON ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(o=>{if(o.ok)return o.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(o=>o?createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(o=>{if(o){const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)}});else{const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)},o.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),o.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((l,c)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(o,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),l(a);return}for(const f of a.pages)this.loadTexture(this.texturePath(r,f.name,n),(m,u)=>{d||(f.setTexture(u),--h===0&&(this.success(e,t,a),l(a)))},(m,u)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),c(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),c(h)}},(o,a)=>{const h=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,h),c(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,c=>{try{const o=this.createTextureAtlas(c,i,t);this.success(e,t,o),r(o)}catch(o){const a=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,a),l(a)}},(c,o)=>{const a=`Couldn't load texture atlas ${t}: status ${c}, ${o}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
2
+ ${s}`:""}`)}remove(t){t=this.pathPrefix+t;const e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(const t in this.cache.assets){const e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Fe){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,s,n){const i=new Fe(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const l=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+l]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},Qs=class Se{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Se.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Se;return Se.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},us=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){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=e.charCodeAt(i);return n}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 n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(l){this.finish(t,400,JSON.stringify(l))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(l){this.finish(t,400,JSON.stringify(l))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},ms=class Sn extends wt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Sn(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Wt=class In extends wt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new In(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},se=class Tn extends wt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Tn(this.name);return this.copyTo(e),e.lengths=[],R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Zs=class An extends wt{x=0;y=0;rotation=0;color=new z(.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*$.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,l=n*e.c+i*e.d;return $.atan2Deg(l,r)}copy(){const e=new An(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},$n=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new j(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new yt(s,i)}newBoundingBoxAttachment(t,e,s){return new ms(s)}newPathAttachment(t,e,s){return new se(s)}newPointAttachment(t,e,s){return new Zs(s)}newClippingAttachment(t,e,s){return new Wt(s)}},ne=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},gs=class Cn extends ne{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new re),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new Cn(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ie=(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))(ie||{}),re=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");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}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,f=t.scaleY,m=(e+i)*$.degRad,u=(e+90+r)*$.degRad;this.a=Math.cos(m)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(m)*s*f,this.d=Math.sin(u)*n*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const l=this.bone.parent.appliedPose;let c=l.a,o=l.b,a=l.c,h=l.d;switch(this.worldX=c*this.x+o*this.y+l.worldX,this.worldY=a*this.x+h*this.y+l.worldY,this.inherit){case 0:{const d=(e+i)*$.degRad,f=(e+90+r)*$.degRad,m=Math.cos(d)*s,u=Math.cos(f)*n,p=Math.sin(d)*s,g=Math.sin(f)*n;this.a=c*m+o*p,this.b=c*u+o*g,this.c=a*m+h*p,this.d=a*u+h*g;return}case 1:{const d=(e+i)*$.degRad,f=(e+90+r)*$.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(f)*n,this.c=Math.sin(d)*s,this.d=Math.sin(f)*n;break}case 2:{const d=1/t.scaleX,f=1/t.scaleY;c*=d,a*=f;let m=c*c+a*a,u=0;m>1e-4?(m=Math.abs(c*h*f-o*d*a)/m,o=a*m,h=c*m,u=$.atan2Deg(a,c)):(c=0,a=0,u=90-$.atan2Deg(h,o));const p=(e+i-u)*$.degRad,g=(e+r-u+90)*$.degRad,b=Math.cos(p)*s,x=Math.cos(g)*n,w=Math.sin(p)*s,v=Math.sin(g)*n;this.a=c*b-o*w,this.b=c*x-o*v,this.c=a*b+h*w,this.d=a*x+h*v;break}case 3:case 4:{let d=e*$.degRad,f=Math.cos(d),m=Math.sin(d),u=(c*f+o*m)/t.scaleX,p=(a*f+h*m)/t.scaleY,g=Math.sqrt(u*u+p*p);g>1e-5&&(g=1/g),u*=g,p*=g,g=Math.sqrt(u*u+p*p),this.inherit===3&&c*h-o*a<0!=(t.scaleX<0!=t.scaleY<0)&&(g=-g),d=Math.PI/2+Math.atan2(p,u);const b=Math.cos(d)*g,x=Math.sin(d)*g,w=i*$.degRad,v=(90+r)*$.degRad,y=Math.cos(w)*s,S=Math.cos(v)*n,I=Math.sin(w)*s,T=Math.sin(v)*n;this.a=u*y+b*I,this.b=u*S+b*T,this.c=p*y+x*I,this.d=p*S+x*T;break}}this.a*=t.scaleX,this.b*=t.scaleX,this.c*=t.scaleY,this.d*=t.scaleY}updateLocalTransform(t){if(this.local=0,this.world=t._update,!this.bone.parent){this.x=this.worldX-t.x,this.y=this.worldY-t.y;const b=this.a,x=this.b,w=this.c,v=this.d;this.rotation=$.atan2Deg(w,b),this.scaleX=Math.sqrt(b*b+w*w),this.scaleY=Math.sqrt(x*x+v*v),this.shearX=0,this.shearY=$.atan2Deg(b*x+w*v,b*v-x*w);return}const e=this.bone.parent.appliedPose;let s=e.a,n=e.b,i=e.c,r=e.d,l=1/(s*r-n*i),c=r*l,o=n*l,a=i*l,h=s*l;const d=this.worldX-e.worldX,f=this.worldY-e.worldY;this.x=d*c-f*o,this.y=f*h-d*a;let m,u,p,g;if(this.inherit===1)m=this.a,u=this.b,p=this.c,g=this.d;else{switch(this.inherit){case 2:{const b=Math.abs(s*r-n*i)/(s*s+i*i);n=-i*t.scaleX*b/t.scaleY,r=s*t.scaleY*b/t.scaleX,l=1/(s*r-n*i),c=r*l,o=n*l;break}case 3:case 4:{let b=this.rotation*$.degRad,x=Math.cos(b),w=Math.sin(b);s=(s*x+n*w)/t.scaleX,i=(i*x+r*w)/t.scaleY;let v=Math.sqrt(s*s+i*i);v>1e-5&&(v=1/v),s*=v,i*=v,v=Math.sqrt(s*s+i*i),this.inherit===3&&l<0!=(t.scaleX<0!=t.scaleY<0)&&(v=-v),b=$.PI/2+Math.atan2(i,s),n=Math.cos(b)*v,r=Math.sin(b)*v,l=1/(s*r-n*i),c=r*l,o=n*l,a=i*l,h=s*l}}m=c*this.a-o*this.c,u=c*this.b-o*this.d,p=h*this.c-a*this.a,g=h*this.d-a*this.b}if(this.shearX=0,this.scaleX=Math.sqrt(m*m+p*p),this.scaleX>1e-4){const b=m*g-u*p;this.scaleY=b/this.scaleX,this.shearY=-$.atan2Deg(m*u+p*g,b),this.rotation=$.atan2Deg(p,m)}else this.scaleX=0,this.scaleY=Math.sqrt(u*u+g*g),this.shearY=0,this.rotation=90-$.atan2Deg(g,u)}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t._update)}modifyWorld(t){this.local=t,this.world=t,this.resetWorld(t)}resetWorld(t){const e=this.bone.children;for(let s=0,n=e.length;s<n;s++){const i=e[s].appliedPose;i.world===t&&(i.world=0,i.local=0,i.resetWorld(t))}}getWorldRotationX(){return $.atan2Deg(this.c,this.a)}getWorldRotationY(){return $.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const 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.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=$.degRad;const e=Math.sin(t),s=Math.cos(t);return $.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*$.degRad;const e=Math.sin(t),s=Math.cos(t);return $.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=$.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},ps=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},bs=class extends ps{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},ae=class Mn extends bs{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new re,new re),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Mn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends bs{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},tn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,R.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,R.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends ne{constructor(t,e){super(t,e)}},oe=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},xs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new oe(-1,this);constructor(t){this.name=t}},ce=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},Ht=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new ce)}create(t){return new en(this,t)}},ws=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(ws||{}),en=class Yt extends Et{bones;target;constructor(e,s){if(super(e,new ce,new ce),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Yt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Yt.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Yt.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,l,c,o,a,h){typeof n=="number"?Yt.apply1(e,s,n,i,r,l,c,o):Yt.apply2(e,s,n,i,r,l,c,o,a,h)}static apply1(e,s,n,i,r,l,c,o){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,f=a.c,m=a.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*$.signum(e.scaleX),g=(i-s.worldY)*$.signum(e.scaleY);break;case 2:{const b=Math.abs(h*m-d*f)/Math.max(1e-4,h*h+f*f),x=h/e.scaleX,w=f/e.scaleY;d=-w*b*e.scaleX,m=x*b*e.scaleY,u+=$.atan2Deg(w,x)}default:{const b=n-a.worldX,x=i-a.worldY,w=h*m-d*f;Math.abs(w)<=1e-4?(p=0,g=0):(p=(b*m-x*d)/w-s.x,g=(x*h-b*f)/w-s.y)}}if(u+=$.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360),s.rotation+=u*o,r||l){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const b=s.bone.data.length*s.scaleX;if(b>1e-4){const x=p*p+g*g;if(r&&x<b*b||l&&x>b*b){const w=(Math.sqrt(x)/b-1)*o+1;switch(s.scaleX*=w,c){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w}}}}}static apply2(e,s,n,i,r,l,c,o,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,f=s.y,m=s.scaleX,u=s.scaleY,p=n.scaleX,g=0,b=0,x=0;m<0?(m=-m,g=180,x=-1):(g=0,x=1),u<0&&(u=-u,x=-x),p<0?(p=-p,b=180):b=0;let w=0,v=0,y=s.a,S=s.b,I=s.c,T=s.d;const A=Math.abs(m-u)<=1e-4;!A||c?(n.y=0,w=y*n.x+s.worldX,v=I*n.x+s.worldY):(w=y*n.x+S*n.y+s.worldX,v=I*n.x+T*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,S=M.b,I=M.c,T=M.d;let F=y*T-S*I,k=w-M.worldX,E=v-M.worldY;F=Math.abs(F)<=1e-4?0:1/F;const X=(k*T-E*S)*F-d,V=(E*y-k*I)*F-f;let O=Math.sqrt(X*X+V*V),D=n.bone.data.length*p,B,P;if(O<1e-4){Yt.apply(e,s,i,r,!1,c,0,h),n.rotation=0;return}k=i-M.worldX,E=r-M.worldY;let Y=(k*T-E*S)*F-d,U=(E*y-k*I)*F-f,N=Y*Y+U*U;if(a!==0){a*=m*(p+1)*.5;const L=Math.sqrt(N),_=L-O-D*m+a;if(_>0){let q=Math.min(1,_/(a*2))-1;q=(_-a*(1-q*q))/L,Y-=q*Y,U-=q*U,N=Y*Y+U*U}}t:if(A){D*=m;let L=(N-O*O-D*D)/(2*O*D);if(L<-1)L=-1,P=Math.PI*l;else if(L>1){if(L=1,P=0,c)switch(y=(Math.sqrt(N)/(O+D)-1)*h+1,s.scaleX*=y,o){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y}}else P=Math.acos(L)*l;y=O+D*L,S=D*Math.sin(P),B=Math.atan2(U*y-Y*S,Y*y+U*S)}else{y=m*D,S=u*D;const L=y*y,_=S*S,q=Math.atan2(U,Y);I=_*O*O+L*N-L*_;const K=-2*_*O,et=_-L;if(T=K*K-4*et*I,T>=0){let ut=Math.sqrt(T);K<0&&(ut=-ut),ut=-(K+ut)*.5;let pt=ut/et,Lt=I/ut;const Jt=Math.abs(pt)<Math.abs(Lt)?pt:Lt;if(pt=N-Jt*Jt,pt>=0){E=Math.sqrt(pt)*l,B=q-Math.atan2(E,Jt),P=Math.atan2(E/u,(Jt-O)/m);break t}}let Q=$.PI,st=O-y,it=st*st,nt=0,ht=0,rt=O+y,at=rt*rt,dt=0;I=-y*O/(L-_),I>=-1&&I<=1&&(I=Math.acos(I),k=y*Math.cos(I)+O,E=S*Math.sin(I),T=k*k+E*E,T<it&&(Q=I,it=T,st=k,nt=E),T>at&&(ht=I,at=T,rt=k,dt=E)),N<=(it+at)*.5?(B=q-Math.atan2(nt*l,st),P=Q*l):(B=q-Math.atan2(dt*l,rt),P=ht*l)}const W=Math.atan2(n.y,n.x)*x;B=(B-W)*$.radDeg+g-s.rotation,B>180?B-=360:B<-180&&(B+=360),s.rotation+=B*h,P=((P+W)*$.radDeg-n.shearX)*x+b-n.rotation,P>180?P-=360:P<-180&&(P+=360),n.rotation+=P*h}},le=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Gt=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new le)}create(t){return new sn(this,t)}},ys=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(ys||{}),vs=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(vs||{}),Ss=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Ss||{}),sn=class xt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new le,new le),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new xt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof se))return;const i=this.appliedPose,r=i.mixRotate,l=i.mixX,c=i.mixY;if(r===0&&l===0&&c===0)return;const o=this.data,a=o.rotateMode===0,h=o.rotateMode===2,d=this.bones,f=d.length,m=a?f:f+1,u=R.setArraySize(this.spaces,m),p=h?this.lengths=R.setArraySize(this.lengths,f):[],g=i.spacing;switch(o.spacingMode){case 2:if(h)for(let S=0,I=m-1;S<I;S++){const T=d[S],A=T.bone.data.length,M=A*T.a,F=A*T.c;p[S]=Math.sqrt(M*M+F*F)}R.arrayFill(u,1,m,g);break;case 3:{let S=0;for(let I=0,T=m-1;I<T;){const A=d[I],M=A.bone.data.length;if(M<xt.epsilon)h&&(p[I]=0),u[++I]=g;else{const F=M*A.a,k=M*A.c,E=Math.sqrt(F*F+k*k);h&&(p[I]=E),u[++I]=E,S+=E}}if(S>0){S=m/S*g;for(let I=1;I<m;I++)u[I]*=S}break}default:{const S=o.spacingMode===0;for(let I=0,T=m-1;I<T;){const A=d[I],M=A.bone.data.length;if(M<xt.epsilon)h&&(p[I]=0),u[++I]=g;else{const F=M*A.a,k=M*A.c,E=Math.sqrt(F*F+k*k);h&&(p[I]=E),u[++I]=(S?Math.max(0,M+g):g)*E/M}}}}const b=this.computeWorldPositions(e,n,m,a);let x=b[0],w=b[1],v=o.offsetRotation,y=!1;if(v===0)y=o.rotateMode===1;else{y=!1;const S=this.slot.bone.appliedPose;v*=S.a*S.d-S.b*S.c>0?$.degRad:-$.degRad}for(let S=0,I=3,T=e._update;S<f;S++,I+=3){const A=d[S];A.worldX+=(x-A.worldX)*l,A.worldY+=(w-A.worldY)*c;const M=b[I],F=b[I+1],k=M-x,E=F-w;if(h){const X=p[S];if(X!==0){const V=(Math.sqrt(k*k+E*E)/X-1)*r+1;A.a*=V,A.c*=V}}if(x=M,w=F,r>0){let X=A.a,V=A.b,O=A.c,D=A.d,B=0,P=0,Y=0;if(a?B=b[I-1]:u[S+1]===0?B=b[I+2]:B=Math.atan2(E,k),B-=Math.atan2(O,X),y){P=Math.cos(B),Y=Math.sin(B);const U=A.bone.data.length;x+=(U*(P*X-Y*O)-k)*r,w+=(U*(Y*X+P*O)-E)*r}else B+=v;B>$.PI?B-=$.PI2:B<-$.PI&&(B+=$.PI2),B*=r,P=Math.cos(B),Y=Math.sin(B),A.a=P*X-Y*O,A.b=P*V-Y*D,A.c=Y*X+P*O,A.d=Y*V+P*D}A.modifyWorld(T)}}computeWorldPositions(e,s,n,i){const r=this.slot;let l=this.appliedPose.position,c=this.spaces,o=R.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,f=d/6,m=xt.NONE;if(!s.constantSpeed){const P=s.lengths;f-=h?1:2;const Y=P[f];this.data.positionMode===1&&(l*=Y);let U;switch(this.data.spacingMode){case 2:U=Y;break;case 3:U=Y/n;break;default:U=1}a=R.setArraySize(this.world,8);for(let N=0,W=0,L=0;N<n;N++,W+=3){const _=c[N]*U;l+=_;let q=l;if(h)q%=Y,q<0&&(q+=Y),L=0;else if(q<0){m!==xt.BEFORE&&(m=xt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition(q,a,0,o,W);continue}else if(q>Y){m!==xt.AFTER&&(m=xt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition(q-Y,a,0,o,W);continue}for(;;L++){const K=P[L];if(!(q>K)){if(L===0)q/=K;else{const et=P[L-1];q=(q-et)/(K-et)}break}}L!==m&&(m=L,h&&L===f?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*6+2,8,a,0,2)),this.addCurvePosition(q,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],o,W,i||N>0&&_===0)}return o}h?(d+=2,a=R.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(f--,d-=4,a=R.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const u=R.setArraySize(this.curves,f);let p=0,g=a[0],b=a[1],x=0,w=0,v=0,y=0,S=0,I=0,T=0,A=0,M=0,F=0,k=0,E=0,X=0,V=0;for(let P=0,Y=2;P<f;P++,Y+=6)x=a[Y],w=a[Y+1],v=a[Y+2],y=a[Y+3],S=a[Y+4],I=a[Y+5],T=(g-x*2+v)*.1875,A=(b-w*2+y)*.1875,M=((x-v)*3-g+S)*.09375,F=((w-y)*3-b+I)*.09375,k=T*2+M,E=A*2+F,X=(x-g)*.75+T+M*.16666667,V=(w-b)*.75+A+F*.16666667,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,k+=M,E+=F,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,p+=Math.sqrt(X*X+V*V),X+=k+M,V+=E+F,p+=Math.sqrt(X*X+V*V),u[P]=p,g=S,b=I;this.data.positionMode===1&&(l*=p);let O;switch(this.data.spacingMode){case 2:O=p;break;case 3:O=p/n;break;default:O=1}const D=this.segments;let B=0;for(let P=0,Y=0,U=0,N=0;P<n;P++,Y+=3){const W=c[P]*O;l+=W;let L=l;if(h)L%=p,L<0&&(L+=p),U=0,N=0;else if(L<0){this.addBeforePosition(L,a,0,o,Y);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,o,Y);continue}for(;;U++){const _=u[U];if(!(L>_)){if(U===0)L/=_;else{const q=u[U-1];L=(L-q)/(_-q)}break}}if(U!==m){m=U;let _=U*6;for(g=a[_],b=a[_+1],x=a[_+2],w=a[_+3],v=a[_+4],y=a[_+5],S=a[_+6],I=a[_+7],T=(g-x*2+v)*.03,A=(b-w*2+y)*.03,M=((x-v)*3-g+S)*.006,F=((w-y)*3-b+I)*.006,k=T*2+M,E=A*2+F,X=(x-g)*.3+T+M*.16666667,V=(w-b)*.3+A+F*.16666667,B=Math.sqrt(X*X+V*V),D[0]=B,_=1;_<8;_++)X+=k,V+=E,k+=M,E+=F,B+=Math.sqrt(X*X+V*V),D[_]=B;X+=k,V+=E,B+=Math.sqrt(X*X+V*V),D[8]=B,X+=k+M,V+=E+F,B+=Math.sqrt(X*X+V*V),D[9]=B,N=0}for(L*=B;;N++){const _=D[N];if(!(L>_)){if(N===0)L/=_;else{const q=D[N-1];L=N+(L-q)/(_-q)}break}}this.addCurvePosition(L*.1,g,b,x,w,v,y,S,I,o,Y,i||P>0&&W===0)}return o}addBeforePosition(e,s,n,i,r){const l=s[n],c=s[n+1],o=s[n+2]-l,a=s[n+3]-c,h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const l=s[n+2],c=s[n+3],o=l-s[n],a=c-s[n+1],h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,l,c,o,a,h,d,f){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const m=e*e,u=m*e,p=1-e,g=p*p,b=g*p,x=p*e,w=x*3,v=p*w,y=w*e,S=s*b+i*v+l*y+o*u,I=n*b+r*v+c*y+a*u;h[d]=S,h[d+1]=I,f&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(I-(n*g+r*x*2+c*m),S-(s*g+i*x*2+l*m)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let l=0;l<r;l++){const c=i[l].bone;e.sortBone(c),e.constrained(c)}e._updateCache.push(this);for(let l=0;l<r;l++)e.sortReset(i[l].bone.children);for(let l=0;l<r;l++)i[l].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let l=0,c=r.length;l<c;l++){const o=r[l];o.slotIndex===n&&this.sortPath(e,o.attachment,i)}}sortPath(e,s,n){if(!(s instanceof se))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let l=0,c=i.length;l<c;){let o=i[l++];for(o+=l;l<o;)e.sortBone(r[i[l++]])}}}isSourceActive(){return this.slot.bone.active}},nn=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(nn||{}),he=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){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}},de=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof wt)||!(this.attachment instanceof wt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},rn=class Fn extends ps{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new Fn(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},an=class Ie{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ie.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ie.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new ae(n,null);else{const r=this.bones[n.parent.index];i=new ae(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new rn(s,this));this.drawOrder=new tn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof Is&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let l=0,c=e.length;l<c;l++)e[l].unconstrained();const s=this.bones,n=s.length;for(let l=0,c=n;l<c;l++){const o=s[l];o.sorted=o.data.skinRequired,o.active=!o.sorted,o.unconstrained()}if(this.skin){const l=this.skin.bones;for(let c=0,o=this.skin.bones.length;c<o;c++){let a=this.bones[l[c].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let l=0;l<r;l++)i[l].unconstrained();for(let l=0;l<r;l++){const c=i[l];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let l=0;l<n;l++)this.sortBone(s[l]);r=this._updateCache.length;for(let l=0;l<r;l++){const c=this._updateCache[l];c instanceof ae&&(this._updateCache[l]=c.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],l=r.data.attachmentName;if(l){const c=e.getAttachment(n,l);c&&r.pose.setAttachment(c)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const l=n[i];if(l instanceof s&&l.data.name===e)return l}return null}getBoundsRect(e){const s=new Ce,n=new Ce;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(e,s,n=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,l=r;let c=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,f=r.length;d<f;d++){const m=l[d];if(!m.bone.active)continue;let u=0,p=null,g=null;const b=m.appliedPose.attachment;if(b){if(b instanceof j)u=8,p=R.setArraySize(n,u,0),b.computeWorldVertices(m,b.getOffsets(m.appliedPose),p,0,2),g=Ie.quadTriangles;else if(b instanceof yt)u=b.worldVerticesLength,p=R.setArraySize(n,u,0),b.computeWorldVertices(this,m,0,u,p,0,2),g=b.triangles;else if(b instanceof Wt&&i){i.clipEnd(m),i.clipStart(this,m,b);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,u=i.clippedVertices.length);for(let x=0,w=p.length;x<w;x+=2){const v=p[x],y=p[x+1];c=Math.min(c,v),o=Math.min(o,y),a=Math.max(a,v),h=Math.max(h,y)}}}i&&i.clipEnd(m)}i&&i.clipEnd(),e.set(c,o),s.set(a-c,h-o)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,l=i.length;r<l;r++)i[r].rotate(e,s,n)}},Is=class Yn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new he,new he),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new Yn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*$.degRad,r=Math.cos(i),l=Math.sin(i),c=this.cx-e,o=this.cy-s;this.translate(c*r-o*l-c,c*l+o*r-o)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,l=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,f=0;switch(s){case 0:return;case 1:this.reset(e);case 2:{const m=Math.max(e.time-this.lastTime,0),u=this.remaining;this.remaining+=m,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let b=this.remaining,x=n.inertia,w=e.data.referenceScale,v=-1,y=0,S=0,I=this.data.limit*m,T=I*Math.abs(e.scaleY);if(I*=Math.abs(e.scaleX),r||l){if(r){const A=(this.ux-p)*x;this.xOffset+=A>I?I:A<-I?-I:A,this.ux=p}if(l){const A=(this.uy-g)*x;this.yOffset+=A>T?T:A<-T?-T:A,this.uy=g}if(b>=d){const A=this.xOffset,M=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,S=n.strength;const F=w*n.wind,k=w*n.gravity,E=(F*e.windX+k*e.gravityX)*e.scaleX,X=(F*e.windY+k*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*S)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),l&&(this.yVelocity-=(X+this.yOffset*S)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),b-=d;while(b>=d);this.xLag=this.xOffset-A,this.yLag=this.yOffset-M}f=Math.max(0,1-b/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c||o){let A=Math.atan2(a.c,a.a),M=0,F=0,k=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>I?E=I:E<-I&&(E=-I),X>T?X=T:X<-T&&(X=-T),b=this.remaining,c){k=(this.data.rotate+this.data.shearX)*i,f=this.rotateLag*Math.max(0,1-u/d);let V=Math.atan2(X+this.ty,E+this.tx)-A-(this.rotateOffset-f)*k;this.rotateOffset+=(V-Math.ceil(V*$.invPI2-.5)*$.PI2)*x,V=(this.rotateOffset-f)*k+A,M=Math.cos(V),F=Math.sin(V),o&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*F)*x/V))}else{M=Math.cos(A),F=Math.sin(A);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);V>0&&(this.scaleOffset+=(E*M+X*F)*x/V)}if(b>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,S=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,O=(n.wind*e.windY+n.gravity*e.gravityY)*an.yDir,D=this.rotateOffset,B=this.scaleOffset,P=h/w;for(;;)if(b-=d,o&&(this.scaleVelocity+=(V*M-O*F-this.scaleOffset*S)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),c){if(this.rotateVelocity-=((V*F+O*M)*P+this.rotateOffset*S)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,b<d)break;const Y=this.rotateOffset*k+A;M=Math.cos(Y),F=Math.sin(Y)}else if(b<d)break;this.rotateLag=this.rotateOffset-D,this.scaleLag=this.scaleOffset-B}f=Math.max(0,1-b/d)}this.remaining=b}this.cx=a.worldX,this.cy=a.worldY;break}case 3:f=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c){let m=(this.rotateOffset-this.rotateLag*f)*i,u=0,p=0,g=0;if(this.data.shearX>0){let b=0;this.data.rotate>0&&(b=m*this.data.rotate,u=Math.sin(b),p=Math.cos(b),g=a.b,a.b=p*g-u*a.d,a.d=u*g+p*a.d),b+=m*this.data.shearX,u=Math.sin(b),p=Math.cos(b),g=a.a,a.a=p*g-u*a.c,a.c=u*g+p*a.c}else m*=this.data.rotate,u=Math.sin(m),p=Math.cos(m),g=a.a,a.a=p*g-u*a.c,a.c=u*g+p*a.c,g=a.b,a.b=p*g-u*a.d,a.d=u*g+p*a.d}if(o){const m=1+(this.scaleOffset-this.scaleLag*f)*i*this.data.scaleX;a.a*=m,a.c*=m}s!==3&&(this.tx=h*a.a,this.ty=h*a.c),a.modifyWorld(e._update)}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},jt=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,new he)}create(t){return new Is(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var fe=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},on=class Os extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new fe,new fe),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Os(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,l=this.bone;if(l!==null){if(!l.active)return;i.local&&l.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,l.appliedPose,i.local,Os.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=e.bones,o=r.bones;for(let a=0,h=r.bones.length;a<h;a++)c[o[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,!1,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const m=i[r[d]];m.sorted=!1,e.sortReset(m.children),e.constrained(m)}const l=n.animation.timelines,c=e.slots,o=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const m=l[d];if(_s(m))e.constrained(c[m.slotIndex]);else if(m instanceof At||m instanceof Dt)e.drawOrder.constrained();else if(m instanceof bt)if(m.constraintIndex===-1)for(let u=0;u<h;u++)e.constrained(a[u]);else e.constrained(o[m.constraintIndex]);else if(Ws(m)){const u=m.constraintIndex;u!==-1&&e.constrained(o[u])}}}},It=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(t){super(t,new fe)}create(t){return new on(this,t)}},Ts=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof It&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},As=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},ue=class{name;attachments=[];bones=[];constraints=[];color=new z(.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.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof yt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new As(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new As(t,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const l=e.attachments[s];for(const c in l){const o=l[c];if(r===o){const a=this.getAttachment(s,c);a&&i.pose.setAttachment(a);break}}}s++}}},Cs=class extends ne{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new de),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Ms=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Ms||{}),me=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},cn=class Pn extends Et{bones;source;constructor(e,s){if(super(e,new me,new me),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new Pn(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,l=i.localTarget,c=i.additive,o=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,f=i.properties.length,m=e._update,u=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const b=u[p];l?b.modifyLocal(e):b.modifyWorld(m);for(let x=0;x<f;x++){const w=d[x],v=w.value(e,h,r,a)-w.offset,y=w.to;for(let S=0,I=w.to.length;S<I;S++){const T=y[S];if(T.mix(n)!==0){let A=T.offset+v*T.scale;o&&(T.offset<T.max?A=$.clamp(A,T.offset,T.max):A=$.clamp(A,T.max,T.offset)),T.apply(e,n,b,A,l,c)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const l=s[r].bone;e.sortReset(l.children),e.constrained(l)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},J=class lt extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new me)}create(e){return new cn(this,e)}getOffsetRotation(){return this.offsets[lt.ROTATION]}setOffsetRotation(e){this.offsets[lt.ROTATION]=e}getOffsetX(){return this.offsets[lt.X]}setOffsetX(e){this.offsets[lt.X]=e}getOffsetY(){return this.offsets[lt.Y]}setOffsetY(e){this.offsets[lt.Y]=e}getOffsetScaleX(){return this.offsets[lt.SCALEX]}setOffsetScaleX(e){this.offsets[lt.SCALEX]=e}getOffsetScaleY(){return this.offsets[lt.SCALEY]}setOffsetScaleY(e){this.offsets[lt.SCALEY]=e}getOffsetShearY(){return this.offsets[lt.SHEARY]}setOffsetShearY(e){this.offsets[lt.SHEARY]=e}},Ct=class{offset=0;to=[]},Mt=class{offset=0;max=0;scale=0},ge=class extends Ct{value(t,e,s,n){if(s)return e.rotation+n[J.ROTATION];const i=t.scaleX,r=t.scaleY;let l=Math.atan2(e.c/r,e.a/i)*$.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[J.ROTATION]:-n[J.ROTATION]);return l<0&&(l+=360),l}},Fs=class extends Mt{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const l=t.scaleX,c=t.scaleY,o=1/l,a=1/c,h=s.a*o,d=s.b*o,f=s.c*a,m=s.d*a;n*=$.degRad,r||(n-=Math.atan2(f,h)),n>$.PI?n-=$.PI2:n<-$.PI&&(n+=$.PI2),n*=e.mixRotate;const u=Math.cos(n),p=Math.sin(n);s.a=(u*h-p*f)*l,s.b=(u*d-p*m)*l,s.c=(p*h+u*f)*c,s.d=(p*d+u*m)*c}}},pe=class extends Ct{value(t,e,s,n){return s?e.x+n[J.X]:(n[J.X]*e.a+n[J.Y]*e.b+e.worldX)/t.scaleX}},Ys=class extends Mt{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},be=class extends Ct{value(t,e,s,n){return s?e.y+n[J.Y]:(n[J.X]*e.c+n[J.Y]*e.d+e.worldY)/t.scaleY}},Ps=class extends Mt{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},xe=class extends Ct{value(t,e,s,n){if(s)return e.scaleX+n[J.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[J.SCALEX]}},ks=class extends Mt{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const l=1+(n-1)*e.mixScaleX;s.a*=l,s.c*=l}else{let l=s.a/t.scaleX,c=s.c/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleX/o,s.a*=o,s.c*=o)}}},we=class extends Ct{value(t,e,s,n){if(s)return e.scaleY+n[J.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[J.SCALEY]}},Es=class extends Mt{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const l=1+(n-1)*e.mixScaleY;s.b*=l,s.d*=l}else{let l=s.b/t.scaleX,c=s.d/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleY/o,s.b*=o,s.d*=o)}}},ye=class extends Ct{value(t,e,s,n){if(s)return e.shearY+n[J.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*$.radDeg-90+n[J.SHEARY]}},Xs=class extends Mt{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const l=t.scaleX,c=t.scaleY,o=s.b/l,a=s.d/c,h=Math.atan2(a,o);n=(n+90)*$.degRad,r?n-=$.PI/2:(n-=h-Math.atan2(s.c/l,s.a/c),n>$.PI?n-=$.PI2:n<-$.PI&&(n+=$.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(o*o+a*a);s.b=Math.cos(n)*d*c,s.d=Math.sin(n)*d*l}}},qn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ts;s.name="";const n=new ln(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const l=n.readBoolean();l&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let m=0;m<c;m++){const u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}const o=s.bones;c=n.readInt(!0);for(let m=0;m<c;m++){const u=n.readString();if(!u)throw new Error("Bone name must not be null.");const p=m===0?null:o[n.readInt(!0)],g=new gs(m,u,p),b=g.setupPose;b.rotation=n.readFloat(),b.x=n.readFloat()*e,b.y=n.readFloat()*e,b.scaleX=n.readFloat(),b.scaleY=n.readFloat(),b.shearX=n.readFloat(),b.shearY=n.readFloat(),b.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),l&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),o.push(g)}c=n.readInt(!0);for(let m=0;m<c;m++){const u=n.readString();if(!u)throw new Error("Slot name must not be null.");const p=o[n.readInt(!0)],g=new Cs(m,u,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const b=n.readInt32();b!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,b),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),l&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let m=0;m<h;m++){const u=n.readString();if(!u)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case li:{const g=new Ht(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.target=o[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const x=g.setupPose;x.bendDirection=(b&4)!==0?-1:1,x.compress=(b&8)!==0,x.stretch=(b&16)!==0,(b&32)!==0&&(x.mix=(b&64)!==0?n.readFloat():1),(b&128)!==0&&(x.softness=n.readFloat()*e),a.push(g);break}case di:{const g=new J(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.source=o[n.readInt(!0)];let b=n.readUnsignedByte();g.skinRequired=(b&1)!==0,g.localSource=(b&2)!==0,g.localTarget=(b&4)!==0,g.additive=(b&8)!==0,g.clamp=(b&16)!==0,p=b>>5;for(let w=0,v;w<p;w++){let y=1,S;switch(n.readByte()){case 0:S=new ge;break;case 1:{y=e,S=new pe;break}case 2:{y=e,S=new be;break}case 3:S=new xe;break;case 4:S=new we;break;case 5:S=new ye;break;default:S=null}if(S){S.offset=n.readFloat()*y,v=n.readByte();for(let I=0;I<v;I++){let T=1,A;switch(n.readByte()){case 0:A=new Fs;break;case 1:{T=e,A=new Ys;break}case 2:{T=e,A=new Ps;break}case 3:A=new ks;break;case 4:A=new Es;break;case 5:A=new Xs;break;default:A=null}A&&(A.offset=n.readFloat()*T,A.max=n.readFloat()*T,A.scale=n.readFloat()*T/y,S.to[I]=A)}g.properties[w]=S}}b=n.readByte(),(b&1)!==0&&(g.offsets[J.ROTATION]=n.readFloat()),(b&2)!==0&&(g.offsets[J.X]=n.readFloat()*e),(b&4)!==0&&(g.offsets[J.Y]=n.readFloat()*e),(b&8)!==0&&(g.offsets[J.SCALEX]=n.readFloat()),(b&16)!==0&&(g.offsets[J.SCALEY]=n.readFloat()),(b&32)!==0&&(g.offsets[J.SHEARY]=n.readFloat()),b=n.readByte();const x=g.setupPose;(b&1)!==0&&(x.mixRotate=n.readFloat()),(b&2)!==0&&(x.mixX=n.readFloat()),(b&4)!==0&&(x.mixY=n.readFloat()),(b&8)!==0&&(x.mixScaleX=n.readFloat()),(b&16)!==0&&(x.mixScaleY=n.readFloat()),(b&32)!==0&&(x.mixShearY=n.readFloat()),a.push(g);break}case hi:{const g=new Gt(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,g.positionMode=b>>1&1,g.spacingMode=b>>2&3,g.rotateMode=b>>4&3,(b&128)!==0&&(g.offsetRotation=n.readFloat());const x=g.setupPose;x.position=n.readFloat(),g.positionMode===0&&(x.position*=e),x.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(x.spacing*=e),x.mixRotate=n.readFloat(),x.mixX=n.readFloat(),x.mixY=n.readFloat(),a.push(g);break}case fi:{const g=new jt(u);g.bone=o[n.readInt(!0)];let b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.x=n.readFloat()),(b&4)!==0&&(g.y=n.readFloat()),(b&8)!==0&&(g.rotate=n.readFloat()),(b&16)!==0&&(g.scaleX=n.readFloat()),(b&32)!==0&&(g.shearX=n.readFloat()),g.limit=((b&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const x=g.setupPose;x.inertia=n.readFloat(),x.strength=n.readFloat(),x.damping=n.readFloat(),x.massInverse=(b&128)!==0?n.readFloat():1,x.wind=n.readFloat(),x.gravity=n.readFloat(),b=n.readByte(),(b&1)!==0&&(g.inertiaGlobal=!0),(b&2)!==0&&(g.strengthGlobal=!0),(b&4)!==0&&(g.dampingGlobal=!0),(b&8)!==0&&(g.massGlobal=!0),(b&16)!==0&&(g.windGlobal=!0),(b&32)!==0&&(g.gravityGlobal=!0),(b&64)!==0&&(g.mixGlobal=!0),x.mix=(b&128)!==0?n.readFloat():1,a.push(g);break}case ui:{const g=new It(u),b=n.readByte();if(g.skinRequired=(b&1)!==0,g.loop=(b&2)!==0,g.additive=(b&4)!==0,(b&8)!==0&&(g.setupPose.time=n.readFloat()),(b&16)!==0&&(g.setupPose.mix=(b&32)!==0?n.readFloat():1),(b&64)!==0){g.local=(b&128)!==0,g.bone=o[n.readInt(!0)];const x=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new ge;break;case 1:{w=e,g.property=new pe;break}case 2:{w=e,g.property=new be;break}case 3:g.property=new xe;break;case 4:g.property=new we;break;case 5:g.property=new ye;break;default:continue}g.property.offset=x*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,l);d&&(s.defaultSkin=d,s.skins.push(d));{let m=s.skins.length;for(R.setArraySize(s.skins,c=m+n.readInt(!0));m<c;m++){const u=this.readSkin(n,s,!1,l);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[m]=u}}c=this.linkedMeshes.length;for(let m=0;m<c;m++){const u=this.linkedMeshes[m],p=s.skins[u.skinIndex];if(!u.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(u.sourceIndex,u.source);if(!g)throw new Error(`Source mesh not found: ${u.source}`);u.mesh.timelineAttachment=u.inheritTimelines?g:u.mesh,u.mesh.setSourceMesh(g),u.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let m=0;m<c;m++){const u=n.readString();if(!u)throw new Error("Event data name must not be null");const p=new xs(u),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const f=s.animations;c=n.readInt(!0);for(let m=0;m<c;m++){const u=n.readString();if(!u)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,u,s,l))}for(let m=0;m<h;m++){const u=a[m];u instanceof It&&(u.animation=f[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new ue("default")}else{const l=t.readString();if(!l)throw new Error("Skin name must not be null.");i=new ue(l),n&&z.rgba8888ToColor(i.color,t.readInt32());let c=t.readInt(!0),o=e.bones,a=i.bones;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];c=t.readInt(!0),o=e.constraints,a=i.constraints;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];r=t.readInt(!0)}for(let l=0;l<r;l++){const c=t.readInt(!0);for(let o=0,a=t.readInt(!0);o<a;o++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(t,e,s,n,i,r){const l=this.scale,c=t.readByte(),o=(c&8)!==0?t.readStringRef():i;if(!o)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let a=(c&16)!==0?t.readStringRef():null;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat();a||(a=o);const w=this.attachmentLoader.newRegionAttachment(s,i,o,a,d);return w?(w.path=a,w.x=m*l,w.y=u*l,w.scaleX=p,w.scaleY=g,w.rotation=f,w.width=b*l,w.height=x*l,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(c&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,o);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(c&16)!==0?t.readStringRef():o;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=t.readInt(!0),m=this.readVertices(t,(c&128)!==0),u=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-f-2)*3),g=t.readInt(!0);let b=null;if(g>0){b=[];for(let S=0;S<g;S++)b[S]=t.readInt(!0)}let x=[],w=0,v=0;r&&(x=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),v=t.readFloat()),a||(a=o);const y=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=f<<1,y.bones=m.bones,y.vertices=m.vertices,y.worldVerticesLength=m.length,y.regionUVs=u,y.triangles=p,b&&(y.timelineSlots=b),r&&(y.edges=x,y.width=w*l,y.height=v*l),y.updateSequence(),y):null}case 3:{const a=(c&16)!==0?t.readStringRef():o;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0,m=t.readInt(!0),u=t.readInt(!0),p=t.readStringRef();let g=0,b=0;r&&(g=t.readFloat(),b=t.readFloat());const x=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return x?(x.path=a,z.rgba8888ToColor(x.color,h),r&&(x.width=g*l,x.height=b*l),this.linkedMeshes.push(new Dn(x,u,n,m,p,f)),x):null}case 4:{const a=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(t,(c&64)!==0),f=this.readFloatArray(t,d.length/6,l),m=r?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,i,o);return u?(u.closed=a,u.constantSpeed=h,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,r&&z.rgba8888ToColor(u.color,m),u):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=r?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,i,o);return m?(m.x=h*l,m.y=d*l,m.rotation=a,r&&z.rgba8888ToColor(m.color,f),m):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(c&16)!==0),d=r?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,i,o);return f?(f.endSlot=e.slots[a],f.convex=(c&32)!==0,f.inverse=(c&64)!==0,f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,r&&z.rgba8888ToColor(f.color,d),f):null}}}readSequence(t,e){if(!e)return new Nt(1,!1);const s=new Nt(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new hn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),l=[],c=[];for(let o=0,a=0;o<r;){const h=t.readInt(!0);l[o++]=h;for(let d=0;d<h;d++,a+=3)l[o++]=t.readInt(!0),c[a]=t.readFloat()*s,c[a+1]=t.readFloat()*s,c[a+2]=t.readFloat()}return new hn(l,R.toFloatArray(c),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=x-1;switch(b){case ni:{const v=new Pt(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readStringRef());i.push(v);break}case ii:{const v=t.readInt(!0),y=new De(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let F=0,k=0;y.setFrame(F,S,I,T,A,M),F!==w;F++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case mt:y.setStepped(F);break;case gt:H(t,y,k++,F,0,S,E,I,X,1),H(t,y,k++,F,1,S,E,T,V,1),H(t,y,k++,F,2,S,E,A,O,1),H(t,y,k++,F,3,S,E,M,D,1)}S=E,I=X,T=V,A=O,M=D}i.push(y);break}case ri:{const v=t.readInt(!0),y=new _e(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let M=0,F=0;y.setFrame(M,S,I,T,A),M!==w;M++){const k=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case mt:y.setStepped(M);break;case gt:H(t,y,F++,M,0,S,k,I,E,1),H(t,y,F++,M,1,S,k,T,X,1),H(t,y,F++,M,2,S,k,A,V,1)}S=k,I=E,T=X,A=V}i.push(y);break}case ai:{const v=t.readInt(!0),y=new We(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,S,I,T,A,M,F,k,E),X!==w;X++){const O=t.readFloat(),D=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case mt:y.setStepped(X);break;case gt:H(t,y,V++,X,0,S,O,I,D,1),H(t,y,V++,X,1,S,O,T,B,1),H(t,y,V++,X,2,S,O,A,P,1),H(t,y,V++,X,3,S,O,M,Y,1),H(t,y,V++,X,4,S,O,F,U,1),H(t,y,V++,X,5,S,O,k,N,1),H(t,y,V++,X,6,S,O,E,W,1)}S=O,I=D,T=B,A=P,M=Y,F=U,k=N,E=W}i.push(y);break}case oi:{const v=t.readInt(!0),y=new He(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,S,I,T,A,M,F,k),E!==w;E++){const V=t.readFloat(),O=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case mt:y.setStepped(E);break;case gt:H(t,y,X++,E,0,S,V,I,O,1),H(t,y,X++,E,1,S,V,T,D,1),H(t,y,X++,E,2,S,V,A,B,1),H(t,y,X++,E,3,S,V,M,P,1),H(t,y,X++,E,4,S,V,F,Y,1),H(t,y,X++,E,5,S,V,k,U,1)}S=V,I=O,T=D,A=B,M=P,F=Y,k=U}i.push(y);break}case ci:{const v=new ze(x,t.readInt(!0),u);let y=t.readFloat(),S=t.readUnsignedByte()/255;for(let I=0,T=0;v.setFrame(I,y,S),I!==w;I++){const A=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case mt:v.setStepped(I);break;case gt:H(t,v,T++,I,0,y,A,S,M,1)}y=A,S=M}i.push(v)}}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===si){const v=new qe(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readByte());i.push(v);continue}const w=t.readInt(!0);switch(b){case Wn:tt(t,i,new $t(x,w,u),1);break;case Hn:tt(t,i,new Xe(x,w,u),r);break;case Gn:tt(t,i,new Ve(x,w,u),r);break;case jn:tt(t,i,new Re(x,w,u),r);break;case Jn:tt(t,i,new Le(x,w,u),1);break;case Kn:tt(t,i,new Be(x,w,u),1);break;case Qn:tt(t,i,new Oe(x,w,u),1);break;case Zn:tt(t,i,new Ne(x,w,u),1);break;case ti:tt(t,i,new Ue(x,w,u),1);break;case ei:tt(t,i,new $e(x,w,u),1);break}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Je(p,t.readInt(!0),u);let x=t.readByte(),w=t.readFloat(),v=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,y=(x&4)!==0?t.readFloat()*r:0;for(let S=0,I=0;b.setFrame(S,w,v,y,(x&8)!==0?1:-1,(x&16)!==0,(x&32)!==0),S!==g;S++){x=t.readByte();const T=t.readFloat(),A=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,M=(x&4)!==0?t.readFloat()*r:0;(x&64)!==0?b.setStepped(S):(x&128)!==0&&(H(t,b,I++,S,0,w,T,v,A,1),H(t,b,I++,S,1,w,T,y,M,r)),w=T,v=A,y=M}i.push(b)}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Ke(p,t.readInt(!0),u);let x=t.readFloat(),w=t.readFloat(),v=t.readFloat(),y=t.readFloat(),S=t.readFloat(),I=t.readFloat(),T=t.readFloat();for(let A=0,M=0;b.setFrame(A,x,w,v,y,S,I,T),A!==g;A++){const F=t.readFloat(),k=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),O=t.readFloat(),D=t.readFloat();switch(t.readByte()){case mt:b.setStepped(A);break;case gt:H(t,b,M++,A,0,x,F,w,k,1),H(t,b,M++,A,1,x,F,v,E,1),H(t,b,M++,A,2,x,F,y,X,1),H(t,b,M++,A,3,x,F,S,V,1),H(t,b,M++,A,4,x,F,I,O,1),H(t,b,M++,A,5,x,F,T,D,1)}x=F,w=k,v=E,y=X,S=V,I=O,T=D}i.push(b)}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=s.constraints[u];for(let g=0,b=t.readInt(!0);g<b;g++){const x=t.readByte(),w=t.readInt(!0),v=t.readInt(!0);switch(x){case pi:tt(t,i,new Qe(w,v,u),p.positionMode===0?r:1);break;case bi:tt(t,i,new Ze(w,v,u),p.spacingMode===0||p.spacingMode===1?r:1);break;case xi:{const y=new ts(w,v,u);let S=t.readFloat(),I=t.readFloat(),T=t.readFloat(),A=t.readFloat();for(let M=0,F=0,k=y.getFrameCount()-1;y.setFrame(M,S,I,T,A),M!==k;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),O=t.readFloat();switch(t.readByte()){case mt:y.setStepped(M);break;case gt:H(t,y,F++,M,0,S,E,I,X,1),H(t,y,F++,M,1,S,E,T,V,1),H(t,y,F++,M,2,S,E,A,O,1)}S=E,I=X,T=V,A=O}i.push(y)}}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===Ci){const v=new cs(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat());i.push(v);continue}const w=t.readInt(!0);switch(b){case wi:tt(t,i,new es(x,w,u),1);break;case yi:tt(t,i,new ss(x,w,u),1);break;case vi:tt(t,i,new ns(x,w,u),1);break;case Si:tt(t,i,new is(x,w,u),1);break;case Ii:tt(t,i,new rs(x,w,u),1);break;case Ti:tt(t,i,new as(x,w,u),1);break;case Ai:tt(t,i,new os(x,w,u),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=t.readInt(!0);switch(b){case Mi:tt(t,i,new ls(x,w,u),1);break;case Fi:tt(t,i,new hs(x,w,u),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readInt(!0);for(let x=0,w=t.readInt(!0);x<w;x++){const v=t.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=u.getAttachment(b,v),S=t.readByte(),I=t.readInt(!0),T=I-1;switch(S){case mi:{const A=y,M=A.bones,F=A.vertices,k=M?F.length/3*2:F.length,E=t.readInt(!0),X=new Ge(I,E,b,A);let V=t.readFloat();for(let O=0,D=0;;O++){let B,P=t.readInt(!0);if(P===0)B=M?R.newFloatArray(k):F;else{B=R.newFloatArray(k);const U=t.readInt(!0);if(P+=U,r===1)for(let N=U;N<P;N++)B[N]=t.readFloat();else for(let N=U;N<P;N++)B[N]=t.readFloat()*r;if(!M)for(let N=0,W=B.length;N<W;N++)B[N]+=F[N]}if(X.setFrame(O,V,B),O===T)break;const Y=t.readFloat();switch(t.readByte()){case mt:X.setStepped(O);break;case gt:H(t,X,D++,O,0,V,Y,0,1,1)}V=Y}i.push(X);break}case gi:{const A=new je(I,b,y);for(let M=0;M<I;M++){const F=t.readFloat(),k=t.readInt32();A.setFrame(M,F,Ee[k&15],k>>4,t.readFloat())}i.push(A);break}}}}}const l=s.slots.length,c=t.readInt(!0);if(c>0){const f=new At(c);for(let m=0;m<c;m++)f.setFrame(m,t.readFloat(),dn(t,l));i.push(f)}const o=t.readInt(!0);for(let f=0;f<o;f++){const m=t.readInt(!0),u=new Array(m);for(let b=0;b<m;b++)u[b]=t.readInt(!0);const p=t.readInt(!0),g=new Dt(p,u,l);for(let b=0;b<p;b++)g.setFrame(b,t.readFloat(),dn(t,m));i.push(g)}const a=t.readInt(!0);if(a>0){const f=new te(a);for(let m=0;m<a;m++){const u=t.readFloat(),p=s.events[t.readInt(!0)],g=new oe(u,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),f.setFrame(m,g)}i.push(f)}let h=0;for(let f=0,m=i.length;f<m;f++)h=Math.max(h,i[f].getDuration());const d=new Qt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},ln=class{constructor(t,e=[],s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const 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(){const 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="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},Dn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},hn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function tt(t,e,s,n){s instanceof Ut?_n(t,e,s,n):zn(t,e,s,n)}function _n(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let l=0,c=0,o=s.getFrameCount()-1;s.setFrame(l,i,r),l!==o;l++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case mt:s.setStepped(l);break;case gt:H(t,s,c++,l,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function zn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,l=t.readFloat()*n;for(let c=0,o=0,a=s.getFrameCount()-1;s.setFrame(c,i,r,l),c!==a;c++){const h=t.readFloat(),d=t.readFloat()*n,f=t.readFloat()*n;switch(t.readByte()){case mt:s.setStepped(c);break;case gt:H(t,s,o++,c,0,i,h,r,d,n),H(t,s,o++,c,1,i,h,l,f,n)}i=h,r=d,l=f}e.push(s)}function dn(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,l=0;for(let c=0;c<s;c++){const o=t.readInt(!0);for(;r!==o;)i[l++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[l++]=r++;for(let c=e-1;c>=0;c--)n[c]===-1&&(n[c]=i[--l]);return n}function H(t,e,s,n,i,r,l,c,o,a){e.setBezier(s,n,i,r,c,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,l,o)}var Wn=0,Hn=1,Gn=2,jn=3,Jn=4,Kn=5,Qn=6,Zn=7,ti=8,ei=9,si=10,ni=0,ii=1,ri=2,ai=3,oi=4,ci=5,li=0,hi=1,di=2,fi=3,ui=4,mi=0,gi=1,pi=0,bi=1,xi=2,wi=0,yi=1,vi=2,Si=4,Ii=5,Ti=6,Ai=7,Ci=8,Mi=0,Fi=1,mt=1,gt=2,Yi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Ot(()=>R.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,l=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<l;c++){const o=r[c];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof ms){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=R.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,o,0,a.worldVerticesLength,h,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,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,l=i.length;r<l;r++){const c=i[r],o=c;for(let a=0,h=c.length;a<h;a+=2){const d=o[a],f=o[a+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),n=Math.max(n,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){const i=this.minX,r=this.minY,l=this.maxX,c=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=l&&s>=l||e>=c&&n>=c)return!1;const o=(n-e)/(s-t);let a=o*(i-t)+e;if(a>r&&a<c||(a=o*(l-t)+e,a>r&&a<c))return!0;let h=(r-e)/o+t;return h>i&&h<l||(h=(c-e)/o+t,h>i&&h<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){const n=t,i=t.length;let r=i-2,l=!1;for(let c=0;c<i;c+=2){const o=n[c+1],a=n[r+1];if(o<s&&a>=s||a<s&&o>=s){const h=n[c];h+(s-o)/(a-o)*(n[r]-h)<e&&(l=!l)}r=c}return l}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,l=i.length;r<l;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,l=t.length,c=e-n,o=s-i,a=e*i-s*n;let h=r[l-2],d=r[l-1];for(let f=0;f<l;f+=2){const m=r[f],u=r[f+1],p=h*u-d*m,g=h-m,b=d-u,x=c*b-o*g,w=(a*g-c*p)/x;if((w>=h&&w<=m||w>=m&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const v=(a*b-o*p)/x;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=m,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},fn=class ot{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Ot(()=>[]);polygonIndicesPool=new Ot(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=ot.isConcave(c,n,s,i);const l=this.triangles;for(l.length=0;n>3;){let c=n-1,o=0,a=1;for(;;){t:if(!r[o]){const f=i[c]<<1,m=i[o]<<1,u=i[a]<<1,p=s[f],g=s[f+1],b=s[m],x=s[m+1],w=s[u],v=s[u+1];for(let y=a+1<n?a+1:0;y!==c;){if(r[y]){const S=i[y]<<1,I=s[S],T=s[S+1];if(ot.positiveArea(w,v,p,g,I,T)&&ot.positiveArea(p,g,b,x,I,T)&&ot.positiveArea(b,x,w,v,I,T))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[o])break;o--}while(o>0);c=o>0?o-1:n-1,a=o+1<n?o+1:0;break}c=o,o=a,++a===n&&(a=0)}l.push(i[c],i[o],i[a]),i.splice(o,1),r.splice(o,1),n--;const h=o>0?o-1:n-1,d=o<n?o:0;r[h]=ot.isConcave(h,n,s,i),r[d]=ot.isConcave(d,n,s,i)}return n===3&&l.push(i[2],i[0],i[1]),l}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let c=this.polygonPool.obtain();c.length=0;let o=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const f=s[h]<<1,m=s[h+1]<<1,u=s[h+2]<<1,p=n[f],g=n[f+1],b=n[m],x=n[m+1],w=n[u],v=n[u+1];if(o===f){const y=c.length-4;if(ot.winding(c[y],c[y+1],c[y+2],c[y+3],w,v)===a&&ot.winding(w,v,c[0],c[1],c[2],c[3])===a){c.push(w,v),l.push(u);continue}}c.length>0&&(i.push(c),r.push(l),c=this.polygonPool.obtain(),l=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,b,x),c.push(w,v),l.length=0,l.push(f,m,u),a=ot.winding(p,g,b,x,w,v),o=f}c.length>0&&(i.push(c),r.push(l));for(let h=0,d=i.length;h<d;h++){if(l=r[h],l.length===0)continue;const f=l[0];let m=l[l.length-1];c=i[h];const u=c.length-4;let p=c[u],g=c[u+1],b=c[u+2],x=c[u+3];const w=c[0],v=c[1],y=c[2],S=c[3],I=ot.winding(p,g,b,x,w,v);for(let T=0;T<d;T++){if(T===h)continue;const A=r[T];if(A.length!==3)continue;const M=A[0],F=A[1],k=A[2],E=i[T],X=E[E.length-2],V=E[E.length-1];M!==f||F!==m||ot.winding(p,g,b,x,X,V)===I&&ot.winding(X,V,w,v,y,S)===I&&(E.length=0,A.length=0,c.push(X,V),l.push(k),m=k,p=b,g=x,b=X,x=V,T=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),l=r[h],r.splice(h,1),this.polygonIndicesPool.free(l)):c.push(c[0],c[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,l=i[e]<<1,c=i[e+1<s?e+1:0]<<1;return!ot.positiveArea(n[r],n[r+1],n[l],n[l+1],n[c],n[c+1])}static positiveArea(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0}static winding(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0?1:-1}},un=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=R.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,l=this.makeClockwise(r);l||this.inverse||s.convex?(l||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new fn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,l,c){return n&&i&&r&&typeof l=="boolean"&&typeof c=="number"?this.clipTrianglesRender(t,e,s,n,i,r,l,c):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let f=e[d]<<1;const m=t[f],u=t[f+1];f=e[d+1]<<1;const p=t[f],g=t[f+1];f=e[d+2]<<1;const b=t[f],x=t[f+1];this.clipInverse(m,u,p,g,b,x,h);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const S=w[v++];let I=S>>1,T=n.length;const A=R.setArraySize(n,T+S);R.arrayCopy(w,v,A,T,S),T=i.length;const M=R.setArraySize(i,T+3*(I-2));for(let F=1;F<I-1;F++,T+=3)M[T]=r,M[T+1]=r+F,M[T+2]=r+F+1;r+=I,v+=S}}return!0}const l=this.clipOutput,c=this.clippingPolygons,o=c.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const f=t[d],m=t[d+1];d=e[h+1]<<1;const u=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],b=t[d+1];for(let x=0;x<o;x++){let w=n.length;if(this.clip(f,m,u,p,g,b,c[x])){a=this.clipOutput;const v=l.length;if(v===0)continue;let y=v>>1;const S=R.setArraySize(n,w+v);R.arrayCopy(a,0,S,w,v),w=i.length;const I=R.setArraySize(i,w+3*(y-2));y--;for(let T=1;T<y;T++,w+=3)I[w]=r,I[w+1]=r+T,I[w+2]=r+T+1;r+=y}else{const v=R.setArraySize(n,w+6);v[w]=f,v[w+1]=m,v[w+2]=u,v[w+3]=p,v[w+4]=g,v[w+5]=b,w=i.length;const y=R.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,l,c){const o=this.clippedVertices;o.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let b=e[g],x=e[g+1],w=e[g+2];const v=t[b*c],y=t[b*c+1],S=t[x*c],I=t[x*c+1],T=t[w*c],A=t[w*c+1];this.clipInverse(v,y,S,I,T,A,p);const M=this.inverseVertices.length;if(M===0)continue;const F=n[b<<=1],k=n[b+1],E=n[x<<=1],X=n[x+1],V=n[w<<=1],O=n[w+1],D=I-A,B=T-S,P=v-T,Y=A-y,U=1/(D*P+B*(y-A)),N=this.inverseVertices;for(let W=0;W<M;){const L=N[W++],_=L>>1;let q=o.length;const K=R.setArraySize(o,q+_*c);for(let Q=0;Q<L;Q+=2,q+=c){const st=N[W+Q],it=N[W+Q+1];K[q]=st,K[q+1]=it,K[q+2]=i.r,K[q+3]=i.g,K[q+4]=i.b,K[q+5]=i.a;const nt=st-T,ht=it-A,rt=(D*nt+B*ht)*U,at=(Y*nt+P*ht)*U,dt=1-rt-at;K[q+6]=F*rt+E*at+V*dt,K[q+7]=k*rt+X*at+O*dt,l&&(K[q+8]=r.r,K[q+9]=r.g,K[q+10]=r.b,K[q+11]=r.a)}q=a.length;const et=R.setArraySize(a,q+3*(_-2));for(let Q=1;Q<_-1;Q++,q+=3)et[q]=h,et[q+1]=h+Q,et[q+2]=h+Q+1;h+=_,W+=L}}return!0}const d=this.clipOutput,f=this.clippingPolygons,m=this.clippingPolygons.length;let u=null;for(let p=0;p<s;p+=3){let g=e[p];const b=t[g*c],x=t[g*c+1],w=n[g<<1],v=n[(g<<1)+1];g=e[p+1];const y=t[g*c],S=t[g*c+1],I=n[g<<1],T=n[(g<<1)+1];g=e[p+2];const A=t[g*c],M=t[g*c+1],F=n[g<<1],k=n[(g<<1)+1],E=S-M,X=A-y,V=b-A,O=M-x,D=1/(E*V+X*(x-M));for(let B=0;B<m;B++){let P=o.length;if(this.clip(b,x,y,S,A,M,f[B])){u=this.clipOutput;const Y=d.length;if(Y===0)continue;let U=Y>>1;const N=R.setArraySize(o,P+U*c);for(let L=0;L<Y;L+=2,P+=c){const _=u[L],q=u[L+1];N[P]=_,N[P+1]=q,N[P+2]=i.r,N[P+3]=i.g,N[P+4]=i.b,N[P+5]=i.a;const K=_-A,et=q-M,Q=(E*K+X*et)*D,st=(O*K+V*et)*D,it=1-Q-st;N[P+6]=w*Q+I*st+F*it,N[P+7]=v*Q+T*st+k*it,l&&(N[P+8]=r.r,N[P+9]=r.g,N[P+10]=r.b,N[P+11]=r.a)}P=a.length;const W=R.setArraySize(a,P+3*(U-2));U--;for(let L=1;L<U;L++,P+=3)W[P]=h,W[P+1]=h+L,W[P+2]=h+L+1;h+=U+1}else{const Y=R.setArraySize(o,P+3*c);Y[P]=b,Y[P+1]=x,Y[P+2]=i.r,Y[P+3]=i.g,Y[P+4]=i.b,Y[P+5]=i.a,l?(Y[P+6]=w,Y[P+7]=v,Y[P+8]=r.r,Y[P+9]=r.g,Y[P+10]=r.b,Y[P+11]=r.a,Y[P+12]=y,Y[P+13]=S,Y[P+14]=i.r,Y[P+15]=i.g,Y[P+16]=i.b,Y[P+17]=i.a,Y[P+18]=I,Y[P+19]=T,Y[P+20]=r.r,Y[P+21]=r.g,Y[P+22]=r.b,Y[P+23]=r.a,Y[P+24]=A,Y[P+25]=M,Y[P+26]=i.r,Y[P+27]=i.g,Y[P+28]=i.b,Y[P+29]=i.a,Y[P+30]=F,Y[P+31]=k,Y[P+32]=r.r,Y[P+33]=r.g,Y[P+34]=r.b,Y[P+35]=r.a):(Y[P+6]=w,Y[P+7]=v,Y[P+8]=y,Y[P+9]=S,Y[P+10]=i.r,Y[P+11]=i.g,Y[P+12]=i.b,Y[P+13]=i.a,Y[P+14]=I,Y[P+15]=T,Y[P+16]=A,Y[P+17]=M,Y[P+18]=i.r,Y[P+19]=i.g,Y[P+20]=i.b,Y[P+21]=i.a,Y[P+22]=F,Y[P+23]=k),P=a.length;const U=R.setArraySize(a,P+3);U[P]=h,U[P+1]=h+1,U[P+2]=h+2,h+=3;break}}}return u!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let l=this._clippedVerticesTyped,c=this._clippedUVsTyped,o=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const u=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const b=t[e+g],x=t[e+g+1];let w=s[p]<<1;const v=i[w],y=i[w+1];g=s[p+1]*r;const S=t[e+g],I=t[e+g+1];w=s[p+1]<<1;const T=i[w],A=i[w+1];g=s[p+2]*r;const M=t[e+g],F=t[e+g+1];w=s[p+2]<<1;const k=i[w],E=i[w+1];this.clipInverse(b,x,S,I,M,F,u);const X=this.inverseVertices.length;if(X===0)continue;const V=I-F,O=M-S,D=b-M,B=F-x,P=1/(V*D+O*(x-F)),Y=this.inverseVertices;for(let U=0;U<X;){const N=Y[U++],W=N>>1;let L=this.clippedVerticesLength;const _=L+W*r,q=this.clippedUVsLength+W*2;l.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(l.subarray(0,L)),l=this._clippedVerticesTyped),c.length<q&&(this._clippedUVsTyped=new Float32Array(q*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=q;const K=this._clippedVerticesTyped,et=this._clippedUVsTyped;let Q=q-W*2;for(let nt=0;nt<N;nt+=2,L+=r,Q+=2){const ht=Y[U+nt],rt=Y[U+nt+1];K[L]=ht,K[L+1]=rt;const at=ht-M,dt=rt-F,ut=(V*at+O*dt)*P,pt=(B*at+D*dt)*P,Lt=1-ut-pt;et[Q]=v*ut+T*pt+k*Lt,et[Q+1]=y*ut+A*pt+E*Lt}L=this.clippedTrianglesLength;const st=L+3*(W-2);o.length<st&&(this._clippedTrianglesTyped=new Uint16Array(st*2),this._clippedTrianglesTyped.set(o.subarray(0,L)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=st;const it=o;for(let nt=1;nt<W-1;nt++,L+=3)it[L]=a,it[L+1]=a+nt,it[L+2]=a+nt+1;a+=W,U+=N}}return!0}const h=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let m=null;for(let u=0;u<n;u+=3){let p=s[u],g=p*r;const b=t[e+g],x=t[e+g+1];let w=p<<1;const v=i[w],y=i[w+1];p=s[u+1],g=p*r;const S=t[e+g],I=t[e+g+1];w=p<<1;const T=i[w],A=i[w+1];p=s[u+2],g=p*r;const M=t[e+g],F=t[e+g+1];w=p<<1;const k=i[w],E=i[w+1],X=I-F,V=M-S,O=b-M,D=F-x,B=1/(X*O+V*(x-F));for(let P=0;P<f;P++){let Y=this.clippedVerticesLength;if(this.clip(b,x,S,I,M,F,d[P])){m=h;const U=h.length;if(U===0)continue;let N=U>>1;const W=Y+N*r;l.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(l.subarray(0,Y)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+N*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),l=this._clippedVerticesTyped,c=this._clippedUVsTyped);const L=l,_=c;this.clippedVerticesLength=W;let q=this.clippedUVsLength;this.clippedUVsLength=q+N*2;for(let Q=0;Q<U;Q+=2,Y+=r,q+=2){const st=m[Q],it=m[Q+1];L[Y]=st,L[Y+1]=it;const nt=st-M,ht=it-F,rt=(X*nt+V*ht)*B,at=(D*nt+O*ht)*B,dt=1-rt-at;_[q]=v*rt+T*at+k*dt,_[q+1]=y*rt+A*at+E*dt}Y=this.clippedTrianglesLength;const K=Y+3*(N-2);o.length<K&&(this._clippedTrianglesTyped=new Uint16Array(K*2),this._clippedTrianglesTyped.set(o.subarray(0,Y)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=K;const et=o;N--;for(let Q=1;Q<N;Q++,Y+=3)et[Y]=a,et[Y+1]=a+Q,et[Y+2]=a+Q+1;a+=N+1}else{let U=Y+3*r;l.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(l.subarray(0,Y)),l=this._clippedVerticesTyped),l[Y]=b,l[Y+1]=x,l[Y+r]=S,l[Y+r+1]=I,l[Y+r*2]=M,l[Y+r*2+1]=F;const N=this.clippedUVsLength+3*2;c.length<N&&(this._clippedUVsTyped=new Float32Array(N*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const W=this.clippedUVsLength;c[W]=v,c[W+1]=y,c[W+2]=T,c[W+3]=A,c[W+4]=k,c[W+5]=E,this.clippedVerticesLength=U,this.clippedUVsLength=N,Y=this.clippedTrianglesLength,U=Y+3,o.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(o.subarray(0,Y)),o=this._clippedTrianglesTyped);const L=o;L[Y]=a,L[Y+1]=a+1,L[Y+2]=a+2,a+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),m!==null}clip(t,e,s,n,i,r,l){const c=this.clipOutput;let o=!1,a,h;l.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=l;a.length=8;const f=a;f[0]=t,f[1]=e,f[2]=s,f[3]=n,f[4]=i,f[5]=r,f[6]=t,f[7]=e,h.length=0;const m=l.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],b=p-d[u+2],x=g-d[u+3],w=h.length,v=a;for(let S=0,I=a.length-2;S<I;){t=v[S],e=v[S+1],S+=2,s=v[S],n=v[S+1];const T=x*(p-s)>b*(g-n),A=x*(p-t)-b*(g-e);if(A>0)if(T)h.push(s,n);else{const M=s-t,F=n-e,k=A/(M*x-F*b);k>=0&&k<=1?(h.push(t+M*k,e+F*k),o=!0):h.push(s,n)}else if(T){const M=s-t,F=n-e,k=A/(M*x-F*b);k>=0&&k<=1?(h.push(t+M*k,e+F*k,s,n),o=!0):h.push(s,n)}else o=!0}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),u===m)break;const y=h;h=a,h.length=0,a=y}if(c!==h){c.length=0;for(let u=0,p=h.length-2;u<p;u++)c[u]=h[u]}else c.length=c.length-2;return o}clipInverse(t,e,s,n,i,r,l){this.inverseVertices.length=0;const c=l.length-4;let o,a;l.length%4>=2?(o=this.clipOutput,a=this.scratch):(o=this.scratch,a=this.clipOutput),o.length=8;let h=l,d=o;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let f=0;;f+=2){const m=h[f],u=h[f+1],p=m-h[f+2],g=u-h[f+3],b=a.length,x=this.inverseVertices.length;this.inverseVertices.push(0),d=o;for(let y=0,S=o.length-2;y<S;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const I=g*(m-s)>p*(u-n),T=g*(m-t)-p*(u-e);if(T>0)if(I)a.push(s,n);else{const A=s-t,M=n-e,F=T/(A*g-M*p);if(F>=0&&F<=1){const k=t+A*F,E=e+M*F;a.push(k,E),this.inverseVertices.push(k,E,s,n)}else a.push(s,n)}else if(I){const A=s-t,M=n-e,F=T/(A*g-M*p);if(F>=0&&F<=1){const k=t+A*F,E=e+M*F;this.inverseVertices.push(k,E),a.push(k,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-x-1;if(w>=6?this.inverseVertices[x]=w:this.inverseVertices.length=x,b===a.length||(a.push(a[0],a[1]),f===c))break;const v=a;a=o,a.length=0,o=v}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,l=e[s-2],c=e[s-1],o=e[0],a=e[1];for(let d=2;d<s;d+=2){const f=e[d],m=e[d+1];r+=o*m-f*a;const u=(o-l)*(m-a)-(a-c)*(f-o);i=i&&u<=0,n=n&&u>=0,l=o,c=a,o=f,a=m}r+=o*e[1]-e[0]*a;const h=(o-l)*(e[1]-a)-(a-c)*(e[0]-o);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,f=s-2,m=s>>1;d<m;d+=2){const u=e[d],p=e[d+1],g=f-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=u,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let l=2;l<e;l+=2){const c=s[l],o=s[l+1];let a=l-2;for(;a>=0&&(n[a]>c||n[a]===c&&n[a+1]>o);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=c,n[a+3]=o}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let l=4;l<e;l+=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=o}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let l=e-6;l>=0;l-=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=o}t.length=i-2}},Pi=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ts,n=typeof t=="string"?JSON.parse(t):t,i=n.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),n.bones)for(let r=0;r<n.bones.length;r++){const l=n.bones[r];let c=null;const o=C(l,"parent",null);o&&(c=s.findBone(o));const a=new gs(s.bones.length,l.name,c);a.length=C(l,"length",0)*e;const h=a.setupPose;h.x=C(l,"x",0)*e,h.y=C(l,"y",0)*e,h.rotation=C(l,"rotation",0),h.scaleX=C(l,"scaleX",1),h.scaleY=C(l,"scaleY",1),h.shearX=C(l,"shearX",0),h.shearY=C(l,"shearY",0),h.inherit=R.enumValue(ie,C(l,"inherit","Normal")),a.skinRequired=C(l,"skin",!1);const d=C(l,"color",null);d&&a.color.setFromString(d),a.icon=C(l,"icon",void 0),a.iconSize=C(l,"iconSize",1),a.iconRotation=C(l,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const l=n.slots[r],c=l.name,o=s.findBone(l.bone);if(!o)throw new Error(`Couldn't find bone ${l.bone} for slot ${c}`);const a=new Cs(s.slots.length,c,o),h=C(l,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(l,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(l,"attachment",null),a.blendMode=R.enumValue(Ms,C(l,"blend","normal")),a.visible=C(l,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const l=r.name,c=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const o=new Ht(l);o.skinRequired=c;for(let m=0;m<r.bones.length;m++){const u=s.findBone(r.bones[m]);if(!u)throw new Error(`Couldn't find bone ${r.bones[m]} for IK constraint ${l}.`);o.bones.push(u)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${l}.`);o.target=h;const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=R.enumValue(ws,d));const f=o.setupPose;f.mix=C(r,"mix",1),f.softness=C(r,"softness",0)*e,f.bendDirection=C(r,"bendPositive",!0)?1:-1,f.compress=C(r,"compress",!1),f.stretch=C(r,"stretch",!1),s.constraints.push(o);break}case"transform":{const o=new J(l);o.skinRequired=c;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);o.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);o.source=h,o.localSource=C(r,"localSource",!1),o.localTarget=C(r,"localTarget",!1),o.additive=C(r,"additive",!1),o.clamp=C(r,"clamp",!1);let d=!1,f=!1,m=!1,u=!1,p=!1,g=!1;const b=Object.entries(C(r,"properties",{}));for(const[w,v]of b){const y=this.fromProperty(w),S=this.propertyScale(w,e);y.offset=C(v,"offset",0)*S;const I=Object.entries(C(v,"to",{}));for(const[T,A]of I){let M=1,F;switch(T){case"rotate":{d=!0,F=new Fs;break}case"x":{f=!0,F=new Ys,M=e;break}case"y":{m=!0,F=new Ps,M=e;break}case"scaleX":{u=!0,F=new ks;break}case"scaleY":{p=!0,F=new Es;break}case"shearY":{g=!0,F=new Xs;break}default:throw new Error(`Invalid transform constraint to property: ${T}`)}F.offset=C(A,"offset",0)*M,F.max=C(A,"max",1)*M,F.scale=C(A,"scale",1)*M/S,y.to.push(F)}y.to.length>0&&o.properties.push(y)}o.offsets[J.ROTATION]=C(r,"rotation",0),o.offsets[J.X]=C(r,"x",0)*e,o.offsets[J.Y]=C(r,"y",0)*e,o.offsets[J.SCALEX]=C(r,"scaleX",0),o.offsets[J.SCALEY]=C(r,"scaleY",0),o.offsets[J.SHEARY]=C(r,"shearY",0);const x=o.setupPose;d&&(x.mixRotate=C(r,"mixRotate",1)),f&&(x.mixX=C(r,"mixX",1)),m&&(x.mixY=C(r,"mixY",x.mixX)),u&&(x.mixScaleX=C(r,"mixScaleX",1)),p&&(x.mixScaleY=C(r,"mixScaleY",x.mixScaleX)),g&&(x.mixShearY=C(r,"mixShearY",1)),s.constraints.push(o);break}case"path":{const o=new Gt(l);o.skinRequired=c;for(let f=0;f<r.bones.length;f++){const m=r.bones[f],u=s.findBone(m);if(!u)throw new Error(`Couldn't find bone ${m} for path constraint ${r.name}.`);o.bones.push(u)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);o.slot=h,o.positionMode=R.enumValue(ys,C(r,"positionMode","Percent")),o.spacingMode=R.enumValue(vs,C(r,"spacingMode","Length")),o.rotateMode=R.enumValue(Ss,C(r,"rotateMode","Tangent")),o.offsetRotation=C(r,"rotation",0);const d=o.setupPose;d.position=C(r,"position",0),o.positionMode===0&&(d.position*=e),d.spacing=C(r,"spacing",0),(o.spacingMode===0||o.spacingMode===1)&&(d.spacing*=e),d.mixRotate=C(r,"mixRotate",1),d.mixX=C(r,"mixX",1),d.mixY=C(r,"mixY",d.mixX),s.constraints.push(o);break}case"physics":{const o=new jt(l);o.skinRequired=c;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);o.bone=h,o.x=C(r,"x",0),o.y=C(r,"y",0),o.rotate=C(r,"rotate",0),o.scaleX=C(r,"scaleX",0),o.shearX=C(r,"shearX",0),o.limit=C(r,"limit",5e3)*e,o.step=1/C(r,"fps",60);const d=o.setupPose;d.inertia=C(r,"inertia",.5),d.strength=C(r,"strength",100),d.damping=C(r,"damping",.85),d.massInverse=1/C(r,"mass",1),d.wind=C(r,"wind",0),d.gravity=C(r,"gravity",0),d.mix=C(r,"mix",1),o.inertiaGlobal=C(r,"inertiaGlobal",!1),o.strengthGlobal=C(r,"strengthGlobal",!1),o.dampingGlobal=C(r,"dampingGlobal",!1),o.massGlobal=C(r,"massGlobal",!1),o.windGlobal=C(r,"windGlobal",!1),o.gravityGlobal=C(r,"gravityGlobal",!1),o.mixGlobal=C(r,"mixGlobal",!1),s.constraints.push(o);break}case"slider":{const o=new It(l);o.skinRequired=c,o.additive=C(r,"additive",!1),o.loop=C(r,"loop",!1),o.setupPose.time=C(r,"time",0),o.setupPose.mix=C(r,"mix",1);const a=r.bone;if(a){if(o.bone=s.findBone(a),!o.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;o.property=this.fromProperty(h);const d=this.propertyScale(h,e);o.property.offset=C(r,"from",0)*d,o.offset=C(r,"to",0),o.scale=C(r,"scale",1)/d,o.local=C(r,"local",!1)}s.constraints.push(o);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const l=n.skins[r],c=new ue(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){const a=l.bones[o],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);c.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){const a=l.ik[o],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){const a=l.transform[o],h=s.findConstraint(a,J);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){const a=l.path[o],h=s.findConstraint(a,Gt);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.physics)for(let o=0;o<l.physics.length;o++){const a=l.physics[o],h=s.findConstraint(a,jt);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.slider)for(let o=0;o<l.slider.length;o++){const a=l.slider[o],h=s.findConstraint(a,It);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}for(const o in l.attachments){const a=s.findSlot(o);if(!a)throw new Error(`Couldn't find skin slot ${o} for skin ${l.name}.`);const h=l.attachments[o];for(const d in h){const f=this.readAttachment(h[d],c,a.index,d,s);f&&c.setAttachment(a.index,d,f)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,l=this.linkedMeshes.length;r<l;r++){const c=this.linkedMeshes[r],o=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${c.skin}`);const a=o.getAttachment(c.sourceIndex,c.source);if(!a)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?a:c.mesh,c.mesh.setSourceMesh(a),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=a.timelineSlots;for(const f of h)if(f===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const l=n.events[r],c=new xs(r),o=c.setupPose;o.intValue=C(l,"int",0),o.floatValue=C(l,"float",0),o.stringValue=C(l,"string",""),c._audioPath=C(l,"audio",null),c.audioPath&&(o.volume=C(l,"volume",o.volume),o.balance=C(l,"balance",o.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const l=n.animations[r];this.readAnimation(l,r,s)}if(n.constraints)for(const r in n.constraints){const l=n.constraints[r];if(l.type==="slider"){const c=s.findConstraint(l.name,It),o=l.animation,a=s.findAnimation(o);if(!a)throw new Error(`Slider animation not found: ${o}`);c.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new ge;break;case"x":e=new pe;break;case"y":e=new be;break;case"scaleX":e=new xe;break;case"scaleY":e=new we;break;case"shearY":e=new ye;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,l=C(t,"name",n);switch(C(t,"type","region")){case"region":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,l,c,o);if(!a)return null;a.path=c,a.x=C(t,"x",0)*r,a.y=C(t,"y",0)*r,a.scaleX=C(t,"scaleX",1),a.scaleY=C(t,"scaleY",1),a.rotation=C(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=C(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(e,n,l);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"mesh":case"linkedmesh":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,l,c,o);if(!a)return null;a.path=c;const h=C(t,"color",null);h&&a.color.setFromString(h),a.width=C(t,"width",0)*r,a.height=C(t,"height",0)*r;const d=C(t,"source",null);if(d){let m=s;const u=C(t,"slot",null);if(u){const p=i.findSlot(u);if(!p)throw new Error(`Source mesh slot not found: ${u}`);m=p.index}return this.linkedMeshes.push(new ki(a,C(t,"skin",null),s,m,d,C(t,"timelines",!0))),a}const f=t.uvs;return this.readVertices(t,a,f.length),a.triangles=t.triangles,a.regionUVs=f,a.edges=C(t,"edges",null),a.hullLength=C(t,"hull",0)*2,a.updateSequence(),a}case"path":{const c=this.attachmentLoader.newPathAttachment(e,n,l);if(!c)return null;c.closed=C(t,"closed",!1),c.constantSpeed=C(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,c,o<<1);const a=R.newArray(o/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;c.lengths=a;const h=C(t,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(e,n,l);if(!c)return null;c.x=C(t,"x",0)*r,c.y=C(t,"y",0)*r,c.rotation=C(t,"rotation",0);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(e,n,l);if(!c)return null;const o=C(t,"end",null);o&&(c.endSlot=i.findSlot(o)),c.convex=C(t,"convex",!1),c.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,c,a<<1);const h=C(t,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(t){if(t==null)return new Nt(1,!1);const e=new Nt(C(t,"count",0),!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){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const c=R.toFloatArray(i);if(n!==1)for(let o=0,a=i.length;o<a;o++)c[o]*=n;e.vertices=c;return}const r=[],l=[];for(let c=0,o=i.length;c<o;){const a=i[c++];l.push(a);for(let h=c+a*4;c<h;c+=4)l.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}e.bones=l,e.vertices=R.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const o in t.slots){const a=t.slots[o],h=s.findSlot(o);if(!h)throw new Error(`Slot not found: ${o}`);const d=h.index;for(const f in a){const m=a[f];if(!m)continue;const u=m.length;switch(f){case"attachment":{const p=new Pt(u,d);for(let g=0;g<u;g++){const b=m[g];p.setFrame(g,C(b,"time",0),C(b,"name",null))}i.push(p);break}case"rgba":{const p=new De(u,u<<2,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b,x.a);const y=m[w+1];if(!y){p.shrink(v);break}const S=C(y,"time",0),I=z.fromString(y.color),T=g.curve;T&&(v=G(T,p,v,w,0,b,S,x.r,I.r,1),v=G(T,p,v,w,1,b,S,x.g,I.g,1),v=G(T,p,v,w,2,b,S,x.b,I.b,1),v=G(T,p,v,w,3,b,S,x.a,I.a,1)),b=S,x=I,g=y}i.push(p);break}case"rgb":{const p=new _e(u,u*3,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b);const y=m[w+1];if(!y){p.shrink(v);break}const S=C(y,"time",0),I=z.fromString(y.color),T=g.curve;T&&(v=G(T,p,v,w,0,b,S,x.r,I.r,1),v=G(T,p,v,w,1,b,S,x.g,I.g,1),v=G(T,p,v,w,2,b,S,x.b,I.b,1)),b=S,x=I,g=y}i.push(p);break}case"alpha":{ct(i,m,new ze(u,u,d),0,1);break}case"rgba2":{const p=new We(u,u*7,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,x.a,w.r,w.g,w.b);const S=m[v+1];if(!S){p.shrink(y);break}const I=C(S,"time",0),T=z.fromString(S.light),A=z.fromString(S.dark),M=g.curve;M&&(y=G(M,p,y,v,0,b,I,x.r,T.r,1),y=G(M,p,y,v,1,b,I,x.g,T.g,1),y=G(M,p,y,v,2,b,I,x.b,T.b,1),y=G(M,p,y,v,3,b,I,x.a,T.a,1),y=G(M,p,y,v,4,b,I,w.r,A.r,1),y=G(M,p,y,v,5,b,I,w.g,A.g,1),y=G(M,p,y,v,6,b,I,w.b,A.b,1)),b=I,x=T,w=A,g=S}i.push(p);break}case"rgb2":{const p=new He(u,u*6,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,w.r,w.g,w.b);const S=m[v+1];if(!S){p.shrink(y);break}const I=C(S,"time",0),T=z.fromString(S.light),A=z.fromString(S.dark),M=g.curve;M&&(y=G(M,p,y,v,0,b,I,x.r,T.r,1),y=G(M,p,y,v,1,b,I,x.g,T.g,1),y=G(M,p,y,v,2,b,I,x.b,T.b,1),y=G(M,p,y,v,3,b,I,w.r,A.r,1),y=G(M,p,y,v,4,b,I,w.g,A.g,1),y=G(M,p,y,v,5,b,I,w.b,A.b,1)),b=I,x=T,w=A,g=S}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${m.name} (${a.name})`)}}}if(t.bones)for(const o in t.bones){const a=t.bones[o],h=s.findBone(o);if(!h)throw new Error(`Bone not found: ${o}`);const d=h.index;for(const f in a){const m=a[f],u=m.length;if(u!==0)switch(f){case"rotate":ct(i,m,new $t(u,u,d),0,1);break;case"translate":Vs(i,m,new Xe(u,u<<1,d),"x","y",0,n);break;case"translatex":ct(i,m,new Ve(u,u,d),0,n);break;case"translatey":ct(i,m,new Re(u,u,d),0,n);break;case"scale":Vs(i,m,new Le(u,u<<1,d),"x","y",1,1);break;case"scalex":ct(i,m,new Be(u,u,d),1,1);break;case"scaley":ct(i,m,new Oe(u,u,d),1,1);break;case"shear":Vs(i,m,new Ne(u,u<<1,d),"x","y",0,1);break;case"shearx":ct(i,m,new Ue(u,u,d),0,1);break;case"sheary":ct(i,m,new $e(u,u,d),0,1);break;case"inherit":{const p=new qe(u,h.index);for(let g=0;g<m.length;g++){const b=m[g];p.setFrame(g,C(b,"time",0),R.enumValue(ie,C(b,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${m.name} (${a.name})`)}}}if(t.ik)for(const o in t.ik){const a=t.ik[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,Ht);if(!d)throw new Error(`IK Constraint not found: ${o}`);const f=new Je(a.length,a.length<<1,s.constraints.indexOf(d));let m=C(h,"time",0),u=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,b=0;;g++){f.setFrame(g,m,u,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const x=a[g+1];if(!x){f.shrink(b);break}const w=C(x,"time",0),v=C(x,"mix",1),y=C(x,"softness",0)*n,S=h.curve;S&&(b=G(S,f,b,g,0,m,w,u,v,1),b=G(S,f,b,g,1,m,w,p,y,n)),m=w,u=v,p=y,h=x}i.push(f)}if(t.transform)for(const o in t.transform){const a=t.transform[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,J);if(!d)throw new Error(`Transform constraint not found: ${o}`);const f=new Ke(a.length,a.length*6,s.constraints.indexOf(d));let m=C(h,"time",0),u=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),b=C(h,"mixScaleX",1),x=C(h,"mixScaleY",1);const w=C(h,"mixShearY",1);for(let v=0,y=0;;v++){f.setFrame(v,m,u,p,g,b,x,w);const S=a[v+1];if(!S){f.shrink(y);break}const I=C(S,"time",0),T=C(S,"mixRotate",1),A=C(S,"mixX",1),M=C(S,"mixY",A),F=C(S,"mixScaleX",1),k=C(S,"mixScaleY",1),E=C(S,"mixShearY",1),X=h.curve;X&&(y=G(X,f,y,v,0,m,I,u,T,1),y=G(X,f,y,v,1,m,I,p,A,1),y=G(X,f,y,v,2,m,I,g,M,1),y=G(X,f,y,v,3,m,I,b,F,1),y=G(X,f,y,v,4,m,I,x,k,1),y=G(X,f,y,v,5,m,I,w,E,1)),m=I,u=T,p=A,g=M,b=F,x=k,b=F,h=S}i.push(f)}if(t.path)for(const o in t.path){const a=t.path[o],h=s.findConstraint(o,Gt);if(!h)throw new Error(`Path constraint not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const m=a[f];let u=m[0];if(!u)continue;const p=m.length;switch(f){case"position":{const g=new Qe(p,p,d);ct(i,m,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Ze(p,p,d);ct(i,m,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new ts(p,p*3,d);let b=C(u,"time",0),x=C(u,"mixRotate",1),w=C(u,"mixX",1),v=C(u,"mixY",w);for(let y=0,S=0;;y++){g.setFrame(y,b,x,w,v);const I=m[y+1];if(!I){g.shrink(S);break}const T=C(I,"time",0),A=C(I,"mixRotate",1),M=C(I,"mixX",1),F=C(I,"mixY",M),k=u.curve;k&&(S=G(k,g,S,y,0,b,T,x,A,1),S=G(k,g,S,y,1,b,T,w,M,1),S=G(k,g,S,y,2,b,T,v,F,1)),b=T,x=A,w=M,v=F,u=I}i.push(g);break}}}}if(t.physics)for(const o in t.physics){const a=t.physics[o];let h=-1;if(o.length>0){const d=s.findConstraint(o,jt);if(!d)throw new Error(`Physics constraint not found: ${o}`);h=s.constraints.indexOf(d)}for(const d in a){const f=a[d];let m=f[0];if(!m)continue;const u=f.length;let p,g=0;if(d==="reset"){const b=new cs(u,h);for(let x=0;m!=null;m=f[x+1],x++)b.setFrame(x,C(m,"time",0));i.push(b);continue}switch(d){case"inertia":p=new es(u,u,h);break;case"strength":p=new ss(u,u,h);break;case"damping":p=new ns(u,u,h);break;case"mass":p=new is(u,u,h);break;case"wind":p=new rs(u,u,h);break;case"gravity":p=new as(u,u,h);break;case"mix":{g=1,p=new os(u,u,h);break}default:continue}ct(i,f,p,g,1)}}if(t.slider)for(const o in t.slider){const a=t.slider[o],h=s.findConstraint(o,It);if(!h)throw new Error(`Slider not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const m=a[f];if(!m[0])continue;const p=m.length;switch(f){case"time":ct(i,m,new ls(p,p,d),1,1);break;case"mix":ct(i,m,new hs(p,p,d),1,1);break}}}if(t.attachments)for(const o in t.attachments){const a=t.attachments[o],h=s.findSkin(o);if(!h)throw new Error(`Skin not found: ${o}`);for(const d in a){const f=a[d],m=s.findSlot(d);if(!m)throw new Error(`Attachment slot not found: ${d}`);const u=m.index;for(const p in f){const g=f[p],b=h.getAttachment(u,p);if(!b)throw new Error(`Timeline attachment not found: ${p}`);for(const x in g){const w=g[x];let v=w[0];if(v){if(x==="deform"){const y=b.bones,S=b.vertices,I=y?S.length/3*2:S.length,T=new Ge(w.length,w.length,u,b);let A=C(v,"time",0);for(let M=0,F=0;;M++){let k;const E=C(v,"vertices",null);if(!E)k=y?R.newFloatArray(I):S;else{k=R.newFloatArray(I);const D=C(v,"offset",0);if(R.arrayCopy(E,0,k,D,E.length),n!==1)for(let B=D,P=B+E.length;B<P;B++)k[B]*=n;if(!y)for(let B=0;B<I;B++)k[B]+=S[B]}T.setFrame(M,A,k);const X=w[M+1];if(!X){T.shrink(F);break}const V=C(X,"time",0),O=v.curve;O&&(F=G(O,T,F,M,0,A,V,0,1,1)),A=V,v=X}i.push(T)}else if(x==="sequence"){const y=new je(w.length,u,b);let S=0;for(let I=0;I<w.length;I++){const T=C(v,"delay",S),A=C(v,"time",0),M=ke[C(v,"mode","hold")],F=C(v,"index",0);y.setFrame(I,A,M,F,T),S=T,v=w[I+1]}i.push(y)}}}}}}if(t.drawOrder){const o=new At(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)o.setFrame(h++,C(d,"time",0),mn(s,d,a,null));i.push(o)}if(t.drawOrderFolder)for(const o of t.drawOrderFolder){const a=C(o,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const f=C(o,"keys",[]),m=new Dt(f.length,h,s.slots.length);let u=0;for(const p of f)m.setFrame(u++,C(p,"time",0),mn(s,p,h.length,h));i.push(m)}if(t.events){const o=new te(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],f=s.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const m=f.setupPose,u=new oe(R.toSinglePrecision(C(d,"time",0)),f);u.intValue=C(d,"int",m.intValue),u.floatValue=C(d,"float",m.floatValue),u.stringValue=C(d,"string",m.stringValue),u.data.audioPath&&(u.volume=C(d,"volume",m.volume),u.balance=C(d,"balance",m.volume)),o.setFrame(a,u)}i.push(o)}let r=0;for(let o=0,a=i.length;o<a;o++)r=Math.max(r,i[o].getDuration());const l=new Qt(e,i,r),c=C(t,"color",null);c!==null&&l.color.setFromString(c),s.animations.push(l)}},ki=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ct(t,e,s,n,i){let r=e[0],l=r.time??0,c=(r.value??n)*i,o=0;for(let a=0;;a++){s.setFrame(a,l,c);const h=e[a+1];if(!h){s.shrink(o),t.push(s);return}const d=h.time??0,f=(h.value??n)*i;r.curve&&(o=G(r.curve,s,o,a,0,l,d,c,f,i)),l=d,c=f,r=h}}function Vs(t,e,s,n,i,r,l){let c=e[0],o=c.time??0,a=(c[n]??r)*l,h=(c[i]??r)*l,d=0;for(let f=0;;f++){s.setFrame(f,o,a,h);const m=e[f+1];if(!m){s.shrink(d),t.push(s);return}const u=m.time??0,p=(m[n]??r)*l,g=(m[i]??r)*l,b=c.curve;b&&(d=G(b,s,d,f,0,o,u,a,p,l),d=G(b,s,d,f,1,o,u,h,g,l)),o=u,a=p,h=g,c=m}}function mn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),l=new Array(s-i.length);let c=0,o=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let f=0;f<s;f++)if(n[f]===h.index){d=f;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;c!==d;)l[o++]=c++;r[c+a.offset]=c++}for(;c<s;)l[o++]=c++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=l[--o]);return r}function G(t,e,s,n,i,r,l,c,o,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],f=t[h+1]*a,m=t[h+2],u=t[h+3]*a;return e.setBezier(s,n,i,r,c,d,f,m,u,l,o),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var Ei=class{commandPool=new Xi;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new un;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let l=0;l<t.slots.length;l++){const c=r[l],o=c.appliedPose.attachment;if(!o){i.clipEnd(c);continue}const a=c.appliedPose,h=a.color;if((h.a===0||!c.bone.active)&&!(o instanceof Wt)){i.clipEnd(c);continue}let f,m,u,p,g,b,x;if(o instanceof j){if(b=o.color,b.a===0){i.clipEnd(c);continue}const I=o.sequence,T=I.resolveIndex(a);o.computeWorldVertices(c,o.getOffsets(a),this.worldVertices,0,n),f=this.worldVertices,m=4,u=I.getUVs(T),p=this.quadIndices,g=6,x=I.regions[T]?.texture}else if(o instanceof yt){if(b=o.color,b.a===0){i.clipEnd(c);continue}this.worldVertices.length<o.worldVerticesLength&&(this.worldVertices=new Float32Array(o.worldVerticesLength)),o.computeWorldVertices(t,c,0,o.worldVerticesLength,this.worldVertices,0,n),f=this.worldVertices,m=o.worldVerticesLength>>1;const I=o.sequence,T=I.resolveIndex(a);u=I.getUVs(T),p=o.triangles,g=p.length,x=I.regions[T]?.texture}else if(o instanceof Wt){i.clipStart(t,c,o);continue}else continue;const w=t.color;let v,y;if(e){let I;if(s){I=Math.floor(s[3]*w.a*h.a*b.a*255);const T=Math.floor(I*s[0]*w.r*h.r*b.r),A=Math.floor(I*s[1]*w.g*h.g*b.g),M=Math.floor(I*s[2]*w.b*h.b*b.b);v=I<<24|T<<16|A<<8|M}else{I=Math.floor(w.a*h.a*b.a*255);const T=Math.floor(I*w.r*h.r*b.r),A=Math.floor(I*w.g*h.g*b.g),M=Math.floor(I*w.b*h.b*b.b);v=I<<24|T<<16|A<<8|M}if(y=4278190080,a.darkColor){const{r:T,g:A,b:M}=a.darkColor;y=4278190080|Math.floor(T*I)<<16|Math.floor(A*I)<<8|Math.floor(M*I)}}else{if(s){const I=Math.floor(s[3]*w.a*h.a*b.a*255),T=Math.floor(s[0]*w.r*h.r*b.r*255),A=Math.floor(s[1]*w.g*h.g*b.g*255),M=Math.floor(s[2]*w.b*h.b*b.b*255);v=I<<24|T<<16|A<<8|M}else{const I=Math.floor(w.a*h.a*b.a*255),T=Math.floor(w.r*h.r*b.r*255),A=Math.floor(w.g*h.g*b.g*255),M=Math.floor(w.b*h.b*b.b*255);v=I<<24|T<<16|A<<8|M}if(y=0,a.darkColor){const{r:I,g:T,b:A}=a.darkColor;y=Math.floor(I*255)<<16|Math.floor(T*255)<<8|Math.floor(A*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(f,0,p,g,u,n),f=i.clippedVerticesTyped,m=i.clippedVerticesLength/n,u=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const S=this.commandPool.getCommand(m,g,n);S.blendMode=c.data.blendMode,S.texture=x,S.positions.set(f.subarray(0,m*n)),S.uvs.set(u.subarray(0,m<<1));for(let I=0;I<m;I++)S.colors[I]=v,S.darkColors[I]=y;p instanceof Uint16Array?S.indices.set(p.subarray(0,g)):S.indices.set(p.slice(0,g)),this.renderCommands.push(S),i.clipEnd(c)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const l=t[e],c=this.commandPool.getCommand(n,i,r);c.blendMode=l.blendMode,c.texture=l.texture;let o=0,a=0,h=0,d=0,f=0;for(let m=e;m<=s;m++){const u=t[m];c.positions.set(u.positions,o),o+=u.numVertices*r,c.uvs.set(u.uvs,a),a+=u.numVertices<<1,c.colors.set(u.colors,h),c.darkColors.set(u.darkColors,h),h+=u.numVertices;for(let p=0;p<u.numIndices;p++)c.indices[d+p]=u.indices[p]+f;d+=u.numIndices,f+=u.numVertices}return c}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,l=n.numVertices,c=n.numIndices;for(;r<=this.renderCommands.length;){const o=r<this.renderCommands.length?this.renderCommands[r]:null;if(o&&o.numVertices===0&&o.numIndices===0){r++;continue}if(o!==null&&o.texture===n.texture&&o.blendMode===n.blendMode&&o.colors[0]===n.colors[0]&&o.darkColors[0]===n.darkColors[0]&&c+o.numIndices<65535)l+=o.numVertices,c+=o.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,l,c,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,l=n.numVertices,c=n.numIndices}r++}return e}},Xi=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),l=new Uint32Array(t),c=new Uint32Array(t),o=new Uint16Array(e);n={positions:i,uvs:r,colors:l,darkColors:c,indices:o,_positions:i,_uvs:r,_colors:l,_darkColors:c,_indices:o,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},gn=class extends Me{constructor(t){super(t)}setFilters(t,e){}setWraps(t,e){}dispose(){}},Vi=class extends Ks{constructor(t="",e=new us){super(s=>new gn(s),t,e)}},Ri=R.newFloatArray(8),Li=class Te{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=R.newFloatArray(8*1024);tempColor=new z;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){const s=this.ctx,n=this.tempColor,i=e.color,r=e.drawOrder.appliedPose;this.debugRendering&&(s.strokeStyle="green");for(let l=0,c=r.length;l<c;l++){const o=r[l],a=o.bone;if(!a.active)continue;const h=o.appliedPose,d=h.attachment;if(!(d instanceof j))continue;const f=d.sequence,m=f.resolveIndex(h);d.computeWorldVertices(o,d.getOffsets(h),Ri,0,2);const u=f.regions[m],p=u.texture.getImage(),g=h.color,b=d.color;n.set(i.r*g.r*b.r,i.g*g.g*b.g,i.b*g.b*b.b,i.a*g.a*b.a),s.save();const x=a.appliedPose;s.transform(x.a,x.c,x.b,x.d,x.worldX,x.worldY);const w=d.getOffsets(h);s.translate(w[0],w[1]),s.rotate(d.rotation*Math.PI/180);const v=d.width/u.originalWidth;s.scale(v*d.scaleX,v*d.scaleY);let y=u.width,S=u.height;if(s.translate(y/2,S/2),u.degrees===90){const I=y;y=S,S=I,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-y/2,-S/2),s.globalAlpha=n.a,s.drawImage(p,p.width*u.u,p.height*u.v,y,S,0,0,y,S),this.debugRendering&&s.strokeRect(0,0,y,S),s.restore()}}drawTriangles(e){const s=this.ctx,n=this.tempColor,i=e.color,r=e.drawOrder.appliedPose;let l=null,c=this.vertices,o=null;for(let a=0,h=r.length;a<h;a++){const d=r[a],f=d.appliedPose,m=f.attachment;let u;if(m instanceof j){const p=m.sequence,g=p.resolveIndex(f),b=p.getUVs(g),x=m.getOffsets(f);c=this.computeRegionVertices(d,m,x,b,!1),o=Te.QUAD_TRIANGLES,u=(p.regions[g]?.texture).getImage()}else if(m instanceof yt){const p=m.sequence,g=p.resolveIndex(f),b=p.getUVs(g);c=this.computeMeshVertices(d,m,b,!1),o=m.triangles,u=(p.regions[g]?.texture).getImage()}else continue;if(u){d.data.blendMode!==l&&(l=d.data.blendMode);const p=f.color,g=m.color;n.set(i.r*p.r*g.r,i.g*p.g*g.g,i.b*p.b*g.b,i.a*p.a*g.a),s.globalAlpha=n.a;for(let b=0;b<o.length;b+=3){const x=o[b]*8,w=o[b+1]*8,v=o[b+2]*8,y=c[x],S=c[x+1],I=c[x+6],T=c[x+7],A=c[w],M=c[w+1],F=c[w+6],k=c[w+7],E=c[v],X=c[v+1],V=c[v+6],O=c[v+7];this.drawTriangle(u,y,S,I,T,A,M,F,k,E,X,V,O),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(y,S),s.lineTo(A,M),s.lineTo(E,X),s.lineTo(y,S),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,n,i,r,l,c,o,a,h,d,f,m){const u=this.ctx,p=e.width-1,g=e.height-1;i*=p,r*=g,o*=p,a*=g,f*=p,m*=g,u.beginPath(),u.moveTo(s,n),u.lineTo(l,c),u.lineTo(h,d),u.closePath(),l-=s,c-=n,h-=s,d-=n,o-=i,a-=r,f-=i,m-=r;let b=o*m-f*a;if(b===0)return;b=1/b;const x=(m*l-a*h)*b,w=(m*c-a*d)*b,v=(o*h-f*l)*b,y=(o*d-f*c)*b,S=s-x*i-v*r,I=n-w*i-y*r;u.save(),u.transform(x,w,v,y,S,I),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,n,i,r){const l=e.skeleton.color,c=e.appliedPose.color,o=s.color,a=l.a*c.a*o.a,h=r?a:1,d=this.tempColor;d.set(l.r*c.r*o.r*h,l.g*c.g*o.g*h,l.b*c.b*o.b*h,a),s.computeWorldVertices(e,n,this.vertices,0,Te.VERTEX_SIZE);const f=this.vertices;return f[j.C1R]=d.r,f[j.C1G]=d.g,f[j.C1B]=d.b,f[j.C1A]=d.a,f[j.U1]=i[0],f[j.V1]=i[1],f[j.C2R]=d.r,f[j.C2G]=d.g,f[j.C2B]=d.b,f[j.C2A]=d.a,f[j.U2]=i[2],f[j.V2]=i[3],f[j.C3R]=d.r,f[j.C3G]=d.g,f[j.C3B]=d.b,f[j.C3A]=d.a,f[j.U3]=i[4],f[j.V3]=i[5],f[j.C4R]=d.r,f[j.C4G]=d.g,f[j.C4B]=d.b,f[j.C4A]=d.a,f[j.U4]=i[6],f[j.V4]=i[7],f}computeMeshVertices(e,s,n,i){const r=e.skeleton,l=r.color,c=e.appliedPose.color,o=s.color,a=l.a*c.a*o.a,h=i?a:1,d=this.tempColor;d.set(l.r*c.r*o.r*h,l.g*c.g*o.g*h,l.b*c.b*o.b*h,a);const f=s.worldVerticesLength/2;let m=this.vertices;m.length<s.worldVerticesLength&&(this.vertices=m=R.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(r,e,0,s.worldVerticesLength,m,0,Te.VERTEX_SIZE);for(let u=0,p=0,g=2;u<f;u++)m[g++]=d.r,m[g++]=d.g,m[g++]=d.b,m[g++]=d.a,m[g++]=n[p++],m[g++]=n[p++],g+=2;return m}};export{ze as AlphaTimeline,Qt as Animation,On as AnimationState,Nn as AnimationStateAdapter,Un as AnimationStateData,Qs as AssetCache,Vi as AssetManager,Ks as AssetManagerBase,$n as AtlasAttachmentLoader,Pe as Attachment,Pt as AttachmentTimeline,ln as BinaryInput,Ms as BlendMode,ae as Bone,gs as BoneData,re as BonePose,St as BoneTimeline1,Zt as BoneTimeline2,ms as BoundingBoxAttachment,gn as CanvasTexture,Wt as ClippingAttachment,z as Color,Et as Constraint,Xt as ConstraintData,kt as ConstraintTimeline1,vt as CurveTimeline,Ut as CurveTimeline1,Xn as DebugUtils,Ge as DeformTimeline,us as Downloader,tn as DrawOrder,Dt as DrawOrderFolderTimeline,At as DrawOrderTimeline,oe as Event,xs as EventData,Gs as EventQueue,te as EventTimeline,js as EventType,_t as FIRST,Ln as FakeTexture,Ct as FromProperty,ge as FromRotate,xe as FromScaleX,we as FromScaleY,ye as FromShearY,pe as FromX,be as FromY,zt as HOLD,Js as HOLD_FIRST,en as IkConstraint,Ht as IkConstraintData,ce as IkConstraintPose,Je as IkConstraintTimeline,ie as Inherit,qe as InheritTimeline,kn as IntSet,Bt as Interpolation,$ as MathUtils,yt as MeshAttachment,se as PathAttachment,sn as PathConstraint,Gt as PathConstraintData,ts as PathConstraintMixTimeline,le as PathConstraintPose,Qe as PathConstraintPositionTimeline,Ze as PathConstraintSpacingTimeline,nn as Physics,Is as PhysicsConstraint,ns as PhysicsConstraintDampingTimeline,jt as PhysicsConstraintData,as as PhysicsConstraintGravityTimeline,es as PhysicsConstraintInertiaTimeline,is as PhysicsConstraintMassTimeline,os as PhysicsConstraintMixTimeline,he as PhysicsConstraintPose,cs as PhysicsConstraintResetTimeline,ss as PhysicsConstraintStrengthTimeline,bt as PhysicsConstraintTimeline,rs as PhysicsConstraintWindTimeline,Zs as PointAttachment,Ot as Pool,ps as Posed,bs as PosedActive,ne as PosedData,ys as PositionMode,Ns as Pow,En as PowOut,Ds as Property,fs as RETAIN,He as RGB2Timeline,We as RGBA2Timeline,De as RGBATimeline,_e as RGBTimeline,j as RegionAttachment,Ss as RotateMode,$t as RotateTimeline,ds as SETUP,ee as SUBSEQUENT,Le as ScaleTimeline,Be as ScaleXTimeline,ws as ScaleYMode,Oe as ScaleYTimeline,Nt as Sequence,ke as SequenceMode,Ee as SequenceModeValues,je as SequenceTimeline,Ne as ShearTimeline,Ue as ShearXTimeline,$e as ShearYTimeline,an as Skeleton,qn as SkeletonBinary,Yi as SkeletonBounds,un as SkeletonClipping,Ts as SkeletonData,Pi as SkeletonJson,Li as SkeletonRenderer,Ei as SkeletonRendererCore,ue as Skin,As as SkinEntry,on as Slider,It as SliderData,hs as SliderMixTimeline,fe as SliderPose,ls as SliderTimeline,rn as Slot,qt as SlotCurveTimeline,Cs as SlotData,de as SlotPose,vs as SpacingMode,Ae as StringSet,Me as Texture,Fe as TextureAtlas,qs as TextureAtlasPage,Ye as TextureAtlasRegion,Kt as TextureFilter,$s as TextureRegion,Us as TextureWrap,Vn as TimeKeeper,Z as Timeline,Mt as ToProperty,Fs as ToRotate,ks as ToScaleX,Es as ToScaleY,Xs as ToShearY,Ys as ToX,Ps as ToY,Hs as TrackEntry,cn as TransformConstraint,J as TransformConstraintData,me as TransformConstraintPose,Ke as TransformConstraintTimeline,Xe as TranslateTimeline,Ve as TranslateXTimeline,Re as TranslateYTimeline,fn as Triangulator,R as Utils,Ce as Vector2,wt as VertexAttachment,Rn as WindowedMean,zs as isBoneTimeline,Ws as isConstraintTimeline,_s as isSlotTimeline};