@esotericsoftware/spine-canvaskit 4.2.79 → 4.2.81

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 Ds=Object.defineProperty,Os=(e,t,s)=>t in e?Ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,B=(e,t,s)=>(Os(e,typeof t!="symbol"?t+"":t,s),s),qs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},st=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},pe=class{constructor(e=0,t=0,s=0,r=0){this.r=e,this.g=t,this.b=s,this.a=r}set(e,t,s,r){return this.r=e,this.g=t,this.b=s,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,r){return this.r+=e,this.g+=t,this.b+=s,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(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new pe().setFromString(e)}},D=pe;B(D,"WHITE",new pe(1,1,1,1)),B(D,"RED",new pe(1,0,0,1)),B(D,"GREEN",new pe(0,1,0,1)),B(D,"BLUE",new pe(0,0,1,1)),B(D,"MAGENTA",new pe(1,0,1,1));var ae=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ae.degRad)}static sinDeg(e){return Math.sin(e*ae.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ae.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ae.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let r=Math.random(),n=t-e;return r<=(s-e)/n?e+Math.sqrt(r*n*(s-e)):t-Math.sqrt((1-r)*n*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},F=ae;B(F,"PI",3.1415927),B(F,"PI2",ae.PI*2),B(F,"invPI2",1/ae.PI2),B(F,"radiansToDegrees",180/ae.PI),B(F,"radDeg",ae.radiansToDegrees),B(F,"degreesToRadians",ae.PI/180),B(F,"degRad",ae.degreesToRadians);var ns=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},as=class extends ns{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},_s=class extends as{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Se=class{static arrayCopy(e,t,s,r,n){for(let h=t,o=r;h<t+n;h++,o++)s[o]=e[h]}static arrayFill(e,t,s,r){for(let n=t;n<s;n++)e[n]=r}static setArraySize(e,t,s=0){let r=e.length;if(r==t)return e;if(e.length=t,r<t)for(let n=r;n<t;n++)e[n]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:Se.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t;return s}static newFloatArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return Se.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Se.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=Se;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ws=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Te=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Ne=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}},Us=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)}},zs=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}},it=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ls=class extends it{id=ls.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,r,n,h){s=n+(s>>1)*h;let o=e.bone.skeleton,i=e.deform,l=this.vertices,a=this.bones;if(!a){i.length>0&&(l=i);let f=e.bone,m=f.worldX,x=f.worldY,b=f.a,w=f.b,g=f.c,p=f.d;for(let v=t,y=n;y<s;v+=2,y+=h){let S=l[v],A=l[v+1];r[y]=S*b+A*w+m,r[y+1]=S*g+A*p+x}return}let c=0,u=0;for(let f=0;f<t;f+=2){let m=a[c];c+=m+1,u+=m}let d=o.bones;if(i.length==0)for(let f=n,m=u*3;f<s;f+=h){let x=0,b=0,w=a[c++];for(w+=c;c<w;c++,m+=3){let g=d[a[c]],p=l[m],v=l[m+1],y=l[m+2];x+=(p*g.a+v*g.b+g.worldX)*y,b+=(p*g.c+v*g.d+g.worldY)*y}r[f]=x,r[f+1]=b}else{let f=i;for(let m=n,x=u*3,b=u<<1;m<s;m+=h){let w=0,g=0,p=a[c++];for(p+=c;c<p;c++,x+=3,b+=2){let v=d[a[c]],y=l[x]+f[b],S=l[x+1]+f[b+1],A=l[x+2];w+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}r[m]=w,r[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},le=ls;B(le,"nextID",0);var De=class{id=De.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new De(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];t.region!=r&&(t.region=r,t.updateRegion())}getPath(e,t){let s=e,r=(this.start+t).toString();for(let n=this.digits-r.length;n>0;n--)s+="0";return s+=r,s}static nextID(){return De._nextID++}},rt=De;B(rt,"_nextID",0);var os=(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))(os||{}),hs=[0,1,2,3,4,5,6],Oe=class{name;timelines=[];timelineIds=new st;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,n,h,o,i){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let a=0,c=l.length;a<c;a++)l[a].apply(e,t,s,n,h,o,i)}},cs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(cs||{}),ds=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ds||{}),O={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},K=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let n=s;n<r;n+=s)if(e[n]>t)return n-s;return r-s}},oe=class extends K{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,n,h,o,i,l,a,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(r-h*2+i)*.03,m=(n-o*2+l)*.03,x=((h-i)*3-r+a)*.006,b=((o-l)*3-n+c)*.006,w=f*2+x,g=m*2+b,p=(h-r)*.3+f+x*.16666667,v=(o-n)*.3+m+b*.16666667,y=r+p,S=n+v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,p+=w,v+=g,w+=x,g+=b,y+=p,S+=v}getBezierValue(e,t,s,r){let n=this.curves;if(n[r]>e){let l=this.frames[t],a=this.frames[t+s];return a+(e-l)/(n[r]-l)*(n[r+1]-a)}let h=r+18;for(r+=2;r<h;r+=2)if(n[r]>=e){let l=n[r-2],a=n[r-1];return a+(e-l)/(n[r]-l)*(n[r+1]-a)}t+=this.getFrameEntries();let o=n[h-2],i=n[h-1];return i+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-i)}},ne=class extends oe{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let n=2;n<=s;n+=2)if(t[n]>e){s=n-2;break}let r=this.curves[s>>1];switch(r){case 0:let n=t[s],h=t[s+1];return h+(e-n)/(t[s+2]-n)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,n){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}let h=this.getCurveValue(e);switch(s){case 0:return n+h*t;case 1:case 2:h+=n-r}return r+h*t}getAbsoluteValue(e,t,s,r,n){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}let h=this.getCurveValue(e);return s==0?n+(h-n)*t:r+(h-r)*t}getAbsoluteValue2(e,t,s,r,n,h){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}return s==0?n+(h-n)*t:r+(h-r)*t}getScaleValue(e,t,s,r,n,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return n+(h-n)*t}return n}let i=this.getCurveValue(e)*h;if(t==1)return s==3?n+i-h:i;if(r==1)switch(s){case 0:return h+(Math.abs(i)*F.signum(h)-h)*t;case 1:case 2:return n+(Math.abs(i)*F.signum(n)-n)*t}else{let l=0;switch(s){case 0:return l=Math.abs(h)*F.signum(i),l+(i-l)*t;case 1:case 2:return l=Math.abs(n)*F.signum(i),l+(i-l)*t}}return n+(i-h)*t}},qe=class extends oe{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Xe=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.rotation=this.getRelativeValue(s,n,h,i.rotation,i.data.rotation))}},nt=class extends qe{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.x=i.data.x,i.y=i.data.y;return;case 1:i.x+=(i.data.x-i.x)*n,i.y+=(i.data.y-i.y)*n}return}let a=0,c=0,u=K.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,c+=(l[u+3+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(h){case 0:i.x=i.data.x+a*n,i.y=i.data.y+c*n;break;case 1:case 2:i.x+=(i.data.x+a-i.x)*n,i.y+=(i.data.y+c-i.y)*n;break;case 3:i.x+=a*n,i.y+=c*n}}},at=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.x=this.getRelativeValue(s,n,h,i.x,i.data.x))}},lt=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.y=this.getRelativeValue(s,n,h,i.y,i.data.y))}},ot=class extends qe{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.scaleX=i.data.scaleX,i.scaleY=i.data.scaleY;return;case 1:i.scaleX+=(i.data.scaleX-i.scaleX)*n,i.scaleY+=(i.data.scaleY-i.scaleY)*n}return}let a,c,u=K.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,c+=(l[u+3+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}if(a*=i.data.scaleX,c*=i.data.scaleY,n==1)h==3?(i.scaleX+=a-i.data.scaleX,i.scaleY+=c-i.data.scaleY):(i.scaleX=a,i.scaleY=c);else{let f=0,m=0;if(o==1)switch(h){case 0:f=i.data.scaleX,m=i.data.scaleY,i.scaleX=f+(Math.abs(a)*F.signum(f)-f)*n,i.scaleY=m+(Math.abs(c)*F.signum(m)-m)*n;break;case 1:case 2:f=i.scaleX,m=i.scaleY,i.scaleX=f+(Math.abs(a)*F.signum(f)-f)*n,i.scaleY=m+(Math.abs(c)*F.signum(m)-m)*n;break;case 3:i.scaleX+=(a-i.data.scaleX)*n,i.scaleY+=(c-i.data.scaleY)*n}else switch(h){case 0:f=Math.abs(i.data.scaleX)*F.signum(a),m=Math.abs(i.data.scaleY)*F.signum(c),i.scaleX=f+(a-f)*n,i.scaleY=m+(c-m)*n;break;case 1:case 2:f=Math.abs(i.scaleX)*F.signum(a),m=Math.abs(i.scaleY)*F.signum(c),i.scaleX=f+(a-f)*n,i.scaleY=m+(c-m)*n;break;case 3:i.scaleX+=(a-i.data.scaleX)*n,i.scaleY+=(c-i.data.scaleY)*n}}}},ht=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.scaleX=this.getScaleValue(s,n,h,o,i.scaleX,i.data.scaleX))}},ct=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.scaleY=this.getScaleValue(s,n,h,o,i.scaleY,i.data.scaleY))}},dt=class extends qe{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.shearX=i.data.shearX,i.shearY=i.data.shearY;return;case 1:i.shearX+=(i.data.shearX-i.shearX)*n,i.shearY+=(i.data.shearY-i.shearY)*n}return}let a=0,c=0,u=K.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,c+=(l[u+3+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(h){case 0:i.shearX=i.data.shearX+a*n,i.shearY=i.data.shearY+c*n;break;case 1:case 2:i.shearX+=(i.data.shearX+a-i.shearX)*n,i.shearY+=(i.data.shearY+c-i.shearY)*n;break;case 3:i.shearX+=a*n,i.shearY+=c*n}}},ft=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.shearX=this.getRelativeValue(s,n,h,i.shearX,i.data.shearX))}},ut=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.shearY=this.getRelativeValue(s,n,h,i.shearY,i.data.shearY))}},mt=class extends K{boneIndex=0;constructor(e,t){super(e,[O.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,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;if(o==1){h==0&&(i.inherit=i.data.inherit);return}let l=this.frames;if(s<l[0]){(h==0||h==1)&&(i.inherit=i.data.inherit);return}i.inherit=this.frames[K.search(l,s,2)+1]}},gt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,r,n,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color;if(s<l[0]){let b=i.data.color;switch(h){case 0:a.setFromColor(b);return;case 1:a.add((b.r-a.r)*n,(b.g-a.g)*n,(b.b-a.b)*n,(b.a-a.a)*n)}return}let c=0,u=0,d=0,f=0,m=K.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let b=l[m];c=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];let w=(s-b)/(l[m+5]-b);c+=(l[m+5+1]-c)*w,u+=(l[m+5+2]-u)*w,d+=(l[m+5+3]-d)*w,f+=(l[m+5+4]-f)*w;break;case 1:c=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];break;default:c=this.getBezierValue(s,m,1,x-2),u=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),f=this.getBezierValue(s,m,4,x+18*3-2)}n==1?a.set(c,u,d,f):(h==0&&a.setFromColor(i.data.color),a.add((c-a.r)*n,(u-a.g)*n,(d-a.b)*n,(f-a.a)*n))}},xt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,n){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color;if(s<l[0]){let x=i.data.color;switch(h){case 0:a.r=x.r,a.g=x.g,a.b=x.b;return;case 1:a.r+=(x.r-a.r)*n,a.g+=(x.g-a.g)*n,a.b+=(x.b-a.b)*n}return}let c=0,u=0,d=0,f=K.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let x=l[f];c=l[f+1],u=l[f+2],d=l[f+3];let b=(s-x)/(l[f+4]-x);c+=(l[f+4+1]-c)*b,u+=(l[f+4+2]-u)*b,d+=(l[f+4+3]-d)*b;break;case 1:c=l[f+1],u=l[f+2],d=l[f+3];break;default:c=this.getBezierValue(s,f,1,m-2),u=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(n==1)a.r=c,a.g=u,a.b=d;else{if(h==0){let x=i.data.color;a.r=x.r,a.g=x.g,a.b=x.b}a.r+=(c-a.r)*n,a.g+=(u-a.g)*n,a.b+=(d-a.b)*n}}},pt=class extends ne{slotIndex=0;constructor(e,t,s){super(e,t,O.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.color;if(s<this.frames[0]){let c=i.data.color;switch(h){case 0:l.a=c.a;return;case 1:l.a+=(c.a-l.a)*n}return}let a=this.getCurveValue(s);n==1?l.a=a:(h==0&&(l.a=i.data.color.a),l.a+=(a-l.a)*n)}},wt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,n,h,o,i,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=i,this.frames[e+7]=l}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color,c=i.darkColor;if(s<l[0]){let v=i.data.color,y=i.data.darkColor;switch(h){case 0:a.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:a.add((v.r-a.r)*n,(v.g-a.g)*n,(v.b-a.b)*n,(v.a-a.a)*n),c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let u=0,d=0,f=0,m=0,x=0,b=0,w=0,g=K.search(l,s,8),p=this.curves[g>>3];switch(p){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],b=l[g+6],w=l[g+7];let y=(s-v)/(l[g+8]-v);u+=(l[g+8+1]-u)*y,d+=(l[g+8+2]-d)*y,f+=(l[g+8+3]-f)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,b+=(l[g+8+6]-b)*y,w+=(l[g+8+7]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],b=l[g+6],w=l[g+7];break;default:u=this.getBezierValue(s,g,1,p-2),d=this.getBezierValue(s,g,2,p+18-2),f=this.getBezierValue(s,g,3,p+18*2-2),m=this.getBezierValue(s,g,4,p+18*3-2),x=this.getBezierValue(s,g,5,p+18*4-2),b=this.getBezierValue(s,g,6,p+18*5-2),w=this.getBezierValue(s,g,7,p+18*6-2)}if(n==1)a.set(u,d,f,m),c.r=x,c.g=b,c.b=w;else{if(h==0){a.setFromColor(i.data.color);let v=i.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}a.add((u-a.r)*n,(d-a.g)*n,(f-a.b)*n,(m-a.a)*n),c.r+=(x-c.r)*n,c.g+=(b-c.g)*n,c.b+=(w-c.b)*n}}},bt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,n,h,o,i){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=i}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color,c=i.darkColor;if(s<l[0]){let v=i.data.color,y=i.data.darkColor;switch(h){case 0:a.r=v.r,a.g=v.g,a.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:a.r+=(v.r-a.r)*n,a.g+=(v.g-a.g)*n,a.b+=(v.b-a.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let u=0,d=0,f=0,m=0,x=0,b=0,w=0,g=K.search(l,s,7),p=this.curves[g/7];switch(p){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],b=l[g+5],w=l[g+6];let y=(s-v)/(l[g+7]-v);u+=(l[g+7+1]-u)*y,d+=(l[g+7+2]-d)*y,f+=(l[g+7+3]-f)*y,x+=(l[g+7+4]-x)*y,b+=(l[g+7+5]-b)*y,w+=(l[g+7+6]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],b=l[g+5],w=l[g+6];break;default:u=this.getBezierValue(s,g,1,p-2),d=this.getBezierValue(s,g,2,p+18-2),f=this.getBezierValue(s,g,3,p+18*2-2),x=this.getBezierValue(s,g,4,p+18*3-2),b=this.getBezierValue(s,g,5,p+18*4-2),w=this.getBezierValue(s,g,6,p+18*5-2)}if(n==1)a.r=u,a.g=d,a.b=f,c.r=x,c.g=b,c.b=w;else{if(h==0){let v=i.data.color,y=i.data.darkColor;a.r=v.r,a.g=v.g,a.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}a.r+=(u-a.r)*n,a.g+=(d-a.g)*n,a.b+=(f-a.b)*n,c.r+=(x-c.r)*n,c.g+=(b-c.g)*n,c.b+=(w-c.b)*n}}},we=class extends K{slotIndex=0;attachmentNames;constructor(e,t){super(e,[O.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,r,n,h,o){let i=e.slots[this.slotIndex];if(i.bone.active){if(o==1){h==0&&this.setAttachment(e,i,i.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,i,i.data.attachmentName);return}this.setAttachment(e,i,this.attachmentNames[K.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},yt=class extends oe{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[O.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,n,h,o,i,l,a,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(r-h*2+i)*.03,m=l*.03-o*.06,x=((h-i)*3-r+a)*.006,b=(o-l+.33333333)*.018,w=f*2+x,g=m*2+b,p=(h-r)*.3+f+x*.16666667,v=o*.3+m+b*.16666667,y=r+p,S=v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,p+=w,v+=g,w+=x,g+=b,y+=p,S+=v}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let i=this.frames[t];return(e-i)/(this.frames[t+this.getFrameEntries()]-i);case 1:return 0}if(r-=2,s[r]>e){let i=this.frames[t];return s[r+1]*(e-i)/(s[r]-i)}let n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=e){let i=s[r-2],l=s[r-1];return l+(e-i)/(s[r]-i)*(s[r+1]-l)}let h=s[n-2],o=s[n-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.getAttachment();if(!l||!(l instanceof le)||l.timelineAttachment!=this.attachment)return;let a=i.deform;a.length==0&&(h=0);let c=this.vertices,u=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:a.length=0;return;case 1:if(n==1){a.length=0;return}a.length=u;let g=l;if(g.bones){n=1-n;for(var f=0;f<u;f++)a[f]*=n}else{let p=g.vertices;for(var f=0;f<u;f++)a[f]+=(p[f]-a[f])*n}}return}if(a.length=u,s>=d[d.length-1]){let g=c[d.length-1];if(n==1)if(h==3){let p=l;if(p.bones)for(let v=0;v<u;v++)a[v]+=g[v];else{let v=p.vertices;for(let y=0;y<u;y++)a[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,a,0,u);else switch(h){case 0:{let v=l;if(v.bones)for(let y=0;y<u;y++)a[y]=g[y]*n;else{let y=v.vertices;for(let S=0;S<u;S++){let A=y[S];a[S]=A+(g[S]-A)*n}}break}case 1:case 2:for(let v=0;v<u;v++)a[v]+=(g[v]-a[v])*n;break;case 3:let p=l;if(p.bones)for(let v=0;v<u;v++)a[v]+=g[v]*n;else{let v=p.vertices;for(let y=0;y<u;y++)a[y]+=(g[y]-v[y])*n}}return}let m=K.search1(d,s),x=this.getCurvePercent(s,m),b=c[m],w=c[m+1];if(n==1)if(h==3){let g=l;if(g.bones)for(let p=0;p<u;p++){let v=b[p];a[p]+=v+(w[p]-v)*x}else{let p=g.vertices;for(let v=0;v<u;v++){let y=b[v];a[v]+=y+(w[v]-y)*x-p[v]}}}else for(let g=0;g<u;g++){let p=b[g];a[g]=p+(w[g]-p)*x}else switch(h){case 0:{let p=l;if(p.bones)for(let v=0;v<u;v++){let y=b[v];a[v]=(y+(w[v]-y)*x)*n}else{let v=p.vertices;for(let y=0;y<u;y++){let S=b[y],A=v[y];a[y]=A+(S+(w[y]-S)*x-A)*n}}break}case 1:case 2:for(let p=0;p<u;p++){let v=b[p];a[p]+=(v+(w[p]-v)*x-a[p])*n}break;case 3:let g=l;if(g.bones)for(let p=0;p<u;p++){let v=b[p];a[p]+=(v+(w[p]-v)*x)*n}else{let p=g.vertices;for(let v=0;v<u;v++){let y=b[v];a[v]+=(y+(w[v]-y)*x-p[v])*n}}}}},fs=class extends K{events;constructor(e){super(e,fs.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,r,n,h,o){if(!r)return;let i=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,r,n,h,o),t=-1;else if(t>=i[l-1])return;if(s<i[0])return;let a=0;if(t<i[0])a=0;else{a=K.search1(i,t)+1;let c=i[a];for(;a>0&&i[a-1]==c;)a--}for(;a<l&&s>=i[a];a++)r.push(this.events[a])}},Fe=fs;B(Fe,"propertyIds",[""+O.event]);var us=class extends K{drawOrders;constructor(e){super(e,us.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,r,n,h,o){if(o==1){h==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(h==0||h==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let i=K.search1(this.frames,s),l=this.drawOrders[i];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let a=e.drawOrder,c=e.slots;for(let u=0,d=l.length;u<d;u++)a[u]=c[l[u]]}}},be=us;B(be,"propertyIds",[""+O.drawOrder]);var vt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,n,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,n,h,o){let i=e.ikConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.mix=i.data.mix,i.softness=i.data.softness,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch;return;case 1:i.mix+=(i.data.mix-i.mix)*n,i.softness+=(i.data.softness-i.softness)*n,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch}return}let a=0,c=0,u=K.search(l,s,6),d=this.curves[u/6];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+6]-f);a+=(l[u+6+1]-a)*m,c+=(l[u+6+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}h==0?(i.mix=i.data.mix+(a-i.data.mix)*n,i.softness=i.data.softness+(c-i.data.softness)*n,o==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=l[u+3],i.compress=l[u+4]!=0,i.stretch=l[u+5]!=0)):(i.mix+=(a-i.mix)*n,i.softness+=(c-i.softness)*n,o==0&&(i.bendDirection=l[u+3],i.compress=l[u+4]!=0,i.stretch=l[u+5]!=0))}},St=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,n,h,o,i){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=r,l[e+3]=n,l[e+4]=h,l[e+5]=o,l[e+6]=i}apply(e,t,s,r,n,h,o){let i=e.transformConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){let w=i.data;switch(h){case 0:i.mixRotate=w.mixRotate,i.mixX=w.mixX,i.mixY=w.mixY,i.mixScaleX=w.mixScaleX,i.mixScaleY=w.mixScaleY,i.mixShearY=w.mixShearY;return;case 1:i.mixRotate+=(w.mixRotate-i.mixRotate)*n,i.mixX+=(w.mixX-i.mixX)*n,i.mixY+=(w.mixY-i.mixY)*n,i.mixScaleX+=(w.mixScaleX-i.mixScaleX)*n,i.mixScaleY+=(w.mixScaleY-i.mixScaleY)*n,i.mixShearY+=(w.mixShearY-i.mixShearY)*n}return}let a,c,u,d,f,m,x=K.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let w=l[x];a=l[x+1],c=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];let g=(s-w)/(l[x+7]-w);a+=(l[x+7+1]-a)*g,c+=(l[x+7+2]-c)*g,u+=(l[x+7+3]-u)*g,d+=(l[x+7+4]-d)*g,f+=(l[x+7+5]-f)*g,m+=(l[x+7+6]-m)*g;break;case 1:a=l[x+1],c=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];break;default:a=this.getBezierValue(s,x,1,b-2),c=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+18*2-2),d=this.getBezierValue(s,x,4,b+18*3-2),f=this.getBezierValue(s,x,5,b+18*4-2),m=this.getBezierValue(s,x,6,b+18*5-2)}if(h==0){let w=i.data;i.mixRotate=w.mixRotate+(a-w.mixRotate)*n,i.mixX=w.mixX+(c-w.mixX)*n,i.mixY=w.mixY+(u-w.mixY)*n,i.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*n,i.mixScaleY=w.mixScaleY+(f-w.mixScaleY)*n,i.mixShearY=w.mixShearY+(m-w.mixShearY)*n}else i.mixRotate+=(a-i.mixRotate)*n,i.mixX+=(c-i.mixX)*n,i.mixY+=(u-i.mixY)*n,i.mixScaleX+=(d-i.mixScaleX)*n,i.mixScaleY+=(f-i.mixScaleY)*n,i.mixShearY+=(m-i.mixShearY)*n}},At=class extends ne{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,h,o){let i=e.pathConstraints[this.constraintIndex];i.active&&(i.position=this.getAbsoluteValue(s,n,h,i.position,i.data.position))}},It=class extends ne{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,h,o){let i=e.pathConstraints[this.constraintIndex];i.active&&(i.spacing=this.getAbsoluteValue(s,n,h,i.spacing,i.data.spacing))}},Ct=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,n){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=r,h[e+3]=n}apply(e,t,s,r,n,h,o){let i=e.pathConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.mixRotate=i.data.mixRotate,i.mixX=i.data.mixX,i.mixY=i.data.mixY;return;case 1:i.mixRotate+=(i.data.mixRotate-i.mixRotate)*n,i.mixX+=(i.data.mixX-i.mixX)*n,i.mixY+=(i.data.mixY-i.mixY)*n}return}let a,c,u,d=K.search(l,s,4),f=this.curves[d>>2];switch(f){case 0:let m=l[d];a=l[d+1],c=l[d+2],u=l[d+3];let x=(s-m)/(l[d+4]-m);a+=(l[d+4+1]-a)*x,c+=(l[d+4+2]-c)*x,u+=(l[d+4+3]-u)*x;break;case 1:a=l[d+1],c=l[d+2],u=l[d+3];break;default:a=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2),u=this.getBezierValue(s,d,3,f+18*2-2)}if(h==0){let m=i.data;i.mixRotate=m.mixRotate+(a-m.mixRotate)*n,i.mixX=m.mixX+(c-m.mixX)*n,i.mixY=m.mixY+(u-m.mixY)*n}else i.mixRotate+=(a-i.mixRotate)*n,i.mixX+=(c-i.mixX)*n,i.mixY+=(u-i.mixY)*n}},ue=class extends ne{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,h,o){let i;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const a of e.physicsConstraints)a.active&&this.global(a.data)&&this.set(a,this.getAbsoluteValue2(s,n,h,this.get(a),this.setup(a),l))}else i=e.physicsConstraints[this.constraintIndex],i.active&&this.set(i,this.getAbsoluteValue(s,n,h,this.get(i),this.setup(i)))}},kt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Mt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Yt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Tt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Xt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ft=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Et=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},ms=class extends K{constraintIndex;constructor(e,t){super(e,ms.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,r,n,h,o){let i;if(this.constraintIndex!=-1&&(i=e.physicsConstraints[this.constraintIndex],!i.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],n,h,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[K.search1(l,t)+1]))if(i!=null)i.reset();else for(const a of e.physicsConstraints)a.active&&a.reset()}},_e=ms;B(_e,"propertyIds",[O.physicsConstraintReset.toString()]);var me=class extends K{slotIndex;attachment;constructor(e,t,s){super(e,[O.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,r,n){let h=this.frames;e*=me.ENTRIES,h[e]=t,h[e+me.MODE]=s|r<<4,h[e+me.DELAY]=n}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.attachment,a=this.attachment;if(l!=a&&(!(l instanceof le)||l.timelineAttachment!=a))return;if(o==1){h==0&&(i.sequenceIndex=-1);return}let c=this.frames;if(s<c[0]){(h==0||h==1)&&(i.sequenceIndex=-1);return}let u=K.search(c,s,me.ENTRIES),d=c[u],f=c[u+me.MODE],m=c[u+me.DELAY];if(!this.attachment.sequence)return;let x=f>>4,b=this.attachment.sequence.regions.length,w=hs[f&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(b-1,x);break;case 2:x%=b;break;case 3:{let g=(b<<1)-2;x=g==0?0:x%g,x>=b&&(x=g-x);break}case 4:x=Math.max(b-1-x,0);break;case 5:x=b-1-x%b;break;case 6:{let g=(b<<1)-2;x=g==0?0:(x+b-1)%g,x>=b&&(x=g-x)}}i.sequenceIndex=x}},Ae=me;B(Ae,"ENTRIES",3),B(Ae,"MODE",1),B(Ae,"DELAY",2);var We=class{static emptyAnimation(){return We._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new xs(this);propertyIDs=new st;animationsChanged=!1;trackEntryPool=new Te(()=>new gs);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=e*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let o=n.next;if(o){let i=n.trackLast-o.delay;if(i>=0){for(o.delay=0,o.trackTime+=n.timeScale==0?0:(i/n.timeScale+e)*o.timeScale,n.trackTime+=h,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){t[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,e)){let i=n.mixingFrom;for(n.mixingFrom=null,i&&(i.mixingTo=null);i;)this.queue.end(i),i=i.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,r=!1;for(let u=0,d=s.length;u<d;u++){let f=s[u];if(!f||f.delay>0)continue;r=!0;let m=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,m):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let b=x>=f.alphaAttachmentThreshold,w=f.animationLast,g=f.getAnimationTime(),p=g,v=t;f.reverse&&(p=f.animation.duration-p,v=null);let y=f.animation.timelines,S=y.length;if(u==0&&x==1||m==3){u==0&&(b=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(x,m);var n=y[A];n instanceof we?this.applyAttachmentTimeline(n,e,p,m,b):n.apply(e,w,p,v,x,m,0)}}else{let A=f.timelineMode,k=f.shortestRotation,Y=!k&&f.timelinesRotation.length!=S<<1;Y&&(f.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let E=y[M],X=A[M]==Ue?m:0;!k&&E instanceof Xe?this.applyRotateTimeline(E,e,p,x,X,f.timelinesRotation,M<<1,Y):E instanceof we?this.applyAttachmentTimeline(E,e,p,m,b):(R.webkit602BugfixHelper(x,m),E.apply(e,w,p,v,x,X,0))}}this.queueEvents(f,g),t.length=0,f.nextAnimationLast=g,f.nextTrackLast=f.trackTime}for(var h=this.unkeyedState+Vt,o=e.slots,i=0,l=e.slots.length;i<l;i++){var a=o[i];if(a.attachmentState==h){var c=a.data.attachmentName;a.setAttachment(c?e.getAttachment(a.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,t,s){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,t,s);let n=0;e.mixDuration==0?(n=1,s==1&&(s=0)):(n=e.mixTime/e.mixDuration,n>1&&(n=1),s!=1&&(s=r.mixBlend));let h=n<r.mixAttachmentThreshold,o=n<r.mixDrawOrderThreshold,i=r.animation.timelines,l=i.length,a=r.alpha*e.interruptAlpha,c=a*(1-n),u=r.animationLast,d=r.getAnimationTime(),f=d,m=null;if(r.reverse?f=r.animation.duration-f:n<r.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)i[x].apply(t,u,f,m,c,s,1);else{let x=r.timelineMode,b=r.timelineHoldMix,w=r.shortestRotation,g=!w&&r.timelinesRotation.length!=l<<1;g&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let p=0;p<l;p++){let v=i[p],y=1,S,A=0;switch(x[p]){case Ue:if(!o&&v instanceof be)continue;S=s,A=c;break;case Pt:S=0,A=c;break;case Bt:S=s,A=a;break;case ze:S=0,A=a;break;default:S=0;let k=b[p];A=a*Math.max(0,1-k.mixTime/k.mixDuration);break}r.totalAlpha+=A,!w&&v instanceof Xe?this.applyRotateTimeline(v,t,f,A,S,r.timelinesRotation,p<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,f,S,h&&A>=r.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof be&&S==0&&(y=0),v.apply(t,u,f,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(r,d),this.events.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime,n}applyAttachmentTimeline(e,t,s,r,n){var h=t.slots[e.slotIndex];h.bone.active&&(s<e.frames[0]?(r==0||r==1)&&this.setAttachment(t,h,h.data.attachmentName,n):this.setAttachment(t,h,e.attachmentNames[K.search1(e.frames,s)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Vt))}setAttachment(e,t,s,r){t.setAttachment(s?e.getAttachment(t.data.index,s):null),r&&(t.attachmentState=this.unkeyedState+ws)}applyRotateTimeline(e,t,s,r,n,h,o,i){if(i&&(h[o]=0),r==1){e.apply(t,0,s,null,1,n,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let a=e.frames,c=0,u=0;if(s<a[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:c=l.rotation,u=l.data.rotation}else c=n==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(s);let d=0,f=u-c;if(f-=Math.ceil(f/360-.5)*360,f==0)d=h[o];else{let m=0,x=0;i?(m=0,x=f):(m=h[o],x=h[o+1]);let b=m-m%360;d=f+b;let w=f>=0,g=m>=0;Math.abs(x)<=90&&F.signum(x)!=F.signum(f)&&(Math.abs(m-b)>180?(d+=360*F.signum(m),g=w):b!=0?d-=360*F.signum(m):g=w),g!=w&&(d+=360*F.signum(m)),h[o]=d}h[o+1]=f,l.rotation=c+d*r}queueEvents(e,t){let s=e.animationStart,r=e.animationEnd,n=r-s,h=e.trackLast%n,o=this.events,i=0,l=o.length;for(;i<l;i++){let c=o[i];if(c.time<h)break;c.time>r||this.queue.event(e,c)}let a=!1;if(e.loop)if(n==0)a=!0;else{const c=Math.floor(e.trackTime/n);a=c>0&&c>Math.floor(e.trackLast/n)}else a=t>=r&&e.animationLast<r;for(a&&this.queue.complete(e);i<l;i++){let c=o[i];c.time<s||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let r=s.mixingFrom;if(!r)break;this.queue.end(r),s.mixingFrom=null,s.mixingTo=null,s=r}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let r=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,r&&(s&&this.queue.interrupt(r),t.mixingFrom=r,r.mixingTo=t,t.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(t.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,r,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(e);n&&(n.nextTrackLast==-1?(this.tracks[e]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,r=!1):this.clearNext(n));let h=this.trackEntry(e,t,s,n);return this.setCurrent(e,h,r),this.queue.drain(),h}addAnimation(e,t,s=!1,r=0){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,n,s,r)}addAnimationWith(e,t,s=!1,r=0){if(!t)throw new Error("animation cannot be null.");let n=this.expandToIndex(e);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(e,t,s,n);return n?(n.next=h,h.previous=n,r<=0&&(r+=n.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=r,h}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,We.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let r=this.addAnimationWith(e,We.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-t),r.mixDuration=t,r.trackEnd=t,r}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++){let n=this.tracks[s];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,r){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=e,n.animation=t,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=t.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=r?this.data.getMix(r.animation,t):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let r=e[t];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,r=e.animation.timelines.length,n=e.timelineMode;n.length=r;let h=e.timelineHoldMix;h.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let i=0;i<r;i++)n[i]=o.addAll(s[i].getPropertyIds())?ze:Bt;return}e:for(let i=0;i<r;i++){let l=s[i],a=l.getPropertyIds();if(!o.addAll(a))n[i]=Ue;else if(!t||l instanceof we||l instanceof be||l instanceof Fe||!t.animation.hasTimeline(a))n[i]=Pt;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(a)){if(e.mixDuration>0){n[i]=ps,h[i]=c;continue e}break}n[i]=ze}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Rt=We;B(Rt,"_emptyAnimation",new Oe("<empty>",[],0));var gs=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,this.previous!=null&&t<=0&&(t+=this.previous.getTrackComplete()-e),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}},xs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(se.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(se.interrupt),this.objects.push(e)}end(e){this.objects.push(se.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(se.dispose),this.objects.push(e)}complete(e){this.objects.push(se.complete),this.objects.push(e)}event(e,t){this.objects.push(se.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let r=e[s],n=e[s+1];switch(r){case se.start:n.listener&&n.listener.start&&n.listener.start(n);for(let o=0;o<t.length;o++){let i=t[o];i.start&&i.start(n)}break;case se.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let o=0;o<t.length;o++){let i=t[o];i.interrupt&&i.interrupt(n)}break;case se.end:n.listener&&n.listener.end&&n.listener.end(n);for(let o=0;o<t.length;o++){let i=t[o];i.end&&i.end(n)}case se.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let o=0;o<t.length;o++){let i=t[o];i.dispose&&i.dispose(n)}this.animState.trackEntryPool.free(n);break;case se.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let o=0;o<t.length;o++){let i=t[o];i.complete&&i.complete(n)}break;case se.event:let h=e[s+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let o=0;o<t.length;o++){let i=t[o];i.event&&i.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},se=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(se||{}),Gs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Ue=0,Pt=1,Bt=2,ze=3,ps=4,Vt=1,ws=2,bs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);this.setMixWith(r,n,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ge=class extends le{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ge(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ee=class extends le{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Ee(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Lt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},He=(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))(He||{}),ys=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ys||{}),vs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Hs=class extends Lt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Nt=class{pages=new Array;regions=new Array;constructor(e){let t=new $s(e),s=new Array(4),r={};r.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},r.format=()=>{},r.filter=a=>{a.minFilter=R.enumValue(He,s[1]),a.magFilter=R.enumValue(He,s[2])},r.repeat=a=>{s[1].indexOf("x")!=-1&&(a.uWrap=10497),s[1].indexOf("y")!=-1&&(a.vWrap=10497)},r.pma=a=>{a.pma=s[1]=="true"};var n={};n.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},n.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},n.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},n.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},n.rotate=a=>{let c=s[1];c=="true"?a.degrees=90:c!="false"&&(a.degrees=parseInt(c))},n.index=a=>{a.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,i=null,l=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let a=new Dt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let u=n[s[0]];if(u)u(a);else{i||(i=[]),l||(l=[]),i.push(s[0]);let d=[];for(let f=0;f<c;f++)d.push(parseInt(s[f+1]));l.push(d)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height),i&&i.length>0&&l&&l.length>0&&(a.names=i,a.values=l,i=null,l=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees==90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new Ss(h.trim());t.readEntry(s,h=t.readLine())!=0;){let a=r[s[0]];a&&a(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(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 r=1,n=s+1;;r++){let h=t.indexOf(",",n);if(h==-1)return e[r]=t.substr(n).trim(),r;if(e[r]=t.substr(n,h-n).trim(),n=h+1,r==4)return 4}}},Ss=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}},Dt=class extends vs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,r=this.region.u,n=this.region.v,h=0,o=0;if(this.region instanceof Dt){let i=this.region,l=i.page,a=l.width,c=l.height;switch(i.degrees){case 90:r-=(i.originalHeight-i.offsetY-i.height)/a,n-=(i.originalWidth-i.offsetX-i.width)/c,h=i.originalHeight/a,o=i.originalWidth/c;for(let u=0;u<s;u+=2)t[u]=r+e[u+1]*h,t[u+1]=n+(1-e[u])*o;return;case 180:r-=(i.originalWidth-i.offsetX-i.width)/a,n-=i.offsetY/c,h=i.originalWidth/a,o=i.originalHeight/c;for(let u=0;u<s;u+=2)t[u]=r+(1-e[u])*h,t[u+1]=n+(1-e[u+1])*o;return;case 270:r-=i.offsetY/a,n-=i.offsetX/c,h=i.originalHeight/a,o=i.originalWidth/c;for(let u=0;u<s;u+=2)t[u]=r+(1-e[u+1])*h,t[u+1]=n+e[u]*o;return}r-=i.offsetX/a,n-=(i.originalHeight-i.offsetY-i.height)/c,h=i.originalWidth/a,o=i.originalHeight/c}else this.region?(h=this.region.u2-r,o=this.region.v2-n):(r=n=0,h=o=1);for(let i=0;i<s;i+=2)t[i]=r+e[i]*h,t[i+1]=n+e[i+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,r,n,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,r,n,h)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ie=class extends le{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ie(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ot=class extends le{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*F.degRad,s=Math.cos(t),r=Math.sin(t),n=s*e.a+r*e.b,h=s*e.c+r*e.d;return F.atan2Deg(h,n)}copy(){let e=new Ot(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},As=class extends it{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*r,o=n+this.region.width*s,i=h+this.region.height*r,l=this.rotation*F.degRad,a=Math.cos(l),c=Math.sin(l),u=this.x,d=this.y,f=n*a+u,m=n*c,x=h*a+d,b=h*c,w=o*a+u,g=o*c,p=i*a+d,v=i*c,y=this.offset;y[0]=f-b,y[1]=x+m,y[2]=f-v,y[3]=p+m,y[4]=w-v,y[5]=p+g,y[6]=w-b,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,r){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,h=this.offset,o=n.worldX,i=n.worldY,l=n.a,a=n.b,c=n.c,u=n.d,d=0,f=0;d=h[0],f=h[1],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i,s+=r,d=h[2],f=h[3],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i,s+=r,d=h[4],f=h[5],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i,s+=r,d=h[6],f=h[7],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i}copy(){let e=new As(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},U=As;B(U,"X1",0),B(U,"Y1",1),B(U,"C1R",2),B(U,"C1G",3),B(U,"C1B",4),B(U,"C1A",5),B(U,"U1",6),B(U,"V1",7),B(U,"X2",8),B(U,"Y2",9),B(U,"C2R",10),B(U,"C2G",11),B(U,"C2B",12),B(U,"C2A",13),B(U,"U2",14),B(U,"V2",15),B(U,"X3",16),B(U,"Y3",17),B(U,"C3R",18),B(U,"C3G",19),B(U,"C3B",20),B(U,"C3A",21),B(U,"U3",22),B(U,"V3",23),B(U,"X4",24),B(U,"Y4",25),B(U,"C4R",26),B(U,"C4G",27),B(U,"C4B",28),B(U,"C4A",29),B(U,"U4",30),B(U,"V4",31);var Is=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let n=0,h=r.length;n<h;n++){let o=s.getPath(t,n),i=this.atlas.findRegion(o);if(i==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[n]=i}}newRegionAttachment(e,t,s,r){let n=new U(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");n.region=h}return n}newMeshAttachment(e,t,s,r){let n=new ye(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");n.region=h}return n}newBoundingBoxAttachment(e,t){return new Ge(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new Ot(t)}newClippingAttachment(e,t){return new Ee(t)}},qt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Re.Normal;skinRequired=!1;color=new D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Re=(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))(Re||{}),_t=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,r,n,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=h,this.ashearY=o;let i=this.parent;if(!i){let d=this.skeleton;const f=d.scaleX,m=d.scaleY,x=(s+h)*F.degRad,b=(s+90+o)*F.degRad;this.a=Math.cos(x)*r*f,this.b=Math.cos(b)*n*f,this.c=Math.sin(x)*r*m,this.d=Math.sin(b)*n*m,this.worldX=e*f+d.x,this.worldY=t*m+d.y;return}let l=i.a,a=i.b,c=i.c,u=i.d;switch(this.worldX=l*e+a*t+i.worldX,this.worldY=c*e+u*t+i.worldY,this.inherit){case 0:{const d=(s+h)*F.degRad,f=(s+90+o)*F.degRad,m=Math.cos(d)*r,x=Math.cos(f)*n,b=Math.sin(d)*r,w=Math.sin(f)*n;this.a=l*m+a*b,this.b=l*x+a*w,this.c=c*m+u*b,this.d=c*x+u*w;return}case 1:{const d=(s+h)*F.degRad,f=(s+90+o)*F.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(f)*n,this.c=Math.sin(d)*r,this.d=Math.sin(f)*n;break}case 2:{let d=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;l*=d,c*=f;let m=l*l+c*c,x=0;m>1e-4?(m=Math.abs(l*u*f-a*d*c)/m,a=c*m,u=l*m,x=Math.atan2(c,l)*F.radDeg):(l=0,c=0,x=90-Math.atan2(u,a)*F.radDeg);const b=(s+h-x)*F.degRad,w=(s+o-x+90)*F.degRad,g=Math.cos(b)*r,p=Math.cos(w)*n,v=Math.sin(b)*r,y=Math.sin(w)*n;this.a=l*g-a*v,this.b=l*p-a*y,this.c=c*g+u*v,this.d=c*p+u*y;break}case 3:case 4:{s*=F.degRad;const d=Math.cos(s),f=Math.sin(s);let m=(l*d+a*f)/this.skeleton.scaleX,x=(c*d+u*f)/this.skeleton.scaleY,b=Math.sqrt(m*m+x*x);b>1e-5&&(b=1/b),m*=b,x*=b,b=Math.sqrt(m*m+x*x),this.inherit==3&&l*u-a*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*b,g=Math.sin(s)*b;h*=F.degRad,o=(90+o)*F.degRad;const p=Math.cos(h)*r,v=Math.cos(o)*n,y=Math.sin(h)*r,S=Math.sin(o)*n;this.a=m*p+w*y,this.b=m*v+w*S,this.c=x*p+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*F.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)*F.radDeg;return}let t=e.a,s=e.b,r=e.c,n=e.d,h=1/(t*n-s*r),o=n*h,i=s*h,l=r*h,a=t*h,c=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=c*o-u*i,this.ay=u*a-c*l;let d,f,m,x;if(this.inherit==1)d=this.a,f=this.b,m=this.c,x=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*n-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*v/this.skeleton.scaleY,n=t*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(t*n-s*r),o=n*h,i=s*h;break}case 3:case 4:let b=F.cosDeg(this.rotation),w=F.sinDeg(this.rotation);t=(t*b+s*w)/this.skeleton.scaleX,r=(r*b+n*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let p=F.PI/2+Math.atan2(r,t);s=Math.cos(p)*g,n=Math.sin(p)*g,h=1/(t*n-s*r),o=n*h,i=s*h,l=r*h,a=t*h}d=o*this.a-i*this.c,f=o*this.b-i*this.d,m=a*this.c-l*this.a,x=a*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let b=d*x-f*m;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*f+m*x,b)*F.radDeg,this.arotation=Math.atan2(m,d)*F.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,f)*F.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*F.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*F.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,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*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=F.sinDeg(e),s=F.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*F.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=F.sinDeg(e),s=F.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*F.radDeg}rotateWorld(e){e*=F.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,n=this.b;this.a=s*r-t*this.c,this.b=s*n-t*this.d,this.c=t*r+s*this.c,this.d=t*n+s*this.d}},Pe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},js=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Cs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load binary ${e}: status ${r}, ${n}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${n}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${r}, ${n}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let n=e.lastIndexOf("/"),h=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let i=new Nt(o),l=i.pages.length,a=!1;for(let c of i.pages)this.loadTexture(r?r[c.name]:h+c.name,(u,d)=>{a||(c.setTexture(d),--l==0&&this.success(t,e,i))},(u,d)=>{a||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${u}`),a=!0})}catch(i){this.error(s,e,`Couldn't parse texture atlas ${e}: ${i.message}`)}},(o,i)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${i}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
1
+ "use strict";var Ds=Object.defineProperty,Os=(e,t,s)=>t in e?Ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,B=(e,t,s)=>(Os(e,typeof t!="symbol"?t+"":t,s),s),qs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},st=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},pe=class{constructor(e=0,t=0,s=0,r=0){this.r=e,this.g=t,this.b=s,this.a=r}set(e,t,s,r){return this.r=e,this.g=t,this.b=s,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,r){return this.r+=e,this.g+=t,this.b+=s,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(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new pe().setFromString(e)}},D=pe;B(D,"WHITE",new pe(1,1,1,1)),B(D,"RED",new pe(1,0,0,1)),B(D,"GREEN",new pe(0,1,0,1)),B(D,"BLUE",new pe(0,0,1,1)),B(D,"MAGENTA",new pe(1,0,1,1));var ae=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ae.degRad)}static sinDeg(e){return Math.sin(e*ae.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ae.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ae.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let r=Math.random(),n=t-e;return r<=(s-e)/n?e+Math.sqrt(r*n*(s-e)):t-Math.sqrt((1-r)*n*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},F=ae;B(F,"PI",3.1415927),B(F,"PI2",ae.PI*2),B(F,"invPI2",1/ae.PI2),B(F,"radiansToDegrees",180/ae.PI),B(F,"radDeg",ae.radiansToDegrees),B(F,"degreesToRadians",ae.PI/180),B(F,"degRad",ae.degreesToRadians);var ns=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},as=class extends ns{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},_s=class extends as{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Se=class{static arrayCopy(e,t,s,r,n){for(let h=t,o=r;h<t+n;h++,o++)s[o]=e[h]}static arrayFill(e,t,s,r){for(let n=t;n<s;n++)e[n]=r}static setArraySize(e,t,s=0){let r=e.length;if(r==t)return e;if(e.length=t,r<t)for(let n=r;n<t;n++)e[n]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:Se.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t;return s}static newFloatArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return Se.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Se.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=Se;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ws=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Te=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Ne=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}},Us=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)}},zs=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}},it=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ls=class extends it{id=ls.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,r,n,h){s=n+(s>>1)*h;let o=e.bone.skeleton,i=e.deform,l=this.vertices,a=this.bones;if(!a){i.length>0&&(l=i);let f=e.bone,m=f.worldX,x=f.worldY,b=f.a,w=f.b,g=f.c,p=f.d;for(let v=t,y=n;y<s;v+=2,y+=h){let S=l[v],A=l[v+1];r[y]=S*b+A*w+m,r[y+1]=S*g+A*p+x}return}let c=0,u=0;for(let f=0;f<t;f+=2){let m=a[c];c+=m+1,u+=m}let d=o.bones;if(i.length==0)for(let f=n,m=u*3;f<s;f+=h){let x=0,b=0,w=a[c++];for(w+=c;c<w;c++,m+=3){let g=d[a[c]],p=l[m],v=l[m+1],y=l[m+2];x+=(p*g.a+v*g.b+g.worldX)*y,b+=(p*g.c+v*g.d+g.worldY)*y}r[f]=x,r[f+1]=b}else{let f=i;for(let m=n,x=u*3,b=u<<1;m<s;m+=h){let w=0,g=0,p=a[c++];for(p+=c;c<p;c++,x+=3,b+=2){let v=d[a[c]],y=l[x]+f[b],S=l[x+1]+f[b+1],A=l[x+2];w+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}r[m]=w,r[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},le=ls;B(le,"nextID",0);var De=class{id=De.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new De(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];t.region!=r&&(t.region=r,t.updateRegion())}getPath(e,t){let s=e,r=(this.start+t).toString();for(let n=this.digits-r.length;n>0;n--)s+="0";return s+=r,s}static nextID(){return De._nextID++}},rt=De;B(rt,"_nextID",0);var os=(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))(os||{}),hs=[0,1,2,3,4,5,6],Oe=class{name;timelines=[];timelineIds=new st;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,n,h,o,i){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let a=0,c=l.length;a<c;a++)l[a].apply(e,t,s,n,h,o,i)}},cs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(cs||{}),ds=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ds||{}),O={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},K=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let n=s;n<r;n+=s)if(e[n]>t)return n-s;return r-s}},oe=class extends K{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,n,h,o,i,l,a,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(r-h*2+i)*.03,m=(n-o*2+l)*.03,x=((h-i)*3-r+a)*.006,b=((o-l)*3-n+c)*.006,w=f*2+x,g=m*2+b,p=(h-r)*.3+f+x*.16666667,v=(o-n)*.3+m+b*.16666667,y=r+p,S=n+v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,p+=w,v+=g,w+=x,g+=b,y+=p,S+=v}getBezierValue(e,t,s,r){let n=this.curves;if(n[r]>e){let l=this.frames[t],a=this.frames[t+s];return a+(e-l)/(n[r]-l)*(n[r+1]-a)}let h=r+18;for(r+=2;r<h;r+=2)if(n[r]>=e){let l=n[r-2],a=n[r-1];return a+(e-l)/(n[r]-l)*(n[r+1]-a)}t+=this.getFrameEntries();let o=n[h-2],i=n[h-1];return i+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-i)}},ne=class extends oe{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let n=2;n<=s;n+=2)if(t[n]>e){s=n-2;break}let r=this.curves[s>>1];switch(r){case 0:let n=t[s],h=t[s+1];return h+(e-n)/(t[s+2]-n)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,n){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}let h=this.getCurveValue(e);switch(s){case 0:return n+h*t;case 1:case 2:h+=n-r}return r+h*t}getAbsoluteValue(e,t,s,r,n){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}let h=this.getCurveValue(e);return s==0?n+(h-n)*t:r+(h-r)*t}getAbsoluteValue2(e,t,s,r,n,h){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}return s==0?n+(h-n)*t:r+(h-r)*t}getScaleValue(e,t,s,r,n,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return n+(h-n)*t}return n}let i=this.getCurveValue(e)*h;if(t==1)return s==3?n+i-h:i;if(r==1)switch(s){case 0:return h+(Math.abs(i)*F.signum(h)-h)*t;case 1:case 2:return n+(Math.abs(i)*F.signum(n)-n)*t}else{let l=0;switch(s){case 0:return l=Math.abs(h)*F.signum(i),l+(i-l)*t;case 1:case 2:return l=Math.abs(n)*F.signum(i),l+(i-l)*t}}return n+(i-h)*t}},qe=class extends oe{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Xe=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.rotation=this.getRelativeValue(s,n,h,i.rotation,i.data.rotation))}},nt=class extends qe{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.x=i.data.x,i.y=i.data.y;return;case 1:i.x+=(i.data.x-i.x)*n,i.y+=(i.data.y-i.y)*n}return}let a=0,c=0,u=K.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,c+=(l[u+3+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(h){case 0:i.x=i.data.x+a*n,i.y=i.data.y+c*n;break;case 1:case 2:i.x+=(i.data.x+a-i.x)*n,i.y+=(i.data.y+c-i.y)*n;break;case 3:i.x+=a*n,i.y+=c*n}}},at=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.x=this.getRelativeValue(s,n,h,i.x,i.data.x))}},lt=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.y=this.getRelativeValue(s,n,h,i.y,i.data.y))}},ot=class extends qe{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.scaleX=i.data.scaleX,i.scaleY=i.data.scaleY;return;case 1:i.scaleX+=(i.data.scaleX-i.scaleX)*n,i.scaleY+=(i.data.scaleY-i.scaleY)*n}return}let a,c,u=K.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,c+=(l[u+3+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}if(a*=i.data.scaleX,c*=i.data.scaleY,n==1)h==3?(i.scaleX+=a-i.data.scaleX,i.scaleY+=c-i.data.scaleY):(i.scaleX=a,i.scaleY=c);else{let f=0,m=0;if(o==1)switch(h){case 0:f=i.data.scaleX,m=i.data.scaleY,i.scaleX=f+(Math.abs(a)*F.signum(f)-f)*n,i.scaleY=m+(Math.abs(c)*F.signum(m)-m)*n;break;case 1:case 2:f=i.scaleX,m=i.scaleY,i.scaleX=f+(Math.abs(a)*F.signum(f)-f)*n,i.scaleY=m+(Math.abs(c)*F.signum(m)-m)*n;break;case 3:i.scaleX+=(a-i.data.scaleX)*n,i.scaleY+=(c-i.data.scaleY)*n}else switch(h){case 0:f=Math.abs(i.data.scaleX)*F.signum(a),m=Math.abs(i.data.scaleY)*F.signum(c),i.scaleX=f+(a-f)*n,i.scaleY=m+(c-m)*n;break;case 1:case 2:f=Math.abs(i.scaleX)*F.signum(a),m=Math.abs(i.scaleY)*F.signum(c),i.scaleX=f+(a-f)*n,i.scaleY=m+(c-m)*n;break;case 3:i.scaleX+=(a-i.data.scaleX)*n,i.scaleY+=(c-i.data.scaleY)*n}}}},ht=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.scaleX=this.getScaleValue(s,n,h,o,i.scaleX,i.data.scaleX))}},ct=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.scaleY=this.getScaleValue(s,n,h,o,i.scaleY,i.data.scaleY))}},dt=class extends qe{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.shearX=i.data.shearX,i.shearY=i.data.shearY;return;case 1:i.shearX+=(i.data.shearX-i.shearX)*n,i.shearY+=(i.data.shearY-i.shearY)*n}return}let a=0,c=0,u=K.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,c+=(l[u+3+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(h){case 0:i.shearX=i.data.shearX+a*n,i.shearY=i.data.shearY+c*n;break;case 1:case 2:i.shearX+=(i.data.shearX+a-i.shearX)*n,i.shearY+=(i.data.shearY+c-i.shearY)*n;break;case 3:i.shearX+=a*n,i.shearY+=c*n}}},ft=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.shearX=this.getRelativeValue(s,n,h,i.shearX,i.data.shearX))}},ut=class extends ne{boneIndex=0;constructor(e,t,s){super(e,t,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,h,o){let i=e.bones[this.boneIndex];i.active&&(i.shearY=this.getRelativeValue(s,n,h,i.shearY,i.data.shearY))}},mt=class extends K{boneIndex=0;constructor(e,t){super(e,[O.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,r,n,h,o){let i=e.bones[this.boneIndex];if(!i.active)return;if(o==1){h==0&&(i.inherit=i.data.inherit);return}let l=this.frames;if(s<l[0]){(h==0||h==1)&&(i.inherit=i.data.inherit);return}i.inherit=this.frames[K.search(l,s,2)+1]}},gt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,r,n,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color;if(s<l[0]){let b=i.data.color;switch(h){case 0:a.setFromColor(b);return;case 1:a.add((b.r-a.r)*n,(b.g-a.g)*n,(b.b-a.b)*n,(b.a-a.a)*n)}return}let c=0,u=0,d=0,f=0,m=K.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let b=l[m];c=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];let w=(s-b)/(l[m+5]-b);c+=(l[m+5+1]-c)*w,u+=(l[m+5+2]-u)*w,d+=(l[m+5+3]-d)*w,f+=(l[m+5+4]-f)*w;break;case 1:c=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];break;default:c=this.getBezierValue(s,m,1,x-2),u=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),f=this.getBezierValue(s,m,4,x+18*3-2)}n==1?a.set(c,u,d,f):(h==0&&a.setFromColor(i.data.color),a.add((c-a.r)*n,(u-a.g)*n,(d-a.b)*n,(f-a.a)*n))}},xt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,n){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color;if(s<l[0]){let x=i.data.color;switch(h){case 0:a.r=x.r,a.g=x.g,a.b=x.b;return;case 1:a.r+=(x.r-a.r)*n,a.g+=(x.g-a.g)*n,a.b+=(x.b-a.b)*n}return}let c=0,u=0,d=0,f=K.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let x=l[f];c=l[f+1],u=l[f+2],d=l[f+3];let b=(s-x)/(l[f+4]-x);c+=(l[f+4+1]-c)*b,u+=(l[f+4+2]-u)*b,d+=(l[f+4+3]-d)*b;break;case 1:c=l[f+1],u=l[f+2],d=l[f+3];break;default:c=this.getBezierValue(s,f,1,m-2),u=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(n==1)a.r=c,a.g=u,a.b=d;else{if(h==0){let x=i.data.color;a.r=x.r,a.g=x.g,a.b=x.b}a.r+=(c-a.r)*n,a.g+=(u-a.g)*n,a.b+=(d-a.b)*n}}},pt=class extends ne{slotIndex=0;constructor(e,t,s){super(e,t,O.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.color;if(s<this.frames[0]){let c=i.data.color;switch(h){case 0:l.a=c.a;return;case 1:l.a+=(c.a-l.a)*n}return}let a=this.getCurveValue(s);n==1?l.a=a:(h==0&&(l.a=i.data.color.a),l.a+=(a-l.a)*n)}},wt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,n,h,o,i,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=i,this.frames[e+7]=l}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color,c=i.darkColor;if(s<l[0]){let v=i.data.color,y=i.data.darkColor;switch(h){case 0:a.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:a.add((v.r-a.r)*n,(v.g-a.g)*n,(v.b-a.b)*n,(v.a-a.a)*n),c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let u=0,d=0,f=0,m=0,x=0,b=0,w=0,g=K.search(l,s,8),p=this.curves[g>>3];switch(p){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],b=l[g+6],w=l[g+7];let y=(s-v)/(l[g+8]-v);u+=(l[g+8+1]-u)*y,d+=(l[g+8+2]-d)*y,f+=(l[g+8+3]-f)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,b+=(l[g+8+6]-b)*y,w+=(l[g+8+7]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],b=l[g+6],w=l[g+7];break;default:u=this.getBezierValue(s,g,1,p-2),d=this.getBezierValue(s,g,2,p+18-2),f=this.getBezierValue(s,g,3,p+18*2-2),m=this.getBezierValue(s,g,4,p+18*3-2),x=this.getBezierValue(s,g,5,p+18*4-2),b=this.getBezierValue(s,g,6,p+18*5-2),w=this.getBezierValue(s,g,7,p+18*6-2)}if(n==1)a.set(u,d,f,m),c.r=x,c.g=b,c.b=w;else{if(h==0){a.setFromColor(i.data.color);let v=i.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}a.add((u-a.r)*n,(d-a.g)*n,(f-a.b)*n,(m-a.a)*n),c.r+=(x-c.r)*n,c.g+=(b-c.g)*n,c.b+=(w-c.b)*n}}},bt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,n,h,o,i){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=i}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color,c=i.darkColor;if(s<l[0]){let v=i.data.color,y=i.data.darkColor;switch(h){case 0:a.r=v.r,a.g=v.g,a.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:a.r+=(v.r-a.r)*n,a.g+=(v.g-a.g)*n,a.b+=(v.b-a.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let u=0,d=0,f=0,m=0,x=0,b=0,w=0,g=K.search(l,s,7),p=this.curves[g/7];switch(p){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],b=l[g+5],w=l[g+6];let y=(s-v)/(l[g+7]-v);u+=(l[g+7+1]-u)*y,d+=(l[g+7+2]-d)*y,f+=(l[g+7+3]-f)*y,x+=(l[g+7+4]-x)*y,b+=(l[g+7+5]-b)*y,w+=(l[g+7+6]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],b=l[g+5],w=l[g+6];break;default:u=this.getBezierValue(s,g,1,p-2),d=this.getBezierValue(s,g,2,p+18-2),f=this.getBezierValue(s,g,3,p+18*2-2),x=this.getBezierValue(s,g,4,p+18*3-2),b=this.getBezierValue(s,g,5,p+18*4-2),w=this.getBezierValue(s,g,6,p+18*5-2)}if(n==1)a.r=u,a.g=d,a.b=f,c.r=x,c.g=b,c.b=w;else{if(h==0){let v=i.data.color,y=i.data.darkColor;a.r=v.r,a.g=v.g,a.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}a.r+=(u-a.r)*n,a.g+=(d-a.g)*n,a.b+=(f-a.b)*n,c.r+=(x-c.r)*n,c.g+=(b-c.g)*n,c.b+=(w-c.b)*n}}},we=class extends K{slotIndex=0;attachmentNames;constructor(e,t){super(e,[O.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,r,n,h,o){let i=e.slots[this.slotIndex];if(i.bone.active){if(o==1){h==0&&this.setAttachment(e,i,i.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,i,i.data.attachmentName);return}this.setAttachment(e,i,this.attachmentNames[K.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},yt=class extends oe{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[O.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,n,h,o,i,l,a,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(r-h*2+i)*.03,m=l*.03-o*.06,x=((h-i)*3-r+a)*.006,b=(o-l+.33333333)*.018,w=f*2+x,g=m*2+b,p=(h-r)*.3+f+x*.16666667,v=o*.3+m+b*.16666667,y=r+p,S=v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,p+=w,v+=g,w+=x,g+=b,y+=p,S+=v}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let i=this.frames[t];return(e-i)/(this.frames[t+this.getFrameEntries()]-i);case 1:return 0}if(r-=2,s[r]>e){let i=this.frames[t];return s[r+1]*(e-i)/(s[r]-i)}let n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=e){let i=s[r-2],l=s[r-1];return l+(e-i)/(s[r]-i)*(s[r+1]-l)}let h=s[n-2],o=s[n-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.getAttachment();if(!l||!(l instanceof le)||l.timelineAttachment!=this.attachment)return;let a=i.deform;a.length==0&&(h=0);let c=this.vertices,u=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:a.length=0;return;case 1:if(n==1){a.length=0;return}a.length=u;let g=l;if(g.bones){n=1-n;for(var f=0;f<u;f++)a[f]*=n}else{let p=g.vertices;for(var f=0;f<u;f++)a[f]+=(p[f]-a[f])*n}}return}if(a.length=u,s>=d[d.length-1]){let g=c[d.length-1];if(n==1)if(h==3){let p=l;if(p.bones)for(let v=0;v<u;v++)a[v]+=g[v];else{let v=p.vertices;for(let y=0;y<u;y++)a[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,a,0,u);else switch(h){case 0:{let v=l;if(v.bones)for(let y=0;y<u;y++)a[y]=g[y]*n;else{let y=v.vertices;for(let S=0;S<u;S++){let A=y[S];a[S]=A+(g[S]-A)*n}}break}case 1:case 2:for(let v=0;v<u;v++)a[v]+=(g[v]-a[v])*n;break;case 3:let p=l;if(p.bones)for(let v=0;v<u;v++)a[v]+=g[v]*n;else{let v=p.vertices;for(let y=0;y<u;y++)a[y]+=(g[y]-v[y])*n}}return}let m=K.search1(d,s),x=this.getCurvePercent(s,m),b=c[m],w=c[m+1];if(n==1)if(h==3){let g=l;if(g.bones)for(let p=0;p<u;p++){let v=b[p];a[p]+=v+(w[p]-v)*x}else{let p=g.vertices;for(let v=0;v<u;v++){let y=b[v];a[v]+=y+(w[v]-y)*x-p[v]}}}else for(let g=0;g<u;g++){let p=b[g];a[g]=p+(w[g]-p)*x}else switch(h){case 0:{let p=l;if(p.bones)for(let v=0;v<u;v++){let y=b[v];a[v]=(y+(w[v]-y)*x)*n}else{let v=p.vertices;for(let y=0;y<u;y++){let S=b[y],A=v[y];a[y]=A+(S+(w[y]-S)*x-A)*n}}break}case 1:case 2:for(let p=0;p<u;p++){let v=b[p];a[p]+=(v+(w[p]-v)*x-a[p])*n}break;case 3:let g=l;if(g.bones)for(let p=0;p<u;p++){let v=b[p];a[p]+=(v+(w[p]-v)*x)*n}else{let p=g.vertices;for(let v=0;v<u;v++){let y=b[v];a[v]+=(y+(w[v]-y)*x-p[v])*n}}}}},fs=class extends K{events;constructor(e){super(e,fs.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,r,n,h,o){if(!r)return;let i=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,r,n,h,o),t=-1;else if(t>=i[l-1])return;if(s<i[0])return;let a=0;if(t<i[0])a=0;else{a=K.search1(i,t)+1;let c=i[a];for(;a>0&&i[a-1]==c;)a--}for(;a<l&&s>=i[a];a++)r.push(this.events[a])}},Fe=fs;B(Fe,"propertyIds",[""+O.event]);var us=class extends K{drawOrders;constructor(e){super(e,us.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,r,n,h,o){if(o==1){h==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(h==0||h==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let i=K.search1(this.frames,s),l=this.drawOrders[i];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let a=e.drawOrder,c=e.slots;for(let u=0,d=l.length;u<d;u++)a[u]=c[l[u]]}}},be=us;B(be,"propertyIds",[""+O.drawOrder]);var vt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,n,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,n,h,o){let i=e.ikConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.mix=i.data.mix,i.softness=i.data.softness,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch;return;case 1:i.mix+=(i.data.mix-i.mix)*n,i.softness+=(i.data.softness-i.softness)*n,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch}return}let a=0,c=0,u=K.search(l,s,6),d=this.curves[u/6];switch(d){case 0:let f=l[u];a=l[u+1],c=l[u+2];let m=(s-f)/(l[u+6]-f);a+=(l[u+6+1]-a)*m,c+=(l[u+6+2]-c)*m;break;case 1:a=l[u+1],c=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}h==0?(i.mix=i.data.mix+(a-i.data.mix)*n,i.softness=i.data.softness+(c-i.data.softness)*n,o==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=l[u+3],i.compress=l[u+4]!=0,i.stretch=l[u+5]!=0)):(i.mix+=(a-i.mix)*n,i.softness+=(c-i.softness)*n,o==0&&(i.bendDirection=l[u+3],i.compress=l[u+4]!=0,i.stretch=l[u+5]!=0))}},St=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,n,h,o,i){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=r,l[e+3]=n,l[e+4]=h,l[e+5]=o,l[e+6]=i}apply(e,t,s,r,n,h,o){let i=e.transformConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){let w=i.data;switch(h){case 0:i.mixRotate=w.mixRotate,i.mixX=w.mixX,i.mixY=w.mixY,i.mixScaleX=w.mixScaleX,i.mixScaleY=w.mixScaleY,i.mixShearY=w.mixShearY;return;case 1:i.mixRotate+=(w.mixRotate-i.mixRotate)*n,i.mixX+=(w.mixX-i.mixX)*n,i.mixY+=(w.mixY-i.mixY)*n,i.mixScaleX+=(w.mixScaleX-i.mixScaleX)*n,i.mixScaleY+=(w.mixScaleY-i.mixScaleY)*n,i.mixShearY+=(w.mixShearY-i.mixShearY)*n}return}let a,c,u,d,f,m,x=K.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let w=l[x];a=l[x+1],c=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];let g=(s-w)/(l[x+7]-w);a+=(l[x+7+1]-a)*g,c+=(l[x+7+2]-c)*g,u+=(l[x+7+3]-u)*g,d+=(l[x+7+4]-d)*g,f+=(l[x+7+5]-f)*g,m+=(l[x+7+6]-m)*g;break;case 1:a=l[x+1],c=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];break;default:a=this.getBezierValue(s,x,1,b-2),c=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+18*2-2),d=this.getBezierValue(s,x,4,b+18*3-2),f=this.getBezierValue(s,x,5,b+18*4-2),m=this.getBezierValue(s,x,6,b+18*5-2)}if(h==0){let w=i.data;i.mixRotate=w.mixRotate+(a-w.mixRotate)*n,i.mixX=w.mixX+(c-w.mixX)*n,i.mixY=w.mixY+(u-w.mixY)*n,i.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*n,i.mixScaleY=w.mixScaleY+(f-w.mixScaleY)*n,i.mixShearY=w.mixShearY+(m-w.mixShearY)*n}else i.mixRotate+=(a-i.mixRotate)*n,i.mixX+=(c-i.mixX)*n,i.mixY+=(u-i.mixY)*n,i.mixScaleX+=(d-i.mixScaleX)*n,i.mixScaleY+=(f-i.mixScaleY)*n,i.mixShearY+=(m-i.mixShearY)*n}},At=class extends ne{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,h,o){let i=e.pathConstraints[this.constraintIndex];i.active&&(i.position=this.getAbsoluteValue(s,n,h,i.position,i.data.position))}},It=class extends ne{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,h,o){let i=e.pathConstraints[this.constraintIndex];i.active&&(i.spacing=this.getAbsoluteValue(s,n,h,i.spacing,i.data.spacing))}},Ct=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,n){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=r,h[e+3]=n}apply(e,t,s,r,n,h,o){let i=e.pathConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:i.mixRotate=i.data.mixRotate,i.mixX=i.data.mixX,i.mixY=i.data.mixY;return;case 1:i.mixRotate+=(i.data.mixRotate-i.mixRotate)*n,i.mixX+=(i.data.mixX-i.mixX)*n,i.mixY+=(i.data.mixY-i.mixY)*n}return}let a,c,u,d=K.search(l,s,4),f=this.curves[d>>2];switch(f){case 0:let m=l[d];a=l[d+1],c=l[d+2],u=l[d+3];let x=(s-m)/(l[d+4]-m);a+=(l[d+4+1]-a)*x,c+=(l[d+4+2]-c)*x,u+=(l[d+4+3]-u)*x;break;case 1:a=l[d+1],c=l[d+2],u=l[d+3];break;default:a=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2),u=this.getBezierValue(s,d,3,f+18*2-2)}if(h==0){let m=i.data;i.mixRotate=m.mixRotate+(a-m.mixRotate)*n,i.mixX=m.mixX+(c-m.mixX)*n,i.mixY=m.mixY+(u-m.mixY)*n}else i.mixRotate+=(a-i.mixRotate)*n,i.mixX+=(c-i.mixX)*n,i.mixY+=(u-i.mixY)*n}},ue=class extends ne{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,h,o){let i;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const a of e.physicsConstraints)a.active&&this.global(a.data)&&this.set(a,this.getAbsoluteValue2(s,n,h,this.get(a),this.setup(a),l))}else i=e.physicsConstraints[this.constraintIndex],i.active&&this.set(i,this.getAbsoluteValue(s,n,h,this.get(i),this.setup(i)))}},kt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Mt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Yt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Tt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Xt=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ft=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Et=class extends ue{constructor(e,t,s){super(e,t,s,O.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},ms=class extends K{constraintIndex;constructor(e,t){super(e,ms.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,r,n,h,o){let i;if(this.constraintIndex!=-1&&(i=e.physicsConstraints[this.constraintIndex],!i.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],n,h,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[K.search1(l,t)+1]))if(i!=null)i.reset();else for(const a of e.physicsConstraints)a.active&&a.reset()}},_e=ms;B(_e,"propertyIds",[O.physicsConstraintReset.toString()]);var me=class extends K{slotIndex;attachment;constructor(e,t,s){super(e,[O.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,r,n){let h=this.frames;e*=me.ENTRIES,h[e]=t,h[e+me.MODE]=s|r<<4,h[e+me.DELAY]=n}apply(e,t,s,r,n,h,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.attachment,a=this.attachment;if(l!=a&&(!(l instanceof le)||l.timelineAttachment!=a))return;if(o==1){h==0&&(i.sequenceIndex=-1);return}let c=this.frames;if(s<c[0]){(h==0||h==1)&&(i.sequenceIndex=-1);return}let u=K.search(c,s,me.ENTRIES),d=c[u],f=c[u+me.MODE],m=c[u+me.DELAY];if(!this.attachment.sequence)return;let x=f>>4,b=this.attachment.sequence.regions.length,w=hs[f&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(b-1,x);break;case 2:x%=b;break;case 3:{let g=(b<<1)-2;x=g==0?0:x%g,x>=b&&(x=g-x);break}case 4:x=Math.max(b-1-x,0);break;case 5:x=b-1-x%b;break;case 6:{let g=(b<<1)-2;x=g==0?0:(x+b-1)%g,x>=b&&(x=g-x)}}i.sequenceIndex=x}},Ae=me;B(Ae,"ENTRIES",3),B(Ae,"MODE",1),B(Ae,"DELAY",2);var We=class{static emptyAnimation(){return We._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new xs(this);propertyIDs=new st;animationsChanged=!1;trackEntryPool=new Te(()=>new gs);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=e*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let o=n.next;if(o){let i=n.trackLast-o.delay;if(i>=0){for(o.delay=0,o.trackTime+=n.timeScale==0?0:(i/n.timeScale+e)*o.timeScale,n.trackTime+=h,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){t[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,e)){let i=n.mixingFrom;for(n.mixingFrom=null,i&&(i.mixingTo=null);i;)this.queue.end(i),i=i.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,r=!1;for(let u=0,d=s.length;u<d;u++){let f=s[u];if(!f||f.delay>0)continue;r=!0;let m=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,m):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let b=x>=f.alphaAttachmentThreshold,w=f.animationLast,g=f.getAnimationTime(),p=g,v=t;f.reverse&&(p=f.animation.duration-p,v=null);let y=f.animation.timelines,S=y.length;if(u==0&&x==1||m==3){u==0&&(b=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(x,m);var n=y[A];n instanceof we?this.applyAttachmentTimeline(n,e,p,m,b):n.apply(e,w,p,v,x,m,0)}}else{let A=f.timelineMode,k=f.shortestRotation,Y=!k&&f.timelinesRotation.length!=S<<1;Y&&(f.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let E=y[M],X=A[M]==Ue?m:0;!k&&E instanceof Xe?this.applyRotateTimeline(E,e,p,x,X,f.timelinesRotation,M<<1,Y):E instanceof we?this.applyAttachmentTimeline(E,e,p,m,b):(R.webkit602BugfixHelper(x,m),E.apply(e,w,p,v,x,X,0))}}this.queueEvents(f,g),t.length=0,f.nextAnimationLast=g,f.nextTrackLast=f.trackTime}for(var h=this.unkeyedState+Vt,o=e.slots,i=0,l=e.slots.length;i<l;i++){var a=o[i];if(a.attachmentState==h){var c=a.data.attachmentName;a.setAttachment(c?e.getAttachment(a.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,t,s){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,t,s);let n=0;e.mixDuration==0?(n=1,s==1&&(s=0)):(n=e.mixTime/e.mixDuration,n>1&&(n=1),s!=1&&(s=r.mixBlend));let h=n<r.mixAttachmentThreshold,o=n<r.mixDrawOrderThreshold,i=r.animation.timelines,l=i.length,a=r.alpha*e.interruptAlpha,c=a*(1-n),u=r.animationLast,d=r.getAnimationTime(),f=d,m=null;if(r.reverse?f=r.animation.duration-f:n<r.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)i[x].apply(t,u,f,m,c,s,1);else{let x=r.timelineMode,b=r.timelineHoldMix,w=r.shortestRotation,g=!w&&r.timelinesRotation.length!=l<<1;g&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let p=0;p<l;p++){let v=i[p],y=1,S,A=0;switch(x[p]){case Ue:if(!o&&v instanceof be)continue;S=s,A=c;break;case Pt:S=0,A=c;break;case Bt:S=s,A=a;break;case ze:S=0,A=a;break;default:S=0;let k=b[p];A=a*Math.max(0,1-k.mixTime/k.mixDuration);break}r.totalAlpha+=A,!w&&v instanceof Xe?this.applyRotateTimeline(v,t,f,A,S,r.timelinesRotation,p<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,f,S,h&&A>=r.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof be&&S==0&&(y=0),v.apply(t,u,f,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(r,d),this.events.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime,n}applyAttachmentTimeline(e,t,s,r,n){var h=t.slots[e.slotIndex];h.bone.active&&(s<e.frames[0]?(r==0||r==1)&&this.setAttachment(t,h,h.data.attachmentName,n):this.setAttachment(t,h,e.attachmentNames[K.search1(e.frames,s)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Vt))}setAttachment(e,t,s,r){t.setAttachment(s?e.getAttachment(t.data.index,s):null),r&&(t.attachmentState=this.unkeyedState+ws)}applyRotateTimeline(e,t,s,r,n,h,o,i){if(i&&(h[o]=0),r==1){e.apply(t,0,s,null,1,n,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let a=e.frames,c=0,u=0;if(s<a[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:c=l.rotation,u=l.data.rotation}else c=n==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(s);let d=0,f=u-c;if(f-=Math.ceil(f/360-.5)*360,f==0)d=h[o];else{let m=0,x=0;i?(m=0,x=f):(m=h[o],x=h[o+1]);let b=m-m%360;d=f+b;let w=f>=0,g=m>=0;Math.abs(x)<=90&&F.signum(x)!=F.signum(f)&&(Math.abs(m-b)>180?(d+=360*F.signum(m),g=w):b!=0?d-=360*F.signum(m):g=w),g!=w&&(d+=360*F.signum(m)),h[o]=d}h[o+1]=f,l.rotation=c+d*r}queueEvents(e,t){let s=e.animationStart,r=e.animationEnd,n=r-s,h=e.trackLast%n,o=this.events,i=0,l=o.length;for(;i<l;i++){let c=o[i];if(c.time<h)break;c.time>r||this.queue.event(e,c)}let a=!1;if(e.loop)if(n==0)a=!0;else{const c=Math.floor(e.trackTime/n);a=c>0&&c>Math.floor(e.trackLast/n)}else a=t>=r&&e.animationLast<r;for(a&&this.queue.complete(e);i<l;i++){let c=o[i];c.time<s||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let r=s.mixingFrom;if(!r)break;this.queue.end(r),s.mixingFrom=null,s.mixingTo=null,s=r}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let r=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,r&&(s&&this.queue.interrupt(r),t.mixingFrom=r,r.mixingTo=t,t.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(t.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,r,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(e);n&&(n.nextTrackLast==-1?(this.tracks[e]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,r=!1):this.clearNext(n));let h=this.trackEntry(e,t,s,n);return this.setCurrent(e,h,r),this.queue.drain(),h}addAnimation(e,t,s=!1,r=0){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,n,s,r)}addAnimationWith(e,t,s=!1,r=0){if(!t)throw new Error("animation cannot be null.");let n=this.expandToIndex(e);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(e,t,s,n);return n?(n.next=h,h.previous=n,r<=0&&(r=Math.max(r+n.getTrackComplete()-h.mixDuration,0))):(this.setCurrent(e,h,!0),this.queue.drain(),r<0&&(r=0)),h.delay=r,h}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,We.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let r=this.addAnimationWith(e,We.emptyAnimation(),!1,s);return s<=0&&(r.delay=Math.max(r.delay+r.mixDuration-t,0)),r.mixDuration=t,r.trackEnd=t,r}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++){let n=this.tracks[s];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,r){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=e,n.animation=t,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=t.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=r?this.data.getMix(r.animation,t):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let r=e[t];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,r=e.animation.timelines.length,n=e.timelineMode;n.length=r;let h=e.timelineHoldMix;h.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let i=0;i<r;i++)n[i]=o.addAll(s[i].getPropertyIds())?ze:Bt;return}e:for(let i=0;i<r;i++){let l=s[i],a=l.getPropertyIds();if(!o.addAll(a))n[i]=Ue;else if(!t||l instanceof we||l instanceof be||l instanceof Fe||!t.animation.hasTimeline(a))n[i]=Pt;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(a)){if(e.mixDuration>0){n[i]=ps,h[i]=c;continue e}break}n[i]=ze}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Rt=We;B(Rt,"_emptyAnimation",new Oe("<empty>",[],0));var gs=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}},xs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(se.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(se.interrupt),this.objects.push(e)}end(e){this.objects.push(se.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(se.dispose),this.objects.push(e)}complete(e){this.objects.push(se.complete),this.objects.push(e)}event(e,t){this.objects.push(se.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let r=e[s],n=e[s+1];switch(r){case se.start:n.listener&&n.listener.start&&n.listener.start(n);for(let o=0;o<t.length;o++){let i=t[o];i.start&&i.start(n)}break;case se.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let o=0;o<t.length;o++){let i=t[o];i.interrupt&&i.interrupt(n)}break;case se.end:n.listener&&n.listener.end&&n.listener.end(n);for(let o=0;o<t.length;o++){let i=t[o];i.end&&i.end(n)}case se.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let o=0;o<t.length;o++){let i=t[o];i.dispose&&i.dispose(n)}this.animState.trackEntryPool.free(n);break;case se.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let o=0;o<t.length;o++){let i=t[o];i.complete&&i.complete(n)}break;case se.event:let h=e[s+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let o=0;o<t.length;o++){let i=t[o];i.event&&i.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},se=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(se||{}),Gs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Ue=0,Pt=1,Bt=2,ze=3,ps=4,Vt=1,ws=2,bs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);this.setMixWith(r,n,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ge=class extends le{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ge(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ee=class extends le{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Ee(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Lt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},He=(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))(He||{}),ys=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ys||{}),vs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Hs=class extends Lt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Nt=class{pages=new Array;regions=new Array;constructor(e){let t=new $s(e),s=new Array(4),r={};r.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},r.format=()=>{},r.filter=a=>{a.minFilter=R.enumValue(He,s[1]),a.magFilter=R.enumValue(He,s[2])},r.repeat=a=>{s[1].indexOf("x")!=-1&&(a.uWrap=10497),s[1].indexOf("y")!=-1&&(a.vWrap=10497)},r.pma=a=>{a.pma=s[1]=="true"};var n={};n.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},n.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},n.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},n.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},n.rotate=a=>{let c=s[1];c=="true"?a.degrees=90:c!="false"&&(a.degrees=parseInt(c))},n.index=a=>{a.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,i=null,l=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let a=new Dt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let u=n[s[0]];if(u)u(a);else{i||(i=[]),l||(l=[]),i.push(s[0]);let d=[];for(let f=0;f<c;f++)d.push(parseInt(s[f+1]));l.push(d)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height),i&&i.length>0&&l&&l.length>0&&(a.names=i,a.values=l,i=null,l=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees==90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new Ss(h.trim());t.readEntry(s,h=t.readLine())!=0;){let a=r[s[0]];a&&a(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(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 r=1,n=s+1;;r++){let h=t.indexOf(",",n);if(h==-1)return e[r]=t.substr(n).trim(),r;if(e[r]=t.substr(n,h-n).trim(),n=h+1,r==4)return 4}}},Ss=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}},Dt=class extends vs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,r=this.region.u,n=this.region.v,h=0,o=0;if(this.region instanceof Dt){let i=this.region,l=i.page,a=l.width,c=l.height;switch(i.degrees){case 90:r-=(i.originalHeight-i.offsetY-i.height)/a,n-=(i.originalWidth-i.offsetX-i.width)/c,h=i.originalHeight/a,o=i.originalWidth/c;for(let u=0;u<s;u+=2)t[u]=r+e[u+1]*h,t[u+1]=n+(1-e[u])*o;return;case 180:r-=(i.originalWidth-i.offsetX-i.width)/a,n-=i.offsetY/c,h=i.originalWidth/a,o=i.originalHeight/c;for(let u=0;u<s;u+=2)t[u]=r+(1-e[u])*h,t[u+1]=n+(1-e[u+1])*o;return;case 270:r-=i.offsetY/a,n-=i.offsetX/c,h=i.originalHeight/a,o=i.originalWidth/c;for(let u=0;u<s;u+=2)t[u]=r+(1-e[u+1])*h,t[u+1]=n+e[u]*o;return}r-=i.offsetX/a,n-=(i.originalHeight-i.offsetY-i.height)/c,h=i.originalWidth/a,o=i.originalHeight/c}else this.region?(h=this.region.u2-r,o=this.region.v2-n):(r=n=0,h=o=1);for(let i=0;i<s;i+=2)t[i]=r+e[i]*h,t[i+1]=n+e[i+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,r,n,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,r,n,h)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ie=class extends le{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ie(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ot=class extends le{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*F.degRad,s=Math.cos(t),r=Math.sin(t),n=s*e.a+r*e.b,h=s*e.c+r*e.d;return F.atan2Deg(h,n)}copy(){let e=new Ot(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},As=class extends it{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*r,o=n+this.region.width*s,i=h+this.region.height*r,l=this.rotation*F.degRad,a=Math.cos(l),c=Math.sin(l),u=this.x,d=this.y,f=n*a+u,m=n*c,x=h*a+d,b=h*c,w=o*a+u,g=o*c,p=i*a+d,v=i*c,y=this.offset;y[0]=f-b,y[1]=x+m,y[2]=f-v,y[3]=p+m,y[4]=w-v,y[5]=p+g,y[6]=w-b,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,r){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,h=this.offset,o=n.worldX,i=n.worldY,l=n.a,a=n.b,c=n.c,u=n.d,d=0,f=0;d=h[0],f=h[1],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i,s+=r,d=h[2],f=h[3],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i,s+=r,d=h[4],f=h[5],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i,s+=r,d=h[6],f=h[7],t[s]=d*l+f*a+o,t[s+1]=d*c+f*u+i}copy(){let e=new As(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},U=As;B(U,"X1",0),B(U,"Y1",1),B(U,"C1R",2),B(U,"C1G",3),B(U,"C1B",4),B(U,"C1A",5),B(U,"U1",6),B(U,"V1",7),B(U,"X2",8),B(U,"Y2",9),B(U,"C2R",10),B(U,"C2G",11),B(U,"C2B",12),B(U,"C2A",13),B(U,"U2",14),B(U,"V2",15),B(U,"X3",16),B(U,"Y3",17),B(U,"C3R",18),B(U,"C3G",19),B(U,"C3B",20),B(U,"C3A",21),B(U,"U3",22),B(U,"V3",23),B(U,"X4",24),B(U,"Y4",25),B(U,"C4R",26),B(U,"C4G",27),B(U,"C4B",28),B(U,"C4A",29),B(U,"U4",30),B(U,"V4",31);var Is=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let n=0,h=r.length;n<h;n++){let o=s.getPath(t,n),i=this.atlas.findRegion(o);if(i==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[n]=i}}newRegionAttachment(e,t,s,r){let n=new U(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");n.region=h}return n}newMeshAttachment(e,t,s,r){let n=new ye(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");n.region=h}return n}newBoundingBoxAttachment(e,t){return new Ge(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new Ot(t)}newClippingAttachment(e,t){return new Ee(t)}},qt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Re.Normal;skinRequired=!1;color=new D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Re=(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))(Re||{}),_t=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,r,n,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=h,this.ashearY=o;let i=this.parent;if(!i){let d=this.skeleton;const f=d.scaleX,m=d.scaleY,x=(s+h)*F.degRad,b=(s+90+o)*F.degRad;this.a=Math.cos(x)*r*f,this.b=Math.cos(b)*n*f,this.c=Math.sin(x)*r*m,this.d=Math.sin(b)*n*m,this.worldX=e*f+d.x,this.worldY=t*m+d.y;return}let l=i.a,a=i.b,c=i.c,u=i.d;switch(this.worldX=l*e+a*t+i.worldX,this.worldY=c*e+u*t+i.worldY,this.inherit){case 0:{const d=(s+h)*F.degRad,f=(s+90+o)*F.degRad,m=Math.cos(d)*r,x=Math.cos(f)*n,b=Math.sin(d)*r,w=Math.sin(f)*n;this.a=l*m+a*b,this.b=l*x+a*w,this.c=c*m+u*b,this.d=c*x+u*w;return}case 1:{const d=(s+h)*F.degRad,f=(s+90+o)*F.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(f)*n,this.c=Math.sin(d)*r,this.d=Math.sin(f)*n;break}case 2:{let d=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;l*=d,c*=f;let m=l*l+c*c,x=0;m>1e-4?(m=Math.abs(l*u*f-a*d*c)/m,a=c*m,u=l*m,x=Math.atan2(c,l)*F.radDeg):(l=0,c=0,x=90-Math.atan2(u,a)*F.radDeg);const b=(s+h-x)*F.degRad,w=(s+o-x+90)*F.degRad,g=Math.cos(b)*r,p=Math.cos(w)*n,v=Math.sin(b)*r,y=Math.sin(w)*n;this.a=l*g-a*v,this.b=l*p-a*y,this.c=c*g+u*v,this.d=c*p+u*y;break}case 3:case 4:{s*=F.degRad;const d=Math.cos(s),f=Math.sin(s);let m=(l*d+a*f)/this.skeleton.scaleX,x=(c*d+u*f)/this.skeleton.scaleY,b=Math.sqrt(m*m+x*x);b>1e-5&&(b=1/b),m*=b,x*=b,b=Math.sqrt(m*m+x*x),this.inherit==3&&l*u-a*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*b,g=Math.sin(s)*b;h*=F.degRad,o=(90+o)*F.degRad;const p=Math.cos(h)*r,v=Math.cos(o)*n,y=Math.sin(h)*r,S=Math.sin(o)*n;this.a=m*p+w*y,this.b=m*v+w*S,this.c=x*p+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*F.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)*F.radDeg;return}let t=e.a,s=e.b,r=e.c,n=e.d,h=1/(t*n-s*r),o=n*h,i=s*h,l=r*h,a=t*h,c=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=c*o-u*i,this.ay=u*a-c*l;let d,f,m,x;if(this.inherit==1)d=this.a,f=this.b,m=this.c,x=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*n-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*v/this.skeleton.scaleY,n=t*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(t*n-s*r),o=n*h,i=s*h;break}case 3:case 4:let b=F.cosDeg(this.rotation),w=F.sinDeg(this.rotation);t=(t*b+s*w)/this.skeleton.scaleX,r=(r*b+n*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let p=F.PI/2+Math.atan2(r,t);s=Math.cos(p)*g,n=Math.sin(p)*g,h=1/(t*n-s*r),o=n*h,i=s*h,l=r*h,a=t*h}d=o*this.a-i*this.c,f=o*this.b-i*this.d,m=a*this.c-l*this.a,x=a*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let b=d*x-f*m;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*f+m*x,b)*F.radDeg,this.arotation=Math.atan2(m,d)*F.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,f)*F.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*F.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*F.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,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*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=F.sinDeg(e),s=F.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*F.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=F.sinDeg(e),s=F.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*F.radDeg}rotateWorld(e){e*=F.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,n=this.b;this.a=s*r-t*this.c,this.b=s*n-t*this.d,this.c=t*r+s*this.c,this.d=t*n+s*this.d}},Pe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},js=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Cs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load binary ${e}: status ${r}, ${n}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${n}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${r}, ${n}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let n=e.lastIndexOf("/"),h=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let i=new Nt(o),l=i.pages.length,a=!1;for(let c of i.pages)this.loadTexture(r?r[c.name]:h+c.name,(u,d)=>{a||(c.setTexture(d),--l==0&&this.success(t,e,i))},(u,d)=>{a||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${u}`),a=!0})}catch(i){this.error(s,e,`Couldn't parse texture atlas ${e}: ${i.message}`)}},(o,i)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${i}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
2
  `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Cs=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,r=new Uint8Array(s),n=0;n<s;n++)r[n]=t.charCodeAt(n);return r}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",e,!0);let n=()=>{this.finish(e,r.status,r.responseText)};r.onload=n,r.onerror=n,r.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer";let n=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):n()},r.onerror=n,r.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let n=t==200||t==0?[s]:[t,s];for(let h=n.length-1,o=r.length;h<o;h+=2)r[h].apply(null,n)}},Wt=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}},Ut=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ks=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 r=0;r<e.bones.length;r++){let n=t.findBone(e.bones[r].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(n)}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,r,n,h,o){let i=e.parent;if(!i)throw new Error("IK bone must have parent.");let l=i.a,a=i.b,c=i.c,u=i.d,d=-e.ashearX-e.arotation,f=0,m=0;switch(e.inherit){case 1:f=(t-e.worldX)*F.signum(e.skeleton.scaleX),m=(s-e.worldY)*F.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(l*u-a*c)/Math.max(1e-4,l*l+c*c),g=l/e.skeleton.scaleX,p=c/e.skeleton.scaleY;a=-p*w*e.skeleton.scaleX,u=g*w*e.skeleton.scaleY,d+=Math.atan2(p,g)*F.radDeg;default:let v=t-i.worldX,y=s-i.worldY,S=l*u-a*c;Math.abs(S)<=1e-4?(f=0,m=0):(f=(v*u-y*a)/S-e.ax,m=(y*l-v*c)/S-e.ay)}d+=Math.atan2(m,f)*F.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,b=e.ascaleY;if(r||n){switch(e.inherit){case 3:case 4:f=t-e.worldX,m=s-e.worldY}const w=e.data.length*x;if(w>1e-4){const g=f*f+m*m;if(r&&g<w*w||n&&g>w*w){const p=(Math.sqrt(g)/w-1)*o+1;x*=p,h&&(b*=p)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,x,b,e.ashearX,e.ashearY)}apply2(e,t,s,r,n,h,o,i,l){if(e.inherit!=0||t.inherit!=0)return;let a=e.ax,c=e.ay,u=e.ascaleX,d=e.ascaleY,f=u,m=d,x=t.ascaleX,b=0,w=0,g=0;u<0?(u=-u,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),x<0?(x=-x,w=180):w=0;let p=t.ax,v=0,y=0,S=0,A=e.a,k=e.b,Y=e.c,M=e.d,E=Math.abs(u-d)<=1e-4;!E||h?(v=0,y=A*p+e.worldX,S=Y*p+e.worldY):(v=t.ay,y=A*p+k*v+e.worldX,S=Y*p+M*v+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,k=X.b,Y=X.c,M=X.d;let C=A*M-k*Y,T=y-X.worldX,P=S-X.worldY;C=Math.abs(C)<=1e-4?0:1/C;let N=(T*M-P*k)*C-a,q=(P*A-T*Y)*C-c,L=Math.sqrt(N*N+q*q),G=t.data.length*x,$,j;if(L<1e-4){this.apply1(e,s,r,!1,h,!1,l),t.updateWorldTransformWith(p,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}T=s-X.worldX,P=r-X.worldY;let V=(T*M-P*k)*C-a,_=(P*A-T*Y)*C-c,W=V*V+_*_;if(i!=0){i*=u*(x+1)*.5;let J=Math.sqrt(W),Q=J-L-G*u+i;if(Q>0){let Z=Math.min(1,Q/(i*2))-1;Z=(Q-i*(1-Z*Z))/J,V-=Z*V,_-=Z*_,W=V*V+_*_}}e:if(E){G*=u;let J=(W-L*L-G*G)/(2*L*G);J<-1?(J=-1,j=Math.PI*n):J>1?(J=1,j=0,h&&(A=(Math.sqrt(W)/(L+G)-1)*l+1,f*=A,o&&(m*=A))):j=Math.acos(J)*n,A=L+G*J,k=G*Math.sin(j),$=Math.atan2(_*A-V*k,V*A+_*k)}else{A=u*G,k=d*G;let J=A*A,Q=k*k,Z=Math.atan2(_,V);Y=Q*L*L+J*W-J*Q;let fe=-2*Q*L,Me=Q-J;if(M=fe*fe-4*Me*Y,M>=0){let ve=Math.sqrt(M);fe<0&&(ve=-ve),ve=-(fe+ve)*.5;let Ye=ve/Me,rs=Y/ve,Le=Math.abs(Ye)<Math.abs(rs)?Ye:rs;if(Ye=W-Le*Le,Ye>=0){P=Math.sqrt(Ye)*n,$=Z-Math.atan2(P,Le),j=Math.atan2(P/d,(Le-L)/u);break e}}let es=F.PI,Be=L-A,et=Be*Be,ts=0,ss=0,Ve=L+A,tt=Ve*Ve,is=0;Y=-A*L/(J-Q),Y>=-1&&Y<=1&&(Y=Math.acos(Y),T=A*Math.cos(Y)+L,P=k*Math.sin(Y),M=T*T+P*P,M<et&&(es=Y,et=M,Be=T,ts=P),M>tt&&(ss=Y,tt=M,Ve=T,is=P)),W<=(et+tt)*.5?($=Z-Math.atan2(ts*n,Be),j=es*n):($=Z-Math.atan2(is*n,Ve),j=ss*n)}let re=Math.atan2(v,p)*g,te=e.arotation;$=($-re)*F.radDeg+b-te,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(a,c,te+$*l,f,m,0,0),te=t.arotation,j=((j+re)*F.radDeg-t.ashearX)*g+w-te,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(p,v,te+j*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},zt=class extends Pe{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)}},Gt=class extends Pe{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=$e.Fixed;spacingMode=je.Fixed;rotateMode=Ke.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},$e=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))($e||{}),je=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(je||{}),Ke=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Ke||{}),ge=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,n=e.bones.length;r<n;r++){let h=t.findBone(e.bones[r].name);if(!h)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(h)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ie))return;let s=this.mixRotate,r=this.mixX,n=this.mixY;if(s==0&&r==0&&n==0)return;let h=this.data,o=h.rotateMode==0,i=h.rotateMode==2,l=this.bones,a=l.length,c=o?a:a+1,u=R.setArraySize(this.spaces,c),d=i?this.lengths=R.setArraySize(this.lengths,a):[],f=this.spacing;switch(h.spacingMode){case 2:if(i)for(let y=0,S=c-1;y<S;y++){let A=l[y],k=A.data.length,Y=k*A.a,M=k*A.c;d[y]=Math.sqrt(Y*Y+M*M)}R.arrayFill(u,1,c,f);break;case 3:let p=0;for(let y=0,S=c-1;y<S;){let A=l[y],k=A.data.length;if(k<ge.epsilon)i&&(d[y]=0),u[++y]=f;else{let Y=k*A.a,M=k*A.c,E=Math.sqrt(Y*Y+M*M);i&&(d[y]=E),u[++y]=E,p+=E}}if(p>0){p=c/p*f;for(let y=1;y<c;y++)u[y]*=p}break;default:let v=h.spacingMode==0;for(let y=0,S=c-1;y<S;){let A=l[y],k=A.data.length;if(k<ge.epsilon)i&&(d[y]=0),u[++y]=f;else{let Y=k*A.a,M=k*A.c,E=Math.sqrt(Y*Y+M*M);i&&(d[y]=E),u[++y]=(v?k+f:f)*E/k}}}let m=this.computeWorldPositions(t,c,o),x=m[0],b=m[1],w=h.offsetRotation,g=!1;if(w==0)g=h.rotateMode==1;else{g=!1;let p=this.target.bone;w*=p.a*p.d-p.b*p.c>0?F.degRad:-F.degRad}for(let p=0,v=3;p<a;p++,v+=3){let y=l[p];y.worldX+=(x-y.worldX)*r,y.worldY+=(b-y.worldY)*n;let S=m[v],A=m[v+1],k=S-x,Y=A-b;if(i){let M=d[p];if(M!=0){let E=(Math.sqrt(k*k+Y*Y)/M-1)*s+1;y.a*=E,y.c*=E}}if(x=S,b=A,s>0){let M=y.a,E=y.b,X=y.c,C=y.d,T=0,P=0,N=0;if(o?T=m[v-1]:u[p+1]==0?T=m[v+2]:T=Math.atan2(Y,k),T-=Math.atan2(X,M),g){P=Math.cos(T),N=Math.sin(T);let q=y.data.length;x+=(q*(P*M-N*X)-k)*s,b+=(q*(N*M+P*X)-Y)*s}else T+=w;T>F.PI?T-=F.PI2:T<-F.PI&&(T+=F.PI2),T*=s,P=Math.cos(T),N=Math.sin(T),y.a=P*M-N*X,y.b=P*E-N*C,y.c=N*M+P*X,y.d=N*E+P*C}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let r=this.target,n=this.position,h=this.spaces,o=R.setArraySize(this.positions,t*3+2),i=this.world,l=e.closed,a=e.worldVerticesLength,c=a/6,u=ge.NONE;if(!e.constantSpeed){let q=e.lengths;c-=l?1:2;let L=q[c];this.data.positionMode==1&&(n*=L);let G;switch(this.data.spacingMode){case 2:G=L;break;case 3:G=L/t;break;default:G=1}i=R.setArraySize(this.world,8);for(let $=0,j=0,V=0;$<t;$++,j+=3){let _=h[$]*G;n+=_;let W=n;if(l)W%=L,W<0&&(W+=L),V=0;else if(W<0){u!=ge.BEFORE&&(u=ge.BEFORE,e.computeWorldVertices(r,2,4,i,0,2)),this.addBeforePosition(W,i,0,o,j);continue}else if(W>L){u!=ge.AFTER&&(u=ge.AFTER,e.computeWorldVertices(r,a-6,4,i,0,2)),this.addAfterPosition(W-L,i,0,o,j);continue}for(;;V++){let re=q[V];if(!(W>re)){if(V==0)W/=re;else{let te=q[V-1];W=(W-te)/(re-te)}break}}V!=u&&(u=V,l&&V==c?(e.computeWorldVertices(r,a-4,4,i,0,2),e.computeWorldVertices(r,0,4,i,4,2)):e.computeWorldVertices(r,V*6+2,8,i,0,2)),this.addCurvePosition(W,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],o,j,s||$>0&&_==0)}return o}l?(a+=2,i=R.setArraySize(this.world,a),e.computeWorldVertices(r,2,a-4,i,0,2),e.computeWorldVertices(r,0,2,i,a-4,2),i[a-2]=i[0],i[a-1]=i[1]):(c--,a-=4,i=R.setArraySize(this.world,a),e.computeWorldVertices(r,2,a,i,0,2));let d=R.setArraySize(this.curves,c),f=0,m=i[0],x=i[1],b=0,w=0,g=0,p=0,v=0,y=0,S=0,A=0,k=0,Y=0,M=0,E=0,X=0,C=0;for(let q=0,L=2;q<c;q++,L+=6)b=i[L],w=i[L+1],g=i[L+2],p=i[L+3],v=i[L+4],y=i[L+5],S=(m-b*2+g)*.1875,A=(x-w*2+p)*.1875,k=((b-g)*3-m+v)*.09375,Y=((w-p)*3-x+y)*.09375,M=S*2+k,E=A*2+Y,X=(b-m)*.75+S+k*.16666667,C=(w-x)*.75+A+Y*.16666667,f+=Math.sqrt(X*X+C*C),X+=M,C+=E,M+=k,E+=Y,f+=Math.sqrt(X*X+C*C),X+=M,C+=E,f+=Math.sqrt(X*X+C*C),X+=M+k,C+=E+Y,f+=Math.sqrt(X*X+C*C),d[q]=f,m=v,x=y;this.data.positionMode==1&&(n*=f);let T;switch(this.data.spacingMode){case 2:T=f;break;case 3:T=f/t;break;default:T=1}let P=this.segments,N=0;for(let q=0,L=0,G=0,$=0;q<t;q++,L+=3){let j=h[q]*T;n+=j;let V=n;if(l)V%=f,V<0&&(V+=f),G=0;else if(V<0){this.addBeforePosition(V,i,0,o,L);continue}else if(V>f){this.addAfterPosition(V-f,i,a-4,o,L);continue}for(;;G++){let _=d[G];if(!(V>_)){if(G==0)V/=_;else{let W=d[G-1];V=(V-W)/(_-W)}break}}if(G!=u){u=G;let _=G*6;for(m=i[_],x=i[_+1],b=i[_+2],w=i[_+3],g=i[_+4],p=i[_+5],v=i[_+6],y=i[_+7],S=(m-b*2+g)*.03,A=(x-w*2+p)*.03,k=((b-g)*3-m+v)*.006,Y=((w-p)*3-x+y)*.006,M=S*2+k,E=A*2+Y,X=(b-m)*.3+S+k*.16666667,C=(w-x)*.3+A+Y*.16666667,N=Math.sqrt(X*X+C*C),P[0]=N,_=1;_<8;_++)X+=M,C+=E,M+=k,E+=Y,N+=Math.sqrt(X*X+C*C),P[_]=N;X+=M,C+=E,N+=Math.sqrt(X*X+C*C),P[8]=N,X+=M+k,C+=E+Y,N+=Math.sqrt(X*X+C*C),P[9]=N,$=0}for(V*=N;;$++){let _=P[$];if(!(V>_)){if($==0)V/=_;else{let W=P[$-1];V=$+(V-W)/(_-W)}break}}this.addCurvePosition(V*.1,m,x,b,w,g,p,v,y,o,L,s||q>0&&j==0)}return o}addBeforePosition(e,t,s,r,n){let h=t[s],o=t[s+1],i=t[s+2]-h,l=t[s+3]-o,a=Math.atan2(l,i);r[n]=h+e*Math.cos(a),r[n+1]=o+e*Math.sin(a),r[n+2]=a}addAfterPosition(e,t,s,r,n){let h=t[s+2],o=t[s+3],i=h-t[s],l=o-t[s+1],a=Math.atan2(l,i);r[n]=h+e*Math.cos(a),r[n+1]=o+e*Math.sin(a),r[n+2]=a}addCurvePosition(e,t,s,r,n,h,o,i,l,a,c,u){if(e==0||isNaN(e)){a[c]=t,a[c+1]=s,a[c+2]=Math.atan2(n-s,r-t);return}let d=e*e,f=d*e,m=1-e,x=m*m,b=x*m,w=m*e,g=w*3,p=m*g,v=g*e,y=t*b+r*p+h*v+i*f,S=s*b+n*p+o*v+l*f;a[c]=y,a[c+1]=S,u&&(e<.001?a[c+2]=Math.atan2(n-s,r-t):a[c+2]=Math.atan2(S-(s*x+n*w*2+o*d),y-(t*x+r*w*2+h*d)))}},Ce=ge;B(Ce,"NONE",-1),B(Ce,"BEFORE",-2),B(Ce,"AFTER",-3),B(Ce,"epsilon",1e-5);var Ks=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,r=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,i=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const l=this.skeleton,a=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=a,this.lastTime=l.time;const c=o.worldX,u=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=u;else{let d=this.remaining,f=this.inertia,m=this.data.step,x=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*a,g=w*Math.abs(l.scaleY);if(w*=Math.abs(l.scaleX),s||r){if(s){const p=(this.ux-c)*f;this.xOffset+=p>w?w:p<-w?-w:p,this.ux=c}if(r){const p=(this.uy-u)*f;this.yOffset+=p>g?g:p<-g?-g:p,this.uy=u}if(d>=m){b=Math.pow(this.damping,60*m);const p=this.massInverse*m,v=this.strength,y=this.wind*x*l.scaleX,S=this.gravity*x*l.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*p,this.xOffset+=this.xVelocity*m,this.xVelocity*=b),r&&(this.yVelocity-=(S+this.yOffset*v)*p,this.yOffset+=this.yVelocity*m,this.yVelocity*=b),d-=m;while(d>=m)}s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(n||h){let p=Math.atan2(o.c,o.a),v=0,y=0,S=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),n){S=(this.data.rotate+this.data.shearX)*t;let Y=Math.atan2(k+this.ty,A+this.tx)-p-this.rotateOffset*S;this.rotateOffset+=(Y-Math.ceil(Y*F.invPI2-.5)*F.PI2)*f,Y=this.rotateOffset*S+p,v=Math.cos(Y),y=Math.sin(Y),h&&(Y=i*o.getWorldScaleX(),Y>0&&(this.scaleOffset+=(A*v+k*y)*f/Y))}else{v=Math.cos(p),y=Math.sin(p);const Y=i*o.getWorldScaleX();Y>0&&(this.scaleOffset+=(A*v+k*y)*f/Y)}if(d=this.remaining,d>=m){b==-1&&(b=Math.pow(this.damping,60*m));const Y=this.massInverse*m,M=this.strength,E=this.wind,X=ke.yDown?-this.gravity:this.gravity,C=i/x;for(;;)if(d-=m,h&&(this.scaleVelocity+=(E*v-X*y-this.scaleOffset*M)*Y,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=b),n){if(this.rotateVelocity-=((E*y+X*v)*C+this.rotateOffset*M)*Y,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=b,d<m)break;const T=this.rotateOffset*S+p;v=Math.cos(T),y=Math.sin(T)}else if(d<m)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(n){let l=this.rotateOffset*t,a=0,c=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,a=Math.sin(d),c=Math.cos(d),u=o.b,o.b=c*u-a*o.d,o.d=a*u+c*o.d),d+=l*this.data.shearX,a=Math.sin(d),c=Math.cos(d),u=o.a,o.a=c*u-a*o.c,o.c=a*u+c*o.c}else l*=this.data.rotate,a=Math.sin(l),c=Math.cos(l),u=o.a,o.a=c*u-a*o.c,o.c=a*u+c*o.c,u=o.b,o.b=c*u-a*o.d,o.d=a*u+c*o.d}if(h){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=i*o.a,this.ty=i*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*F.degRad,n=Math.cos(r),h=Math.sin(r),o=this.cx-e,i=this.cy-t;this.translate(o*n-i*h-o,o*h+i*n-i)}},Ms=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof le)||!(this.attachment instanceof le)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ne;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 r=0;r<e.bones.length;r++){let n=t.findBone(e.bones[r].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(n)}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,r=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,i=this.target,l=i.a,a=i.b,c=i.c,u=i.d,d=l*u-a*c>0?F.degRad:-F.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let b=0,w=x.length;b<w;b++){let g=x[b];if(e!=0){let p=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(c,l)-Math.atan2(y,p)+f;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let k=Math.cos(A),Y=Math.sin(A);g.a=k*p-Y*y,g.b=k*v-Y*S,g.c=Y*p+k*y,g.d=Y*v+k*S}if(o){let p=this.temp;i.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(p.x-g.worldX)*t,g.worldY+=(p.y-g.worldY)*s}if(r!=0){let p=Math.sqrt(g.a*g.a+g.c*g.c);p!=0&&(p=(p+(Math.sqrt(l*l+c*c)-p+this.data.offsetScaleX)*r)/p),g.a*=p,g.c*=p}if(n!=0){let p=Math.sqrt(g.b*g.b+g.d*g.d);p!=0&&(p=(p+(Math.sqrt(a*a+u*u)-p+this.data.offsetScaleY)*n)/p),g.b*=p,g.d*=p}if(h>0){let p=g.b,v=g.d,y=Math.atan2(v,p),S=Math.atan2(u,a)-Math.atan2(c,l)-(y-Math.atan2(g.c,g.a));S>F.PI?S-=F.PI2:S<-F.PI&&(S+=F.PI2),S=y+(S+m)*h;let A=Math.sqrt(p*p+v*v);g.b=Math.cos(S)*A,g.d=Math.sin(S)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,i=this.target,l=i.a,a=i.b,c=i.c,u=i.d,d=l*u-a*c>0?F.degRad:-F.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let b=0,w=x.length;b<w;b++){let g=x[b];if(e!=0){let p=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(c,l)+f;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let k=Math.cos(A),Y=Math.sin(A);g.a=k*p-Y*y,g.b=k*v-Y*S,g.c=Y*p+k*y,g.d=Y*v+k*S}if(o){let p=this.temp;i.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),g.worldX+=p.x*t,g.worldY+=p.y*s}if(r!=0){let p=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=p,g.c*=p}if(n!=0){let p=(Math.sqrt(a*a+u*u)-1+this.data.offsetScaleY)*n+1;g.b*=p,g.d*=p}if(h>0){let p=Math.atan2(u,a)-Math.atan2(c,l);p>F.PI?p-=F.PI2:p<-F.PI&&(p+=F.PI2);let v=g.b,y=g.d;p=Math.atan2(y,v)+(p-F.PI/2+m)*h;let S=Math.sqrt(v*v+y*y);g.b=Math.cos(p)*S,g.d=Math.sin(p)*S}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,o=this.target,i=this.bones;for(let l=0,a=i.length;l<a;l++){let c=i[l],u=c.arotation;e!=0&&(u+=(o.arotation-u+this.data.offsetRotation)*e);let d=c.ax,f=c.ay;d+=(o.ax-d+this.data.offsetX)*t,f+=(o.ay-f+this.data.offsetY)*s;let m=c.ascaleX,x=c.ascaleY;r!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*r)/m),n!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*n)/x);let b=c.ashearY;h!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,f,u,m,x,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,o=this.target,i=this.bones;for(let l=0,a=i.length;l<a;l++){let c=i[l],u=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,f=c.ay+(o.ay+this.data.offsetY)*s,m=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),x=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*n+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,f,u,m,x,c.ashearX,b)}}},Ht=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ht.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],r;if(!s.parent)r=new _t(s,this,null);else{let n=this.bones[s.parent.index];r=new _t(s,this,n),n.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],r=this.bones[s.boneData.index],n=new Ms(s,r);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new ks(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new Ys(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ce(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new Ks(s,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let u=0,d=t.length;u<d;u++){let f=t[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let d=0,f=this.skin.bones.length;d<f;d++){let m=this.bones[u[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,r=this.transformConstraints,n=this.pathConstraints,h=this.physicsConstraints,o=s.length,i=r.length,l=n.length,a=this.physicsConstraints.length,c=o+i+l+a;e:for(let u=0;u<c;u++){for(let d=0;d<o;d++){let f=s[d];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let d=0;d<i;d++){let f=r[d];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let d=0;d<l;d++){let f=n[d];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let d=0;d<a;d++){const f=h[d];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,d=t.length;u<d;u++)this.sortBone(t[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,r=s[0];if(this.sortBone(r),s.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let n=s[s.length-1];this.sortBone(n),this._updateCache.push(e),this.sortReset(r.children),n.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,r=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let i=0,l=this.data.skins.length;i<l;i++)this.sortPathConstraintAttachment(this.data.skins[i],s,r);let n=t.getAttachment();n instanceof Ie&&this.sortPathConstraintAttachmentWith(n,r);let h=e.bones,o=h.length;for(let i=0;i<o;i++)this.sortBone(h[i]);this._updateCache.push(e);for(let i=0;i<o;i++)this.sortReset(h[i].children);for(let i=0;i<o;i++)h[i].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let r=0;r<s;r++){let n=t[r];this.sortBone(n.parent),this.sortBone(n)}else for(let r=0;r<s;r++)this.sortBone(t[r]);this._updateCache.push(e);for(let r=0;r<s;r++)this.sortReset(t[r].children);for(let r=0;r<s;r++)t[r].sorted=!0}sortPathConstraintAttachment(e,t,s){let r=e.attachments[t];if(r)for(let n in r)this.sortPathConstraintAttachmentWith(r[n],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ie))return;let s=e.bones;if(!s)this.sortBone(t);else{let r=this.bones;for(let n=0,h=s.length;n<h;){let o=s[n++];for(o+=n;n<o;)this.sortBone(r[s[n++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let r=e[t];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let r=0,n=t.length;r<n;r++){let h=t[r];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let s=this._updateCache;for(let r=0,n=s.length;r<n;r++)s[r].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let s=this.bones;for(let x=1,b=s.length;x<b;x++){let w=s[x];w.ax=w.x,w.ay=w.y,w.arotation=w.rotation,w.ascaleX=w.scaleX,w.ascaleY=w.scaleY,w.ashearX=w.shearX,w.ashearY=w.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let n=t.a,h=t.b,o=t.c,i=t.d;r.worldX=n*this.x+h*this.y+t.worldX,r.worldY=o*this.x+i*this.y+t.worldY;const l=(r.rotation+r.shearX)*F.degRad,a=(r.rotation+90+r.shearY)*F.degRad,c=Math.cos(l)*r.scaleX,u=Math.cos(a)*r.scaleY,d=Math.sin(l)*r.scaleX,f=Math.sin(a)*r.scaleY;r.a=(n*c+h*d)*this.scaleX,r.b=(n*u+h*f)*this.scaleX,r.c=(o*c+i*d)*this.scaleY,r.d=(o*u+i*f)*this.scaleY;let m=this._updateCache;for(let x=0,b=m.length;x<b;x++){let w=m[x];w!=r&&w.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.data.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.data.name==e)return n}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,r=t.length;s<r;s++){let n=t[s],h=n.data.attachmentName;if(h){let o=e.getAttachment(s,h);o&&n.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,n=s.length;r<n;r++){let h=s[r];if(h.data.name==e){let o=null;if(t&&(o=this.getAttachment(r,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);h.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new Ne,s=new Ne;return this.getBounds(t,s,void 0,e),{x:t.x,y:t.y,width:s.x,height:s.y}}getBounds(e,t,s=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let n=this.drawOrder,h=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let a=0,c=n.length;a<c;a++){let u=n[a];if(!u.bone.active)continue;let d=0,f=null,m=null,x=u.getAttachment();if(x instanceof U)d=8,f=R.setArraySize(s,d,0),x.computeWorldVertices(u,f,0,2),m=Ht.quadTriangles;else if(x instanceof ye){let b=x;d=b.worldVerticesLength,f=R.setArraySize(s,d,0),b.computeWorldVertices(u,0,d,f,0,2),m=b.triangles}else if(x instanceof Ee&&r!=null){r.clipStart(u,x);continue}if(f&&m){r!=null&&r.isClipping()&&(r.clipTriangles(f,m,m.length),f=r.clippedVertices,d=r.clippedVertices.length);for(let b=0,w=f.length;b<w;b+=2){let g=f[b],p=f[b+1];h=Math.min(h,g),o=Math.min(o,p),i=Math.max(i,g),l=Math.max(l,p)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(h,o),t.set(i-h,l-o)}update(e){this.time+=e}physicsTranslate(e,t){const s=this.physicsConstraints;for(let r=0,n=s.length;r<n;r++)s[r].translate(e,t)}physicsRotate(e,t,s){const r=this.physicsConstraints;for(let n=0,h=r.length;n<h;n++)r[n].rotate(e,t,s)}},ke=Ht;B(ke,"quadTriangles",[0,1,2,2,3,0]),B(ke,"yDown",!1);var Ts=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Ts||{}),Xs=class extends Pe{_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)}},$t=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,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}},jt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Je=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 r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let n=e.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==n){h=!0;break}h||this.bones.push(n)}for(let r=0;r<e.constraints.length;r++){let n=e.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==n){h=!0;break}h||this.constraints.push(n)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let n=e.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==n){h=!0;break}h||this.bones.push(n)}for(let r=0;r<e.constraints.length;r++){let n=e.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==n){h=!0;break}h||this.constraints.push(n)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof ye?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let r in s){let n=s[r];n&&e.push(new jt(t,r,n))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let n=s[r];n&&t.push(new jt(e,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let n=e.slots[r],h=n.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let i in o){let l=o[i];if(h==l){let a=this.getAttachment(s,i);a&&n.setAttachment(a);break}}}s++}}},Kt=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Qe.Normal;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Qe=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Qe||{}),Jt=class extends Pe{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)}},Fs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new $t;s.name="";let r=new Es(e),n=r.readInt32(),h=r.readInt32();s.hash=h==0&&n==0?null:h.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let i=0;i=r.readInt(!0);for(let a=0;a<i;a++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}i=r.readInt(!0);for(let a=0;a<i;a++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let u=a==0?null:s.bones[r.readInt(!0)],d=new qt(a,c,u);d.rotation=r.readFloat(),d.x=r.readFloat()*t,d.y=r.readFloat()*t,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*t,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),o&&(D.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}i=r.readInt(!0);for(let a=0;a<i;a++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let u=s.bones[r.readInt(!0)],d=new Kt(a,c,u);D.rgba8888ToColor(d.color,r.readInt32());let f=r.readInt32();f!=-1&&D.rgb888ToColor(d.darkColor=new D,f),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),o&&(d.visible=r.readBoolean()),s.slots.push(d)}i=r.readInt(!0);for(let a=0,c;a<i;a++){let u=r.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new zt(u);d.order=r.readInt(!0),c=r.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let f=r.readByte();d.skinRequired=(f&1)!=0,d.bendDirection=f&2?1:-1,d.compress=(f&4)!=0,d.stretch=(f&8)!=0,d.uniform=(f&16)!=0,f&32&&(d.mix=f&64?r.readFloat():1),f&128&&(d.softness=r.readFloat()*t),s.ikConstraints.push(d)}i=r.readInt(!0);for(let a=0,c;a<i;a++){let u=r.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new Jt(u);d.order=r.readInt(!0),c=r.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let f=r.readByte();d.skinRequired=(f&1)!=0,d.local=(f&2)!=0,d.relative=(f&4)!=0,f&8&&(d.offsetRotation=r.readFloat()),f&16&&(d.offsetX=r.readFloat()*t),f&32&&(d.offsetY=r.readFloat()*t),f&64&&(d.offsetScaleX=r.readFloat()),f&128&&(d.offsetScaleY=r.readFloat()),f=r.readByte(),f&1&&(d.offsetShearY=r.readFloat()),f&2&&(d.mixRotate=r.readFloat()),f&4&&(d.mixX=r.readFloat()),f&8&&(d.mixY=r.readFloat()),f&16&&(d.mixScaleX=r.readFloat()),f&32&&(d.mixScaleY=r.readFloat()),f&64&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}i=r.readInt(!0);for(let a=0,c;a<i;a++){let u=r.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new Gt(u);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const f=r.readByte();d.positionMode=f&1,d.spacingMode=f>>1&3,d.rotateMode=f>>3&3,f&128&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}i=r.readInt(!0);for(let a=0,c;a<i;a++){const u=r.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Xs(u);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let f=r.readByte();d.skinRequired=(f&1)!=0,f&2&&(d.x=r.readFloat()),f&4&&(d.y=r.readFloat()),f&8&&(d.rotate=r.readFloat()),f&16&&(d.scaleX=r.readFloat()),f&32&&(d.shearX=r.readFloat()),d.limit=(f&64?r.readFloat():5e3)*t,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=f&128?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),f=r.readByte(),f&1&&(d.inertiaGlobal=!0),f&2&&(d.strengthGlobal=!0),f&4&&(d.dampingGlobal=!0),f&8&&(d.massGlobal=!0),f&16&&(d.windGlobal=!0),f&32&&(d.gravityGlobal=!0),f&64&&(d.mixGlobal=!0),d.mix=f&128?r.readFloat():1,s.physicsConstraints.push(d)}let l=this.readSkin(r,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let a=s.skins.length;for(R.setArraySize(s.skins,i=a+r.readInt(!0));a<i;a++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[a]=c}}i=this.linkedMeshes.length;for(let a=0;a<i;a++){let c=this.linkedMeshes[a];const u=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,i=r.readInt(!0);for(let a=0;a<i;a++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let u=new Ut(c);u.intValue=r.readInt(!1),u.floatValue=r.readFloat(),u.stringValue=r.readString(),u.audioPath=r.readString(),u.audioPath&&(u.volume=r.readFloat(),u.balance=r.readFloat()),s.events.push(u)}i=r.readInt(!0);for(let a=0;a<i;a++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(e,t,s,r){let n=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;n=new Je("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");n=new Je(o),r&&D.rgba8888ToColor(n.color,e.readInt32()),n.bones.length=e.readInt(!0);for(let i=0,l=n.bones.length;i<l;i++)n.bones[i]=t.bones[e.readInt(!0)];for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let i=e.readInt(!0);for(let l=0,a=e.readInt(!0);l<a;l++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let u=this.readAttachment(e,t,n,i,c,r);u&&n.setAttachment(i,c,u)}}return n}readAttachment(e,t,s,r,n,h){let o=this.scale,i=e.readByte();const l=i&8?e.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(i&7){case xe.Region:{let a=i&16?e.readStringRef():null;const c=i&32?e.readInt32():4294967295,u=i&64?this.readSequence(e):null;let d=i&128?e.readFloat():0,f=e.readFloat(),m=e.readFloat(),x=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat();a||(a=l);let p=this.attachmentLoader.newRegionAttachment(s,l,a,u);return p?(p.path=a,p.x=f*o,p.y=m*o,p.scaleX=x,p.scaleY=b,p.rotation=d,p.width=w*o,p.height=g*o,D.rgba8888ToColor(p.color,c),p.sequence=u,u==null&&p.updateRegion(),p):null}case xe.BoundingBox:{let a=this.readVertices(e,(i&16)!=0),c=h?e.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,l);return u?(u.worldVerticesLength=a.length,u.vertices=a.vertices,u.bones=a.bones,h&&D.rgba8888ToColor(u.color,c),u):null}case xe.Mesh:{let a=i&16?e.readStringRef():l;const c=i&32?e.readInt32():4294967295,u=i&64?this.readSequence(e):null,d=e.readInt(!0),f=this.readVertices(e,(i&128)!=0),m=this.readFloatArray(e,f.length,1),x=this.readShortArray(e,(f.length-d-2)*3);let b=[],w=0,g=0;h&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),a||(a=l);let p=this.attachmentLoader.newMeshAttachment(s,l,a,u);return p?(p.path=a,D.rgba8888ToColor(p.color,c),p.bones=f.bones,p.vertices=f.vertices,p.worldVerticesLength=f.length,p.triangles=x,p.regionUVs=m,u==null&&p.updateRegion(),p.hullLength=d<<1,p.sequence=u,h&&(p.edges=b,p.width=w*o,p.height=g*o),p):null}case xe.LinkedMesh:{const a=i&16?e.readStringRef():l;if(a==null)throw new Error("Path of linked mesh must not be null");const c=i&32?e.readInt32():4294967295,u=i&64?this.readSequence(e):null,d=(i&128)!=0,f=e.readInt(!0),m=e.readStringRef();let x=0,b=0;h&&(x=e.readFloat(),b=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,l,a,u);return w?(w.path=a,D.rgba8888ToColor(w.color,c),w.sequence=u,h&&(w.width=x*o,w.height=b*o),this.linkedMeshes.push(new Js(w,f,r,m,d)),w):null}case xe.Path:{const a=(i&16)!=0,c=(i&32)!=0,u=this.readVertices(e,(i&64)!=0),d=R.newArray(u.length/6,0);for(let x=0,b=d.length;x<b;x++)d[x]=e.readFloat()*o;const f=h?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=a,m.constantSpeed=c,m.worldVerticesLength=u.length,m.vertices=u.vertices,m.bones=u.bones,m.lengths=d,h&&D.rgba8888ToColor(m.color,f),m):null}case xe.Point:{const a=e.readFloat(),c=e.readFloat(),u=e.readFloat(),d=h?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,l);return f?(f.x=c*o,f.y=u*o,f.rotation=a,h&&D.rgba8888ToColor(f.color,d),f):null}case xe.Clipping:{const a=e.readInt(!0),c=this.readVertices(e,(i&16)!=0);let u=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[a],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&D.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(e){let t=new rt(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,r=e.readInt(!0),n=new Qs;if(n.length=r<<1,!t)return n.vertices=this.readFloatArray(e,n.length,s),n;let h=new Array,o=new Array;for(let i=0;i<r;i++){let l=e.readInt(!0);o.push(l);for(let a=0;a<l;a++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return n.vertices=R.toFloatArray(h),n.bones=o,n}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let n=0;n<t;n++)r[n]=e.readFloat();else for(let n=0;n<t;n++)r[n]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,n=this.scale;for(let l=0,a=e.readInt(!0);l<a;l++){let c=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0),x=m-1;switch(f){case ci:{let b=new we(m,c);for(let w=0;w<m;w++)b.setFrame(w,e.readFloat(),e.readStringRef());r.push(b);break}case di:{let b=e.readInt(!0),w=new gt(m,b,c),g=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,p,v,y,S),A!=x;A++){let Y=e.readFloat(),M=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(A);break;case de:z(e,w,k++,A,0,g,Y,p,M,1),z(e,w,k++,A,1,g,Y,v,E,1),z(e,w,k++,A,2,g,Y,y,X,1),z(e,w,k++,A,3,g,Y,S,C,1)}g=Y,p=M,v=E,y=X,S=C}r.push(w);break}case fi:{let b=e.readInt(!0),w=new xt(m,b,c),g=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,A=0;w.setFrame(S,g,p,v,y),S!=x;S++){let k=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(S);break;case de:z(e,w,A++,S,0,g,k,p,Y,1),z(e,w,A++,S,1,g,k,v,M,1),z(e,w,A++,S,2,g,k,y,E,1)}g=k,p=Y,v=M,y=E}r.push(w);break}case ui:{let b=e.readInt(!0),w=new wt(m,b,c),g=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255;for(let M=0,E=0;w.setFrame(M,g,p,v,y,S,A,k,Y),M!=x;M++){let X=e.readFloat(),C=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(M);break;case de:z(e,w,E++,M,0,g,X,p,C,1),z(e,w,E++,M,1,g,X,v,T,1),z(e,w,E++,M,2,g,X,y,P,1),z(e,w,E++,M,3,g,X,S,N,1),z(e,w,E++,M,4,g,X,A,q,1),z(e,w,E++,M,5,g,X,k,L,1),z(e,w,E++,M,6,g,X,Y,G,1)}g=X,p=C,v=T,y=P,S=N,A=q,k=L,Y=G}r.push(w);break}case mi:{let b=e.readInt(!0),w=new bt(m,b,c),g=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,p,v,y,S,A,k),Y!=x;Y++){let E=e.readFloat(),X=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(Y);break;case de:z(e,w,M++,Y,0,g,E,p,X,1),z(e,w,M++,Y,1,g,E,v,C,1),z(e,w,M++,Y,2,g,E,y,T,1),z(e,w,M++,Y,3,g,E,S,P,1),z(e,w,M++,Y,4,g,E,A,N,1),z(e,w,M++,Y,5,g,E,k,q,1)}g=E,p=X,v=C,y=T,S=P,A=N,k=q}r.push(w);break}case gi:{let b=new pt(m,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let p=0,v=0;b.setFrame(p,w,g),p!=x;p++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case ce:b.setStepped(p);break;case de:z(e,b,v++,p,0,w,y,g,S,1)}w=y,g=S}r.push(b)}}}}for(let l=0,a=e.readInt(!0);l<a;l++){let c=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0);if(f==hi){let b=new mt(m,c);for(let w=0;w<m;w++)b.setFrame(w,e.readFloat(),e.readByte());r.push(b);continue}let x=e.readInt(!0);switch(f){case Zs:r.push(ee(e,new Xe(m,x,c),1));break;case ei:r.push(Qt(e,new nt(m,x,c),n));break;case ti:r.push(ee(e,new at(m,x,c),n));break;case si:r.push(ee(e,new lt(m,x,c),n));break;case ii:r.push(Qt(e,new ot(m,x,c),1));break;case ri:r.push(ee(e,new ht(m,x,c),1));break;case ni:r.push(ee(e,new ct(m,x,c),1));break;case ai:r.push(Qt(e,new dt(m,x,c),1));break;case li:r.push(ee(e,new ft(m,x,c),1));break;case oi:r.push(ee(e,new ut(m,x,c),1))}}}for(let l=0,a=e.readInt(!0);l<a;l++){let c=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new vt(u,e.readInt(!0),c),m=e.readByte(),x=e.readFloat(),b=m&1?m&2?e.readFloat():1:0,w=m&4?e.readFloat()*n:0;for(let g=0,p=0;f.setFrame(g,x,b,w,m&8?1:-1,(m&16)!=0,(m&32)!=0),g!=d;g++){m=e.readByte();const v=e.readFloat(),y=m&1?m&2?e.readFloat():1:0,S=m&4?e.readFloat()*n:0;m&64?f.setStepped(g):m&128&&(z(e,f,p++,g,0,x,v,b,y,1),z(e,f,p++,g,1,x,v,w,S,n)),x=v,b=y,w=S}r.push(f)}for(let l=0,a=e.readInt(!0);l<a;l++){let c=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new St(u,e.readInt(!0),c),m=e.readFloat(),x=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat(),p=e.readFloat(),v=e.readFloat();for(let y=0,S=0;f.setFrame(y,m,x,b,w,g,p,v),y!=d;y++){let A=e.readFloat(),k=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),E=e.readFloat(),X=e.readFloat(),C=e.readFloat();switch(e.readByte()){case ce:f.setStepped(y);break;case de:z(e,f,S++,y,0,m,A,x,k,1),z(e,f,S++,y,1,m,A,b,Y,1),z(e,f,S++,y,2,m,A,w,M,1),z(e,f,S++,y,3,m,A,g,E,1),z(e,f,S++,y,4,m,A,p,X,1),z(e,f,S++,y,5,m,A,v,C,1)}m=A,x=k,b=Y,w=M,g=E,p=X,v=C}r.push(f)}for(let l=0,a=e.readInt(!0);l<a;l++){let c=e.readInt(!0),u=s.pathConstraints[c];for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),x=e.readInt(!0),b=e.readInt(!0);switch(m){case wi:r.push(ee(e,new At(x,b,c),u.positionMode==0?n:1));break;case bi:r.push(ee(e,new It(x,b,c),u.spacingMode==0||u.spacingMode==1?n:1));break;case yi:let w=new Ct(x,b,c),g=e.readFloat(),p=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,A=0,k=w.getFrameCount()-1;w.setFrame(S,g,p,v,y),S!=k;S++){let Y=e.readFloat(),M=e.readFloat(),E=e.readFloat(),X=e.readFloat();switch(e.readByte()){case ce:w.setStepped(S);break;case de:z(e,w,A++,S,0,g,Y,p,M,1),z(e,w,A++,S,1,g,Y,v,E,1),z(e,w,A++,S,2,g,Y,y,X,1)}g=Y,p=M,v=E,y=X}r.push(w)}}}for(let l=0,a=e.readInt(!0);l<a;l++){const c=e.readInt(!0)-1;for(let u=0,d=e.readInt(!0);u<d;u++){const f=e.readByte(),m=e.readInt(!0);if(f==Yi){const b=new _e(m,c);for(let w=0;w<m;w++)b.setFrame(w,e.readFloat());r.push(b);continue}const x=e.readInt(!0);switch(f){case vi:r.push(ee(e,new kt(m,x,c),1));break;case Si:r.push(ee(e,new Mt(m,x,c),1));break;case Ai:r.push(ee(e,new Yt(m,x,c),1));break;case Ii:r.push(ee(e,new Tt(m,x,c),1));break;case Ci:r.push(ee(e,new Xt(m,x,c),1));break;case ki:r.push(ee(e,new Ft(m,x,c),1));break;case Mi:r.push(ee(e,new Et(m,x,c),1))}}}for(let l=0,a=e.readInt(!0);l<a;l++){let c=s.skins[e.readInt(!0)];for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readInt(!0);for(let m=0,x=e.readInt(!0);m<x;m++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(f,b),g=e.readByte(),p=e.readInt(!0),v=p-1;switch(g){case xi:{let y=w,S=y.bones,A=y.vertices,k=S?A.length/3*2:A.length,Y=e.readInt(!0),M=new yt(p,Y,f,y),E=e.readFloat();for(let X=0,C=0;;X++){let T,P=e.readInt(!0);if(P==0)T=S?R.newFloatArray(k):A;else{T=R.newFloatArray(k);let q=e.readInt(!0);if(P+=q,n==1)for(let L=q;L<P;L++)T[L]=e.readFloat();else for(let L=q;L<P;L++)T[L]=e.readFloat()*n;if(!S)for(let L=0,G=T.length;L<G;L++)T[L]+=A[L]}if(M.setFrame(X,E,T),X==v)break;let N=e.readFloat();switch(e.readByte()){case ce:M.setStepped(X);break;case de:z(e,M,C++,X,0,E,N,0,1,1)}E=N}r.push(M);break}case pi:{let y=new Ae(p,f,w);for(let S=0;S<p;S++){let A=e.readFloat(),k=e.readInt32();y.setFrame(S,A,hs[k&15],k>>4,e.readFloat())}r.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let l=new be(h),a=s.slots.length;for(let c=0;c<h;c++){let u=e.readFloat(),d=e.readInt(!0),f=R.newArray(a,0);for(let w=a-1;w>=0;w--)f[w]=-1;let m=R.newArray(a-d,0),x=0,b=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;x!=g;)m[b++]=x++;f[x+e.readInt(!0)]=x++}for(;x<a;)m[b++]=x++;for(let w=a-1;w>=0;w--)f[w]==-1&&(f[w]=m[--b]);l.setFrame(c,u,f)}r.push(l)}let o=e.readInt(!0);if(o>0){let l=new Fe(o);for(let a=0;a<o;a++){let c=e.readFloat(),u=s.events[e.readInt(!0)],d=new Wt(c,u);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(a,d)}r.push(l)}let i=0;for(let l=0,a=r.length;l<a;l++)i=Math.max(i,r[l].getDuration());return new Oe(t,r,i)}},Es=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let r=0;r<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(n),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Js=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,n){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}},Qs=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}},xe=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(xe||{});function ee(e,t,s){let r=e.readFloat(),n=e.readFloat()*s;for(let h=0,o=0,i=t.getFrameCount()-1;t.setFrame(h,r,n),h!=i;h++){let l=e.readFloat(),a=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(h);break;case de:z(e,t,o++,h,0,r,l,n,a,s)}r=l,n=a}return t}function Qt(e,t,s){let r=e.readFloat(),n=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,i=0,l=t.getFrameCount()-1;t.setFrame(o,r,n,h),o!=l;o++){let a=e.readFloat(),c=e.readFloat()*s,u=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(o);break;case de:z(e,t,i++,o,0,r,a,n,c,s),z(e,t,i++,o,1,r,a,h,u,s)}r=a,n=c,h=u}return t}function z(e,t,s,r,n,h,o,i,l,a){t.setBezier(s,r,n,h,i,e.readFloat(),e.readFloat()*a,e.readFloat(),e.readFloat()*a,o,l)}var Zs=0,ei=1,ti=2,si=3,ii=4,ri=5,ni=6,ai=7,li=8,oi=9,hi=10,ci=0,di=1,fi=2,ui=3,mi=4,gi=5,xi=0,pi=1,wi=0,bi=1,yi=2,vi=0,Si=1,Ai=2,Ii=4,Ci=5,ki=6,Mi=7,Yi=8,ce=1,de=2,Ti=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Te(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,n=this.polygonPool,h=e.slots,o=h.length;s.length=0,n.freeAll(r),r.length=0;for(let i=0;i<o;i++){let l=h[i];if(!l.bone.active)continue;let a=l.getAttachment();if(a instanceof Ge){let c=a;s.push(c);let u=n.obtain();u.length!=c.worldVerticesLength&&(u=R.newFloatArray(c.worldVerticesLength)),r.push(u),c.computeWorldVertices(l,0,c.worldVerticesLength,u,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,n=this.polygons;for(let h=0,o=n.length;h<o;h++){let i=n[h],l=i;for(let a=0,c=i.length;a<c;a+=2){let u=l[a],d=l[a+1];e=Math.min(e,u),t=Math.min(t,d),s=Math.max(s,u),r=Math.max(r,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let n=this.minX,h=this.minY,o=this.maxX,i=this.maxY;if(e<=n&&s<=n||t<=h&&r<=h||e>=o&&s>=o||t>=i&&r>=i)return!1;let l=(r-t)/(s-e),a=l*(n-e)+t;if(a>h&&a<i||(a=l*(o-e)+t,a>h&&a<i))return!0;let c=(h-t)/l+e;return c>n&&c<o||(c=(i-t)/l+e,c>n&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,n=s.length;r<n;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,n=e.length,h=n-2,o=!1;for(let i=0;i<n;i+=2){let l=r[i+1],a=r[h+1];if(l<s&&a>=s||a<s&&l>=s){let c=r[i];c+(s-l)/(a-l)*(r[h]-c)<t&&(o=!o)}h=i}return o}intersectsSegment(e,t,s,r){let n=this.polygons;for(let h=0,o=n.length;h<o;h++)if(this.intersectsSegmentPolygon(n[h],e,t,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,r,n){let h=e,o=e.length,i=t-r,l=s-n,a=t*n-s*r,c=h[o-2],u=h[o-1];for(let d=0;d<o;d+=2){let f=h[d],m=h[d+1],x=c*m-u*f,b=c-f,w=u-m,g=i*w-l*b,p=(a*b-i*x)/g;if((p>=c&&p<=f||p>=f&&p<=c)&&(p>=t&&p<=r||p>=r&&p<=t)){let v=(a*w-l*x)/g;if((v>=u&&v<=m||v>=m&&v<=u)&&(v>=s&&v<=n||v>=n&&v<=s))return!0}c=f,u=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},ie=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Te(()=>new Array);polygonIndicesPool=new Te(()=>new Array);triangulate(e){let t=e,s=e.length>>1,r=this.indicesArray;r.length=0;for(let o=0;o<s;o++)r[o]=o;let n=this.isConcaveArray;n.length=0;for(let o=0,i=s;o<i;++o)n[o]=ie.isConcave(o,s,t,r);let h=this.triangles;for(h.length=0;s>3;){let o=s-1,i=0,l=1;for(;;){e:if(!n[i]){let u=r[o]<<1,d=r[i]<<1,f=r[l]<<1,m=t[u],x=t[u+1],b=t[d],w=t[d+1],g=t[f],p=t[f+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!n[v])continue;let y=r[v]<<1,S=t[y],A=t[y+1];if(ie.positiveArea(g,p,m,x,S,A)&&ie.positiveArea(m,x,b,w,S,A)&&ie.positiveArea(b,w,g,p,S,A))break e}break}if(l==0){do{if(!n[i])break;i--}while(i>0);break}o=i,i=l,l=(l+1)%s}h.push(r[(s+i-1)%s]),h.push(r[i]),h.push(r[(i+1)%s]),r.splice(i,1),n.splice(i,1),s--;let a=(s+i-1)%s,c=i==s?0:i;n[a]=ie.isConcave(a,s,t,r),n[c]=ie.isConcave(c,s,t,r)}return s==3&&(h.push(r[2]),h.push(r[0]),h.push(r[1])),h}decompose(e,t){let s=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let o=this.polygonPool.obtain();o.length=0;let i=-1,l=0;for(let a=0,c=t.length;a<c;a+=3){let u=t[a]<<1,d=t[a+1]<<1,f=t[a+2]<<1,m=s[u],x=s[u+1],b=s[d],w=s[d+1],g=s[f],p=s[f+1],v=!1;if(i==u){let y=o.length-4,S=ie.winding(o[y],o[y+1],o[y+2],o[y+3],g,p),A=ie.winding(g,p,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(g),o.push(p),h.push(f),v=!0)}v||(o.length>0?(r.push(o),n.push(h)):(this.polygonPool.free(o),this.polygonIndicesPool.free(h)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(x),o.push(b),o.push(w),o.push(g),o.push(p),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(u),h.push(d),h.push(f),l=ie.winding(m,x,b,w,g,p),i=u)}o.length>0&&(r.push(o),n.push(h));for(let a=0,c=r.length;a<c;a++){if(h=n[a],h.length==0)continue;let u=h[0],d=h[h.length-1];o=r[a];let f=o.length-4,m=o[f],x=o[f+1],b=o[f+2],w=o[f+3],g=o[0],p=o[1],v=o[2],y=o[3],S=ie.winding(m,x,b,w,g,p);for(let A=0;A<c;A++){if(A==a)continue;let k=n[A];if(k.length!=3)continue;let Y=k[0],M=k[1],E=k[2],X=r[A],C=X[X.length-2],T=X[X.length-1];if(Y!=u||M!=d)continue;let P=ie.winding(m,x,b,w,C,T),N=ie.winding(C,T,g,p,v,y);P==S&&N==S&&(X.length=0,k.length=0,o.push(C),o.push(T),h.push(E),m=b,x=w,b=C,w=T,A=0)}}for(let a=r.length-1;a>=0;a--)o=r[a],o.length==0&&(r.splice(a,1),this.polygonPool.free(o),h=n[a],n.splice(a,1),this.polygonIndicesPool.free(h));return r}static isConcave(e,t,s,r){let n=r[(t+e-1)%t]<<1,h=r[e]<<1,o=r[(e+1)%t]<<1;return!this.positiveArea(s[n],s[n+1],s[h],s[h+1],s[o],s[o+1])}static positiveArea(e,t,s,r,n,h){return e*(h-r)+s*(t-h)+n*(r-t)>=0}static winding(e,t,s,r,n,h){let o=s-e,i=r-t;return n*i-h*o+o*t-e*i>=0?1:-1}},Ze=class{triangulator=new ie;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,r=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,r,0,2);let n=this.clippingPolygon;Ze.makeClockwise(n);let h=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let o=0,i=h.length;o<i;o++){let l=h[o];Ze.makeClockwise(l),l.push(l[0]),l.push(l[1])}return h.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,r,n,h,o,i){let l,a,c,u,d,f;typeof t=="number"?(l=s,a=r,c=n,u=h,d=o,f=i):(l=t,a=s,c=r,u=n,d=h,f=o),c&&u&&d&&typeof f=="boolean"?this.clipTrianglesRender(e,l,a,c,u,d,f):this.clipTrianglesNoRender(e,l,a)}clipTrianglesNoRender(e,t,s){let r=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,o=this.clippingPolygons,i=o.length,l=0;n.length=0,h.length=0;for(let a=0;a<s;a+=3){let c=t[a]<<1,u=e[c],d=e[c+1];c=t[a+1]<<1;let f=e[c],m=e[c+1];c=t[a+2]<<1;let x=e[c],b=e[c+1];for(let w=0;w<i;w++){let g=n.length;if(this.clip(u,d,f,m,x,b,o[w],r)){let p=r.length;if(p==0)continue;let v=p>>1,y=this.clipOutput,S=R.setArraySize(n,g+v*2);for(let k=0;k<p;k+=2,g+=2){let Y=y[k],M=y[k+1];S[g]=Y,S[g+1]=M}g=h.length;let A=R.setArraySize(h,g+3*(v-2));v--;for(let k=1;k<v;k++,g+=3)A[g]=l,A[g+1]=l+k,A[g+2]=l+k+1;l+=v+1}else{let p=R.setArraySize(n,g+6);p[g]=u,p[g+1]=d,p[g+2]=f,p[g+3]=m,p[g+4]=x,p[g+5]=b,g=h.length;let v=R.setArraySize(h,g+3);v[g]=l,v[g+1]=l+1,v[g+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,s,r,n,h,o){let i=this.clipOutput,l=this.clippedVertices,a=this.clippedTriangles,c=this.clippingPolygons,u=c.length,d=o?12:8,f=0;l.length=0,a.length=0;for(let m=0;m<s;m+=3){let x=t[m]<<1,b=e[x],w=e[x+1],g=r[x],p=r[x+1];x=t[m+1]<<1;let v=e[x],y=e[x+1],S=r[x],A=r[x+1];x=t[m+2]<<1;let k=e[x],Y=e[x+1],M=r[x],E=r[x+1];for(let X=0;X<u;X++){let C=l.length;if(this.clip(b,w,v,y,k,Y,c[X],i)){let T=i.length;if(T==0)continue;let P=y-Y,N=k-v,q=b-k,L=Y-w,G=1/(P*q+N*(w-Y)),$=T>>1,j=this.clipOutput,V=R.setArraySize(l,C+$*d);for(let W=0;W<T;W+=2,C+=d){let re=j[W],te=j[W+1];V[C]=re,V[C+1]=te,V[C+2]=n.r,V[C+3]=n.g,V[C+4]=n.b,V[C+5]=n.a;let J=re-k,Q=te-Y,Z=(P*J+N*Q)*G,fe=(L*J+q*Q)*G,Me=1-Z-fe;V[C+6]=g*Z+S*fe+M*Me,V[C+7]=p*Z+A*fe+E*Me,o&&(V[C+8]=h.r,V[C+9]=h.g,V[C+10]=h.b,V[C+11]=h.a)}C=a.length;let _=R.setArraySize(a,C+3*($-2));$--;for(let W=1;W<$;W++,C+=3)_[C]=f,_[C+1]=f+W,_[C+2]=f+W+1;f+=$+1}else{let T=R.setArraySize(l,C+3*d);T[C]=b,T[C+1]=w,T[C+2]=n.r,T[C+3]=n.g,T[C+4]=n.b,T[C+5]=n.a,o?(T[C+6]=g,T[C+7]=p,T[C+8]=h.r,T[C+9]=h.g,T[C+10]=h.b,T[C+11]=h.a,T[C+12]=v,T[C+13]=y,T[C+14]=n.r,T[C+15]=n.g,T[C+16]=n.b,T[C+17]=n.a,T[C+18]=S,T[C+19]=A,T[C+20]=h.r,T[C+21]=h.g,T[C+22]=h.b,T[C+23]=h.a,T[C+24]=k,T[C+25]=Y,T[C+26]=n.r,T[C+27]=n.g,T[C+28]=n.b,T[C+29]=n.a,T[C+30]=M,T[C+31]=E,T[C+32]=h.r,T[C+33]=h.g,T[C+34]=h.b,T[C+35]=h.a):(T[C+6]=g,T[C+7]=p,T[C+8]=v,T[C+9]=y,T[C+10]=n.r,T[C+11]=n.g,T[C+12]=n.b,T[C+13]=n.a,T[C+14]=S,T[C+15]=A,T[C+16]=k,T[C+17]=Y,T[C+18]=n.r,T[C+19]=n.g,T[C+20]=n.b,T[C+21]=n.a,T[C+22]=M,T[C+23]=E),C=a.length;let P=R.setArraySize(a,C+3);P[C]=f,P[C+1]=f+1,P[C+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,t,s,r){let n=this.clipOutput,h=this.clippedVertices,o=this.clippedUVs,i=this.clippedTriangles,l=this.clippingPolygons,a=l.length,c=0;h.length=0,o.length=0,i.length=0;for(let u=0;u<s;u+=3){let d=t[u]<<1,f=e[d],m=e[d+1],x=r[d],b=r[d+1];d=t[u+1]<<1;let w=e[d],g=e[d+1],p=r[d],v=r[d+1];d=t[u+2]<<1;let y=e[d],S=e[d+1],A=r[d],k=r[d+1];for(let Y=0;Y<a;Y++){let M=h.length;if(this.clip(f,m,w,g,y,S,l[Y],n)){let E=n.length;if(E==0)continue;let X=g-S,C=y-w,T=f-y,P=S-m,N=1/(X*T+C*(m-S)),q=E>>1,L=this.clipOutput,G=R.setArraySize(h,M+q*2),$=R.setArraySize(o,M+q*2);for(let V=0;V<E;V+=2,M+=2){let _=L[V],W=L[V+1];G[M]=_,G[M+1]=W;let re=_-y,te=W-S,J=(X*re+C*te)*N,Q=(P*re+T*te)*N,Z=1-J-Q;$[M]=x*J+p*Q+A*Z,$[M+1]=b*J+v*Q+k*Z}M=i.length;let j=R.setArraySize(i,M+3*(q-2));q--;for(let V=1;V<q;V++,M+=3)j[M]=c,j[M+1]=c+V,j[M+2]=c+V+1;c+=q+1}else{let E=R.setArraySize(h,M+6);E[M]=f,E[M+1]=m,E[M+2]=w,E[M+3]=g,E[M+4]=y,E[M+5]=S;let X=R.setArraySize(o,M+3*2);X[M]=x,X[M+1]=b,X[M+2]=p,X[M+3]=v,X[M+4]=A,X[M+5]=k,M=i.length;let C=R.setArraySize(i,M+3);C[M]=c,C[M+1]=c+1,C[M+2]=c+2,c+=3;break}}}}clip(e,t,s,r,n,h,o,i){let l=i,a=!1,c;o.length%4>=2?(c=i,i=this.scratch):c=this.scratch,c.length=0,c.push(e),c.push(t),c.push(s),c.push(r),c.push(n),c.push(h),c.push(e),c.push(t),i.length=0;let u=o.length-4,d=o;for(let f=0;;f+=2){let m=d[f],x=d[f+1],b=m-d[f+2],w=x-d[f+3],g=i.length,p=c;for(let y=0,S=c.length-2;y<S;){let A=p[y],k=p[y+1];y+=2;let Y=p[y],M=p[y+1],E=w*(m-Y)>b*(x-M),X=w*(m-A)-b*(x-k);if(X>0){if(E){i.push(Y),i.push(M);continue}let C=Y-A,T=M-k,P=X/(C*w-T*b);if(P>=0&&P<=1)i.push(A+C*P),i.push(k+T*P);else{i.push(Y),i.push(M);continue}}else if(E){let C=Y-A,T=M-k,P=X/(C*w-T*b);if(P>=0&&P<=1)i.push(A+C*P),i.push(k+T*P),i.push(Y),i.push(M);else{i.push(Y),i.push(M);continue}}a=!0}if(g==i.length)return l.length=0,!0;if(i.push(i[0]),i.push(i[1]),f==u)break;let v=i;i=c,i.length=0,c=v}if(l!=i){l.length=0;for(let f=0,m=i.length-2;f<m;f++)l[f]=i[f]}else l.length=l.length-2;return a}static makeClockwise(e){let t=e,s=e.length,r=t[s-2]*t[1]-t[0]*t[s-1],n=0,h=0,o=0,i=0;for(let l=0,a=s-3;l<a;l+=2)n=t[l],h=t[l+1],o=t[l+2],i=t[l+3],r+=n*i-o*h;if(!(r<0))for(let l=0,a=s-2,c=s>>1;l<c;l+=2){let u=t[l],d=t[l+1],f=a-l;t[l]=t[f],t[l+1]=t[f+1],t[f]=u,t[f+1]=d}}},Rs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new $t,r=typeof e=="string"?JSON.parse(e):e,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=I(n,"referenceScale",100)*t,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let o=r.bones[h],i=null,l=I(o,"parent",null);l&&(i=s.findBone(l));let a=new qt(s.bones.length,o.name,i);a.length=I(o,"length",0)*t,a.x=I(o,"x",0)*t,a.y=I(o,"y",0)*t,a.rotation=I(o,"rotation",0),a.scaleX=I(o,"scaleX",1),a.scaleY=I(o,"scaleY",1),a.shearX=I(o,"shearX",0),a.shearY=I(o,"shearY",0),a.inherit=R.enumValue(Re,I(o,"inherit","Normal")),a.skinRequired=I(o,"skin",!1);let c=I(o,"color",null);c&&a.color.setFromString(c),s.bones.push(a)}if(r.slots)for(let h=0;h<r.slots.length;h++){let o=r.slots[h],i=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${i}`);let a=new Kt(s.slots.length,i,l),c=I(o,"color",null);c&&a.color.setFromString(c);let u=I(o,"dark",null);u&&(a.darkColor=D.fromString(u)),a.attachmentName=I(o,"attachment",null),a.blendMode=R.enumValue(Qe,I(o,"blend","normal")),a.visible=I(o,"visible",!0),s.slots.push(a)}if(r.ik)for(let h=0;h<r.ik.length;h++){let o=r.ik[h],i=new zt(o.name);i.order=I(o,"order",0),i.skinRequired=I(o,"skin",!1);for(let a=0;a<o.bones.length;a++){let c=s.findBone(o.bones[a]);if(!c)throw new Error(`Couldn't find bone ${o.bones[a]} for IK constraint ${o.name}.`);i.bones.push(c)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);i.target=l,i.mix=I(o,"mix",1),i.softness=I(o,"softness",0)*t,i.bendDirection=I(o,"bendPositive",!0)?1:-1,i.compress=I(o,"compress",!1),i.stretch=I(o,"stretch",!1),i.uniform=I(o,"uniform",!1),s.ikConstraints.push(i)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],i=new Jt(o.name);i.order=I(o,"order",0),i.skinRequired=I(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=o.bones[c],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${o.name}.`);i.bones.push(d)}let l=o.target,a=s.findBone(l);if(!a)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);i.target=a,i.local=I(o,"local",!1),i.relative=I(o,"relative",!1),i.offsetRotation=I(o,"rotation",0),i.offsetX=I(o,"x",0)*t,i.offsetY=I(o,"y",0)*t,i.offsetScaleX=I(o,"scaleX",0),i.offsetScaleY=I(o,"scaleY",0),i.offsetShearY=I(o,"shearY",0),i.mixRotate=I(o,"mixRotate",1),i.mixX=I(o,"mixX",1),i.mixY=I(o,"mixY",i.mixX),i.mixScaleX=I(o,"mixScaleX",1),i.mixScaleY=I(o,"mixScaleY",i.mixScaleX),i.mixShearY=I(o,"mixShearY",1),s.transformConstraints.push(i)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],i=new Gt(o.name);i.order=I(o,"order",0),i.skinRequired=I(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=o.bones[c],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${o.name}.`);i.bones.push(d)}let l=o.target,a=s.findSlot(l);if(!a)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);i.target=a,i.positionMode=R.enumValue($e,I(o,"positionMode","Percent")),i.spacingMode=R.enumValue(je,I(o,"spacingMode","Length")),i.rotateMode=R.enumValue(Ke,I(o,"rotateMode","Tangent")),i.offsetRotation=I(o,"rotation",0),i.position=I(o,"position",0),i.positionMode==0&&(i.position*=t),i.spacing=I(o,"spacing",0),(i.spacingMode==0||i.spacingMode==1)&&(i.spacing*=t),i.mixRotate=I(o,"mixRotate",1),i.mixX=I(o,"mixX",1),i.mixY=I(o,"mixY",i.mixX),s.pathConstraints.push(i)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],i=new Xs(o.name);i.order=I(o,"order",0),i.skinRequired=I(o,"skin",!1);const l=o.bone,a=s.findBone(l);if(a==null)throw new Error("Physics bone not found: "+l);i.bone=a,i.x=I(o,"x",0),i.y=I(o,"y",0),i.rotate=I(o,"rotate",0),i.scaleX=I(o,"scaleX",0),i.shearX=I(o,"shearX",0),i.limit=I(o,"limit",5e3)*t,i.step=1/I(o,"fps",60),i.inertia=I(o,"inertia",1),i.strength=I(o,"strength",100),i.damping=I(o,"damping",1),i.massInverse=1/I(o,"mass",1),i.wind=I(o,"wind",0),i.gravity=I(o,"gravity",0),i.mix=I(o,"mix",1),i.inertiaGlobal=I(o,"inertiaGlobal",!1),i.strengthGlobal=I(o,"strengthGlobal",!1),i.dampingGlobal=I(o,"dampingGlobal",!1),i.massGlobal=I(o,"massGlobal",!1),i.windGlobal=I(o,"windGlobal",!1),i.gravityGlobal=I(o,"gravityGlobal",!1),i.mixGlobal=I(o,"mixGlobal",!1),s.physicsConstraints.push(i)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],i=new Je(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let a=o.bones[l],c=s.findBone(a);if(!c)throw new Error(`Couldn't find bone ${a} for skin ${o.name}.`);i.bones.push(c)}if(o.ik)for(let l=0;l<o.ik.length;l++){let a=o.ik[l],c=s.findIkConstraint(a);if(!c)throw new Error(`Couldn't find IK constraint ${a} for skin ${o.name}.`);i.constraints.push(c)}if(o.transform)for(let l=0;l<o.transform.length;l++){let a=o.transform[l],c=s.findTransformConstraint(a);if(!c)throw new Error(`Couldn't find transform constraint ${a} for skin ${o.name}.`);i.constraints.push(c)}if(o.path)for(let l=0;l<o.path.length;l++){let a=o.path[l],c=s.findPathConstraint(a);if(!c)throw new Error(`Couldn't find path constraint ${a} for skin ${o.name}.`);i.constraints.push(c)}if(o.physics)for(let l=0;l<o.physics.length;l++){let a=o.physics[l],c=s.findPhysicsConstraint(a);if(!c)throw new Error(`Couldn't find physics constraint ${a} for skin ${o.name}.`);i.constraints.push(c)}for(let l in o.attachments){let a=s.findSlot(l);if(!a)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let c=o.attachments[l];for(let u in c){let d=this.readAttachment(c[u],i,a.index,u,s);d&&i.setAttachment(a.index,u,d)}}s.skins.push(i),i.name=="default"&&(s.defaultSkin=i)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let i=this.linkedMeshes[h],l=i.skin?s.findSkin(i.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${i.skin}`);let a=l.getAttachment(i.slotIndex,i.parent);if(!a)throw new Error(`Parent mesh not found: ${i.parent}`);i.mesh.timelineAttachment=i.inheritTimeline?a:i.mesh,i.mesh.setParentMesh(a),i.mesh.region!=null&&i.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],i=new Ut(h);i.intValue=I(o,"int",0),i.floatValue=I(o,"float",0),i.stringValue=I(o,"string",""),i.audioPath=I(o,"audio",null),i.audioPath&&(i.volume=I(o,"volume",1),i.balance=I(o,"balance",0)),s.events.push(i)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,r,n){let h=this.scale;switch(r=I(e,"name",r),I(e,"type","region")){case"region":{let o=I(e,"path",r),i=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,r,o,i);if(!l)return null;l.path=o,l.x=I(e,"x",0)*h,l.y=I(e,"y",0)*h,l.scaleX=I(e,"scaleX",1),l.scaleY=I(e,"scaleY",1),l.rotation=I(e,"rotation",0),l.width=e.width*h,l.height=e.height*h,l.sequence=i;let a=I(e,"color",null);return a&&l.color.setFromString(a),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let i=I(e,"color",null);return i&&o.color.setFromString(i),o}case"mesh":case"linkedmesh":{let o=I(e,"path",r),i=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,r,o,i);if(!l)return null;l.path=o;let a=I(e,"color",null);a&&l.color.setFromString(a),l.width=I(e,"width",0)*h,l.height=I(e,"height",0)*h,l.sequence=i;let c=I(e,"parent",null);if(c)return this.linkedMeshes.push(new Xi(l,I(e,"skin",null),s,c,I(e,"timelines",!0))),l;let u=e.uvs;return this.readVertices(e,l,u.length),l.triangles=e.triangles,l.regionUVs=u,l.region!=null&&l.updateRegion(),l.edges=I(e,"edges",null),l.hullLength=I(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=I(e,"closed",!1),o.constantSpeed=I(e,"constantSpeed",!0);let i=e.vertexCount;this.readVertices(e,o,i<<1);let l=R.newArray(i/3,0);for(let c=0;c<e.lengths.length;c++)l[c]=e.lengths[c]*h;o.lengths=l;let a=I(e,"color",null);return a&&o.color.setFromString(a),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=I(e,"x",0)*h,o.y=I(e,"y",0)*h,o.rotation=I(e,"rotation",0);let i=I(e,"color",null);return i&&o.color.setFromString(i),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let i=I(e,"end",null);i&&(o.endSlot=n.findSlot(i));let l=e.vertexCount;this.readVertices(e,o,l<<1);let a=I(e,"color",null);return a&&o.color.setFromString(a),o}}return null}readSequence(e){if(e==null)return null;let t=new rt(I(e,"count",0));return t.start=I(e,"start",1),t.digits=I(e,"digits",0),t.setupIndex=I(e,"setup",0),t}readVertices(e,t,s){let r=this.scale;t.worldVerticesLength=s;let n=e.vertices;if(s==n.length){let i=R.toFloatArray(n);if(r!=1)for(let l=0,a=n.length;l<a;l++)i[l]*=r;t.vertices=i;return}let h=new Array,o=new Array;for(let i=0,l=n.length;i<l;){let a=n[i++];o.push(a);for(let c=i+a*4;i<c;i+=4)o.push(n[i]),h.push(n[i+1]*r),h.push(n[i+2]*r),h.push(n[i+3])}t.bones=o,t.vertices=R.toFloatArray(h)}readAnimation(e,t,s){let r=this.scale,n=new Array;if(e.slots)for(let o in e.slots){let i=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let a=l.index;for(let c in i){let u=i[c];if(!u)continue;let d=u.length;if(c=="attachment"){let f=new we(d,a);for(let m=0;m<d;m++){let x=u[m];f.setFrame(m,I(x,"time",0),I(x,"name",null))}n.push(f)}else if(c=="rgba"){let f=new gt(d,d<<2,a),m=u[0],x=I(m,"time",0),b=D.fromString(m.color);for(let w=0,g=0;;w++){f.setFrame(w,x,b.r,b.g,b.b,b.a);let p=u[w+1];if(!p){f.shrink(g);break}let v=I(p,"time",0),y=D.fromString(p.color),S=m.curve;S&&(g=H(S,f,g,w,0,x,v,b.r,y.r,1),g=H(S,f,g,w,1,x,v,b.g,y.g,1),g=H(S,f,g,w,2,x,v,b.b,y.b,1),g=H(S,f,g,w,3,x,v,b.a,y.a,1)),x=v,b=y,m=p}n.push(f)}else if(c=="rgb"){let f=new xt(d,d*3,a),m=u[0],x=I(m,"time",0),b=D.fromString(m.color);for(let w=0,g=0;;w++){f.setFrame(w,x,b.r,b.g,b.b);let p=u[w+1];if(!p){f.shrink(g);break}let v=I(p,"time",0),y=D.fromString(p.color),S=m.curve;S&&(g=H(S,f,g,w,0,x,v,b.r,y.r,1),g=H(S,f,g,w,1,x,v,b.g,y.g,1),g=H(S,f,g,w,2,x,v,b.b,y.b,1)),x=v,b=y,m=p}n.push(f)}else if(c=="alpha")n.push(he(u,new pt(d,d,a),0,1));else if(c=="rgba2"){let f=new wt(d,d*7,a),m=u[0],x=I(m,"time",0),b=D.fromString(m.light),w=D.fromString(m.dark);for(let g=0,p=0;;g++){f.setFrame(g,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let v=u[g+1];if(!v){f.shrink(p);break}let y=I(v,"time",0),S=D.fromString(v.light),A=D.fromString(v.dark),k=m.curve;k&&(p=H(k,f,p,g,0,x,y,b.r,S.r,1),p=H(k,f,p,g,1,x,y,b.g,S.g,1),p=H(k,f,p,g,2,x,y,b.b,S.b,1),p=H(k,f,p,g,3,x,y,b.a,S.a,1),p=H(k,f,p,g,4,x,y,w.r,A.r,1),p=H(k,f,p,g,5,x,y,w.g,A.g,1),p=H(k,f,p,g,6,x,y,w.b,A.b,1)),x=y,b=S,w=A,m=v}n.push(f)}else if(c=="rgb2"){let f=new bt(d,d*6,a),m=u[0],x=I(m,"time",0),b=D.fromString(m.light),w=D.fromString(m.dark);for(let g=0,p=0;;g++){f.setFrame(g,x,b.r,b.g,b.b,w.r,w.g,w.b);let v=u[g+1];if(!v){f.shrink(p);break}let y=I(v,"time",0),S=D.fromString(v.light),A=D.fromString(v.dark),k=m.curve;k&&(p=H(k,f,p,g,0,x,y,b.r,S.r,1),p=H(k,f,p,g,1,x,y,b.g,S.g,1),p=H(k,f,p,g,2,x,y,b.b,S.b,1),p=H(k,f,p,g,3,x,y,w.r,A.r,1),p=H(k,f,p,g,4,x,y,w.g,A.g,1),p=H(k,f,p,g,5,x,y,w.b,A.b,1)),x=y,b=S,w=A,m=v}n.push(f)}}}if(e.bones)for(let o in e.bones){let i=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let a=l.index;for(let c in i){let u=i[c],d=u.length;if(d!=0){if(c==="rotate")n.push(he(u,new Xe(d,d,a),0,1));else if(c==="translate"){let f=new nt(d,d<<1,a);n.push(Zt(u,f,"x","y",0,r))}else if(c==="translatex"){let f=new at(d,d,a);n.push(he(u,f,0,r))}else if(c==="translatey"){let f=new lt(d,d,a);n.push(he(u,f,0,r))}else if(c==="scale"){let f=new ot(d,d<<1,a);n.push(Zt(u,f,"x","y",1,1))}else if(c==="scalex"){let f=new ht(d,d,a);n.push(he(u,f,1,1))}else if(c==="scaley"){let f=new ct(d,d,a);n.push(he(u,f,1,1))}else if(c==="shear"){let f=new dt(d,d<<1,a);n.push(Zt(u,f,"x","y",0,1))}else if(c==="shearx"){let f=new ft(d,d,a);n.push(he(u,f,0,1))}else if(c==="sheary"){let f=new ut(d,d,a);n.push(he(u,f,0,1))}else if(c==="inherit"){let f=new mt(d,l.index);for(let m=0;m<u.length;m++){let x=u[m];f.setFrame(m,I(x,"time",0),R.enumValue(Re,I(x,"inherit","Normal")))}n.push(f)}}}}if(e.ik)for(let o in e.ik){let i=e.ik[o],l=i[0];if(!l)continue;let a=s.findIkConstraint(o);if(!a)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(a),u=new vt(i.length,i.length<<1,c),d=I(l,"time",0),f=I(l,"mix",1),m=I(l,"softness",0)*r;for(let x=0,b=0;;x++){u.setFrame(x,d,f,m,I(l,"bendPositive",!0)?1:-1,I(l,"compress",!1),I(l,"stretch",!1));let w=i[x+1];if(!w){u.shrink(b);break}let g=I(w,"time",0),p=I(w,"mix",1),v=I(w,"softness",0)*r,y=l.curve;y&&(b=H(y,u,b,x,0,d,g,f,p,1),b=H(y,u,b,x,1,d,g,m,v,r)),d=g,f=p,m=v,l=w}n.push(u)}if(e.transform)for(let o in e.transform){let i=e.transform[o],l=i[0];if(!l)continue;let a=s.findTransformConstraint(o);if(!a)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(a),u=new St(i.length,i.length*6,c),d=I(l,"time",0),f=I(l,"mixRotate",1),m=I(l,"mixX",1),x=I(l,"mixY",m),b=I(l,"mixScaleX",1),w=I(l,"mixScaleY",b),g=I(l,"mixShearY",1);for(let p=0,v=0;;p++){u.setFrame(p,d,f,m,x,b,w,g);let y=i[p+1];if(!y){u.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),Y=I(y,"mixY",k),M=I(y,"mixScaleX",1),E=I(y,"mixScaleY",M),X=I(y,"mixShearY",1),C=l.curve;C&&(v=H(C,u,v,p,0,d,S,f,A,1),v=H(C,u,v,p,1,d,S,m,k,1),v=H(C,u,v,p,2,d,S,x,Y,1),v=H(C,u,v,p,3,d,S,b,M,1),v=H(C,u,v,p,4,d,S,w,E,1),v=H(C,u,v,p,5,d,S,g,X,1)),d=S,f=A,m=k,x=Y,b=M,w=E,b=M,l=y}n.push(u)}if(e.path)for(let o in e.path){let i=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let a=s.pathConstraints.indexOf(l);for(let c in i){let u=i[c],d=u[0];if(!d)continue;let f=u.length;if(c==="position"){let m=new At(f,f,a);n.push(he(u,m,0,l.positionMode==0?r:1))}else if(c==="spacing"){let m=new It(f,f,a);n.push(he(u,m,0,l.spacingMode==0||l.spacingMode==1?r:1))}else if(c==="mix"){let m=new Ct(f,f*3,a),x=I(d,"time",0),b=I(d,"mixRotate",1),w=I(d,"mixX",1),g=I(d,"mixY",w);for(let p=0,v=0;;p++){m.setFrame(p,x,b,w,g);let y=u[p+1];if(!y){m.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),Y=I(y,"mixY",k),M=d.curve;M&&(v=H(M,m,v,p,0,x,S,b,A,1),v=H(M,m,v,p,1,x,S,w,k,1),v=H(M,m,v,p,2,x,S,g,Y,1)),x=S,b=A,w=k,g=Y,d=y}n.push(m)}}}if(e.physics)for(let o in e.physics){let i=e.physics[o],l=-1;if(o.length>0){let a=s.findPhysicsConstraint(o);if(!a)throw new Error("Physics constraint not found: "+o);l=s.physicsConstraints.indexOf(a)}for(let a in i){let c=i[a],u=c[0];if(!u)continue;let d=c.length;if(a=="reset"){const m=new _e(d,l);for(let x=0;u!=null;u=c[x+1],x++)m.setFrame(x,I(u,"time",0));n.push(m);continue}let f;if(a=="inertia")f=new kt(d,d,l);else if(a=="strength")f=new Mt(d,d,l);else if(a=="damping")f=new Yt(d,d,l);else if(a=="mass")f=new Tt(d,d,l);else if(a=="wind")f=new Xt(d,d,l);else if(a=="gravity")f=new Ft(d,d,l);else if(a=="mix")f=new Et(d,d,l);else continue;n.push(he(c,f,0,1))}}if(e.attachments)for(let o in e.attachments){let i=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let a in i){let c=i[a],u=s.findSlot(a);if(!u)throw new Error("Slot not found: "+a);let d=u.index;for(let f in c){let m=c[f],x=l.getAttachment(d,f);for(let b in m){let w=m[b],g=w[0];if(g){if(b=="deform"){let p=x.bones,v=x.vertices,y=p?v.length/3*2:v.length,S=new yt(w.length,w.length,d,x),A=I(g,"time",0);for(let k=0,Y=0;;k++){let M,E=I(g,"vertices",null);if(!E)M=p?R.newFloatArray(y):v;else{M=R.newFloatArray(y);let P=I(g,"offset",0);if(R.arrayCopy(E,0,M,P,E.length),r!=1)for(let N=P,q=N+E.length;N<q;N++)M[N]*=r;if(!p)for(let N=0;N<y;N++)M[N]+=v[N]}S.setFrame(k,A,M);let X=w[k+1];if(!X){S.shrink(Y);break}let C=I(X,"time",0),T=g.curve;T&&(Y=H(T,S,Y,k,0,A,C,0,1,1)),A=C,g=X}n.push(S)}else if(b=="sequence"){let p=new Ae(w.length,d,x),v=0;for(let y=0;y<w.length;y++){let S=I(g,"delay",v),A=I(g,"time",0),k=os[I(g,"mode","hold")],Y=I(g,"index",0);p.setFrame(y,A,k,Y,S),v=S,g=w[y+1]}n.push(p)}}}}}}if(e.drawOrder){let o=new be(e.drawOrder.length),i=s.slots.length,l=0;for(let a=0;a<e.drawOrder.length;a++,l++){let c=e.drawOrder[a],u=null,d=I(c,"offsets",null);if(d){u=R.newArray(i,-1);let f=R.newArray(i-d.length,0),m=0,x=0;for(let b=0;b<d.length;b++){let w=d[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let p=g.index;for(;m!=p;)f[x++]=m++;u[m+w.offset]=m++}for(;m<i;)f[x++]=m++;for(let b=i-1;b>=0;b--)u[b]==-1&&(u[b]=f[--x])}o.setFrame(l,I(c,"time",0),u)}n.push(o)}if(e.events){let o=new Fe(e.events.length),i=0;for(let l=0;l<e.events.length;l++,i++){let a=e.events[l],c=s.findEvent(a.name);if(!c)throw new Error("Event not found: "+a.name);let u=new Wt(R.toSinglePrecision(I(a,"time",0)),c);u.intValue=I(a,"int",c.intValue),u.floatValue=I(a,"float",c.floatValue),u.stringValue=I(a,"string",c.stringValue),u.data.audioPath&&(u.volume=I(a,"volume",1),u.balance=I(a,"balance",0)),o.setFrame(i,u)}n.push(o)}let h=0;for(let o=0,i=n.length;o<i;o++)h=Math.max(h,n[o].getDuration());s.animations.push(new Oe(t,n,h))}},Xi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,n){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};function he(e,t,s,r){let n=e[0],h=I(n,"time",0),o=I(n,"value",s)*r,i=0;for(let l=0;;l++){t.setFrame(l,h,o);let a=e[l+1];if(!a)return t.shrink(i),t;let c=I(a,"time",0),u=I(a,"value",s)*r;n.curve&&(i=H(n.curve,t,i,l,0,h,c,o,u,r)),h=c,o=u,n=a}}function Zt(e,t,s,r,n,h){let o=e[0],i=I(o,"time",0),l=I(o,s,n)*h,a=I(o,r,n)*h,c=0;for(let u=0;;u++){t.setFrame(u,i,l,a);let d=e[u+1];if(!d)return t.shrink(c),t;let f=I(d,"time",0),m=I(d,s,n)*h,x=I(d,r,n)*h,b=o.curve;b&&(c=H(b,t,c,u,0,i,f,l,m,h),c=H(b,t,c,u,1,i,f,a,x,h)),i=f,l=m,a=x,o=d}}function H(e,t,s,r,n,h,o,i,l,a){if(e=="stepped")return t.setStepped(r),s;let c=n<<2,u=e[c],d=e[c+1]*a,f=e[c+2],m=e[c+3]*a;return t.setBezier(s,r,n,h,i,u,d,f,m,o,l),s+1}function I(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1))),ke.yDown=!0;function Fi(e,t){switch(t){case 0:return e.BlendMode.SrcOver;case 1:return e.BlendMode.Plus;case 2:return e.BlendMode.SrcOver;case 3:return e.BlendMode.Screen;default:return e.BlendMode.SrcOver}}function Ps(e){if(typeof Buffer<"u")return e.toString("utf-8");if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(e);throw new Error("Unsupported environment")}var Bs=class extends Lt{getImage(){return this._image}setFilters(e,t){}setWraps(e,t){}dispose(){const e=this._image;for(const t of e.paintPerBlendMode.values())t.delete();for(const t of e.shaders)t.delete();e.image.delete(),this._image=null}static async fromFile(e,t,s){const r=await s(t);if(!r)throw new Error(`Could not load image ${t}`);const n=e.MakeImageFromEncoded(r);if(!n)throw new Error(`Could not load image ${t}`);const h=new Map,o=[];for(const i of[0,1,2,3]){const l=new e.Paint,a=n.makeShaderOptions(e.TileMode.Clamp,e.TileMode.Clamp,e.FilterMode.Linear,e.MipmapMode.Linear);l.setShader(a),l.setBlendMode(Fi(e,i)),h.set(i,l),o.push(a)}return new Bs({shaders:o,paintPerBlendMode:h,image:n})}};async function Ei(e,t,s){const r=new Nt(Ps(await s(t))),n=t.lastIndexOf("/"),h=n>=0?t.substring(0,n+1):"";for(const o of r.pages){const i=await Bs.fromFile(e,h+o.name,s);o.setTexture(i)}return r}async function Ri(e,t,s,r=1){const n=new Is(t),h=e.endsWith(".json")?new Rs(n):new Fs(n);h.scale=r;let o=await s(e);return e.endsWith(".json")&&(o=Ps(o)),h.readSkeletonData(o)}var Vs=class{skeleton;animationState;constructor(e){this.skeleton=new ke(e),this.animationState=new Rt(new bs(e))}update(e,t=2){this.animationState.update(e),this.skeleton.update(e),this.animationState.apply(this.skeleton),this.skeleton.updateWorldTransform(t)}},Ls=class{constructor(e){this.ck=e}clipper=new Ze;tempColor=new D;tempColor2=new D;scratchPositions=R.newFloatArray(100);scratchColors=R.newFloatArray(100);scratchUVs=R.newFloatArray(100);render(e,t){t instanceof Vs&&(t=t.skeleton);let s=this.clipper,r=t.drawOrder,n=t.color;for(let h=0,o=r.length;h<o;h++){let i=r[h];if(!i.bone.active){s.clipEndWithSlot(i);continue}let l=i.getAttachment(),a=this.scratchPositions,c=this.scratchColors,u,d,f,m,x=0;if(l instanceof U){let b=l;a=a.length<8?R.newFloatArray(8):a,x=4,b.computeWorldVertices(i,a,0,2),f=Ls.QUAD_TRIANGLES,u=b.uvs,d=b.region?.texture,m=b.color}else if(l instanceof ye){let b=l;a=a.length<b.worldVerticesLength?R.newFloatArray(b.worldVerticesLength):a,x=b.worldVerticesLength>>1,b.computeWorldVertices(i,0,b.worldVerticesLength,a,0,2),f=b.triangles,d=b.region?.texture,u=b.uvs,m=b.color}else if(l instanceof Ee){let b=l;s.clipStart(i,b);continue}else{s.clipEndWithSlot(i);continue}if(d){s.isClipping()&&(s.clipTrianglesUnpacked(a,f,f.length,u),a=s.clippedVertices,u=s.clippedUVs,f=s.clippedTriangles);let b=i.color,w=this.tempColor;w.r=n.r*b.r*m.r,w.g=n.g*b.g*m.g,w.b=n.b*b.b*m.b,w.a=n.a*b.a*m.a,c.length/4<x&&(c=R.newFloatArray(x*4));for(let A=0,k=x*4;A<k;A+=4)c[A]=w.r,c[A+1]=w.g,c[A+2]=w.b,c[A+3]=w.a;const g=this.scratchUVs.length<u.length?R.newFloatArray(u.length):this.scratchUVs,p=d.getImage().image.width(),v=d.getImage().image.height();for(let A=0;A<u.length;A+=2)g[A]=u[A]*p,g[A+1]=u[A+1]*v;const y=i.data.blendMode,S=this.ck.MakeVertices(this.ck.VertexMode.Triangles,a,g,c,f,!1);e.drawVertices(S,this.ck.BlendMode.Modulate,d.getImage().paintPerBlendMode.get(y)),S.delete()}s.clipEndWithSlot(i)}s.clipEnd()}},Ns=Ls;B(Ns,"QUAD_TRIANGLES",[0,1,2,2,3,0]);export{pt as AlphaTimeline,Oe as Animation,Rt as AnimationState,Gs as AnimationStateAdapter,bs as AnimationStateData,js as AssetManagerBase,Is as AtlasAttachmentLoader,it as Attachment,we as AttachmentTimeline,Es as BinaryInput,Qe as BlendMode,_t as Bone,qt as BoneData,Ge as BoundingBoxAttachment,ws as CURRENT,Ee as ClippingAttachment,D as Color,Pe as ConstraintData,oe as CurveTimeline,ne as CurveTimeline1,qe as CurveTimeline2,Ws as DebugUtils,yt as DeformTimeline,Cs as Downloader,be as DrawOrderTimeline,Wt as Event,Ut as EventData,xs as EventQueue,Fe as EventTimeline,se as EventType,Pt as FIRST,Hs as FakeTexture,ze as HOLD_FIRST,ps as HOLD_MIX,Bt as HOLD_SUBSEQUENT,ks as IkConstraint,zt as IkConstraintData,vt as IkConstraintTimeline,Re as Inherit,mt as InheritTimeline,qs as IntSet,ns as Interpolation,F as MathUtils,ye as MeshAttachment,cs as MixBlend,ds as MixDirection,Ie as PathAttachment,Ce as PathConstraint,Gt as PathConstraintData,Ct as PathConstraintMixTimeline,At as PathConstraintPositionTimeline,It as PathConstraintSpacingTimeline,Ts as Physics,Yt as PhysicsConstraintDampingTimeline,Ft as PhysicsConstraintGravityTimeline,kt as PhysicsConstraintInertiaTimeline,Tt as PhysicsConstraintMassTimeline,Et as PhysicsConstraintMixTimeline,_e as PhysicsConstraintResetTimeline,Mt as PhysicsConstraintStrengthTimeline,ue as PhysicsConstraintTimeline,Xt as PhysicsConstraintWindTimeline,Ot as PointAttachment,Te as Pool,$e as PositionMode,as as Pow,_s as PowOut,bt as RGB2Timeline,wt as RGBA2Timeline,gt as RGBATimeline,xt as RGBTimeline,U as RegionAttachment,Ke as RotateMode,Xe as RotateTimeline,Vt as SETUP,Ue as SUBSEQUENT,ot as ScaleTimeline,ht as ScaleXTimeline,ct as ScaleYTimeline,Ae as SequenceTimeline,dt as ShearTimeline,ft as ShearXTimeline,ut as ShearYTimeline,ke as Skeleton,Fs as SkeletonBinary,Ti as SkeletonBounds,Ze as SkeletonClipping,$t as SkeletonData,Vs as SkeletonDrawable,Rs as SkeletonJson,Ns as SkeletonRenderer,Je as Skin,jt as SkinEntry,Ms as Slot,Kt as SlotData,je as SpacingMode,st as StringSet,Lt as Texture,Nt as TextureAtlas,Ss as TextureAtlasPage,Dt as TextureAtlasRegion,He as TextureFilter,vs as TextureRegion,ys as TextureWrap,Us as TimeKeeper,K as Timeline,gs as TrackEntry,Ys as TransformConstraint,Jt as TransformConstraintData,St as TransformConstraintTimeline,nt as TranslateTimeline,at as TranslateXTimeline,lt as TranslateYTimeline,ie as Triangulator,R as Utils,Ne as Vector2,le as VertexAttachment,zs as WindowedMean,Ri as loadSkeletonData,Ei as loadTextureAtlas};