@esotericsoftware/spine-core 4.2.111 → 4.2.113
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.
- package/dist/AssetManagerBase.js +6 -1
- package/dist/esm/spine-core.min.mjs +2 -2
- package/dist/esm/spine-core.mjs +5 -0
- package/dist/esm/spine-core.mjs.map +2 -2
- package/dist/iife/spine-core.js +5 -0
- package/dist/iife/spine-core.js.map +2 -2
- package/dist/iife/spine-core.min.js +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Bs=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},zt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},q=class mt{constructor(e=0,s=0,r=0,i=0){this.r=e,this.g=s,this.b=r,this.a=i}static WHITE=new mt(1,1,1,1);static RED=new mt(1,0,0,1);static GREEN=new mt(0,1,0,1);static BLUE=new mt(0,0,1,1);static MAGENTA=new mt(1,0,1,1);set(e,s,r,i){return this.r=e,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,r,i){return this.r+=e,this.g+=s,this.b+=r,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new mt){return s.setFromString(e)}},R=class nt{static PI=3.1415927;static PI2=nt.PI*2;static invPI2=1/nt.PI2;static radiansToDegrees=180/nt.PI;static radDeg=nt.radiansToDegrees;static degreesToRadians=nt.PI/180;static degRad=nt.degreesToRadians;static clamp(e,s,r){return e<s?s:e>r?r:e}static cosDeg(e){return Math.cos(e*nt.degRad)}static sinDeg(e){return Math.sin(e*nt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*nt.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return nt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,r){let i=Math.random(),h=s-e;return i<=(r-e)/h?e+Math.sqrt(i*h*(r-e)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Qe=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ze=class extends Qe{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Vs=class extends Ze{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},P=class bt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,r,i,h){for(let l=s,a=i;l<s+h;l++,a++)r[a]=e[l]}static arrayFill(e,s,r,i){for(let h=s;h<r;h++)e[h]=i}static setArraySize(e,s,r=0){let i=e.length;if(i==s)return e;if(e.length=s,i<s)for(let h=i;h<s;h++)e[h]=r;return e}static ensureArrayCapacity(e,s,r=0){return e.length>=s?e:bt.setArraySize(e,s,r)}static newArray(e,s){let r=new Array(e);for(let i=0;i<e;i++)r[i]=s;return r}static newFloatArray(e){if(bt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(e){if(bt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(e){return bt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return bt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,r=!0){for(var i=0;i<e.length;i++)if(e[i]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Ls=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},vt=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Yt=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Ns=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ds=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Ut=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},lt=class ks extends Ut{static nextID=0;id=ks.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,r,i,h,l){r=h+(r>>1)*l;let a=e.bone.skeleton,n=e.deform,o=this.vertices,c=this.bones;if(!c){n.length>0&&(o=n);let u=e.bone,w=u.worldX,b=u.worldY,p=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,A=h;A<r;v+=2,A+=l){let I=o[v],C=o[v+1];i[A]=I*p+C*g+w,i[A+1]=I*x+C*y+b}return}let f=0,d=0;for(let u=0;u<s;u+=2){let w=c[f];f+=w+1,d+=w}let m=a.bones;if(n.length==0)for(let u=h,w=d*3;u<r;u+=l){let b=0,p=0,g=c[f++];for(g+=f;f<g;f++,w+=3){let x=m[c[f]],y=o[w],v=o[w+1],A=o[w+2];b+=(y*x.a+v*x.b+x.worldX)*A,p+=(y*x.c+v*x.d+x.worldY)*A}i[u]=b,i[u+1]=p}else{let u=n;for(let w=h,b=d*3,p=d<<1;w<r;w+=l){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,b+=3,p+=2){let v=m[c[f]],A=o[b]+u[p],I=o[b+1]+u[p+1],C=o[b+2];g+=(A*v.a+I*v.b+v.worldX)*C,x+=(A*v.c+I*v.d+v.worldY)*C}i[w]=g,i[w+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ts=class Nt{static _nextID=0;id=Nt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Nt(this.regions.length);return P.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let r=e.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(e,s){let r=e,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return Nt._nextID++}},es=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(es||{}),ss=[0,1,2,3,4,5,6],Mt=class{name;timelines=[];timelineIds=new zt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,i,h,l,a){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let n=this.timelines;for(let o=0,c=n.length;o<c;o++)n[o].apply(t,e,s,i,h,l,a)}},is=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(is||{}),rs=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(rs||{}),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},H=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=P.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}},rt=class extends H{curves;constructor(t,e,s){super(t,s),this.curves=P.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=P.newFloatArray(e);P.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,i,h,l,a,n,o,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(r-h*2+a)*.03,u=(i-l*2+n)*.03,w=((h-a)*3-r+o)*.006,b=((l-n)*3-i+c)*.006,p=m*2+w,g=u*2+b,x=(h-r)*.3+m+w*.16666667,y=(l-i)*.3+u+b*.16666667,v=r+x,A=i+y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],o=this.frames[e+s];return o+(t-n)/(i[r]-n)*(i[r+1]-o)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=t){let n=i[r-2],o=i[r-1];return o+(t-n)/(i[r]-n)*(i[r+1]-o)}e+=this.getFrameEntries();let l=i[h-2],a=i[h-1];return a+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-a)}},st=class extends rt{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=e[s],h=e[s+1];return h+(t-i)/(e[s+2]-i)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);switch(s){case 0:return i+h*e;case 1:case 2:h+=i-r}return r+h*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);return s==0?i+(h-i)*e:r+(h-r)*e}getAbsoluteValue2(t,e,s,r,i,h){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}return s==0?i+(h-i)*e:r+(h-r)*e}getScaleValue(t,e,s,r,i,h){const l=this.frames;if(t<l[0]){switch(s){case 0:return h;case 1:return i+(h-i)*e}return i}let a=this.getCurveValue(t)*h;if(e==1)return s==3?i+a-h:a;if(r==1)switch(s){case 0:return h+(Math.abs(a)*R.signum(h)-h)*e;case 1:case 2:return i+(Math.abs(a)*R.signum(i)-i)*e}else{let n=0;switch(s){case 0:return n=Math.abs(h)*R.signum(a),n+(a-n)*e;case 1:case 2:return n=Math.abs(i)*R.signum(a),n+(a-n)*e}}return i+(a-h)*e}},Xt=class extends rt{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}},At=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,i,h,a.rotation,a.data.rotation))}},_t=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*i,a.y+=(a.data.y-a.y)*i}return}let o=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);o+=(n[f+3+1]-o)*u,c+=(n[f+3+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.x=a.data.x+o*i,a.y=a.data.y+c*i;break;case 1:case 2:a.x+=(a.data.x+o-a.x)*i,a.y+=(a.data.y+c-a.y)*i;break;case 3:a.x+=o*i,a.y+=c*i}}},Gt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,i,h,a.x,a.data.x))}},$t=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,i,h,a.y,a.data.y))}},Ht=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*i,a.scaleY+=(a.data.scaleY-a.scaleY)*i}return}let o,c,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);o+=(n[f+3+1]-o)*u,c+=(n[f+3+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(o*=a.data.scaleX,c*=a.data.scaleY,i==1)h==3?(a.scaleX+=o-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=o,a.scaleY=c);else{let m=0,u=0;if(l==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(o)*R.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*i;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(o)*R.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*i;break;case 3:a.scaleX+=(o-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}else switch(h){case 0:m=Math.abs(a.data.scaleX)*R.signum(o),u=Math.abs(a.data.scaleY)*R.signum(c),a.scaleX=m+(o-m)*i,a.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(a.scaleX)*R.signum(o),u=Math.abs(a.scaleY)*R.signum(c),a.scaleX=m+(o-m)*i,a.scaleY=u+(c-u)*i;break;case 3:a.scaleX+=(o-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}}}},jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,i,h,l,a.scaleX,a.data.scaleX))}},Jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,i,h,l,a.scaleY,a.data.scaleY))}},Kt=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*i,a.shearY+=(a.data.shearY-a.shearY)*i}return}let o=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);o+=(n[f+3+1]-o)*u,c+=(n[f+3+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.shearX=a.data.shearX+o*i,a.shearY=a.data.shearY+c*i;break;case 1:case 2:a.shearX+=(a.data.shearX+o-a.shearX)*i,a.shearY+=(a.data.shearY+c-a.shearY)*i;break;case 3:a.shearX+=o*i,a.shearY+=c*i}}},Qt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,i,h,a.shearX,a.data.shearX))}},Zt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,i,h,a.shearY,a.data.shearY))}},te=class extends H{boneIndex=0;constructor(t,e){super(t,[O.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,i,h,l){let a=t.bones[this.boneIndex];if(!a.active)return;if(l==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[H.search(n,s,2)+1]}},ee=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color;if(s<n[0]){let b=a.data.color;switch(h){case 0:o.setFromColor(b);return;case 1:o.add((b.r-o.r)*i,(b.g-o.g)*i,(b.b-o.b)*i,(b.a-o.a)*i)}return}let c=0,f=0,d=0,m=0,u=H.search(n,s,5),w=this.curves[u/5];switch(w){case 0:let b=n[u];c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];let p=(s-b)/(n[u+5]-b);c+=(n[u+5+1]-c)*p,f+=(n[u+5+2]-f)*p,d+=(n[u+5+3]-d)*p,m+=(n[u+5+4]-m)*p;break;case 1:c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,w-2),f=this.getBezierValue(s,u,2,w+18-2),d=this.getBezierValue(s,u,3,w+18*2-2),m=this.getBezierValue(s,u,4,w+18*3-2)}i==1?o.set(c,f,d,m):(h==0&&o.setFromColor(a.data.color),o.add((c-o.r)*i,(f-o.g)*i,(d-o.b)*i,(m-o.a)*i))}},se=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color;if(s<n[0]){let w=a.data.color;switch(h){case 0:o.r=w.r,o.g=w.g,o.b=w.b;return;case 1:o.r+=(w.r-o.r)*i,o.g+=(w.g-o.g)*i,o.b+=(w.b-o.b)*i}return}let c=0,f=0,d=0,m=H.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let w=n[m];c=n[m+1],f=n[m+2],d=n[m+3];let b=(s-w)/(n[m+4]-w);c+=(n[m+4+1]-c)*b,f+=(n[m+4+2]-f)*b,d+=(n[m+4+3]-d)*b;break;case 1:c=n[m+1],f=n[m+2],d=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2),d=this.getBezierValue(s,m,3,u+18*2-2)}if(i==1)o.r=c,o.g=f,o.b=d;else{if(h==0){let w=a.data.color;o.r=w.r,o.g=w.g,o.b=w.b}o.r+=(c-o.r)*i,o.g+=(f-o.g)*i,o.b+=(d-o.b)*i}}},ie=class extends st{slotIndex=0;constructor(t,e,s){super(t,e,O.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*i}return}let o=this.getCurveValue(s);i==1?n.a=o:(h==0&&(n.a=a.data.color.a),n.a+=(o-n.a)*i)}},re=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,h,l,a,n){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=a,this.frames[t+7]=n}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:o.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:o.add((y.r-o.r)*i,(y.g-o.g)*i,(y.b-o.b)*i,(y.a-o.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,8),x=this.curves[g>>3];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];let v=(s-y)/(n[g+8]-y);f+=(n[g+8+1]-f)*v,d+=(n[g+8+2]-d)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,w+=(n[g+8+5]-w)*v,b+=(n[g+8+6]-b)*v,p+=(n[g+8+7]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),w=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),p=this.getBezierValue(s,g,7,x+18*6-2)}if(i==1)o.set(f,d,m,u),c.r=w,c.g=b,c.b=p;else{if(h==0){o.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}o.add((f-o.r)*i,(d-o.g)*i,(m-o.b)*i,(u-o.a)*i),c.r+=(w-c.r)*i,c.g+=(b-c.g)*i,c.b+=(p-c.b)*i}}},ae=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,l,a){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=a}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:o.r=y.r,o.g=y.g,o.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:o.r+=(y.r-o.r)*i,o.g+=(y.g-o.g)*i,o.b+=(y.b-o.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,7),x=this.curves[g/7];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];let v=(s-y)/(n[g+7]-y);f+=(n[g+7+1]-f)*v,d+=(n[g+7+2]-d)*v,m+=(n[g+7+3]-m)*v,w+=(n[g+7+4]-w)*v,b+=(n[g+7+5]-b)*v,p+=(n[g+7+6]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),w=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),p=this.getBezierValue(s,g,6,x+18*5-2)}if(i==1)o.r=f,o.g=d,o.b=m,c.r=w,c.g=b,c.b=p;else{if(h==0){let y=a.data.color,v=a.data.darkColor;o.r=y.r,o.g=y.g,o.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}o.r+=(f-o.r)*i,o.g+=(d-o.g)*i,o.b+=(m-o.b)*i,c.r+=(w-c.r)*i,c.g+=(b-c.g)*i,c.b+=(p-c.b)*i}}},ut=class extends H{slotIndex=0;attachmentNames;constructor(t,e){super(t,[O.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(a.bone.active){if(l==1){h==0&&this.setAttachment(t,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,a,a.data.attachmentName);return}this.setAttachment(t,a,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},ne=class extends rt{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[O.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,i,h,l,a,n,o,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(r-h*2+a)*.03,u=n*.03-l*.06,w=((h-a)*3-r+o)*.006,b=(l-n+.33333333)*.018,p=m*2+w,g=u*2+b,x=(h-r)*.3+m+w*.16666667,y=l*.3+u+b*.16666667,v=r+x,A=y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let a=this.frames[e];return(t-a)/(this.frames[e+this.getFrameEntries()]-a);case 1:return 0}if(r-=2,s[r]>t){let a=this.frames[e];return s[r+1]*(t-a)/(s[r]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let a=s[r-2],n=s[r-1];return n+(t-a)/(s[r]-a)*(s[r+1]-n)}let h=s[i-2],l=s[i-1];return l+(1-l)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,r,i,h,l){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof lt)||n.timelineAttachment!=this.attachment)return;let o=a.deform;o.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:o.length=0;return;case 1:if(i==1){o.length=0;return}o.length=f;let g=n;if(g.bones){i=1-i;for(var m=0;m<f;m++)o[m]*=i}else{let x=g.vertices;for(var m=0;m<f;m++)o[m]+=(x[m]-o[m])*i}}return}if(o.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(i==1)if(h==3){let x=n;if(x.bones)for(let y=0;y<f;y++)o[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)o[v]+=g[v]-y[v]}}else P.arrayCopy(g,0,o,0,f);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<f;v++)o[v]=g[v]*i;else{let v=y.vertices;for(let A=0;A<f;A++){let I=v[A];o[A]=I+(g[A]-I)*i}}break}case 1:case 2:for(let y=0;y<f;y++)o[y]+=(g[y]-o[y])*i;break;case 3:let x=n;if(x.bones)for(let y=0;y<f;y++)o[y]+=g[y]*i;else{let y=x.vertices;for(let v=0;v<f;v++)o[v]+=(g[v]-y[v])*i}}return}let u=H.search1(d,s),w=this.getCurvePercent(s,u),b=c[u],p=c[u+1];if(i==1)if(h==3){let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];o[x]+=y+(p[x]-y)*w}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];o[y]+=v+(p[y]-v)*w-x[y]}}}else for(let g=0;g<f;g++){let x=b[g];o[g]=x+(p[g]-x)*w}else switch(h){case 0:{let x=n;if(x.bones)for(let y=0;y<f;y++){let v=b[y];o[y]=(v+(p[y]-v)*w)*i}else{let y=x.vertices;for(let v=0;v<f;v++){let A=b[v],I=y[v];o[v]=I+(A+(p[v]-A)*w-I)*i}}break}case 1:case 2:for(let x=0;x<f;x++){let y=b[x];o[x]+=(y+(p[x]-y)*w-o[x])*i}break;case 3:let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];o[x]+=(y+(p[x]-y)*w)*i}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];o[y]+=(v+(p[y]-v)*w-x[y])*i}}}}},Ft=class Ts extends H{static propertyIds=[""+O.event];events;constructor(e){super(e,Ts.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,r,i,h,l,a){if(!i)return;let n=this.frames,o=this.frames.length;if(s>r)this.apply(e,s,Number.MAX_VALUE,i,h,l,a),s=-1;else if(s>=n[o-1])return;if(r<n[0])return;let c=0;if(s<n[0])c=0;else{c=H.search1(n,s)+1;let f=n[c];for(;c>0&&n[c-1]==f;)c--}for(;c<o&&r>=n[c];c++)i.push(this.events[c])}},wt=class Ys extends H{static propertyIds=[""+O.drawOrder];drawOrders;constructor(e){super(e,Ys.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,r){this.frames[e]=s,this.drawOrders[e]=r}apply(e,s,r,i,h,l,a){if(a==1){l==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(r<this.frames[0]){(l==0||l==1)&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let n=H.search1(this.frames,r),o=this.drawOrders[n];if(!o)P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,f=e.slots;for(let d=0,m=o.length;d<m;d++)c[d]=f[o[d]]}}},le=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,h,l){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,r,i,h,l){let a=t.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*i,a.softness+=(a.data.softness-a.softness)*i,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let o=0,c=0,f=H.search(n,s,6),d=this.curves[f/6];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+6]-m);o+=(n[f+6+1]-o)*u,c+=(n[f+6+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(a.mix=a.data.mix+(o-a.data.mix)*i,a.softness=a.data.softness+(c-a.data.softness)*i,l==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0)):(a.mix+=(o-a.mix)*i,a.softness+=(c-a.softness)*i,l==0&&(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0))}},oe=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,l,a){let n=this.frames;t*=7,n[t]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i,n[t+4]=h,n[t+5]=l,n[t+6]=a}apply(t,e,s,r,i,h,l){let a=t.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let p=a.data;switch(h){case 0:a.mixRotate=p.mixRotate,a.mixX=p.mixX,a.mixY=p.mixY,a.mixScaleX=p.mixScaleX,a.mixScaleY=p.mixScaleY,a.mixShearY=p.mixShearY;return;case 1:a.mixRotate+=(p.mixRotate-a.mixRotate)*i,a.mixX+=(p.mixX-a.mixX)*i,a.mixY+=(p.mixY-a.mixY)*i,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*i,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*i,a.mixShearY+=(p.mixShearY-a.mixShearY)*i}return}let o,c,f,d,m,u,w=H.search(n,s,7),b=this.curves[w/7];switch(b){case 0:let p=n[w];o=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];let g=(s-p)/(n[w+7]-p);o+=(n[w+7+1]-o)*g,c+=(n[w+7+2]-c)*g,f+=(n[w+7+3]-f)*g,d+=(n[w+7+4]-d)*g,m+=(n[w+7+5]-m)*g,u+=(n[w+7+6]-u)*g;break;case 1:o=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];break;default:o=this.getBezierValue(s,w,1,b-2),c=this.getBezierValue(s,w,2,b+18-2),f=this.getBezierValue(s,w,3,b+18*2-2),d=this.getBezierValue(s,w,4,b+18*3-2),m=this.getBezierValue(s,w,5,b+18*4-2),u=this.getBezierValue(s,w,6,b+18*5-2)}if(h==0){let p=a.data;a.mixRotate=p.mixRotate+(o-p.mixRotate)*i,a.mixX=p.mixX+(c-p.mixX)*i,a.mixY=p.mixY+(f-p.mixY)*i,a.mixScaleX=p.mixScaleX+(d-p.mixScaleX)*i,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*i,a.mixShearY=p.mixShearY+(u-p.mixShearY)*i}else a.mixRotate+=(o-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i,a.mixScaleX+=(d-a.mixScaleX)*i,a.mixScaleY+=(m-a.mixScaleY)*i,a.mixShearY+=(u-a.mixShearY)*i}},he=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,l){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,i,h,a.position,a.data.position))}},ce=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,l){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,i,h,a.spacing,a.data.spacing))}},de=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=r,h[t+3]=i}apply(t,e,s,r,i,h,l){let a=t.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*i,a.mixX+=(a.data.mixX-a.mixX)*i,a.mixY+=(a.data.mixY-a.mixY)*i}return}let o,c,f,d=H.search(n,s,4),m=this.curves[d>>2];switch(m){case 0:let u=n[d];o=n[d+1],c=n[d+2],f=n[d+3];let w=(s-u)/(n[d+4]-u);o+=(n[d+4+1]-o)*w,c+=(n[d+4+2]-c)*w,f+=(n[d+4+3]-f)*w;break;case 1:o=n[d+1],c=n[d+2],f=n[d+3];break;default:o=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),f=this.getBezierValue(s,d,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(o-u.mixRotate)*i,a.mixX=u.mixX+(c-u.mixX)*i,a.mixY=u.mixY+(f-u.mixY)*i}else a.mixRotate+=(o-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i}},ct=class extends st{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,l){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const o of t.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,i,h,this.get(o),this.setup(o),n))}else a=t.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,i,h,this.get(a),this.setup(a)))}},fe=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ue=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},me=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ge=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},xe=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},we=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},be=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},pe=class Ms extends H{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,Ms.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,r,i,h,l,a){let n;if(this.constraintIndex!=-1&&(n=e.physicsConstraints[this.constraintIndex],!n.active))return;const o=this.frames;if(s>r)this.apply(e,s,Number.MAX_VALUE,[],h,l,a),s=-1;else if(s>=o[o.length-1])return;if(!(r<o[0])&&(s<o[0]||r>=o[H.search1(o,s)+1]))if(n!=null)n.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},ye=class dt extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,r){super(e,[O.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,r,i,h){let l=this.frames;e*=dt.ENTRIES,l[e]=s,l[e+dt.MODE]=r|i<<4,l[e+dt.DELAY]=h}apply(e,s,r,i,h,l,a){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let o=n.attachment,c=this.attachment;if(o!=c&&(!(o instanceof lt)||o.timelineAttachment!=c))return;if(a==1){l==0&&(n.sequenceIndex=-1);return}let f=this.frames;if(r<f[0]){(l==0||l==1)&&(n.sequenceIndex=-1);return}let d=H.search(f,r,dt.ENTRIES),m=f[d],u=f[d+dt.MODE],w=f[d+dt.DELAY];if(!this.attachment.sequence)return;let b=u>>4,p=this.attachment.sequence.regions.length,g=ss[u&15];if(g!=0)switch(b+=(r-m)/w+1e-5|0,g){case 1:b=Math.min(p-1,b);break;case 2:b%=p;break;case 3:{let x=(p<<1)-2;b=x==0?0:b%x,b>=p&&(b=x-b);break}case 4:b=Math.max(p-1-b,0);break;case 5:b=p-1-b%p;break;case 6:{let x=(p<<1)-2;b=x==0?0:(b+p-1)%x,b>=p&&(b=x-b)}}n.sequenceIndex=b}},Os=class Dt{static _emptyAnimation=new Mt("<empty>",[],0);static emptyAnimation(){return Dt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ns(this);propertyIDs=new zt;animationsChanged=!1;trackEntryPool=new vt(()=>new as);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let l=e*h.timeScale;if(h.delay>0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+e)*a.timeScale,h.trackTime+=l,this.setCurrent(r,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){let r=e.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((r.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=e),e.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let d=0,m=r.length;d<m;d++){let u=r[d];if(!u||u.delay>0)continue;i=!0;let w=d==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,e,w):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let p=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,I=A.length;if(d==0&&b==1||w==3){d==0&&(p=!0);for(let C=0;C<I;C++){P.webkit602BugfixHelper(b,w);var h=A[C];h instanceof ut?this.applyAttachmentTimeline(h,e,y,w,p):h.apply(e,g,y,v,b,w,0)}}else{let C=u.timelineMode,T=u.shortestRotation,M=!T&&u.timelinesRotation.length!=I<<1;M&&(u.timelinesRotation.length=I<<1);for(let Y=0;Y<I;Y++){let F=A[Y],E=C[Y]==Et?w:0;!T&&F instanceof At?this.applyRotateTimeline(F,e,y,b,E,u.timelinesRotation,Y<<1,M):F instanceof ut?this.applyAttachmentTimeline(F,e,y,w,p):(P.webkit602BugfixHelper(b,w),F.apply(e,g,y,v,b,E,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var l=this.unkeyedState+Se,a=e.slots,n=0,o=e.slots.length;n<o;n++){var c=a[n];if(c.attachmentState==l){var f=c.data.attachmentName;c.setAttachment(f?e.getAttachment(c.data.index,f):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s,r){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;e.mixDuration==0?(h=1,r==1&&(r=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let l=h<i.mixAttachmentThreshold,a=h<i.mixDrawOrderThreshold,n=i.animation.timelines,o=n.length,c=i.alpha*e.interruptAlpha,f=c*(1-h),d=i.animationLast,m=i.getAnimationTime(),u=m,w=null;if(i.reverse?u=i.animation.duration-u:h<i.eventThreshold&&(w=this.events),r==3)for(let b=0;b<o;b++)n[b].apply(s,d,u,w,f,r,1);else{let b=i.timelineMode,p=i.timelineHoldMix,g=i.shortestRotation,x=!g&&i.timelinesRotation.length!=o<<1;x&&(i.timelinesRotation.length=o<<1),i.totalAlpha=0;for(let y=0;y<o;y++){let v=n[y],A=1,I,C=0;switch(b[y]){case Et:if(!a&&v instanceof wt)continue;I=r,C=f;break;case ve:I=0,C=f;break;case Ae:I=r,C=c;break;case Rt:I=0,C=c;break;default:I=0;let T=p[y];C=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=C,!g&&v instanceof At?this.applyRotateTimeline(v,s,u,C,I,i.timelinesRotation,y<<1,x):v instanceof ut?this.applyAttachmentTimeline(v,s,u,I,l&&C>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(C,r),a&&v instanceof wt&&I==0&&(A=0),v.apply(s,d,u,w,C,I,A))}}return e.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(e,s,r,i,h){var l=s.slots[e.slotIndex];l.bone.active&&(r<e.frames[0]?(i==0||i==1)&&this.setAttachment(s,l,l.data.attachmentName,h):this.setAttachment(s,l,e.attachmentNames[H.search1(e.frames,r)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+Se))}setAttachment(e,s,r,i){s.setAttachment(r?e.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,s,r,i,h,l,a,n){if(n&&(l[a]=0),i==1){e.apply(s,0,r,null,1,h,0);return}let o=s.bones[e.boneIndex];if(!o.active)return;let c=e.frames,f=0,d=0;if(r<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:f=o.rotation,d=o.data.rotation}else f=h==0?o.data.rotation:o.rotation,d=o.data.rotation+e.getCurveValue(r);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=l[a];else{let w=0,b=0;n?(w=0,b=u):(w=l[a],b=l[a+1]);let p=w-w%360;m=u+p;let g=u>=0,x=w>=0;Math.abs(b)<=90&&R.signum(b)!=R.signum(u)&&(Math.abs(w-p)>180?(m+=360*R.signum(w),x=g):p!=0?m-=360*R.signum(w):x=g),x!=g&&(m+=360*R.signum(w)),l[a]=m}l[a+1]=u,o.rotation=f+m*i}queueEvents(e,s){let r=e.animationStart,i=e.animationEnd,h=i-r,l=e.trackLast%h,a=this.events,n=0,o=a.length;for(;n<o;n++){let f=a[n];if(f.time<l)break;f.time>i||this.queue.event(e,f)}let c=!1;if(e.loop)if(h==0)c=!0;else{const f=Math.floor(e.trackTime/h);c=f>0&&f>Math.floor(e.trackLast/h)}else c=s>=i&&e.animationLast<i;for(c&&this.queue.complete(e);n<o;n++){let f=a[n];f.time<r||this.queue.event(e,f)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,r){let i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,i,r)}setAnimationWith(e,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let l=this.trackEntry(e,s,r,h);return this.setCurrent(e,l,i),this.queue.drain(),l}addAnimation(e,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,r,i)}addAnimationWith(e,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(e,s,r,h);return h?(h.next=l,l.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(e,l,!0),this.queue.drain(),i<0&&(i=0)),l.delay=i,l}setEmptyAnimation(e,s=0){let r=this.setAnimationWith(e,Dt.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(e,s=0,r=0){let i=this.addAnimationWith(e,Dt.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(P.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let s=e.mixingTo,r=e.animation.timelines,i=e.animation.timelines.length,h=e.timelineMode;h.length=i;let l=e.timelineHoldMix;l.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<i;n++)h[n]=a.addAll(r[n].getPropertyIds())?Rt:Ae;return}t:for(let n=0;n<i;n++){let o=r[n],c=o.getPropertyIds();if(!a.addAll(c))h[n]=Et;else if(!s||o instanceof ut||o instanceof wt||o instanceof Ft||!s.animation.hasTimeline(c))h[n]=ve;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(e.mixDuration>0){h[n]=os,l[n]=f;continue t}break}h[n]=Rt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},as=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ns=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let l=0;l<e.length;l++){let a=e[l];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let l=0;l<e.length;l++){let a=e[l];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let l=0;l<e.length;l++){let a=e[l];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let l=0;l<e.length;l++){let a=e[l];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let l=0;l<e.length;l++){let a=e[l];a.complete&&a.complete(i)}break;case 5:let h=t[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let l=0;l<e.length;l++){let a=e[l];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ls=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(ls||{}),qs=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Et=0,ve=1,Ae=2,Rt=3,os=4,Se=1,hs=2,Ws=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ie=class Xs extends lt{color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Xs(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ce=class Fs extends lt{endSlot=null;color=new q(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Fs(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},cs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Pt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Pt||{}),ds=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(ds||{}),fs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},zs=class extends cs{setFilters(t,e){}setWraps(t,e){}dispose(){}},ke=class{pages=new Array;regions=new Array;constructor(t){let e=new Us(t),s=new Array(4),r={};r.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},r.format=()=>{},r.filter=o=>{o.minFilter=P.enumValue(Pt,s[1]),o.magFilter=P.enumValue(Pt,s[2])},r.repeat=o=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},r.pma=o=>{o.pma=s[1]=="true"};var i={};i.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},i.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},i.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},i.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},i.rotate=o=>{let c=s[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},i.index=o=>{o.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let l=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)l=null,h=e.readLine();else if(l){let o=new Te(l,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let f=i[s[0]];if(f)f(o);else{a||(a=[]),n||(n=[]),a.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));n.push(d)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height),a&&a.length>0&&n&&n.length>0&&(o.names=a,o.values=n,a=null,n=null),o.u=o.x/l.width,o.v=o.y/l.height,o.degrees==90?(o.u2=(o.x+o.height)/l.width,o.v2=(o.y+o.width)/l.height):(o.u2=(o.x+o.width)/l.width,o.v2=(o.y+o.height)/l.height),this.regions.push(o)}else{for(l=new us(h.trim());e.readEntry(s,h=e.readLine())!=0;){let o=r[s[0]];o&&o(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Us=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=e.indexOf(",",i);if(h==-1)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},us=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Te=class extends fs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Bt=class _e extends lt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new q(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new q(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=P.newFloatArray(e.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,l=0,a=0;if(this.region instanceof Te){let n=this.region,o=n.page,c=o.width,f=o.height;switch(n.degrees){case 90:i-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/f,l=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+e[d+1]*l,s[d+1]=h+(1-e[d])*a;return;case 180:i-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/f,l=n.originalWidth/c,a=n.originalHeight/f;for(let d=0;d<r;d+=2)s[d]=i+(1-e[d])*l,s[d+1]=h+(1-e[d+1])*a;return;case 270:i-=n.offsetY/c,h-=n.offsetX/f,l=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+(1-e[d+1])*l,s[d+1]=h+e[d]*a;return}i-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/f,l=n.originalWidth/c,a=n.originalHeight/f}else this.region?(l=this.region.u2-i,a=this.region.v2-h):(i=h=0,l=a=1);for(let n=0;n<r;n+=2)s[n]=i+e[n]*l,s[n+1]=h+e[n+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new _e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,r,i,h,l){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,r,i,h,l)}newLinkedMesh(){let e=new _e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},St=class Es extends lt{lengths=[];closed=!1;constantSpeed=!1;color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Es(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},ms=class Rs extends lt{x=0;y=0;rotation=0;color=new q(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*R.degRad,r=Math.cos(s),i=Math.sin(s),h=r*e.a+i*e.b,l=r*e.c+i*e.d;return R.atan2Deg(l,h)}copy(){let e=new Rs(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Ye=class Ps extends Ut{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new q(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new q(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,l=-this.height/2*this.scaleY+this.region.offsetY*i,a=h+this.region.width*r,n=l+this.region.height*i,o=this.rotation*R.degRad,c=Math.cos(o),f=Math.sin(o),d=this.x,m=this.y,u=h*c+d,w=h*f,b=l*c+m,p=l*f,g=a*c+d,x=a*f,y=n*c+m,v=n*f,A=this.offset;A[0]=u-p,A[1]=b+w,A[2]=u-v,A[3]=y+w,A[4]=g-v,A[5]=y+x,A[6]=g-p,A[7]=b+x,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,r,i){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,l=this.offset,a=h.worldX,n=h.worldY,o=h.a,c=h.b,f=h.c,d=h.d,m=0,u=0;m=l[0],u=l[1],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=l[2],u=l[3],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=l[4],u=l[5],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=l[6],u=l[7],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n}copy(){let e=new Ps(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,P.arrayCopy(this.uvs,0,e.uvs,0,8),P.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},_s=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let l=s.getPath(e,i),a=this.atlas.findRegion(l);if(a==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new Ye(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=h}return i}newMeshAttachment(t,e,s,r){let i=new Bt(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=h}return i}newBoundingBoxAttachment(t,e){return new Ie(e)}newPathAttachment(t,e){return new St(e)}newPointAttachment(t,e){return new ms(e)}newClippingAttachment(t,e){return new Ce(e)}},Me=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new q;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Vt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Vt||{}),Xe=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,h,l){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=l;let a=this.parent;if(!a){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,w=(s+h)*R.degRad,b=(s+90+l)*R.degRad;this.a=Math.cos(w)*r*m,this.b=Math.cos(b)*i*m,this.c=Math.sin(w)*r*u,this.d=Math.sin(b)*i*u,this.worldX=t*m+d.x,this.worldY=e*u+d.y;return}let n=a.a,o=a.b,c=a.c,f=a.d;switch(this.worldX=n*t+o*e+a.worldX,this.worldY=c*t+f*e+a.worldY,this.inherit){case 0:{const d=(s+h)*R.degRad,m=(s+90+l)*R.degRad,u=Math.cos(d)*r,w=Math.cos(m)*i,b=Math.sin(d)*r,p=Math.sin(m)*i;this.a=n*u+o*b,this.b=n*w+o*p,this.c=c*u+f*b,this.d=c*w+f*p;return}case 1:{const d=(s+h)*R.degRad,m=(s+90+l)*R.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(m)*i,this.c=Math.sin(d)*r,this.d=Math.sin(m)*i;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=d,c*=m;let u=n*n+c*c,w=0;u>1e-4?(u=Math.abs(n*f*m-o*d*c)/u,o=c*u,f=n*u,w=Math.atan2(c,n)*R.radDeg):(n=0,c=0,w=90-Math.atan2(f,o)*R.radDeg);const b=(s+h-w)*R.degRad,p=(s+l-w+90)*R.degRad,g=Math.cos(b)*r,x=Math.cos(p)*i,y=Math.sin(b)*r,v=Math.sin(p)*i;this.a=n*g-o*y,this.b=n*x-o*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=R.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(n*d+o*m)/this.skeleton.scaleX,w=(c*d+f*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+w*w);b>1e-5&&(b=1/b),u*=b,w*=b,b=Math.sqrt(u*u+w*w),this.inherit==3&&n*f-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(w,u);const p=Math.cos(s)*b,g=Math.sin(s)*b;h*=R.degRad,l=(90+l)*R.degRad;const x=Math.cos(h)*r,y=Math.cos(l)*i,v=Math.sin(h)*r,A=Math.sin(l)*i;this.a=u*x+p*v,this.b=u*y+p*A,this.c=w*x+g*v,this.d=w*y+g*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*R.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*R.radDeg;return}let e=t.a,s=t.b,r=t.c,i=t.d,h=1/(e*i-s*r),l=i*h,a=s*h,n=r*h,o=e*h,c=this.worldX-t.worldX,f=this.worldY-t.worldY;this.ax=c*l-f*a,this.ay=f*o-c*n;let d,m,u,w;if(this.inherit==1)d=this.a,m=this.b,u=this.c,w=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(e*i-s*r)/(e*e+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*i-s*r),l=i*h,a=s*h;break}case 3:case 4:let b=R.cosDeg(this.rotation),p=R.sinDeg(this.rotation);e=(e*b+s*p)/this.skeleton.scaleX,r=(r*b+i*p)/this.skeleton.scaleY;let g=Math.sqrt(e*e+r*r);g>1e-5&&(g=1/g),e*=g,r*=g,g=Math.sqrt(e*e+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=R.PI/2+Math.atan2(r,e);s=Math.cos(x)*g,i=Math.sin(x)*g,h=1/(e*i-s*r),l=i*h,a=s*h,n=r*h,o=e*h}d=l*this.a-a*this.c,m=l*this.b-a*this.d,u=o*this.c-n*this.a,w=o*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let b=d*w-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*w,b)*R.radDeg,this.arotation=Math.atan2(u,d)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+w*w),this.ashearY=0,this.arotation=90-Math.atan2(w,m)*R.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*R.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=R.sinDeg(t),s=R.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*R.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=R.sinDeg(t),s=R.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*R.radDeg}rotateWorld(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}},It=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Gs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new xs,r=new gs){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=r}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),r(h)},(h,l)=>{const a=`Couldn't load binary ${t}: status ${h}, ${l}`;this.error(s,t,a),i(a)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,r=>{this.success(e,t,r)},(r,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${r}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),r(h)},(h,l)=>{const a=`Couldn't load JSON ${t}: status ${h}, ${l}`;this.error(s,t,a),i(a)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[t],i=r!==void 0;return i&&(this.cache.assetsLoaded[t]=r.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),i}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),i(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.createTexture(t,a);this.success(e,t,n),r(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.createTexture(t,a);this.success(e,t,n),r(n)},a.onerror=()=>{const n=`Couldn't load image: ${t}`;this.error(s,t,n),i(n)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((l,a)=>{this.downloader.downloadText(t,n=>{try{const o=this.createTextureAtlas(t,n);let c=o.pages.length,f=!1;for(let d of o.pages)this.loadTexture(r?r[d.name]:h+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(e,t,o),l(o)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,w),a(w)}f=!0})}catch(o){const c=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,c),a(c)}},(n,o)=>{const c=`Couldn't load texture atlas ${t}: status ${n}, ${o}`;this.error(s,t,c),a(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},r){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,h)=>{this.downloader.downloadText(t,l=>{try{const a=this.createTextureAtlas(t,l);this.success(e,t,a),i(a)}catch(a){const n=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,n),h(n)}},(l,a)=>{const n=`Couldn't load texture atlas ${t}: status ${l}, ${a}`;this.error(s,t,n),h(n)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(r,i)=>e(i),(r,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
-
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof ke){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new ke(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const r of s.pages)r.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),r=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&r()},s}},gs=class Ot{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Ot.AVAILABLE_CACHES.get(e);if(s)return s;const r=new Ot;return Ot.AVAILABLE_CACHES.set(e,r),r}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},xs=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToString(r))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||t,!0);let h=()=>{this.finish(t,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(t,e,s){this.downloadText(t,r=>{e(JSON.parse(r))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(r))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let i=new XMLHttpRequest;i.open("GET",r||t,!0),i.responseType="arraybuffer";let h=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(t,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=e==200||e==0?[s]:[e,s];for(let h=i.length-1,l=r.length;h<l;h+=2)r[h].apply(null,i)}},Fe=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Ee=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},ws=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,r,i,h,l){let a=t.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,o=a.b,c=a.c,f=a.d,d=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case 1:m=(e-t.worldX)*R.signum(t.skeleton.scaleX),u=(s-t.worldY)*R.signum(t.skeleton.scaleY);break;case 2:let p=Math.abs(n*f-o*c)/Math.max(1e-4,n*n+c*c),g=n/t.skeleton.scaleX,x=c/t.skeleton.scaleY;o=-x*p*t.skeleton.scaleX,f=g*p*t.skeleton.scaleY,d+=Math.atan2(x,g)*R.radDeg;default:let y=e-a.worldX,v=s-a.worldY,A=n*f-o*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*o)/A-t.ax,u=(v*n-y*c)/A-t.ay)}d+=Math.atan2(u,m)*R.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=t.ascaleX,b=t.ascaleY;if(r||i){switch(t.inherit){case 3:case 4:m=e-t.worldX,u=s-t.worldY}const p=t.data.length*w;if(p>1e-4){const g=m*m+u*u;if(r&&g<p*p||i&&g>p*p){const x=(Math.sqrt(g)/p-1)*l+1;w*=x,h&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*l,w,b,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,h,l,a,n){if(t.inherit!=0||e.inherit!=0)return;let o=t.ax,c=t.ay,f=t.ascaleX,d=t.ascaleY,m=f,u=d,w=e.ascaleX,b=0,p=0,g=0;f<0?(f=-f,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),w<0?(w=-w,p=180):p=0;let x=e.ax,y=0,v=0,A=0,I=t.a,C=t.b,T=t.c,M=t.d,Y=Math.abs(f-d)<=1e-4;!Y||h?(y=0,v=I*x+t.worldX,A=T*x+t.worldY):(y=e.ay,v=I*x+C*y+t.worldX,A=T*x+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");I=F.a,C=F.b,T=F.c,M=F.d;let E=I*M-C*T,k=v-F.worldX,X=A-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let V=(k*M-X*C)*E-o,N=(X*I-k*T)*E-c,L=Math.sqrt(V*V+N*N),D=e.data.length*w,$,U;if(L<1e-4){this.apply1(t,s,r,!1,h,!1,n),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}k=s-F.worldX,X=r-F.worldY;let j=(k*M-X*C)*E-o,B=(X*I-k*T)*E-c,W=j*j+B*B;if(a!=0){a*=f*(w+1)*.5;let J=Math.sqrt(W),K=J-L-D*f+a;if(K>0){let Q=Math.min(1,K/(a*2))-1;Q=(K-a*(1-Q*Q))/J,j-=Q*j,B-=Q*B,W=j*j+B*B}}t:if(Y){D*=f;let J=(W-L*L-D*D)/(2*L*D);J<-1?(J=-1,U=Math.PI*i):J>1?(J=1,U=0,h&&(I=(Math.sqrt(W)/(L+D)-1)*n+1,m*=I,l&&(u*=I))):U=Math.acos(J)*i,I=L+D*J,C=D*Math.sin(U),$=Math.atan2(B*I-j*C,j*I+B*C)}else{I=f*D,C=d*D;let J=I*I,K=C*C,Q=Math.atan2(B,j);T=K*L*L+J*W-J*K;let it=-2*K*L,gt=K-J;if(M=it*it-4*gt*T,M>=0){let xt=Math.sqrt(M);it<0&&(xt=-xt),xt=-(it+xt)*.5;let yt=xt/gt,Ke=T/xt,Tt=Math.abs(yt)<Math.abs(Ke)?yt:Ke;if(yt=W-Tt*Tt,yt>=0){X=Math.sqrt(yt)*i,$=Q-Math.atan2(X,Tt),U=Math.atan2(X/d,(Tt-L)/f);break t}}let pt=R.PI,Ct=L-I,qt=Ct*Ct,He=0,je=0,kt=L+I,Wt=kt*kt,Je=0;T=-I*L/(J-K),T>=-1&&T<=1&&(T=Math.acos(T),k=I*Math.cos(T)+L,X=C*Math.sin(T),M=k*k+X*X,M<qt&&(pt=T,qt=M,Ct=k,He=X),M>Wt&&(je=T,Wt=M,kt=k,Je=X)),W<=(qt+Wt)*.5?($=Q-Math.atan2(He*i,Ct),U=pt*i):($=Q-Math.atan2(Je*i,kt),U=je*i)}let G=Math.atan2(y,x)*g,tt=t.arotation;$=($-G)*R.radDeg+b-tt,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(o,c,tt+$*n,m,u,0,0),tt=e.arotation,U=((U+G)*R.radDeg-e.ashearX)*g+p-tt,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(x,y,tt+U*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Re=class extends It{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},Pe=class extends It{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Be=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Be||{}),Ve=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ve||{}),Le=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Le||{}),bs=class ft{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,h=e.bones.length;i<h;i++){let l=s.findBone(e.bones[i].name);if(!l)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(l)}let r=s.findSlot(e.target.name);if(!r)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=r,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof St))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let l=this.data,a=l.rotateMode==0,n=l.rotateMode==2,o=this.bones,c=o.length,f=a?c:c+1,d=P.setArraySize(this.spaces,f),m=n?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(l.spacingMode){case 2:if(n)for(let A=0,I=f-1;A<I;A++){let C=o[A],T=C.data.length,M=T*C.a,Y=T*C.c;m[A]=Math.sqrt(M*M+Y*Y)}P.arrayFill(d,1,f,u);break;case 3:let y=0;for(let A=0,I=f-1;A<I;){let C=o[A],T=C.data.length;if(T<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=T*C.a,Y=T*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=F,y+=F}}if(y>0){y=f/y*u;for(let A=1;A<f;A++)d[A]*=y}break;default:let v=l.spacingMode==0;for(let A=0,I=f-1;A<I;){let C=o[A],T=C.data.length;if(T<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=T*C.a,Y=T*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=(v?T+u:u)*F/T}}}let w=this.computeWorldPositions(s,f,a),b=w[0],p=w[1],g=l.offsetRotation,x=!1;if(g==0)x=l.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?R.degRad:-R.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=o[y];A.worldX+=(b-A.worldX)*i,A.worldY+=(p-A.worldY)*h;let I=w[v],C=w[v+1],T=I-b,M=C-p;if(n){let Y=m[y];if(Y!=0){let F=(Math.sqrt(T*T+M*M)/Y-1)*r+1;A.a*=F,A.c*=F}}if(b=I,p=C,r>0){let Y=A.a,F=A.b,E=A.c,k=A.d,X=0,V=0,N=0;if(a?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(M,T),X-=Math.atan2(E,Y),x){V=Math.cos(X),N=Math.sin(X);let L=A.data.length;b+=(L*(V*Y-N*E)-T)*r,p+=(L*(N*Y+V*E)-M)*r}else X+=g;X>R.PI?X-=R.PI2:X<-R.PI&&(X+=R.PI2),X*=r,V=Math.cos(X),N=Math.sin(X),A.a=V*Y-N*E,A.b=V*F-N*k,A.c=N*Y+V*E,A.d=N*F+V*k}A.updateAppliedTransform()}}computeWorldPositions(e,s,r){let i=this.target,h=this.position,l=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,o=e.closed,c=e.worldVerticesLength,f=c/6,d=ft.NONE;if(!e.constantSpeed){let L=e.lengths;f-=o?1:2;let D=L[f];this.data.positionMode==1&&(h*=D);let $;switch(this.data.spacingMode){case 2:$=D;break;case 3:$=D/s;break;default:$=1}n=P.setArraySize(this.world,8);for(let U=0,j=0,B=0;U<s;U++,j+=3){let W=l[U]*$;h+=W;let G=h;if(o)G%=D,G<0&&(G+=D),B=0;else if(G<0){d!=ft.BEFORE&&(d=ft.BEFORE,e.computeWorldVertices(i,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>D){d!=ft.AFTER&&(d=ft.AFTER,e.computeWorldVertices(i,c-6,4,n,0,2)),this.addAfterPosition(G-D,n,0,a,j);continue}for(;;B++){let tt=L[B];if(!(G>tt)){if(B==0)G/=tt;else{let J=L[B-1];G=(G-J)/(tt-J)}break}}B!=d&&(d=B,o&&B==f?(e.computeWorldVertices(i,c-4,4,n,0,2),e.computeWorldVertices(i,0,4,n,4,2)):e.computeWorldVertices(i,B*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,j,r||U>0&&W==0)}return a}o?(c+=2,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c-4,n,0,2),e.computeWorldVertices(i,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(f--,c-=4,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c,n,0,2));let m=P.setArraySize(this.curves,f),u=0,w=n[0],b=n[1],p=0,g=0,x=0,y=0,v=0,A=0,I=0,C=0,T=0,M=0,Y=0,F=0,E=0,k=0;for(let L=0,D=2;L<f;L++,D+=6)p=n[D],g=n[D+1],x=n[D+2],y=n[D+3],v=n[D+4],A=n[D+5],I=(w-p*2+x)*.1875,C=(b-g*2+y)*.1875,T=((p-x)*3-w+v)*.09375,M=((g-y)*3-b+A)*.09375,Y=I*2+T,F=C*2+M,E=(p-w)*.75+I+T*.16666667,k=(g-b)*.75+C+M*.16666667,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,u+=Math.sqrt(E*E+k*k),E+=Y+T,k+=F+M,u+=Math.sqrt(E*E+k*k),m[L]=u,w=v,b=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let V=this.segments,N=0;for(let L=0,D=0,$=0,U=0;L<s;L++,D+=3){let j=l[L]*X;h+=j;let B=h;if(o)B%=u,B<0&&(B+=u),$=0;else if(B<0){this.addBeforePosition(B,n,0,a,D);continue}else if(B>u){this.addAfterPosition(B-u,n,c-4,a,D);continue}for(;;$++){let W=m[$];if(!(B>W)){if($==0)B/=W;else{let G=m[$-1];B=(B-G)/(W-G)}break}}if($!=d){d=$;let W=$*6;for(w=n[W],b=n[W+1],p=n[W+2],g=n[W+3],x=n[W+4],y=n[W+5],v=n[W+6],A=n[W+7],I=(w-p*2+x)*.03,C=(b-g*2+y)*.03,T=((p-x)*3-w+v)*.006,M=((g-y)*3-b+A)*.006,Y=I*2+T,F=C*2+M,E=(p-w)*.3+I+T*.16666667,k=(g-b)*.3+C+M*.16666667,N=Math.sqrt(E*E+k*k),V[0]=N,W=1;W<8;W++)E+=Y,k+=F,Y+=T,F+=M,N+=Math.sqrt(E*E+k*k),V[W]=N;E+=Y,k+=F,N+=Math.sqrt(E*E+k*k),V[8]=N,E+=Y+T,k+=F+M,N+=Math.sqrt(E*E+k*k),V[9]=N,U=0}for(B*=N;;U++){let W=V[U];if(!(B>W)){if(U==0)B/=W;else{let G=V[U-1];B=U+(B-G)/(W-G)}break}}this.addCurvePosition(B*.1,w,b,p,g,x,y,v,A,a,D,r||L>0&&j==0)}return a}addBeforePosition(e,s,r,i,h){let l=s[r],a=s[r+1],n=s[r+2]-l,o=s[r+3]-a,c=Math.atan2(o,n);i[h]=l+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addAfterPosition(e,s,r,i,h){let l=s[r+2],a=s[r+3],n=l-s[r],o=a-s[r+1],c=Math.atan2(o,n);i[h]=l+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addCurvePosition(e,s,r,i,h,l,a,n,o,c,f,d){if(e==0||isNaN(e)){c[f]=s,c[f+1]=r,c[f+2]=Math.atan2(h-r,i-s);return}let m=e*e,u=m*e,w=1-e,b=w*w,p=b*w,g=w*e,x=g*3,y=w*x,v=x*e,A=s*p+i*y+l*v+n*u,I=r*p+h*y+a*v+o*u;c[f]=A,c[f+1]=I,d&&(e<.001?c[f+2]=Math.atan2(h-r,i-s):c[f+2]=Math.atan2(I-(r*b+h*g*2+a*m),A-(s*b+i*g*2+l*m)))}},$s=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,a=l.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=n.time;const c=l.worldX,f=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=f;else{let d=this.remaining,m=this.inertia,u=this.data.step,w=this.skeleton.data.referenceScale,b=-1,p=this.data.limit*o,g=p*Math.abs(n.scaleY);if(p*=Math.abs(n.scaleX),s||r){if(s){const x=(this.ux-c)*m;this.xOffset+=x>p?p:x<-p?-p:x,this.ux=c}if(r){const x=(this.uy-f)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=f}if(d>=u){b=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*w*n.scaleX,A=this.gravity*w*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),r&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),d-=u;while(d>=u)}s&&(l.worldX+=this.xOffset*e*this.data.x),r&&(l.worldY+=this.yOffset*e*this.data.y)}if(i||h){let x=Math.atan2(l.c,l.a),y=0,v=0,A=0,I=this.cx-l.worldX,C=this.cy-l.worldY;if(I>p?I=p:I<-p&&(I=-p),C>g?C=g:C<-g&&(C=-g),i){A=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(C+this.ty,I+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*R.invPI2-.5)*R.PI2)*m,T=this.rotateOffset*A+x,y=Math.cos(T),v=Math.sin(T),h&&(T=a*l.getWorldScaleX(),T>0&&(this.scaleOffset+=(I*y+C*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=a*l.getWorldScaleX();T>0&&(this.scaleOffset+=(I*y+C*v)*m/T)}if(d=this.remaining,d>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,M=this.strength,Y=this.wind,F=vs.yDown?-this.gravity:this.gravity,E=a/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),i){if(this.rotateVelocity-=((Y*v+F*y)*E+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,d<u)break;const k=this.rotateOffset*A+x;y=Math.cos(k),v=Math.sin(k)}else if(d<u)break}}this.remaining=d}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*e*this.data.x),r&&(l.worldY+=this.yOffset*e*this.data.y)}if(i){let n=this.rotateOffset*e,o=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=n*this.data.rotate,o=Math.sin(d),c=Math.cos(d),f=l.b,l.b=c*f-o*l.d,l.d=o*f+c*l.d),d+=n*this.data.shearX,o=Math.sin(d),c=Math.cos(d),f=l.a,l.a=c*f-o*l.c,l.c=o*f+c*l.c}else n*=this.data.rotate,o=Math.sin(n),c=Math.cos(n),f=l.a,l.a=c*f-o*l.c,l.c=o*f+c*l.c,f=l.b,l.b=c*f-o*l.d,l.d=o*f+c*l.d}if(h){const n=1+this.scaleOffset*e*this.data.scaleX;l.a*=n,l.c*=n}t!=3&&(this.tx=a*l.a,this.ty=a*l.c),l.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*R.degRad,i=Math.cos(r),h=Math.sin(r),l=this.cx-t,a=this.cy-e;this.translate(l*i-a*h-l,l*h+a*i-a)}},ps=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new q,this.darkColor=t.darkColor?new q:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof lt)||!(this.attachment instanceof lt)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Yt;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=e!=0||s!=0,a=this.target,n=a.a,o=a.b,c=a.c,f=a.d,d=n*f-o*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)-Math.atan2(v,x)+m;I>R.PI?I-=R.PI2:I<-R.PI&&(I+=R.PI2),I*=t;let C=Math.cos(I),T=Math.sin(I);g.a=C*x-T*v,g.b=C*y-T*A,g.c=T*x+C*v,g.d=T*y+C*A}if(l){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*e,g.worldY+=(x.y-g.worldY)*s}if(r!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(n*n+c*c)-x+this.data.offsetScaleX)*r)/x),g.a*=x,g.c*=x}if(i!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(o*o+f*f)-x+this.data.offsetScaleY)*i)/x),g.b*=x,g.d*=x}if(h>0){let x=g.b,y=g.d,v=Math.atan2(y,x),A=Math.atan2(f,o)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>R.PI?A-=R.PI2:A<-R.PI&&(A+=R.PI2),A=v+(A+u)*h;let I=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*I,g.d=Math.sin(A)*I}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=e!=0||s!=0,a=this.target,n=a.a,o=a.b,c=a.c,f=a.d,d=n*f-o*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)+m;I>R.PI?I-=R.PI2:I<-R.PI&&(I+=R.PI2),I*=t;let C=Math.cos(I),T=Math.sin(I);g.a=C*x-T*v,g.b=C*y-T*A,g.c=T*x+C*v,g.d=T*y+C*A}if(l){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*e,g.worldY+=x.y*s}if(r!=0){let x=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=x,g.c*=x}if(i!=0){let x=(Math.sqrt(o*o+f*f)-1+this.data.offsetScaleY)*i+1;g.b*=x,g.d*=x}if(h>0){let x=Math.atan2(f,o)-Math.atan2(c,n);x>R.PI?x-=R.PI2:x<-R.PI&&(x+=R.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-R.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*A,g.d=Math.sin(x)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=this.target,a=this.bones;for(let n=0,o=a.length;n<o;n++){let c=a[n],f=c.arotation;t!=0&&(f+=(l.arotation-f+this.data.offsetRotation)*t);let d=c.ax,m=c.ay;d+=(l.ax-d+this.data.offsetX)*e,m+=(l.ay-m+this.data.offsetY)*s;let u=c.ascaleX,w=c.ascaleY;r!=0&&u!=0&&(u=(u+(l.ascaleX-u+this.data.offsetScaleX)*r)/u),i!=0&&w!=0&&(w=(w+(l.ascaleY-w+this.data.offsetScaleY)*i)/w);let b=c.ashearY;h!=0&&(b+=(l.ashearY-b+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=this.target,a=this.bones;for(let n=0,o=a.length;n<o;n++){let c=a[n],f=c.arotation+(l.arotation+this.data.offsetRotation)*t,d=c.ax+(l.ax+this.data.offsetX)*e,m=c.ay+(l.ay+this.data.offsetY)*s,u=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*r+1),w=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*i+1),b=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}},vs=class Ge{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ge.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let r=e.bones[s],i;if(!r.parent)i=new Xe(r,this,null);else{let h=this.bones[r.parent.index];i=new Xe(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let r=e.slots[s],i=this.bones[r.boneData.index],h=new ps(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let r=e.ikConstraints[s];this.ikConstraints.push(new ws(r,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let r=e.transformConstraints[s];this.transformConstraints.push(new ys(r,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let r=e.pathConstraints[s];this.pathConstraints.push(new bs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let r=e.physicsConstraints[s];this.physicsConstraints.push(new $s(r,this))}this.color=new q(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let u=s[d];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let w=this.bones[d[m].index];do w.sorted=!1,w.active=!0,w=w.parent;while(w)}}let r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,l=this.physicsConstraints,a=r.length,n=i.length,o=h.length,c=this.physicsConstraints.length,f=a+n+o+c;t:for(let d=0;d<f;d++){for(let m=0;m<a;m++){let u=r[m];if(u.data.order==d){this.sortIkConstraint(u);continue t}}for(let m=0;m<n;m++){let u=i[m];if(u.data.order==d){this.sortTransformConstraint(u);continue t}}for(let m=0;m<o;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=l[m];if(u.data.order==d){this.sortPhysicsConstraint(u);continue t}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let r=e.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let n=0,o=this.data.skins.length;n<o;n++)this.sortPathConstraintAttachment(this.data.skins[n],r,i);let h=s.getAttachment();h instanceof St&&this.sortPathConstraintAttachmentWith(h,i);let l=e.bones,a=l.length;for(let n=0;n<a;n++)this.sortBone(l[n]);this._updateCache.push(e);for(let n=0;n<a;n++)this.sortReset(l[n].children);for(let n=0;n<a;n++)l[n].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,r=s.length;if(e.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(e);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(e,s,r){let i=e.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof St))return;let r=e.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,l=r.length;h<l;){let a=r[h++];for(a+=h;h<a;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,r=e.length;s<r;s++){let i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let l=s[i];l.ax=l.x,l.ay=l.y,l.arotation=l.rotation,l.ascaleX=l.scaleX,l.ascaleY=l.scaleY,l.ashearX=l.shearX,l.ashearY=l.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let b=1,p=r.length;b<p;b++){let g=r[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,l=s.b,a=s.c,n=s.d;i.worldX=h*this.x+l*this.y+s.worldX,i.worldY=a*this.x+n*this.y+s.worldY;const o=(i.rotation+i.shearX)*R.degRad,c=(i.rotation+90+i.shearY)*R.degRad,f=Math.cos(o)*i.scaleX,d=Math.cos(c)*i.scaleY,m=Math.sin(o)*i.scaleX,u=Math.sin(c)*i.scaleY;i.a=(h*f+l*m)*this.scaleX,i.b=(h*d+l*u)*this.scaleX,i.c=(a*f+n*m)*this.scaleY,i.d=(a*d+n*u)*this.scaleY;let w=this._updateCache;for(let b=0,p=w.length;b<p;b++){let g=w[b];g!=i&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;P.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,r=e.length;s<r;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],l=h.data.attachmentName;if(l){let a=e.getAttachment(r,l);a&&h.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let r=this.data.findSlot(e);if(!r)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(r.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(e,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let l=r[i];if(l.data.name==e){let a=null;if(s&&(a=this.getAttachment(i,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+e);l.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Yt,r=new Yt;return this.getBounds(s,r,void 0,e),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(e,s,r=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,f=h.length;c<f;c++){let d=h[c];if(!d.bone.active)continue;let m=0,u=null,w=null,b=d.getAttachment();if(b instanceof Ye)m=8,u=P.setArraySize(r,m,0),b.computeWorldVertices(d,u,0,2),w=Ge.quadTriangles;else if(b instanceof Bt){let p=b;m=p.worldVerticesLength,u=P.setArraySize(r,m,0),p.computeWorldVertices(d,0,m,u,0,2),w=p.triangles}else if(b instanceof Ce&&i!=null){i.clipStart(d,b);continue}if(u&&w){i!=null&&i.isClipping()&&(i.clipTriangles(u,w,w.length),u=i.clippedVertices,m=i.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let x=u[p],y=u[p+1];l=Math.min(l,x),a=Math.min(a,y),n=Math.max(n,x),o=Math.max(o,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),e.set(l,a),s.set(n-l,o-a)}update(e){this.time+=e}physicsTranslate(e,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(e,s)}physicsRotate(e,s,r){const i=this.physicsConstraints;for(let h=0,l=i.length;h<l;h++)i[h].rotate(e,s,r)}},As=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(As||{}),Ss=class extends It{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},Ne=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}},De=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Lt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new q(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];s.attachment&&(s.attachment instanceof Bt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new De(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new De(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],h=i.getAttachment();if(h&&s<e.attachments.length){let l=e.attachments[s];for(let a in l){let n=l[a];if(h==n){let o=this.getAttachment(s,a);o&&i.setAttachment(o);break}}}s++}}},Oe=class{index=0;name;boneData;color=new q(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},qe=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(qe||{}),We=class extends It{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ne;s.name="";let r=new Is(t),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let l=r.readBoolean();l&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let a=0;a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let f=o==0?null:s.bones[r.readInt(!0)],d=new Me(o,c,f);d.rotation=r.readFloat(),d.x=r.readFloat()*e,d.y=r.readFloat()*e,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*e,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),l&&(q.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[r.readInt(!0)],d=new Oe(o,c,f);q.rgba8888ToColor(d.color,r.readInt32());let m=r.readInt32();m!=-1&&q.rgb888ToColor(d.darkColor=new q,m),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),l&&(d.visible=r.readBoolean()),s.slots.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){let f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Re(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(d.softness=r.readFloat()*e),s.ikConstraints.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){let f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new We(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=r.readFloat()),(m&16)!=0&&(d.offsetX=r.readFloat()*e),(m&32)!=0&&(d.offsetY=r.readFloat()*e),(m&64)!=0&&(d.offsetScaleX=r.readFloat()),(m&128)!=0&&(d.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(d.offsetShearY=r.readFloat()),(m&2)!=0&&(d.mixRotate=r.readFloat()),(m&4)!=0&&(d.mixX=r.readFloat()),(m&8)!=0&&(d.mixY=r.readFloat()),(m&16)!=0&&(d.mixScaleX=r.readFloat()),(m&32)!=0&&(d.mixScaleY=r.readFloat()),(m&64)!=0&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){let f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Pe(f);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const m=r.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=e),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=e),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){const f=r.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ss(f);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=r.readFloat()),(m&4)!=0&&(d.y=r.readFloat()),(m&8)!=0&&(d.rotate=r.readFloat()),(m&16)!=0&&(d.scaleX=r.readFloat()),(m&32)!=0&&(d.shearX=r.readFloat()),d.limit=((m&64)!=0?r.readFloat():5e3)*e,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=(m&128)!=0?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(d)}let n=this.readSkin(r,s,!0,l);n&&(s.defaultSkin=n,s.skins.push(n));{let o=s.skins.length;for(P.setArraySize(s.skins,a=o+r.readInt(!0));o<a;o++){let c=this.readSkin(r,s,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[o]=c}}a=this.linkedMeshes.length;for(let o=0;o<a;o++){let c=this.linkedMeshes[o];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.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,a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let f=new Ee(c);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(t,e,s,r){let i=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;i=new Lt("default")}else{let l=t.readString();if(!l)throw new Error("Skin name must not be null.");i=new Lt(l),r&&q.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let a=0,n=i.bones.length;a<n;a++)i.bones[a]=e.bones[t.readInt(!0)];for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let l=0;l<h;l++){let a=t.readInt(!0);for(let n=0,o=t.readInt(!0);n<o;n++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(t,e,i,a,c,r);f&&i.setAttachment(a,c,f)}}return i}readAttachment(t,e,s,r,i,h){let l=this.scale,a=t.readByte();const n=(a&8)!=0?t.readStringRef():i;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let o=(a&16)!=0?t.readStringRef():null;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null;let d=(a&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),g=t.readFloat();o||(o=n);let x=this.attachmentLoader.newRegionAttachment(s,n,o,f);return x?(x.path=o,x.x=m*l,x.y=u*l,x.scaleX=w,x.scaleY=b,x.rotation=d,x.width=p*l,x.height=g*l,q.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let o=this.readVertices(t,(a&16)!=0),c=h?t.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,n);return f?(f.worldVerticesLength=o.length,f.vertices=o.vertices,f.bones=o.bones,h&&q.rgba8888ToColor(f.color,c),f):null}case 2:{let o=(a&16)!=0?t.readStringRef():n;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=t.readInt(!0),m=this.readVertices(t,(a&128)!=0),u=this.readFloatArray(t,m.length,1),w=this.readShortArray(t,(m.length-d-2)*3);let b=[],p=0,g=0;h&&(b=this.readShortArray(t,t.readInt(!0)),p=t.readFloat(),g=t.readFloat()),o||(o=n);let x=this.attachmentLoader.newMeshAttachment(s,n,o,f);return x?(x.path=o,q.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=w,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,h&&(x.edges=b,x.width=p*l,x.height=g*l),x):null}case 3:{const o=(a&16)!=0?t.readStringRef():n;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=(a&128)!=0,m=t.readInt(!0),u=t.readStringRef();let w=0,b=0;h&&(w=t.readFloat(),b=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,n,o,f);return p?(p.path=o,q.rgba8888ToColor(p.color,c),p.sequence=f,h&&(p.width=w*l,p.height=b*l),this.linkedMeshes.push(new js(p,m,r,u,d)),p):null}case 4:{const o=(a&16)!=0,c=(a&32)!=0,f=this.readVertices(t,(a&64)!=0),d=P.newArray(f.length/6,0);for(let w=0,b=d.length;w<b;w++)d[w]=t.readFloat()*l;const m=h?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=o,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,h&&q.rgba8888ToColor(u.color,m),u):null}case 5:{const o=t.readFloat(),c=t.readFloat(),f=t.readFloat(),d=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*l,m.y=f*l,m.rotation=o,h&&q.rgba8888ToColor(m.color,d),m):null}case 6:{const o=t.readInt(!0),c=this.readVertices(t,(a&16)!=0);let f=h?t.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,n);return d?(d.endSlot=e.slots[o],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&q.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(t){let e=new ts(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),i=new Js;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let h=new Array,l=new Array;for(let a=0;a<r;a++){let n=t.readInt(!0);l.push(n);for(let o=0;o<n;o++)l.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=l,i}readFloatArray(t,e,s){let r=new Array(e);if(s==1)for(let i=0;i<e;i++)r[i]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let n=0,o=t.readInt(!0);n<o;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0),w=u-1;switch(m){case oi:{let b=new ut(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat(),t.readStringRef());r.push(b);break}case hi:{let b=t.readInt(!0),p=new ee(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,C=0;p.setFrame(I,g,x,y,v,A),I!=w;I++){let T=t.readFloat(),M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(I);break;case ht:z(t,p,C++,I,0,g,T,x,M,1),z(t,p,C++,I,1,g,T,y,Y,1),z(t,p,C++,I,2,g,T,v,F,1),z(t,p,C++,I,3,g,T,A,E,1)}g=T,x=M,y=Y,v=F,A=E}r.push(p);break}case ci:{let b=t.readInt(!0),p=new se(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,I=0;p.setFrame(A,g,x,y,v),A!=w;A++){let C=t.readFloat(),T=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(A);break;case ht:z(t,p,I++,A,0,g,C,x,T,1),z(t,p,I++,A,1,g,C,y,M,1),z(t,p,I++,A,2,g,C,v,Y,1)}g=C,x=T,y=M,v=Y}r.push(p);break}case di:{let b=t.readInt(!0),p=new re(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let M=0,Y=0;p.setFrame(M,g,x,y,v,A,I,C,T),M!=w;M++){let F=t.readFloat(),E=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(M);break;case ht:z(t,p,Y++,M,0,g,F,x,E,1),z(t,p,Y++,M,1,g,F,y,k,1),z(t,p,Y++,M,2,g,F,v,X,1),z(t,p,Y++,M,3,g,F,A,V,1),z(t,p,Y++,M,4,g,F,I,N,1),z(t,p,Y++,M,5,g,F,C,L,1),z(t,p,Y++,M,6,g,F,T,D,1)}g=F,x=E,y=k,v=X,A=V,I=N,C=L,T=D}r.push(p);break}case fi:{let b=t.readInt(!0),p=new ae(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let T=0,M=0;p.setFrame(T,g,x,y,v,A,I,C),T!=w;T++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(T);break;case ht:z(t,p,M++,T,0,g,Y,x,F,1),z(t,p,M++,T,1,g,Y,y,E,1),z(t,p,M++,T,2,g,Y,v,k,1),z(t,p,M++,T,3,g,Y,A,X,1),z(t,p,M++,T,4,g,Y,I,V,1),z(t,p,M++,T,5,g,Y,C,N,1)}g=Y,x=F,y=E,v=k,A=X,I=V,C=N}r.push(p);break}case ui:{let b=new ie(u,t.readInt(!0),c),p=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,p,g),x!=w;x++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(x);break;case ht:z(t,b,y++,x,0,p,v,g,A,1)}p=v,g=A}r.push(b)}}}}for(let n=0,o=t.readInt(!0);n<o;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0);if(m==li){let b=new te(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat(),t.readByte());r.push(b);continue}let w=t.readInt(!0);switch(m){case Ks:r.push(Z(t,new At(u,w,c),1));break;case Qs:r.push(ze(t,new _t(u,w,c),i));break;case Zs:r.push(Z(t,new Gt(u,w,c),i));break;case ti:r.push(Z(t,new $t(u,w,c),i));break;case ei:r.push(ze(t,new Ht(u,w,c),1));break;case si:r.push(Z(t,new jt(u,w,c),1));break;case ii:r.push(Z(t,new Jt(u,w,c),1));break;case ri:r.push(ze(t,new Kt(u,w,c),1));break;case ai:r.push(Z(t,new Qt(u,w,c),1));break;case ni:r.push(Z(t,new Zt(u,w,c),1))}}}for(let n=0,o=t.readInt(!0);n<o;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new le(f,t.readInt(!0),c),u=t.readByte(),w=t.readFloat(),b=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,p=(u&4)!=0?t.readFloat()*i:0;for(let g=0,x=0;m.setFrame(g,w,b,p,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,A=(u&4)!=0?t.readFloat()*i:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(z(t,m,x++,g,0,w,y,b,v,1),z(t,m,x++,g,1,w,y,p,A,i)),w=y,b=v,p=A}r.push(m)}for(let n=0,o=t.readInt(!0);n<o;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new oe(f,t.readInt(!0),c),u=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,b,p,g,x,y),v!=d;v++){let I=t.readFloat(),C=t.readFloat(),T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),E=t.readFloat();switch(t.readByte()){case ot:m.setStepped(v);break;case ht:z(t,m,A++,v,0,u,I,w,C,1),z(t,m,A++,v,1,u,I,b,T,1),z(t,m,A++,v,2,u,I,p,M,1),z(t,m,A++,v,3,u,I,g,Y,1),z(t,m,A++,v,4,u,I,x,F,1),z(t,m,A++,v,5,u,I,y,E,1)}u=I,w=C,b=T,p=M,g=Y,x=F,y=E}r.push(m)}for(let n=0,o=t.readInt(!0);n<o;n++){let c=t.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=t.readInt(!0);d<m;d++){const u=t.readByte(),w=t.readInt(!0),b=t.readInt(!0);switch(u){case xi:r.push(Z(t,new he(w,b,c),f.positionMode==0?i:1));break;case wi:r.push(Z(t,new ce(w,b,c),f.spacingMode==0||f.spacingMode==1?i:1));break;case bi:let p=new de(w,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,I=0,C=p.getFrameCount()-1;p.setFrame(A,g,x,y,v),A!=C;A++){let T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case ot:p.setStepped(A);break;case ht:z(t,p,I++,A,0,g,T,x,M,1),z(t,p,I++,A,1,g,T,y,Y,1),z(t,p,I++,A,2,g,T,v,F,1)}g=T,x=M,y=Y,v=F}r.push(p)}}}for(let n=0,o=t.readInt(!0);n<o;n++){const c=t.readInt(!0)-1;for(let f=0,d=t.readInt(!0);f<d;f++){const m=t.readByte(),u=t.readInt(!0);if(m==ki){const b=new pe(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat());r.push(b);continue}const w=t.readInt(!0);switch(m){case pi:r.push(Z(t,new fe(u,w,c),1));break;case yi:r.push(Z(t,new ue(u,w,c),1));break;case vi:r.push(Z(t,new me(u,w,c),1));break;case Ai:r.push(Z(t,new ge(u,w,c),1));break;case Si:r.push(Z(t,new xe(u,w,c),1));break;case Ii:r.push(Z(t,new we(u,w,c),1));break;case Ci:r.push(Z(t,new be(u,w,c),1))}}}for(let n=0,o=t.readInt(!0);n<o;n++){let c=s.skins[t.readInt(!0)];for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readInt(!0);for(let u=0,w=t.readInt(!0);u<w;u++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case mi:{let v=p,A=v.bones,I=v.vertices,C=A?I.length/3*2:I.length,T=t.readInt(!0),M=new ne(x,T,m,v),Y=t.readFloat();for(let F=0,E=0;;F++){let k,X=t.readInt(!0);if(X==0)k=A?P.newFloatArray(C):I;else{k=P.newFloatArray(C);let N=t.readInt(!0);if(X+=N,i==1)for(let L=N;L<X;L++)k[L]=t.readFloat();else for(let L=N;L<X;L++)k[L]=t.readFloat()*i;if(!A)for(let L=0,D=k.length;L<D;L++)k[L]+=I[L]}if(M.setFrame(F,Y,k),F==y)break;let V=t.readFloat();switch(t.readByte()){case ot:M.setStepped(F);break;case ht:z(t,M,E++,F,0,Y,V,0,1,1)}Y=V}r.push(M);break}case gi:{let v=new ye(x,m,p);for(let A=0;A<x;A++){let I=t.readFloat(),C=t.readInt32();v.setFrame(A,I,ss[C&15],C>>4,t.readFloat())}r.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let n=new wt(h),o=s.slots.length;for(let c=0;c<h;c++){let f=t.readFloat(),d=t.readInt(!0),m=P.newArray(o,0);for(let p=o-1;p>=0;p--)m[p]=-1;let u=P.newArray(o-d,0),w=0,b=0;for(let p=0;p<d;p++){let g=t.readInt(!0);for(;w!=g;)u[b++]=w++;m[w+t.readInt(!0)]=w++}for(;w<o;)u[b++]=w++;for(let p=o-1;p>=0;p--)m[p]==-1&&(m[p]=u[--b]);n.setFrame(c,f,m)}r.push(n)}let l=t.readInt(!0);if(l>0){let n=new Ft(l);for(let o=0;o<l;o++){let c=t.readFloat(),f=s.events[t.readInt(!0)],d=new Fe(c,f);d.intValue=t.readInt(!1),d.floatValue=t.readFloat(),d.stringValue=t.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=t.readFloat(),d.balance=t.readFloat()),n.setFrame(o,d)}r.push(n)}let a=0;for(let n=0,o=r.length;n<o;n++)a=Math.max(a,r[n].getDuration());return new Mt(e,r,a)}},Is=class{constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let r=0;r<t;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:e+=String.fromCharCode(i),r++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},js=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},Js=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let h=0,l=0,a=e.getFrameCount()-1;e.setFrame(h,r,i),h!=a;h++){let n=t.readFloat(),o=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(h);break;case ht:z(t,e,l++,h,0,r,n,i,o,s)}r=n,i=o}return e}function ze(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,h=t.readFloat()*s;for(let l=0,a=0,n=e.getFrameCount()-1;e.setFrame(l,r,i,h),l!=n;l++){let o=t.readFloat(),c=t.readFloat()*s,f=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(l);break;case ht:z(t,e,a++,l,0,r,o,i,c,s),z(t,e,a++,l,1,r,o,h,f,s)}r=o,i=c,h=f}return e}function z(t,e,s,r,i,h,l,a,n,o){e.setBezier(s,r,i,h,a,t.readFloat(),t.readFloat()*o,t.readFloat(),t.readFloat()*o,l,n)}var Ks=0,Qs=1,Zs=2,ti=3,ei=4,si=5,ii=6,ri=7,ai=8,ni=9,li=10,oi=0,hi=1,ci=2,di=3,fi=4,ui=5,mi=0,gi=1,xi=0,wi=1,bi=2,pi=0,yi=1,vi=2,Ai=4,Si=5,Ii=6,Ci=7,ki=8,ot=1,ht=2,Ti=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new vt(()=>P.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=t.slots,l=h.length;s.length=0,i.freeAll(r),r.length=0;for(let a=0;a<l;a++){let n=h[a];if(!n.bone.active)continue;let o=n.getAttachment();if(o instanceof Ie){let c=o;s.push(c);let f=i.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),r.push(f),c.computeWorldVertices(n,0,c.worldVerticesLength,f,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,l=i.length;h<l;h++){let a=i[h],n=a;for(let o=0,c=a.length;o<c;o+=2){let f=n[o],d=n[o+1];t=Math.min(t,f),e=Math.min(e,d),s=Math.max(s,f),r=Math.max(r,d)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,h=this.minY,l=this.maxX,a=this.maxY;if(t<=i&&s<=i||e<=h&&r<=h||t>=l&&s>=l||e>=a&&r>=a)return!1;let n=(r-e)/(s-t),o=n*(i-t)+e;if(o>h&&o<a||(o=n*(l-t)+e,o>h&&o<a))return!0;let c=(h-e)/n+t;return c>i&&c<l||(c=(a-e)/n+t,c>i&&c<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,h=i-2,l=!1;for(let a=0;a<i;a+=2){let n=r[a+1],o=r[h+1];if(n<s&&o>=s||o<s&&n>=s){let c=r[a];c+(s-n)/(o-n)*(r[h]-c)<e&&(l=!l)}h=a}return l}intersectsSegment(t,e,s,r){let i=this.polygons;for(let h=0,l=i.length;h<l;h++)if(this.intersectsSegmentPolygon(i[h],t,e,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,r,i){let h=t,l=t.length,a=e-r,n=s-i,o=e*i-s*r,c=h[l-2],f=h[l-1];for(let d=0;d<l;d+=2){let m=h[d],u=h[d+1],w=c*u-f*m,b=c-m,p=f-u,g=a*p-n*b,x=(o*b-a*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let y=(o*p-n*w)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,f=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Cs=class et{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new vt(()=>new Array);polygonIndicesPool=new vt(()=>new Array);triangulate(e){let s=e,r=e.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<r;a++)i[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=r;a<n;++a)h[a]=et.isConcave(a,r,s,i);let l=this.triangles;for(l.length=0;r>3;){let a=r-1,n=0,o=1;for(;;){t:if(!h[n]){let d=i[a]<<1,m=i[n]<<1,u=i[o]<<1,w=s[d],b=s[d+1],p=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(o+1)%r;v!=a;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,I=s[A],C=s[A+1];if(et.positiveArea(x,y,w,b,I,C)&&et.positiveArea(w,b,p,g,I,C)&&et.positiveArea(p,g,x,y,I,C))break t}break}if(o==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=o,o=(o+1)%r}l.push(i[(r+n-1)%r]),l.push(i[n]),l.push(i[(n+1)%r]),i.splice(n,1),h.splice(n,1),r--;let c=(r+n-1)%r,f=n==r?0:n;h[c]=et.isConcave(c,r,s,i),h[f]=et.isConcave(f,r,s,i)}return r==3&&(l.push(i[2]),l.push(i[0]),l.push(i[1])),l}decompose(e,s){let r=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,o=0;for(let c=0,f=s.length;c<f;c+=3){let d=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,w=r[d],b=r[d+1],p=r[m],g=r[m+1],x=r[u],y=r[u+1],v=!1;if(n==d){let A=a.length-4,I=et.winding(a[A],a[A+1],a[A+2],a[A+3],x,y),C=et.winding(x,y,a[0],a[1],a[2],a[3]);I==o&&C==o&&(a.push(x),a.push(y),l.push(u),v=!0)}v||(a.length>0?(i.push(a),h.push(l)):(this.polygonPool.free(a),this.polygonIndicesPool.free(l)),a=this.polygonPool.obtain(),a.length=0,a.push(w),a.push(b),a.push(p),a.push(g),a.push(x),a.push(y),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(d),l.push(m),l.push(u),o=et.winding(w,b,p,g,x,y),n=d)}a.length>0&&(i.push(a),h.push(l));for(let c=0,f=i.length;c<f;c++){if(l=h[c],l.length==0)continue;let d=l[0],m=l[l.length-1];a=i[c];let u=a.length-4,w=a[u],b=a[u+1],p=a[u+2],g=a[u+3],x=a[0],y=a[1],v=a[2],A=a[3],I=et.winding(w,b,p,g,x,y);for(let C=0;C<f;C++){if(C==c)continue;let T=h[C];if(T.length!=3)continue;let M=T[0],Y=T[1],F=T[2],E=i[C],k=E[E.length-2],X=E[E.length-1];if(M!=d||Y!=m)continue;let V=et.winding(w,b,p,g,k,X),N=et.winding(k,X,x,y,v,A);V==I&&N==I&&(E.length=0,T.length=0,a.push(k),a.push(X),l.push(F),w=p,b=g,p=k,g=X,C=0)}}for(let c=i.length-1;c>=0;c--)a=i[c],a.length==0&&(i.splice(c,1),this.polygonPool.free(a),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return i}static isConcave(e,s,r,i){let h=i[(s+e-1)%s]<<1,l=i[e]<<1,a=i[(e+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[l],r[l+1],r[a],r[a+1])}static positiveArea(e,s,r,i,h,l){return e*(l-i)+r*(s-l)+h*(i-s)>=0}static winding(e,s,r,i,h,l){let a=r-e,n=i-s;return h*n-l*a+a*s-e*n>=0?1:-1}},Yi=class $e{triangulator=new Cs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(e,0,r,i,0,2);let h=this.clippingPolygon;$e.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=l.length;a<n;a++){let o=l[a];$e.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,r,i,h,l,a,n){let o,c,f,d,m,u;typeof s=="number"?(o=r,c=i,f=h,d=l,m=a,u=n):(o=s,c=r,f=i,d=h,m=l,u=a),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,o,c,f,d,m,u):this.clipTrianglesNoRender(e,o,c)}clipTrianglesNoRender(e,s,r){let i=this.clipOutput,h=this.clippedVertices,l=this.clippedTriangles,a=this.clippingPolygons,n=a.length,o=0;h.length=0,l.length=0;for(let c=0;c<r;c+=3){let f=s[c]<<1,d=e[f],m=e[f+1];f=s[c+1]<<1;let u=e[f],w=e[f+1];f=s[c+2]<<1;let b=e[f],p=e[f+1];for(let g=0;g<n;g++){let x=h.length;if(this.clip(d,m,u,w,b,p,a[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,I=P.setArraySize(h,x+v*2);for(let T=0;T<y;T+=2,x+=2){let M=A[T],Y=A[T+1];I[x]=M,I[x+1]=Y}x=l.length;let C=P.setArraySize(l,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)C[x]=o,C[x+1]=o+T,C[x+2]=o+T+1;o+=v+1}else{let y=P.setArraySize(h,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=w,y[x+4]=b,y[x+5]=p,x=l.length;let v=P.setArraySize(l,x+3);v[x]=o,v[x+1]=o+1,v[x+2]=o+2,o+=3;break}}}}clipTrianglesRender(e,s,r,i,h,l,a){let n=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=a?12:8,u=0;o.length=0,c.length=0;for(let w=0;w<r;w+=3){let b=s[w]<<1,p=e[b],g=e[b+1],x=i[b],y=i[b+1];b=s[w+1]<<1;let v=e[b],A=e[b+1],I=i[b],C=i[b+1];b=s[w+2]<<1;let T=e[b],M=e[b+1],Y=i[b],F=i[b+1];for(let E=0;E<d;E++){let k=o.length;if(this.clip(p,g,v,A,T,M,f[E],n)){let X=n.length;if(X==0)continue;let V=A-M,N=T-v,L=p-T,D=M-g,$=1/(V*L+N*(g-M)),U=X>>1,j=this.clipOutput,B=P.setArraySize(o,k+U*m);for(let G=0;G<X;G+=2,k+=m){let tt=j[G],J=j[G+1];B[k]=tt,B[k+1]=J,B[k+2]=h.r,B[k+3]=h.g,B[k+4]=h.b,B[k+5]=h.a;let K=tt-T,Q=J-M,it=(V*K+N*Q)*$,gt=(D*K+L*Q)*$,pt=1-it-gt;B[k+6]=x*it+I*gt+Y*pt,B[k+7]=y*it+C*gt+F*pt,a&&(B[k+8]=l.r,B[k+9]=l.g,B[k+10]=l.b,B[k+11]=l.a)}k=c.length;let W=P.setArraySize(c,k+3*(U-2));U--;for(let G=1;G<U;G++,k+=3)W[k]=u,W[k+1]=u+G,W[k+2]=u+G+1;u+=U+1}else{let X=P.setArraySize(o,k+3*m);X[k]=p,X[k+1]=g,X[k+2]=h.r,X[k+3]=h.g,X[k+4]=h.b,X[k+5]=h.a,a?(X[k+6]=x,X[k+7]=y,X[k+8]=l.r,X[k+9]=l.g,X[k+10]=l.b,X[k+11]=l.a,X[k+12]=v,X[k+13]=A,X[k+14]=h.r,X[k+15]=h.g,X[k+16]=h.b,X[k+17]=h.a,X[k+18]=I,X[k+19]=C,X[k+20]=l.r,X[k+21]=l.g,X[k+22]=l.b,X[k+23]=l.a,X[k+24]=T,X[k+25]=M,X[k+26]=h.r,X[k+27]=h.g,X[k+28]=h.b,X[k+29]=h.a,X[k+30]=Y,X[k+31]=F,X[k+32]=l.r,X[k+33]=l.g,X[k+34]=l.b,X[k+35]=l.a):(X[k+6]=x,X[k+7]=y,X[k+8]=v,X[k+9]=A,X[k+10]=h.r,X[k+11]=h.g,X[k+12]=h.b,X[k+13]=h.a,X[k+14]=I,X[k+15]=C,X[k+16]=T,X[k+17]=M,X[k+18]=h.r,X[k+19]=h.g,X[k+20]=h.b,X[k+21]=h.a,X[k+22]=Y,X[k+23]=F),k=c.length;let V=P.setArraySize(c,k+3);V[k]=u,V[k+1]=u+1,V[k+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,r,i){let h=this.clipOutput,l=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,o=this.clippingPolygons,c=o.length,f=0;l.length=0,a.length=0,n.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,u=e[m],w=e[m+1],b=i[m],p=i[m+1];m=s[d+1]<<1;let g=e[m],x=e[m+1],y=i[m],v=i[m+1];m=s[d+2]<<1;let A=e[m],I=e[m+1],C=i[m],T=i[m+1];for(let M=0;M<c;M++){let Y=l.length;if(this.clip(u,w,g,x,A,I,o[M],h)){let F=h.length;if(F==0)continue;let E=x-I,k=A-g,X=u-A,V=I-w,N=1/(E*X+k*(w-I)),L=F>>1,D=this.clipOutput,$=P.setArraySize(l,Y+L*2),U=P.setArraySize(a,Y+L*2);for(let B=0;B<F;B+=2,Y+=2){let W=D[B],G=D[B+1];$[Y]=W,$[Y+1]=G;let tt=W-A,J=G-I,K=(E*tt+k*J)*N,Q=(V*tt+X*J)*N,it=1-K-Q;U[Y]=b*K+y*Q+C*it,U[Y+1]=p*K+v*Q+T*it}Y=n.length;let j=P.setArraySize(n,Y+3*(L-2));L--;for(let B=1;B<L;B++,Y+=3)j[Y]=f,j[Y+1]=f+B,j[Y+2]=f+B+1;f+=L+1}else{let F=P.setArraySize(l,Y+6);F[Y]=u,F[Y+1]=w,F[Y+2]=g,F[Y+3]=x,F[Y+4]=A,F[Y+5]=I;let E=P.setArraySize(a,Y+3*2);E[Y]=b,E[Y+1]=p,E[Y+2]=y,E[Y+3]=v,E[Y+4]=C,E[Y+5]=T,Y=n.length;let k=P.setArraySize(n,Y+3);k[Y]=f,k[Y+1]=f+1,k[Y+2]=f+2,f+=3;break}}}}clip(e,s,r,i,h,l,a,n){let o=n,c=!1,f;a.length%4>=2?(f=n,n=this.scratch):f=this.scratch,f.length=0,f.push(e),f.push(s),f.push(r),f.push(i),f.push(h),f.push(l),f.push(e),f.push(s),n.length=0;let d=a.length-4,m=a;for(let u=0;;u+=2){let w=m[u],b=m[u+1],p=w-m[u+2],g=b-m[u+3],x=n.length,y=f;for(let A=0,I=f.length-2;A<I;){let C=y[A],T=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(w-M)>p*(b-Y),E=g*(w-C)-p*(b-T);if(E>0){if(F){n.push(M),n.push(Y);continue}let k=M-C,X=Y-T,V=E/(k*g-X*p);if(V>=0&&V<=1)n.push(C+k*V),n.push(T+X*V);else{n.push(M),n.push(Y);continue}}else if(F){let k=M-C,X=Y-T,V=E/(k*g-X*p);if(V>=0&&V<=1)n.push(C+k*V),n.push(T+X*V),n.push(M),n.push(Y);else{n.push(M),n.push(Y);continue}}c=!0}if(x==n.length)return o.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==d)break;let v=n;n=f,n.length=0,f=v}if(o!=n){o.length=0;for(let u=0,w=n.length-2;u<w;u++)o[u]=n[u]}else o.length=o.length-2;return c}static makeClockwise(e){let s=e,r=e.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,l=0,a=0,n=0;for(let o=0,c=r-3;o<c;o+=2)h=s[o],l=s[o+1],a=s[o+2],n=s[o+3],i+=h*n-a*l;if(!(i<0))for(let o=0,c=r-2,f=r>>1;o<f;o+=2){let d=s[o],m=s[o+1],u=c-o;s[o]=s[u],s[o+1]=s[u+1],s[u]=d,s[u+1]=m}}},Mi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ne,r=typeof t=="string"?JSON.parse(t):t,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=S(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let l=r.bones[h],a=null,n=S(l,"parent",null);n&&(a=s.findBone(n));let o=new Me(s.bones.length,l.name,a);o.length=S(l,"length",0)*e,o.x=S(l,"x",0)*e,o.y=S(l,"y",0)*e,o.rotation=S(l,"rotation",0),o.scaleX=S(l,"scaleX",1),o.scaleY=S(l,"scaleY",1),o.shearX=S(l,"shearX",0),o.shearY=S(l,"shearY",0),o.inherit=P.enumValue(Vt,S(l,"inherit","Normal")),o.skinRequired=S(l,"skin",!1);let c=S(l,"color",null);c&&o.color.setFromString(c),s.bones.push(o)}if(r.slots)for(let h=0;h<r.slots.length;h++){let l=r.slots[h],a=l.name,n=s.findBone(l.bone);if(!n)throw new Error(`Couldn't find bone ${l.bone} for slot ${a}`);let o=new Oe(s.slots.length,a,n),c=S(l,"color",null);c&&o.color.setFromString(c);let f=S(l,"dark",null);f&&(o.darkColor=q.fromString(f)),o.attachmentName=S(l,"attachment",null),o.blendMode=P.enumValue(qe,S(l,"blend","normal")),o.visible=S(l,"visible",!0),s.slots.push(o)}if(r.ik)for(let h=0;h<r.ik.length;h++){let l=r.ik[h],a=new Re(l.name);a.order=S(l,"order",0),a.skinRequired=S(l,"skin",!1);for(let o=0;o<l.bones.length;o++){let c=s.findBone(l.bones[o]);if(!c)throw new Error(`Couldn't find bone ${l.bones[o]} for IK constraint ${l.name}.`);a.bones.push(c)}let n=s.findBone(l.target);if(!n)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);a.target=n,a.mix=S(l,"mix",1),a.softness=S(l,"softness",0)*e,a.bendDirection=S(l,"bendPositive",!0)?1:-1,a.compress=S(l,"compress",!1),a.stretch=S(l,"stretch",!1),a.uniform=S(l,"uniform",!1),s.ikConstraints.push(a)}if(r.transform)for(let h=0;h<r.transform.length;h++){let l=r.transform[h],a=new We(l.name);a.order=S(l,"order",0),a.skinRequired=S(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let f=l.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${l.name}.`);a.bones.push(d)}let n=l.target,o=s.findBone(n);if(!o)throw new Error(`Couldn't find target bone ${n} for transform constraint ${l.name}.`);a.target=o,a.local=S(l,"local",!1),a.relative=S(l,"relative",!1),a.offsetRotation=S(l,"rotation",0),a.offsetX=S(l,"x",0)*e,a.offsetY=S(l,"y",0)*e,a.offsetScaleX=S(l,"scaleX",0),a.offsetScaleY=S(l,"scaleY",0),a.offsetShearY=S(l,"shearY",0),a.mixRotate=S(l,"mixRotate",1),a.mixX=S(l,"mixX",1),a.mixY=S(l,"mixY",a.mixX),a.mixScaleX=S(l,"mixScaleX",1),a.mixScaleY=S(l,"mixScaleY",a.mixScaleX),a.mixShearY=S(l,"mixShearY",1),s.transformConstraints.push(a)}if(r.path)for(let h=0;h<r.path.length;h++){let l=r.path[h],a=new Pe(l.name);a.order=S(l,"order",0),a.skinRequired=S(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let f=l.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${l.name}.`);a.bones.push(d)}let n=l.target,o=s.findSlot(n);if(!o)throw new Error(`Couldn't find target slot ${n} for path constraint ${l.name}.`);a.target=o,a.positionMode=P.enumValue(Be,S(l,"positionMode","Percent")),a.spacingMode=P.enumValue(Ve,S(l,"spacingMode","Length")),a.rotateMode=P.enumValue(Le,S(l,"rotateMode","Tangent")),a.offsetRotation=S(l,"rotation",0),a.position=S(l,"position",0),a.positionMode==0&&(a.position*=e),a.spacing=S(l,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=e),a.mixRotate=S(l,"mixRotate",1),a.mixX=S(l,"mixX",1),a.mixY=S(l,"mixY",a.mixX),s.pathConstraints.push(a)}if(r.physics)for(let h=0;h<r.physics.length;h++){const l=r.physics[h],a=new Ss(l.name);a.order=S(l,"order",0),a.skinRequired=S(l,"skin",!1);const n=l.bone,o=s.findBone(n);if(o==null)throw new Error("Physics bone not found: "+n);a.bone=o,a.x=S(l,"x",0),a.y=S(l,"y",0),a.rotate=S(l,"rotate",0),a.scaleX=S(l,"scaleX",0),a.shearX=S(l,"shearX",0),a.limit=S(l,"limit",5e3)*e,a.step=1/S(l,"fps",60),a.inertia=S(l,"inertia",1),a.strength=S(l,"strength",100),a.damping=S(l,"damping",1),a.massInverse=1/S(l,"mass",1),a.wind=S(l,"wind",0),a.gravity=S(l,"gravity",0),a.mix=S(l,"mix",1),a.inertiaGlobal=S(l,"inertiaGlobal",!1),a.strengthGlobal=S(l,"strengthGlobal",!1),a.dampingGlobal=S(l,"dampingGlobal",!1),a.massGlobal=S(l,"massGlobal",!1),a.windGlobal=S(l,"windGlobal",!1),a.gravityGlobal=S(l,"gravityGlobal",!1),a.mixGlobal=S(l,"mixGlobal",!1),s.physicsConstraints.push(a)}if(r.skins)for(let h=0;h<r.skins.length;h++){let l=r.skins[h],a=new Lt(l.name);if(l.bones)for(let n=0;n<l.bones.length;n++){let o=l.bones[n],c=s.findBone(o);if(!c)throw new Error(`Couldn't find bone ${o} for skin ${l.name}.`);a.bones.push(c)}if(l.ik)for(let n=0;n<l.ik.length;n++){let o=l.ik[n],c=s.findIkConstraint(o);if(!c)throw new Error(`Couldn't find IK constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}if(l.transform)for(let n=0;n<l.transform.length;n++){let o=l.transform[n],c=s.findTransformConstraint(o);if(!c)throw new Error(`Couldn't find transform constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}if(l.path)for(let n=0;n<l.path.length;n++){let o=l.path[n],c=s.findPathConstraint(o);if(!c)throw new Error(`Couldn't find path constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}if(l.physics)for(let n=0;n<l.physics.length;n++){let o=l.physics[n],c=s.findPhysicsConstraint(o);if(!c)throw new Error(`Couldn't find physics constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}for(let n in l.attachments){let o=s.findSlot(n);if(!o)throw new Error(`Couldn't find slot ${n} for skin ${l.name}.`);let c=l.attachments[n];for(let f in c){let d=this.readAttachment(c[f],a,o.index,f,s);d&&a.setAttachment(o.index,f,d)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let o=n.getAttachment(a.slotIndex,a.parent);if(!o)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?o:a.mesh,a.mesh.setParentMesh(o),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let l=r.events[h],a=new Ee(h);a.intValue=S(l,"int",0),a.floatValue=S(l,"float",0),a.stringValue=S(l,"string",""),a.audioPath=S(l,"audio",null),a.audioPath&&(a.volume=S(l,"volume",1),a.balance=S(l,"balance",0)),s.events.push(a)}if(r.animations)for(let h in r.animations){let l=r.animations[h];this.readAnimation(l,h,s)}return s}readAttachment(t,e,s,r,i){let h=this.scale;switch(r=S(t,"name",r),S(t,"type","region")){case"region":{let l=S(t,"path",r),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(e,r,l,a);if(!n)return null;n.path=l,n.x=S(t,"x",0)*h,n.y=S(t,"y",0)*h,n.scaleX=S(t,"scaleX",1),n.scaleY=S(t,"scaleY",1),n.rotation=S(t,"rotation",0),n.width=t.width*h,n.height=t.height*h,n.sequence=a;let o=S(t,"color",null);return o&&n.color.setFromString(o),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let a=S(t,"color",null);return a&&l.color.setFromString(a),l}case"mesh":case"linkedmesh":{let l=S(t,"path",r),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(e,r,l,a);if(!n)return null;n.path=l;let o=S(t,"color",null);o&&n.color.setFromString(o),n.width=S(t,"width",0)*h,n.height=S(t,"height",0)*h,n.sequence=a;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new Xi(n,S(t,"skin",null),s,c,S(t,"timelines",!0))),n;let f=t.uvs;return this.readVertices(t,n,f.length),n.triangles=t.triangles,n.regionUVs=f,n.region!=null&&n.updateRegion(),n.edges=S(t,"edges",null),n.hullLength=S(t,"hull",0)*2,n}case"path":{let l=this.attachmentLoader.newPathAttachment(e,r);if(!l)return null;l.closed=S(t,"closed",!1),l.constantSpeed=S(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,l,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<t.lengths.length;c++)n[c]=t.lengths[c]*h;l.lengths=n;let o=S(t,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,r);if(!l)return null;l.x=S(t,"x",0)*h,l.y=S(t,"y",0)*h,l.rotation=S(t,"rotation",0);let a=S(t,"color",null);return a&&l.color.setFromString(a),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,r);if(!l)return null;let a=S(t,"end",null);a&&(l.endSlot=i.findSlot(a));let n=t.vertexCount;this.readVertices(t,l,n<<1);let o=S(t,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(t){if(t==null)return null;let e=new ts(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let a=P.toFloatArray(i);if(r!=1)for(let n=0,o=i.length;n<o;n++)a[n]*=r;e.vertices=a;return}let h=new Array,l=new Array;for(let a=0,n=i.length;a<n;){let o=i[a++];l.push(o);for(let c=a+o*4;a<c;a+=4)l.push(i[a]),h.push(i[a+1]*r),h.push(i[a+2]*r),h.push(i[a+3])}e.bones=l,e.vertices=P.toFloatArray(h)}readAnimation(t,e,s){let r=this.scale,i=new Array;if(t.slots)for(let l in t.slots){let a=t.slots[l],n=s.findSlot(l);if(!n)throw new Error("Slot not found: "+l);let o=n.index;for(let c in a){let f=a[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ut(d,o);for(let u=0;u<d;u++){let w=f[u];m.setFrame(u,S(w,"time",0),S(w,"name",null))}i.push(m)}else if(c=="rgba"){let m=new ee(d,d<<2,o),u=f[0],w=S(u,"time",0),b=q.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b,b.a);let x=f[p+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1),g=_(A,m,g,p,3,w,y,b.a,v.a,1)),w=y,b=v,u=x}i.push(m)}else if(c=="rgb"){let m=new se(d,d*3,o),u=f[0],w=S(u,"time",0),b=q.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b);let x=f[p+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1)),w=y,b=v,u=x}i.push(m)}else if(c=="alpha")i.push(at(f,new ie(d,d,o),0,1));else if(c=="rgba2"){let m=new re(d,d*7,o),u=f[0],w=S(u,"time",0),b=q.fromString(u.light),p=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,b.a,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,b.a,A.a,1),x=_(C,m,x,g,4,w,v,p.r,I.r,1),x=_(C,m,x,g,5,w,v,p.g,I.g,1),x=_(C,m,x,g,6,w,v,p.b,I.b,1)),w=v,b=A,p=I,u=y}i.push(m)}else if(c=="rgb2"){let m=new ae(d,d*6,o),u=f[0],w=S(u,"time",0),b=q.fromString(u.light),p=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,p.r,I.r,1),x=_(C,m,x,g,4,w,v,p.g,I.g,1),x=_(C,m,x,g,5,w,v,p.b,I.b,1)),w=v,b=A,p=I,u=y}i.push(m)}}}if(t.bones)for(let l in t.bones){let a=t.bones[l],n=s.findBone(l);if(!n)throw new Error("Bone not found: "+l);let o=n.index;for(let c in a){let f=a[c],d=f.length;if(d!=0){if(c==="rotate")i.push(at(f,new At(d,d,o),0,1));else if(c==="translate"){let m=new _t(d,d<<1,o);i.push(Ue(f,m,"x","y",0,r))}else if(c==="translatex"){let m=new Gt(d,d,o);i.push(at(f,m,0,r))}else if(c==="translatey"){let m=new $t(d,d,o);i.push(at(f,m,0,r))}else if(c==="scale"){let m=new Ht(d,d<<1,o);i.push(Ue(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new jt(d,d,o);i.push(at(f,m,1,1))}else if(c==="scaley"){let m=new Jt(d,d,o);i.push(at(f,m,1,1))}else if(c==="shear"){let m=new Kt(d,d<<1,o);i.push(Ue(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new Qt(d,d,o);i.push(at(f,m,0,1))}else if(c==="sheary"){let m=new Zt(d,d,o);i.push(at(f,m,0,1))}else if(c==="inherit"){let m=new te(d,n.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,S(w,"time",0),P.enumValue(Vt,S(w,"inherit","Normal")))}i.push(m)}}}}if(t.ik)for(let l in t.ik){let a=t.ik[l],n=a[0];if(!n)continue;let o=s.findIkConstraint(l);if(!o)throw new Error("IK Constraint not found: "+l);let c=s.ikConstraints.indexOf(o),f=new le(a.length,a.length<<1,c),d=S(n,"time",0),m=S(n,"mix",1),u=S(n,"softness",0)*r;for(let w=0,b=0;;w++){f.setFrame(w,d,m,u,S(n,"bendPositive",!0)?1:-1,S(n,"compress",!1),S(n,"stretch",!1));let p=a[w+1];if(!p){f.shrink(b);break}let g=S(p,"time",0),x=S(p,"mix",1),y=S(p,"softness",0)*r,v=n.curve;v&&(b=_(v,f,b,w,0,d,g,m,x,1),b=_(v,f,b,w,1,d,g,u,y,r)),d=g,m=x,u=y,n=p}i.push(f)}if(t.transform)for(let l in t.transform){let a=t.transform[l],n=a[0];if(!n)continue;let o=s.findTransformConstraint(l);if(!o)throw new Error("Transform constraint not found: "+l);let c=s.transformConstraints.indexOf(o),f=new oe(a.length,a.length*6,c),d=S(n,"time",0),m=S(n,"mixRotate",1),u=S(n,"mixX",1),w=S(n,"mixY",u),b=S(n,"mixScaleX",1),p=S(n,"mixScaleY",b),g=S(n,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,b,p,g);let v=a[x+1];if(!v){f.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),T=S(v,"mixY",C),M=S(v,"mixScaleX",1),Y=S(v,"mixScaleY",M),F=S(v,"mixShearY",1),E=n.curve;E&&(y=_(E,f,y,x,0,d,A,m,I,1),y=_(E,f,y,x,1,d,A,u,C,1),y=_(E,f,y,x,2,d,A,w,T,1),y=_(E,f,y,x,3,d,A,b,M,1),y=_(E,f,y,x,4,d,A,p,Y,1),y=_(E,f,y,x,5,d,A,g,F,1)),d=A,m=I,u=C,w=T,b=M,p=Y,b=M,n=v}i.push(f)}if(t.path)for(let l in t.path){let a=t.path[l],n=s.findPathConstraint(l);if(!n)throw new Error("Path constraint not found: "+l);let o=s.pathConstraints.indexOf(n);for(let c in a){let f=a[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new he(m,m,o);i.push(at(f,u,0,n.positionMode==0?r:1))}else if(c==="spacing"){let u=new ce(m,m,o);i.push(at(f,u,0,n.spacingMode==0||n.spacingMode==1?r:1))}else if(c==="mix"){let u=new de(m,m*3,o),w=S(d,"time",0),b=S(d,"mixRotate",1),p=S(d,"mixX",1),g=S(d,"mixY",p);for(let x=0,y=0;;x++){u.setFrame(x,w,b,p,g);let v=f[x+1];if(!v){u.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),T=S(v,"mixY",C),M=d.curve;M&&(y=_(M,u,y,x,0,w,A,b,I,1),y=_(M,u,y,x,1,w,A,p,C,1),y=_(M,u,y,x,2,w,A,g,T,1)),w=A,b=I,p=C,g=T,d=v}i.push(u)}}}if(t.physics)for(let l in t.physics){let a=t.physics[l],n=-1;if(l.length>0){let o=s.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);n=s.physicsConstraints.indexOf(o)}for(let o in a){let c=a[o],f=c[0];if(!f)continue;let d=c.length;if(o=="reset"){const u=new pe(d,n);for(let w=0;f!=null;f=c[w+1],w++)u.setFrame(w,S(f,"time",0));i.push(u);continue}let m;if(o=="inertia")m=new fe(d,d,n);else if(o=="strength")m=new ue(d,d,n);else if(o=="damping")m=new me(d,d,n);else if(o=="mass")m=new ge(d,d,n);else if(o=="wind")m=new xe(d,d,n);else if(o=="gravity")m=new we(d,d,n);else if(o=="mix")m=new be(d,d,n);else continue;i.push(at(c,m,0,1))}}if(t.attachments)for(let l in t.attachments){let a=t.attachments[l],n=s.findSkin(l);if(!n)throw new Error("Skin not found: "+l);for(let o in a){let c=a[o],f=s.findSlot(o);if(!f)throw new Error("Slot not found: "+o);let d=f.index;for(let m in c){let u=c[m],w=n.getAttachment(d,m);for(let b in u){let p=u[b],g=p[0];if(g){if(b=="deform"){let x=w.bones,y=w.vertices,v=x?y.length/3*2:y.length,A=new ne(p.length,p.length,d,w),I=S(g,"time",0);for(let C=0,T=0;;C++){let M,Y=S(g,"vertices",null);if(!Y)M=x?P.newFloatArray(v):y;else{M=P.newFloatArray(v);let X=S(g,"offset",0);if(P.arrayCopy(Y,0,M,X,Y.length),r!=1)for(let V=X,N=V+Y.length;V<N;V++)M[V]*=r;if(!x)for(let V=0;V<v;V++)M[V]+=y[V]}A.setFrame(C,I,M);let F=p[C+1];if(!F){A.shrink(T);break}let E=S(F,"time",0),k=g.curve;k&&(T=_(k,A,T,C,0,I,E,0,1,1)),I=E,g=F}i.push(A)}else if(b=="sequence"){let x=new ye(p.length,d,w),y=0;for(let v=0;v<p.length;v++){let A=S(g,"delay",y),I=S(g,"time",0),C=es[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,I,C,T,A),y=A,g=p[v+1]}i.push(x)}}}}}}if(t.drawOrder){let l=new wt(t.drawOrder.length),a=s.slots.length,n=0;for(let o=0;o<t.drawOrder.length;o++,n++){let c=t.drawOrder[o],f=null,d=S(c,"offsets",null);if(d){f=P.newArray(a,-1);let m=P.newArray(a-d.length,0),u=0,w=0;for(let b=0;b<d.length;b++){let p=d[b],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[w++]=u++;f[u+p.offset]=u++}for(;u<a;)m[w++]=u++;for(let b=a-1;b>=0;b--)f[b]==-1&&(f[b]=m[--w])}l.setFrame(n,S(c,"time",0),f)}i.push(l)}if(t.events){let l=new Ft(t.events.length),a=0;for(let n=0;n<t.events.length;n++,a++){let o=t.events[n],c=s.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let f=new Fe(P.toSinglePrecision(S(o,"time",0)),c);f.intValue=S(o,"int",c.intValue),f.floatValue=S(o,"float",c.floatValue),f.stringValue=S(o,"string",c.stringValue),f.data.audioPath&&(f.volume=S(o,"volume",1),f.balance=S(o,"balance",0)),l.setFrame(a,f)}i.push(l)}let h=0;for(let l=0,a=i.length;l<a;l++)h=Math.max(h,i[l].getDuration());s.animations.push(new Mt(e,i,h))}},Xi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function at(t,e,s,r){let i=t[0],h=S(i,"time",0),l=S(i,"value",s)*r,a=0;for(let n=0;;n++){e.setFrame(n,h,l);let o=t[n+1];if(!o)return e.shrink(a),e;let c=S(o,"time",0),f=S(o,"value",s)*r;i.curve&&(a=_(i.curve,e,a,n,0,h,c,l,f,r)),h=c,l=f,i=o}}function Ue(t,e,s,r,i,h){let l=t[0],a=S(l,"time",0),n=S(l,s,i)*h,o=S(l,r,i)*h,c=0;for(let f=0;;f++){e.setFrame(f,a,n,o);let d=t[f+1];if(!d)return e.shrink(c),e;let m=S(d,"time",0),u=S(d,s,i)*h,w=S(d,r,i)*h,b=l.curve;b&&(c=_(b,e,c,f,0,a,m,n,u,h),c=_(b,e,c,f,1,a,m,o,w,h)),a=m,n=u,o=w,l=d}}function _(t,e,s,r,i,h,l,a,n,o){if(t=="stepped")return e.setStepped(r),s;let c=i<<2,f=t[c],d=t[c+1]*o,m=t[c+2],u=t[c+3]*o;return e.setBezier(s,r,i,h,a,f,d,m,u,l,n),s+1}function S(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));export{ie as AlphaTimeline,Mt as Animation,Os as AnimationState,qs as AnimationStateAdapter,Ws as AnimationStateData,gs as AssetCache,Gs as AssetManagerBase,_s as AtlasAttachmentLoader,Ut as Attachment,ut as AttachmentTimeline,Is as BinaryInput,qe as BlendMode,Xe as Bone,Me as BoneData,Ie as BoundingBoxAttachment,hs as CURRENT,Ce as ClippingAttachment,q as Color,It as ConstraintData,rt as CurveTimeline,st as CurveTimeline1,Xt as CurveTimeline2,Ls as DebugUtils,ne as DeformTimeline,xs as Downloader,wt as DrawOrderTimeline,Fe as Event,Ee as EventData,ns as EventQueue,Ft as EventTimeline,ls as EventType,ve as FIRST,zs as FakeTexture,Rt as HOLD_FIRST,os as HOLD_MIX,Ae as HOLD_SUBSEQUENT,ws as IkConstraint,Re as IkConstraintData,le as IkConstraintTimeline,Vt as Inherit,te as InheritTimeline,Bs as IntSet,Qe as Interpolation,R as MathUtils,Bt as MeshAttachment,is as MixBlend,rs as MixDirection,St as PathAttachment,bs as PathConstraint,Pe as PathConstraintData,de as PathConstraintMixTimeline,he as PathConstraintPositionTimeline,ce as PathConstraintSpacingTimeline,As as Physics,me as PhysicsConstraintDampingTimeline,we as PhysicsConstraintGravityTimeline,fe as PhysicsConstraintInertiaTimeline,ge as PhysicsConstraintMassTimeline,be as PhysicsConstraintMixTimeline,pe as PhysicsConstraintResetTimeline,ue as PhysicsConstraintStrengthTimeline,ct as PhysicsConstraintTimeline,xe as PhysicsConstraintWindTimeline,ms as PointAttachment,vt as Pool,Be as PositionMode,Ze as Pow,Vs as PowOut,ae as RGB2Timeline,re as RGBA2Timeline,ee as RGBATimeline,se as RGBTimeline,Ye as RegionAttachment,Le as RotateMode,At as RotateTimeline,Se as SETUP,Et as SUBSEQUENT,Ht as ScaleTimeline,jt as ScaleXTimeline,Jt as ScaleYTimeline,ye as SequenceTimeline,Kt as ShearTimeline,Qt as ShearXTimeline,Zt as ShearYTimeline,vs as Skeleton,Hs as SkeletonBinary,Ti as SkeletonBounds,Yi as SkeletonClipping,Ne as SkeletonData,Mi as SkeletonJson,Lt as Skin,De as SkinEntry,ps as Slot,Oe as SlotData,Ve as SpacingMode,zt as StringSet,cs as Texture,ke as TextureAtlas,us as TextureAtlasPage,Te as TextureAtlasRegion,Pt as TextureFilter,fs as TextureRegion,ds as TextureWrap,Ns as TimeKeeper,H as Timeline,as as TrackEntry,ys as TransformConstraint,We as TransformConstraintData,oe as TransformConstraintTimeline,_t as TranslateTimeline,Gt as TranslateXTimeline,$t as TranslateYTimeline,Cs as Triangulator,P as Utils,Yt as Vector2,lt as VertexAttachment,Ds as WindowedMean};
|
|
1
|
+
"use strict";var Bs=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},zt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},q=class mt{constructor(e=0,s=0,r=0,i=0){this.r=e,this.g=s,this.b=r,this.a=i}static WHITE=new mt(1,1,1,1);static RED=new mt(1,0,0,1);static GREEN=new mt(0,1,0,1);static BLUE=new mt(0,0,1,1);static MAGENTA=new mt(1,0,1,1);set(e,s,r,i){return this.r=e,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,r,i){return this.r+=e,this.g+=s,this.b+=r,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new mt){return s.setFromString(e)}},R=class nt{static PI=3.1415927;static PI2=nt.PI*2;static invPI2=1/nt.PI2;static radiansToDegrees=180/nt.PI;static radDeg=nt.radiansToDegrees;static degreesToRadians=nt.PI/180;static degRad=nt.degreesToRadians;static clamp(e,s,r){return e<s?s:e>r?r:e}static cosDeg(e){return Math.cos(e*nt.degRad)}static sinDeg(e){return Math.sin(e*nt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*nt.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return nt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,r){let i=Math.random(),h=s-e;return i<=(r-e)/h?e+Math.sqrt(i*h*(r-e)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Qe=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ze=class extends Qe{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Vs=class extends Ze{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},P=class bt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,r,i,h){for(let o=s,a=i;o<s+h;o++,a++)r[a]=e[o]}static arrayFill(e,s,r,i){for(let h=s;h<r;h++)e[h]=i}static setArraySize(e,s,r=0){let i=e.length;if(i==s)return e;if(e.length=s,i<s)for(let h=i;h<s;h++)e[h]=r;return e}static ensureArrayCapacity(e,s,r=0){return e.length>=s?e:bt.setArraySize(e,s,r)}static newArray(e,s){let r=new Array(e);for(let i=0;i<e;i++)r[i]=s;return r}static newFloatArray(e){if(bt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(e){if(bt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(e){return bt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return bt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,r=!0){for(var i=0;i<e.length;i++)if(e[i]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Ls=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},vt=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Yt=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Ns=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ds=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Ut=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},lt=class ks extends Ut{static nextID=0;id=ks.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,r,i,h,o){r=h+(r>>1)*o;let a=e.bone.skeleton,n=e.deform,l=this.vertices,c=this.bones;if(!c){n.length>0&&(l=n);let u=e.bone,w=u.worldX,b=u.worldY,p=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,A=h;A<r;v+=2,A+=o){let I=l[v],C=l[v+1];i[A]=I*p+C*g+w,i[A+1]=I*x+C*y+b}return}let f=0,d=0;for(let u=0;u<s;u+=2){let w=c[f];f+=w+1,d+=w}let m=a.bones;if(n.length==0)for(let u=h,w=d*3;u<r;u+=o){let b=0,p=0,g=c[f++];for(g+=f;f<g;f++,w+=3){let x=m[c[f]],y=l[w],v=l[w+1],A=l[w+2];b+=(y*x.a+v*x.b+x.worldX)*A,p+=(y*x.c+v*x.d+x.worldY)*A}i[u]=b,i[u+1]=p}else{let u=n;for(let w=h,b=d*3,p=d<<1;w<r;w+=o){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,b+=3,p+=2){let v=m[c[f]],A=l[b]+u[p],I=l[b+1]+u[p+1],C=l[b+2];g+=(A*v.a+I*v.b+v.worldX)*C,x+=(A*v.c+I*v.d+v.worldY)*C}i[w]=g,i[w+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ts=class Nt{static _nextID=0;id=Nt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Nt(this.regions.length);return P.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let r=e.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(e,s){let r=e,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return Nt._nextID++}},es=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(es||{}),ss=[0,1,2,3,4,5,6],Mt=class{name;timelines=[];timelineIds=new zt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,i,h,o,a){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let n=this.timelines;for(let l=0,c=n.length;l<c;l++)n[l].apply(t,e,s,i,h,o,a)}},is=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(is||{}),rs=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(rs||{}),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},H=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=P.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}},rt=class extends H{curves;constructor(t,e,s){super(t,s),this.curves=P.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=P.newFloatArray(e);P.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,i,h,o,a,n,l,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(r-h*2+a)*.03,u=(i-o*2+n)*.03,w=((h-a)*3-r+l)*.006,b=((o-n)*3-i+c)*.006,p=m*2+w,g=u*2+b,x=(h-r)*.3+m+w*.16666667,y=(o-i)*.3+u+b*.16666667,v=r+x,A=i+y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],l=this.frames[e+s];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=t){let n=i[r-2],l=i[r-1];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}e+=this.getFrameEntries();let o=i[h-2],a=i[h-1];return a+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-a)}},st=class extends rt{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=e[s],h=e[s+1];return h+(t-i)/(e[s+2]-i)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);switch(s){case 0:return i+h*e;case 1:case 2:h+=i-r}return r+h*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);return s==0?i+(h-i)*e:r+(h-r)*e}getAbsoluteValue2(t,e,s,r,i,h){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}return s==0?i+(h-i)*e:r+(h-r)*e}getScaleValue(t,e,s,r,i,h){const o=this.frames;if(t<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*e}return i}let a=this.getCurveValue(t)*h;if(e==1)return s==3?i+a-h:a;if(r==1)switch(s){case 0:return h+(Math.abs(a)*R.signum(h)-h)*e;case 1:case 2:return i+(Math.abs(a)*R.signum(i)-i)*e}else{let n=0;switch(s){case 0:return n=Math.abs(h)*R.signum(a),n+(a-n)*e;case 1:case 2:return n=Math.abs(i)*R.signum(a),n+(a-n)*e}}return i+(a-h)*e}},Xt=class extends rt{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}},At=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,i,h,a.rotation,a.data.rotation))}},_t=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*i,a.y+=(a.data.y-a.y)*i}return}let l=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.x=a.data.x+l*i,a.y=a.data.y+c*i;break;case 1:case 2:a.x+=(a.data.x+l-a.x)*i,a.y+=(a.data.y+c-a.y)*i;break;case 3:a.x+=l*i,a.y+=c*i}}},Gt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,i,h,a.x,a.data.x))}},$t=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,i,h,a.y,a.data.y))}},Ht=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*i,a.scaleY+=(a.data.scaleY-a.scaleY)*i}return}let l,c,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(l*=a.data.scaleX,c*=a.data.scaleY,i==1)h==3?(a.scaleX+=l-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=l,a.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*i;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*i;break;case 3:a.scaleX+=(l-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}else switch(h){case 0:m=Math.abs(a.data.scaleX)*R.signum(l),u=Math.abs(a.data.scaleY)*R.signum(c),a.scaleX=m+(l-m)*i,a.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(a.scaleX)*R.signum(l),u=Math.abs(a.scaleY)*R.signum(c),a.scaleX=m+(l-m)*i,a.scaleY=u+(c-u)*i;break;case 3:a.scaleX+=(l-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}}}},jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,i,h,o,a.scaleX,a.data.scaleX))}},Jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,i,h,o,a.scaleY,a.data.scaleY))}},Kt=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*i,a.shearY+=(a.data.shearY-a.shearY)*i}return}let l=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.shearX=a.data.shearX+l*i,a.shearY=a.data.shearY+c*i;break;case 1:case 2:a.shearX+=(a.data.shearX+l-a.shearX)*i,a.shearY+=(a.data.shearY+c-a.shearY)*i;break;case 3:a.shearX+=l*i,a.shearY+=c*i}}},Qt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,i,h,a.shearX,a.data.shearX))}},Zt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,i,h,a.shearY,a.data.shearY))}},te=class extends H{boneIndex=0;constructor(t,e){super(t,[O.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;if(o==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[H.search(n,s,2)+1]}},ee=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let b=a.data.color;switch(h){case 0:l.setFromColor(b);return;case 1:l.add((b.r-l.r)*i,(b.g-l.g)*i,(b.b-l.b)*i,(b.a-l.a)*i)}return}let c=0,f=0,d=0,m=0,u=H.search(n,s,5),w=this.curves[u/5];switch(w){case 0:let b=n[u];c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];let p=(s-b)/(n[u+5]-b);c+=(n[u+5+1]-c)*p,f+=(n[u+5+2]-f)*p,d+=(n[u+5+3]-d)*p,m+=(n[u+5+4]-m)*p;break;case 1:c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,w-2),f=this.getBezierValue(s,u,2,w+18-2),d=this.getBezierValue(s,u,3,w+18*2-2),m=this.getBezierValue(s,u,4,w+18*3-2)}i==1?l.set(c,f,d,m):(h==0&&l.setFromColor(a.data.color),l.add((c-l.r)*i,(f-l.g)*i,(d-l.b)*i,(m-l.a)*i))}},se=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let w=a.data.color;switch(h){case 0:l.r=w.r,l.g=w.g,l.b=w.b;return;case 1:l.r+=(w.r-l.r)*i,l.g+=(w.g-l.g)*i,l.b+=(w.b-l.b)*i}return}let c=0,f=0,d=0,m=H.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let w=n[m];c=n[m+1],f=n[m+2],d=n[m+3];let b=(s-w)/(n[m+4]-w);c+=(n[m+4+1]-c)*b,f+=(n[m+4+2]-f)*b,d+=(n[m+4+3]-d)*b;break;case 1:c=n[m+1],f=n[m+2],d=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2),d=this.getBezierValue(s,m,3,u+18*2-2)}if(i==1)l.r=c,l.g=f,l.b=d;else{if(h==0){let w=a.data.color;l.r=w.r,l.g=w.g,l.b=w.b}l.r+=(c-l.r)*i,l.g+=(f-l.g)*i,l.b+=(d-l.b)*i}}},ie=class extends st{slotIndex=0;constructor(t,e,s){super(t,e,O.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*i}return}let l=this.getCurveValue(s);i==1?n.a=l:(h==0&&(n.a=a.data.color.a),n.a+=(l-n.a)*i)}},re=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,h,o,a,n){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=a,this.frames[t+7]=n}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*i,(y.g-l.g)*i,(y.b-l.b)*i,(y.a-l.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,8),x=this.curves[g>>3];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];let v=(s-y)/(n[g+8]-y);f+=(n[g+8+1]-f)*v,d+=(n[g+8+2]-d)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,w+=(n[g+8+5]-w)*v,b+=(n[g+8+6]-b)*v,p+=(n[g+8+7]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),w=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),p=this.getBezierValue(s,g,7,x+18*6-2)}if(i==1)l.set(f,d,m,u),c.r=w,c.g=b,c.b=p;else{if(h==0){l.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((f-l.r)*i,(d-l.g)*i,(m-l.b)*i,(u-l.a)*i),c.r+=(w-c.r)*i,c.g+=(b-c.g)*i,c.b+=(p-c.b)*i}}},ae=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,o,a){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=a}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*i,l.g+=(y.g-l.g)*i,l.b+=(y.b-l.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,7),x=this.curves[g/7];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];let v=(s-y)/(n[g+7]-y);f+=(n[g+7+1]-f)*v,d+=(n[g+7+2]-d)*v,m+=(n[g+7+3]-m)*v,w+=(n[g+7+4]-w)*v,b+=(n[g+7+5]-b)*v,p+=(n[g+7+6]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),w=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),p=this.getBezierValue(s,g,6,x+18*5-2)}if(i==1)l.r=f,l.g=d,l.b=m,c.r=w,c.g=b,c.b=p;else{if(h==0){let y=a.data.color,v=a.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(f-l.r)*i,l.g+=(d-l.g)*i,l.b+=(m-l.b)*i,c.r+=(w-c.r)*i,c.g+=(b-c.g)*i,c.b+=(p-c.b)*i}}},ut=class extends H{slotIndex=0;attachmentNames;constructor(t,e){super(t,[O.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(a.bone.active){if(o==1){h==0&&this.setAttachment(t,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,a,a.data.attachmentName);return}this.setAttachment(t,a,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},ne=class extends rt{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[O.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,i,h,o,a,n,l,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(r-h*2+a)*.03,u=n*.03-o*.06,w=((h-a)*3-r+l)*.006,b=(o-n+.33333333)*.018,p=m*2+w,g=u*2+b,x=(h-r)*.3+m+w*.16666667,y=o*.3+u+b*.16666667,v=r+x,A=y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let a=this.frames[e];return(t-a)/(this.frames[e+this.getFrameEntries()]-a);case 1:return 0}if(r-=2,s[r]>t){let a=this.frames[e];return s[r+1]*(t-a)/(s[r]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let a=s[r-2],n=s[r-1];return n+(t-a)/(s[r]-a)*(s[r+1]-n)}let h=s[i-2],o=s[i-1];return o+(1-o)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof lt)||n.timelineAttachment!=this.attachment)return;let l=a.deform;l.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:l.length=0;return;case 1:if(i==1){l.length=0;return}l.length=f;let g=n;if(g.bones){i=1-i;for(var m=0;m<f;m++)l[m]*=i}else{let x=g.vertices;for(var m=0;m<f;m++)l[m]+=(x[m]-l[m])*i}}return}if(l.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(i==1)if(h==3){let x=n;if(x.bones)for(let y=0;y<f;y++)l[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)l[v]+=g[v]-y[v]}}else P.arrayCopy(g,0,l,0,f);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<f;v++)l[v]=g[v]*i;else{let v=y.vertices;for(let A=0;A<f;A++){let I=v[A];l[A]=I+(g[A]-I)*i}}break}case 1:case 2:for(let y=0;y<f;y++)l[y]+=(g[y]-l[y])*i;break;case 3:let x=n;if(x.bones)for(let y=0;y<f;y++)l[y]+=g[y]*i;else{let y=x.vertices;for(let v=0;v<f;v++)l[v]+=(g[v]-y[v])*i}}return}let u=H.search1(d,s),w=this.getCurvePercent(s,u),b=c[u],p=c[u+1];if(i==1)if(h==3){let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];l[x]+=y+(p[x]-y)*w}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];l[y]+=v+(p[y]-v)*w-x[y]}}}else for(let g=0;g<f;g++){let x=b[g];l[g]=x+(p[g]-x)*w}else switch(h){case 0:{let x=n;if(x.bones)for(let y=0;y<f;y++){let v=b[y];l[y]=(v+(p[y]-v)*w)*i}else{let y=x.vertices;for(let v=0;v<f;v++){let A=b[v],I=y[v];l[v]=I+(A+(p[v]-A)*w-I)*i}}break}case 1:case 2:for(let x=0;x<f;x++){let y=b[x];l[x]+=(y+(p[x]-y)*w-l[x])*i}break;case 3:let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];l[x]+=(y+(p[x]-y)*w)*i}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];l[y]+=(v+(p[y]-v)*w-x[y])*i}}}}},Ft=class Ts extends H{static propertyIds=[""+O.event];events;constructor(e){super(e,Ts.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,r,i,h,o,a){if(!i)return;let n=this.frames,l=this.frames.length;if(s>r)this.apply(e,s,Number.MAX_VALUE,i,h,o,a),s=-1;else if(s>=n[l-1])return;if(r<n[0])return;let c=0;if(s<n[0])c=0;else{c=H.search1(n,s)+1;let f=n[c];for(;c>0&&n[c-1]==f;)c--}for(;c<l&&r>=n[c];c++)i.push(this.events[c])}},wt=class Ys extends H{static propertyIds=[""+O.drawOrder];drawOrders;constructor(e){super(e,Ys.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,r){this.frames[e]=s,this.drawOrders[e]=r}apply(e,s,r,i,h,o,a){if(a==1){o==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let n=H.search1(this.frames,r),l=this.drawOrders[n];if(!l)P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,f=e.slots;for(let d=0,m=l.length;d<m;d++)c[d]=f[l[d]]}}},le=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,h,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,r,i,h,o){let a=t.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*i,a.softness+=(a.data.softness-a.softness)*i,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let l=0,c=0,f=H.search(n,s,6),d=this.curves[f/6];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+6]-m);l+=(n[f+6+1]-l)*u,c+=(n[f+6+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(a.mix=a.data.mix+(l-a.data.mix)*i,a.softness=a.data.softness+(c-a.data.softness)*i,o==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0)):(a.mix+=(l-a.mix)*i,a.softness+=(c-a.softness)*i,o==0&&(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0))}},oe=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,o,a){let n=this.frames;t*=7,n[t]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i,n[t+4]=h,n[t+5]=o,n[t+6]=a}apply(t,e,s,r,i,h,o){let a=t.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let p=a.data;switch(h){case 0:a.mixRotate=p.mixRotate,a.mixX=p.mixX,a.mixY=p.mixY,a.mixScaleX=p.mixScaleX,a.mixScaleY=p.mixScaleY,a.mixShearY=p.mixShearY;return;case 1:a.mixRotate+=(p.mixRotate-a.mixRotate)*i,a.mixX+=(p.mixX-a.mixX)*i,a.mixY+=(p.mixY-a.mixY)*i,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*i,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*i,a.mixShearY+=(p.mixShearY-a.mixShearY)*i}return}let l,c,f,d,m,u,w=H.search(n,s,7),b=this.curves[w/7];switch(b){case 0:let p=n[w];l=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];let g=(s-p)/(n[w+7]-p);l+=(n[w+7+1]-l)*g,c+=(n[w+7+2]-c)*g,f+=(n[w+7+3]-f)*g,d+=(n[w+7+4]-d)*g,m+=(n[w+7+5]-m)*g,u+=(n[w+7+6]-u)*g;break;case 1:l=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];break;default:l=this.getBezierValue(s,w,1,b-2),c=this.getBezierValue(s,w,2,b+18-2),f=this.getBezierValue(s,w,3,b+18*2-2),d=this.getBezierValue(s,w,4,b+18*3-2),m=this.getBezierValue(s,w,5,b+18*4-2),u=this.getBezierValue(s,w,6,b+18*5-2)}if(h==0){let p=a.data;a.mixRotate=p.mixRotate+(l-p.mixRotate)*i,a.mixX=p.mixX+(c-p.mixX)*i,a.mixY=p.mixY+(f-p.mixY)*i,a.mixScaleX=p.mixScaleX+(d-p.mixScaleX)*i,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*i,a.mixShearY=p.mixShearY+(u-p.mixShearY)*i}else a.mixRotate+=(l-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i,a.mixScaleX+=(d-a.mixScaleX)*i,a.mixScaleY+=(m-a.mixScaleY)*i,a.mixShearY+=(u-a.mixShearY)*i}},he=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,i,h,a.position,a.data.position))}},ce=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,i,h,a.spacing,a.data.spacing))}},de=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=r,h[t+3]=i}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*i,a.mixX+=(a.data.mixX-a.mixX)*i,a.mixY+=(a.data.mixY-a.mixY)*i}return}let l,c,f,d=H.search(n,s,4),m=this.curves[d>>2];switch(m){case 0:let u=n[d];l=n[d+1],c=n[d+2],f=n[d+3];let w=(s-u)/(n[d+4]-u);l+=(n[d+4+1]-l)*w,c+=(n[d+4+2]-c)*w,f+=(n[d+4+3]-f)*w;break;case 1:l=n[d+1],c=n[d+2],f=n[d+3];break;default:l=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),f=this.getBezierValue(s,d,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(l-u.mixRotate)*i,a.mixX=u.mixX+(c-u.mixX)*i,a.mixY=u.mixY+(f-u.mixY)*i}else a.mixRotate+=(l-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i}},ct=class extends st{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),n))}else a=t.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,i,h,this.get(a),this.setup(a)))}},fe=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ue=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},me=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ge=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},xe=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},we=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},be=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},pe=class Ms extends H{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,Ms.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,r,i,h,o,a){let n;if(this.constraintIndex!=-1&&(n=e.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>r)this.apply(e,s,Number.MAX_VALUE,[],h,o,a),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[H.search1(l,s)+1]))if(n!=null)n.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},ye=class dt extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,r){super(e,[O.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,r,i,h){let o=this.frames;e*=dt.ENTRIES,o[e]=s,o[e+dt.MODE]=r|i<<4,o[e+dt.DELAY]=h}apply(e,s,r,i,h,o,a){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,c=this.attachment;if(l!=c&&(!(l instanceof lt)||l.timelineAttachment!=c))return;if(a==1){o==0&&(n.sequenceIndex=-1);return}let f=this.frames;if(r<f[0]){(o==0||o==1)&&(n.sequenceIndex=-1);return}let d=H.search(f,r,dt.ENTRIES),m=f[d],u=f[d+dt.MODE],w=f[d+dt.DELAY];if(!this.attachment.sequence)return;let b=u>>4,p=this.attachment.sequence.regions.length,g=ss[u&15];if(g!=0)switch(b+=(r-m)/w+1e-5|0,g){case 1:b=Math.min(p-1,b);break;case 2:b%=p;break;case 3:{let x=(p<<1)-2;b=x==0?0:b%x,b>=p&&(b=x-b);break}case 4:b=Math.max(p-1-b,0);break;case 5:b=p-1-b%p;break;case 6:{let x=(p<<1)-2;b=x==0?0:(b+p-1)%x,b>=p&&(b=x-b)}}n.sequenceIndex=b}},Os=class Dt{static _emptyAnimation=new Mt("<empty>",[],0);static emptyAnimation(){return Dt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ns(this);propertyIDs=new zt;animationsChanged=!1;trackEntryPool=new vt(()=>new as);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=e*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+e)*a.timeScale,h.trackTime+=o,this.setCurrent(r,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(e,s){let r=e.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((r.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=e),e.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let d=0,m=r.length;d<m;d++){let u=r[d];if(!u||u.delay>0)continue;i=!0;let w=d==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,e,w):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let p=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,I=A.length;if(d==0&&b==1||w==3){d==0&&(p=!0);for(let C=0;C<I;C++){P.webkit602BugfixHelper(b,w);var h=A[C];h instanceof ut?this.applyAttachmentTimeline(h,e,y,w,p):h.apply(e,g,y,v,b,w,0)}}else{let C=u.timelineMode,T=u.shortestRotation,M=!T&&u.timelinesRotation.length!=I<<1;M&&(u.timelinesRotation.length=I<<1);for(let Y=0;Y<I;Y++){let F=A[Y],E=C[Y]==Et?w:0;!T&&F instanceof At?this.applyRotateTimeline(F,e,y,b,E,u.timelinesRotation,Y<<1,M):F instanceof ut?this.applyAttachmentTimeline(F,e,y,w,p):(P.webkit602BugfixHelper(b,w),F.apply(e,g,y,v,b,E,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Se,a=e.slots,n=0,l=e.slots.length;n<l;n++){var c=a[n];if(c.attachmentState==o){var f=c.data.attachmentName;c.setAttachment(f?e.getAttachment(c.data.index,f):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s,r){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;e.mixDuration==0?(h=1,r==1&&(r=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let o=h<i.mixAttachmentThreshold,a=h<i.mixDrawOrderThreshold,n=i.animation.timelines,l=n.length,c=i.alpha*e.interruptAlpha,f=c*(1-h),d=i.animationLast,m=i.getAnimationTime(),u=m,w=null;if(i.reverse?u=i.animation.duration-u:h<i.eventThreshold&&(w=this.events),r==3)for(let b=0;b<l;b++)n[b].apply(s,d,u,w,f,r,1);else{let b=i.timelineMode,p=i.timelineHoldMix,g=i.shortestRotation,x=!g&&i.timelinesRotation.length!=l<<1;x&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let y=0;y<l;y++){let v=n[y],A=1,I,C=0;switch(b[y]){case Et:if(!a&&v instanceof wt)continue;I=r,C=f;break;case ve:I=0,C=f;break;case Ae:I=r,C=c;break;case Rt:I=0,C=c;break;default:I=0;let T=p[y];C=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=C,!g&&v instanceof At?this.applyRotateTimeline(v,s,u,C,I,i.timelinesRotation,y<<1,x):v instanceof ut?this.applyAttachmentTimeline(v,s,u,I,o&&C>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(C,r),a&&v instanceof wt&&I==0&&(A=0),v.apply(s,d,u,w,C,I,A))}}return e.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(e,s,r,i,h){var o=s.slots[e.slotIndex];o.bone.active&&(r<e.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,e.attachmentNames[H.search1(e.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Se))}setAttachment(e,s,r,i){s.setAttachment(r?e.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,s,r,i,h,o,a,n){if(n&&(o[a]=0),i==1){e.apply(s,0,r,null,1,h,0);return}let l=s.bones[e.boneIndex];if(!l.active)return;let c=e.frames,f=0,d=0;if(r<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:f=l.rotation,d=l.data.rotation}else f=h==0?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(r);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[a];else{let w=0,b=0;n?(w=0,b=u):(w=o[a],b=o[a+1]);let p=w-w%360;m=u+p;let g=u>=0,x=w>=0;Math.abs(b)<=90&&R.signum(b)!=R.signum(u)&&(Math.abs(w-p)>180?(m+=360*R.signum(w),x=g):p!=0?m-=360*R.signum(w):x=g),x!=g&&(m+=360*R.signum(w)),o[a]=m}o[a+1]=u,l.rotation=f+m*i}queueEvents(e,s){let r=e.animationStart,i=e.animationEnd,h=i-r,o=e.trackLast%h,a=this.events,n=0,l=a.length;for(;n<l;n++){let f=a[n];if(f.time<o)break;f.time>i||this.queue.event(e,f)}let c=!1;if(e.loop)if(h==0)c=!0;else{const f=Math.floor(e.trackTime/h);c=f>0&&f>Math.floor(e.trackLast/h)}else c=s>=i&&e.animationLast<i;for(c&&this.queue.complete(e);n<l;n++){let f=a[n];f.time<r||this.queue.event(e,f)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,r){let i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,i,r)}setAnimationWith(e,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let o=this.trackEntry(e,s,r,h);return this.setCurrent(e,o,i),this.queue.drain(),o}addAnimation(e,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,r,i)}addAnimationWith(e,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(e,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(e,s=0){let r=this.setAnimationWith(e,Dt.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(e,s=0,r=0){let i=this.addAnimationWith(e,Dt.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(P.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let s=e.mixingTo,r=e.animation.timelines,i=e.animation.timelines.length,h=e.timelineMode;h.length=i;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<i;n++)h[n]=a.addAll(r[n].getPropertyIds())?Rt:Ae;return}t:for(let n=0;n<i;n++){let l=r[n],c=l.getPropertyIds();if(!a.addAll(c))h[n]=Et;else if(!s||l instanceof ut||l instanceof wt||l instanceof Ft||!s.animation.hasTimeline(c))h[n]=ve;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(e.mixDuration>0){h[n]=os,o[n]=f;continue t}break}h[n]=Rt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},as=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ns=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<e.length;o++){let a=e[o];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<e.length;o++){let a=e[o];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<e.length;o++){let a=e[o];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<e.length;o++){let a=e[o];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<e.length;o++){let a=e[o];a.complete&&a.complete(i)}break;case 5:let h=t[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<e.length;o++){let a=e[o];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ls=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(ls||{}),qs=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Et=0,ve=1,Ae=2,Rt=3,os=4,Se=1,hs=2,Ws=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ie=class Xs extends lt{color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Xs(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ce=class Fs extends lt{endSlot=null;color=new q(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Fs(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},cs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Pt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Pt||{}),ds=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(ds||{}),fs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},zs=class extends cs{setFilters(t,e){}setWraps(t,e){}dispose(){}},ke=class{pages=new Array;regions=new Array;constructor(t){let e=new Us(t),s=new Array(4),r={};r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.format=()=>{},r.filter=l=>{l.minFilter=P.enumValue(Pt,s[1]),l.magFilter=P.enumValue(Pt,s[2])},r.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},r.pma=l=>{l.pma=s[1]=="true"};var i={};i.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},i.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},i.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},i.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},i.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},i.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let o=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)o=null,h=e.readLine();else if(o){let l=new Te(o,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let f=i[s[0]];if(f)f(l);else{a||(a=[]),n||(n=[]),a.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));n.push(d)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),a&&a.length>0&&n&&n.length>0&&(l.names=a,l.values=n,a=null,n=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new us(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Us=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=e.indexOf(",",i);if(h==-1)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},us=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Te=class extends fs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Bt=class _e extends lt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new q(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new q(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=P.newFloatArray(e.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,a=0;if(this.region instanceof Te){let n=this.region,l=n.page,c=l.width,f=l.height;switch(n.degrees){case 90:i-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/f,o=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+e[d+1]*o,s[d+1]=h+(1-e[d])*a;return;case 180:i-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/f,o=n.originalWidth/c,a=n.originalHeight/f;for(let d=0;d<r;d+=2)s[d]=i+(1-e[d])*o,s[d+1]=h+(1-e[d+1])*a;return;case 270:i-=n.offsetY/c,h-=n.offsetX/f,o=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+(1-e[d+1])*o,s[d+1]=h+e[d]*a;return}i-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/f,o=n.originalWidth/c,a=n.originalHeight/f}else this.region?(o=this.region.u2-i,a=this.region.v2-h):(i=h=0,o=a=1);for(let n=0;n<r;n+=2)s[n]=i+e[n]*o,s[n+1]=h+e[n+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new _e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,r,i,h,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,r,i,h,o)}newLinkedMesh(){let e=new _e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},St=class Es extends lt{lengths=[];closed=!1;constantSpeed=!1;color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Es(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},ms=class Rs extends lt{x=0;y=0;rotation=0;color=new q(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*R.degRad,r=Math.cos(s),i=Math.sin(s),h=r*e.a+i*e.b,o=r*e.c+i*e.d;return R.atan2Deg(o,h)}copy(){let e=new Rs(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Ye=class Ps extends Ut{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new q(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new q(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,a=h+this.region.width*r,n=o+this.region.height*i,l=this.rotation*R.degRad,c=Math.cos(l),f=Math.sin(l),d=this.x,m=this.y,u=h*c+d,w=h*f,b=o*c+m,p=o*f,g=a*c+d,x=a*f,y=n*c+m,v=n*f,A=this.offset;A[0]=u-p,A[1]=b+w,A[2]=u-v,A[3]=y+w,A[4]=g-v,A[5]=y+x,A[6]=g-p,A[7]=b+x,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,r,i){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,o=this.offset,a=h.worldX,n=h.worldY,l=h.a,c=h.b,f=h.c,d=h.d,m=0,u=0;m=o[0],u=o[1],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=o[2],u=o[3],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=o[4],u=o[5],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=o[6],u=o[7],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n}copy(){let e=new Ps(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,P.arrayCopy(this.uvs,0,e.uvs,0,8),P.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},_s=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let o=s.getPath(e,i),a=this.atlas.findRegion(o);if(a==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new Ye(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=h}return i}newMeshAttachment(t,e,s,r){let i=new Bt(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=h}return i}newBoundingBoxAttachment(t,e){return new Ie(e)}newPathAttachment(t,e){return new St(e)}newPointAttachment(t,e){return new ms(e)}newClippingAttachment(t,e){return new Ce(e)}},Me=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new q;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Vt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Vt||{}),Xe=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,h,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let a=this.parent;if(!a){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,w=(s+h)*R.degRad,b=(s+90+o)*R.degRad;this.a=Math.cos(w)*r*m,this.b=Math.cos(b)*i*m,this.c=Math.sin(w)*r*u,this.d=Math.sin(b)*i*u,this.worldX=t*m+d.x,this.worldY=e*u+d.y;return}let n=a.a,l=a.b,c=a.c,f=a.d;switch(this.worldX=n*t+l*e+a.worldX,this.worldY=c*t+f*e+a.worldY,this.inherit){case 0:{const d=(s+h)*R.degRad,m=(s+90+o)*R.degRad,u=Math.cos(d)*r,w=Math.cos(m)*i,b=Math.sin(d)*r,p=Math.sin(m)*i;this.a=n*u+l*b,this.b=n*w+l*p,this.c=c*u+f*b,this.d=c*w+f*p;return}case 1:{const d=(s+h)*R.degRad,m=(s+90+o)*R.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(m)*i,this.c=Math.sin(d)*r,this.d=Math.sin(m)*i;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=d,c*=m;let u=n*n+c*c,w=0;u>1e-4?(u=Math.abs(n*f*m-l*d*c)/u,l=c*u,f=n*u,w=Math.atan2(c,n)*R.radDeg):(n=0,c=0,w=90-Math.atan2(f,l)*R.radDeg);const b=(s+h-w)*R.degRad,p=(s+o-w+90)*R.degRad,g=Math.cos(b)*r,x=Math.cos(p)*i,y=Math.sin(b)*r,v=Math.sin(p)*i;this.a=n*g-l*y,this.b=n*x-l*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=R.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(n*d+l*m)/this.skeleton.scaleX,w=(c*d+f*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+w*w);b>1e-5&&(b=1/b),u*=b,w*=b,b=Math.sqrt(u*u+w*w),this.inherit==3&&n*f-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(w,u);const p=Math.cos(s)*b,g=Math.sin(s)*b;h*=R.degRad,o=(90+o)*R.degRad;const x=Math.cos(h)*r,y=Math.cos(o)*i,v=Math.sin(h)*r,A=Math.sin(o)*i;this.a=u*x+p*v,this.b=u*y+p*A,this.c=w*x+g*v,this.d=w*y+g*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*R.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*R.radDeg;return}let e=t.a,s=t.b,r=t.c,i=t.d,h=1/(e*i-s*r),o=i*h,a=s*h,n=r*h,l=e*h,c=this.worldX-t.worldX,f=this.worldY-t.worldY;this.ax=c*o-f*a,this.ay=f*l-c*n;let d,m,u,w;if(this.inherit==1)d=this.a,m=this.b,u=this.c,w=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(e*i-s*r)/(e*e+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*i-s*r),o=i*h,a=s*h;break}case 3:case 4:let b=R.cosDeg(this.rotation),p=R.sinDeg(this.rotation);e=(e*b+s*p)/this.skeleton.scaleX,r=(r*b+i*p)/this.skeleton.scaleY;let g=Math.sqrt(e*e+r*r);g>1e-5&&(g=1/g),e*=g,r*=g,g=Math.sqrt(e*e+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=R.PI/2+Math.atan2(r,e);s=Math.cos(x)*g,i=Math.sin(x)*g,h=1/(e*i-s*r),o=i*h,a=s*h,n=r*h,l=e*h}d=o*this.a-a*this.c,m=o*this.b-a*this.d,u=l*this.c-n*this.a,w=l*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let b=d*w-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*w,b)*R.radDeg,this.arotation=Math.atan2(u,d)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+w*w),this.ashearY=0,this.arotation=90-Math.atan2(w,m)*R.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*R.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=R.sinDeg(t),s=R.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*R.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=R.sinDeg(t),s=R.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*R.radDeg}rotateWorld(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}},It=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Gs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new xs,r=new gs){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=r}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),r(h)},(h,o)=>{const a=`Couldn't load binary ${t}: status ${h}, ${o}`;this.error(s,t,a),i(a)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,r=>{this.success(e,t,r)},(r,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${r}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),r(h)},(h,o)=>{const a=`Couldn't load JSON ${t}: status ${h}, ${o}`;this.error(s,t,a),i(a)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[t],i=r!==void 0;return i&&(this.cache.assetsLoaded[t]=r.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),i}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),i(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.createTexture(t,a);this.success(e,t,n),r(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.createTexture(t,a);this.success(e,t,n),r(n)},a.onerror=()=>{const n=`Couldn't load image: ${t}`;this.error(s,t,n),i(n)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,a)=>{this.downloader.downloadText(t,n=>{try{const l=this.createTextureAtlas(t,n);let c=l.pages.length,f=!1;if(c===0){this.success(e,t,l),o(l);return}for(let d of l.pages)this.loadTexture(r?r[d.name]:h+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(e,t,l),o(l)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,w),a(w)}f=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),a(c)}},(n,l)=>{const c=`Couldn't load texture atlas ${t}: status ${n}, ${l}`;this.error(s,t,c),a(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},r){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,h)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(t,o);this.success(e,t,a),i(a)}catch(a){const n=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,n),h(n)}},(o,a)=>{const n=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,n),h(n)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(r,i)=>e(i),(r,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
+
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof ke){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new ke(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const r of s.pages)r.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),r=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&r()},s}},gs=class Ot{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Ot.AVAILABLE_CACHES.get(e);if(s)return s;const r=new Ot;return Ot.AVAILABLE_CACHES.set(e,r),r}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},xs=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToString(r))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||t,!0);let h=()=>{this.finish(t,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(t,e,s){this.downloadText(t,r=>{e(JSON.parse(r))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(r))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||t,!0),i.responseType="arraybuffer";let h=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(t,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=e==200||e==0?[s]:[e,s];for(let h=i.length-1,o=r.length;h<o;h+=2)r[h].apply(null,i)}},Fe=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Ee=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},ws=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,r,i,h,o){let a=t.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,l=a.b,c=a.c,f=a.d,d=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case 1:m=(e-t.worldX)*R.signum(t.skeleton.scaleX),u=(s-t.worldY)*R.signum(t.skeleton.scaleY);break;case 2:let p=Math.abs(n*f-l*c)/Math.max(1e-4,n*n+c*c),g=n/t.skeleton.scaleX,x=c/t.skeleton.scaleY;l=-x*p*t.skeleton.scaleX,f=g*p*t.skeleton.scaleY,d+=Math.atan2(x,g)*R.radDeg;default:let y=e-a.worldX,v=s-a.worldY,A=n*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*l)/A-t.ax,u=(v*n-y*c)/A-t.ay)}d+=Math.atan2(u,m)*R.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=t.ascaleX,b=t.ascaleY;if(r||i){switch(t.inherit){case 3:case 4:m=e-t.worldX,u=s-t.worldY}const p=t.data.length*w;if(p>1e-4){const g=m*m+u*u;if(r&&g<p*p||i&&g>p*p){const x=(Math.sqrt(g)/p-1)*o+1;w*=x,h&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*o,w,b,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,h,o,a,n){if(t.inherit!=0||e.inherit!=0)return;let l=t.ax,c=t.ay,f=t.ascaleX,d=t.ascaleY,m=f,u=d,w=e.ascaleX,b=0,p=0,g=0;f<0?(f=-f,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),w<0?(w=-w,p=180):p=0;let x=e.ax,y=0,v=0,A=0,I=t.a,C=t.b,T=t.c,M=t.d,Y=Math.abs(f-d)<=1e-4;!Y||h?(y=0,v=I*x+t.worldX,A=T*x+t.worldY):(y=e.ay,v=I*x+C*y+t.worldX,A=T*x+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");I=F.a,C=F.b,T=F.c,M=F.d;let E=I*M-C*T,k=v-F.worldX,X=A-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let V=(k*M-X*C)*E-l,N=(X*I-k*T)*E-c,L=Math.sqrt(V*V+N*N),D=e.data.length*w,$,U;if(L<1e-4){this.apply1(t,s,r,!1,h,!1,n),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}k=s-F.worldX,X=r-F.worldY;let j=(k*M-X*C)*E-l,B=(X*I-k*T)*E-c,W=j*j+B*B;if(a!=0){a*=f*(w+1)*.5;let J=Math.sqrt(W),K=J-L-D*f+a;if(K>0){let Q=Math.min(1,K/(a*2))-1;Q=(K-a*(1-Q*Q))/J,j-=Q*j,B-=Q*B,W=j*j+B*B}}t:if(Y){D*=f;let J=(W-L*L-D*D)/(2*L*D);J<-1?(J=-1,U=Math.PI*i):J>1?(J=1,U=0,h&&(I=(Math.sqrt(W)/(L+D)-1)*n+1,m*=I,o&&(u*=I))):U=Math.acos(J)*i,I=L+D*J,C=D*Math.sin(U),$=Math.atan2(B*I-j*C,j*I+B*C)}else{I=f*D,C=d*D;let J=I*I,K=C*C,Q=Math.atan2(B,j);T=K*L*L+J*W-J*K;let it=-2*K*L,gt=K-J;if(M=it*it-4*gt*T,M>=0){let xt=Math.sqrt(M);it<0&&(xt=-xt),xt=-(it+xt)*.5;let yt=xt/gt,Ke=T/xt,Tt=Math.abs(yt)<Math.abs(Ke)?yt:Ke;if(yt=W-Tt*Tt,yt>=0){X=Math.sqrt(yt)*i,$=Q-Math.atan2(X,Tt),U=Math.atan2(X/d,(Tt-L)/f);break t}}let pt=R.PI,Ct=L-I,qt=Ct*Ct,He=0,je=0,kt=L+I,Wt=kt*kt,Je=0;T=-I*L/(J-K),T>=-1&&T<=1&&(T=Math.acos(T),k=I*Math.cos(T)+L,X=C*Math.sin(T),M=k*k+X*X,M<qt&&(pt=T,qt=M,Ct=k,He=X),M>Wt&&(je=T,Wt=M,kt=k,Je=X)),W<=(qt+Wt)*.5?($=Q-Math.atan2(He*i,Ct),U=pt*i):($=Q-Math.atan2(Je*i,kt),U=je*i)}let G=Math.atan2(y,x)*g,tt=t.arotation;$=($-G)*R.radDeg+b-tt,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(l,c,tt+$*n,m,u,0,0),tt=e.arotation,U=((U+G)*R.radDeg-e.ashearX)*g+p-tt,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(x,y,tt+U*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Re=class extends It{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},Pe=class extends It{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Be=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Be||{}),Ve=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ve||{}),Le=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Le||{}),bs=class ft{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,h=e.bones.length;i<h;i++){let o=s.findBone(e.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(e.target.name);if(!r)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=r,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof St))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,a=o.rotateMode==0,n=o.rotateMode==2,l=this.bones,c=l.length,f=a?c:c+1,d=P.setArraySize(this.spaces,f),m=n?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(n)for(let A=0,I=f-1;A<I;A++){let C=l[A],T=C.data.length,M=T*C.a,Y=T*C.c;m[A]=Math.sqrt(M*M+Y*Y)}P.arrayFill(d,1,f,u);break;case 3:let y=0;for(let A=0,I=f-1;A<I;){let C=l[A],T=C.data.length;if(T<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=T*C.a,Y=T*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=F,y+=F}}if(y>0){y=f/y*u;for(let A=1;A<f;A++)d[A]*=y}break;default:let v=o.spacingMode==0;for(let A=0,I=f-1;A<I;){let C=l[A],T=C.data.length;if(T<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=T*C.a,Y=T*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=(v?T+u:u)*F/T}}}let w=this.computeWorldPositions(s,f,a),b=w[0],p=w[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?R.degRad:-R.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(b-A.worldX)*i,A.worldY+=(p-A.worldY)*h;let I=w[v],C=w[v+1],T=I-b,M=C-p;if(n){let Y=m[y];if(Y!=0){let F=(Math.sqrt(T*T+M*M)/Y-1)*r+1;A.a*=F,A.c*=F}}if(b=I,p=C,r>0){let Y=A.a,F=A.b,E=A.c,k=A.d,X=0,V=0,N=0;if(a?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(M,T),X-=Math.atan2(E,Y),x){V=Math.cos(X),N=Math.sin(X);let L=A.data.length;b+=(L*(V*Y-N*E)-T)*r,p+=(L*(N*Y+V*E)-M)*r}else X+=g;X>R.PI?X-=R.PI2:X<-R.PI&&(X+=R.PI2),X*=r,V=Math.cos(X),N=Math.sin(X),A.a=V*Y-N*E,A.b=V*F-N*k,A.c=N*Y+V*E,A.d=N*F+V*k}A.updateAppliedTransform()}}computeWorldPositions(e,s,r){let i=this.target,h=this.position,o=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,l=e.closed,c=e.worldVerticesLength,f=c/6,d=ft.NONE;if(!e.constantSpeed){let L=e.lengths;f-=l?1:2;let D=L[f];this.data.positionMode==1&&(h*=D);let $;switch(this.data.spacingMode){case 2:$=D;break;case 3:$=D/s;break;default:$=1}n=P.setArraySize(this.world,8);for(let U=0,j=0,B=0;U<s;U++,j+=3){let W=o[U]*$;h+=W;let G=h;if(l)G%=D,G<0&&(G+=D),B=0;else if(G<0){d!=ft.BEFORE&&(d=ft.BEFORE,e.computeWorldVertices(i,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>D){d!=ft.AFTER&&(d=ft.AFTER,e.computeWorldVertices(i,c-6,4,n,0,2)),this.addAfterPosition(G-D,n,0,a,j);continue}for(;;B++){let tt=L[B];if(!(G>tt)){if(B==0)G/=tt;else{let J=L[B-1];G=(G-J)/(tt-J)}break}}B!=d&&(d=B,l&&B==f?(e.computeWorldVertices(i,c-4,4,n,0,2),e.computeWorldVertices(i,0,4,n,4,2)):e.computeWorldVertices(i,B*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,j,r||U>0&&W==0)}return a}l?(c+=2,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c-4,n,0,2),e.computeWorldVertices(i,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(f--,c-=4,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c,n,0,2));let m=P.setArraySize(this.curves,f),u=0,w=n[0],b=n[1],p=0,g=0,x=0,y=0,v=0,A=0,I=0,C=0,T=0,M=0,Y=0,F=0,E=0,k=0;for(let L=0,D=2;L<f;L++,D+=6)p=n[D],g=n[D+1],x=n[D+2],y=n[D+3],v=n[D+4],A=n[D+5],I=(w-p*2+x)*.1875,C=(b-g*2+y)*.1875,T=((p-x)*3-w+v)*.09375,M=((g-y)*3-b+A)*.09375,Y=I*2+T,F=C*2+M,E=(p-w)*.75+I+T*.16666667,k=(g-b)*.75+C+M*.16666667,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,u+=Math.sqrt(E*E+k*k),E+=Y+T,k+=F+M,u+=Math.sqrt(E*E+k*k),m[L]=u,w=v,b=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let V=this.segments,N=0;for(let L=0,D=0,$=0,U=0;L<s;L++,D+=3){let j=o[L]*X;h+=j;let B=h;if(l)B%=u,B<0&&(B+=u),$=0;else if(B<0){this.addBeforePosition(B,n,0,a,D);continue}else if(B>u){this.addAfterPosition(B-u,n,c-4,a,D);continue}for(;;$++){let W=m[$];if(!(B>W)){if($==0)B/=W;else{let G=m[$-1];B=(B-G)/(W-G)}break}}if($!=d){d=$;let W=$*6;for(w=n[W],b=n[W+1],p=n[W+2],g=n[W+3],x=n[W+4],y=n[W+5],v=n[W+6],A=n[W+7],I=(w-p*2+x)*.03,C=(b-g*2+y)*.03,T=((p-x)*3-w+v)*.006,M=((g-y)*3-b+A)*.006,Y=I*2+T,F=C*2+M,E=(p-w)*.3+I+T*.16666667,k=(g-b)*.3+C+M*.16666667,N=Math.sqrt(E*E+k*k),V[0]=N,W=1;W<8;W++)E+=Y,k+=F,Y+=T,F+=M,N+=Math.sqrt(E*E+k*k),V[W]=N;E+=Y,k+=F,N+=Math.sqrt(E*E+k*k),V[8]=N,E+=Y+T,k+=F+M,N+=Math.sqrt(E*E+k*k),V[9]=N,U=0}for(B*=N;;U++){let W=V[U];if(!(B>W)){if(U==0)B/=W;else{let G=V[U-1];B=U+(B-G)/(W-G)}break}}this.addCurvePosition(B*.1,w,b,p,g,x,y,v,A,a,D,r||L>0&&j==0)}return a}addBeforePosition(e,s,r,i,h){let o=s[r],a=s[r+1],n=s[r+2]-o,l=s[r+3]-a,c=Math.atan2(l,n);i[h]=o+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addAfterPosition(e,s,r,i,h){let o=s[r+2],a=s[r+3],n=o-s[r],l=a-s[r+1],c=Math.atan2(l,n);i[h]=o+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addCurvePosition(e,s,r,i,h,o,a,n,l,c,f,d){if(e==0||isNaN(e)){c[f]=s,c[f+1]=r,c[f+2]=Math.atan2(h-r,i-s);return}let m=e*e,u=m*e,w=1-e,b=w*w,p=b*w,g=w*e,x=g*3,y=w*x,v=x*e,A=s*p+i*y+o*v+n*u,I=r*p+h*y+a*v+l*u;c[f]=A,c[f+1]=I,d&&(e<.001?c[f+2]=Math.atan2(h-r,i-s):c[f+2]=Math.atan2(I-(r*b+h*g*2+a*m),A-(s*b+i*g*2+o*m)))}},$s=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=n.time;const c=o.worldX,f=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=f;else{let d=this.remaining,m=this.inertia,u=this.data.step,w=this.skeleton.data.referenceScale,b=-1,p=this.data.limit*l,g=p*Math.abs(n.scaleY);if(p*=Math.abs(n.scaleX),s||r){if(s){const x=(this.ux-c)*m;this.xOffset+=x>p?p:x<-p?-p:x,this.ux=c}if(r){const x=(this.uy-f)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=f}if(d>=u){b=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*w*n.scaleX,A=this.gravity*w*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),r&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),d-=u;while(d>=u)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||h){let x=Math.atan2(o.c,o.a),y=0,v=0,A=0,I=this.cx-o.worldX,C=this.cy-o.worldY;if(I>p?I=p:I<-p&&(I=-p),C>g?C=g:C<-g&&(C=-g),i){A=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(C+this.ty,I+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*R.invPI2-.5)*R.PI2)*m,T=this.rotateOffset*A+x,y=Math.cos(T),v=Math.sin(T),h&&(T=a*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(I*y+C*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=a*o.getWorldScaleX();T>0&&(this.scaleOffset+=(I*y+C*v)*m/T)}if(d=this.remaining,d>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,M=this.strength,Y=this.wind,F=vs.yDown?-this.gravity:this.gravity,E=a/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),i){if(this.rotateVelocity-=((Y*v+F*y)*E+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,d<u)break;const k=this.rotateOffset*A+x;y=Math.cos(k),v=Math.sin(k)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let n=this.rotateOffset*e,l=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=n*this.data.rotate,l=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-l*o.d,o.d=l*f+c*o.d),d+=n*this.data.shearX,l=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-l*o.c,o.c=l*f+c*o.c}else n*=this.data.rotate,l=Math.sin(n),c=Math.cos(n),f=o.a,o.a=c*f-l*o.c,o.c=l*f+c*o.c,f=o.b,o.b=c*f-l*o.d,o.d=l*f+c*o.d}if(h){const n=1+this.scaleOffset*e*this.data.scaleX;o.a*=n,o.c*=n}t!=3&&(this.tx=a*o.a,this.ty=a*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*R.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-t,a=this.cy-e;this.translate(o*i-a*h-o,o*h+a*i-a)}},ps=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new q,this.darkColor=t.darkColor?new q:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof lt)||!(this.attachment instanceof lt)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Yt;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,f=a.d,d=n*f-l*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)-Math.atan2(v,x)+m;I>R.PI?I-=R.PI2:I<-R.PI&&(I+=R.PI2),I*=t;let C=Math.cos(I),T=Math.sin(I);g.a=C*x-T*v,g.b=C*y-T*A,g.c=T*x+C*v,g.d=T*y+C*A}if(o){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*e,g.worldY+=(x.y-g.worldY)*s}if(r!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(n*n+c*c)-x+this.data.offsetScaleX)*r)/x),g.a*=x,g.c*=x}if(i!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(l*l+f*f)-x+this.data.offsetScaleY)*i)/x),g.b*=x,g.d*=x}if(h>0){let x=g.b,y=g.d,v=Math.atan2(y,x),A=Math.atan2(f,l)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>R.PI?A-=R.PI2:A<-R.PI&&(A+=R.PI2),A=v+(A+u)*h;let I=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*I,g.d=Math.sin(A)*I}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,f=a.d,d=n*f-l*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)+m;I>R.PI?I-=R.PI2:I<-R.PI&&(I+=R.PI2),I*=t;let C=Math.cos(I),T=Math.sin(I);g.a=C*x-T*v,g.b=C*y-T*A,g.c=T*x+C*v,g.d=T*y+C*A}if(o){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*e,g.worldY+=x.y*s}if(r!=0){let x=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=x,g.c*=x}if(i!=0){let x=(Math.sqrt(l*l+f*f)-1+this.data.offsetScaleY)*i+1;g.b*=x,g.d*=x}if(h>0){let x=Math.atan2(f,l)-Math.atan2(c,n);x>R.PI?x-=R.PI2:x<-R.PI&&(x+=R.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-R.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*A,g.d=Math.sin(x)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],f=c.arotation;t!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*t);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,w=c.ascaleY;r!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*r)/u),i!=0&&w!=0&&(w=(w+(o.ascaleY-w+this.data.offsetScaleY)*i)/w);let b=c.ashearY;h!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],f=c.arotation+(o.arotation+this.data.offsetRotation)*t,d=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),w=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}},vs=class Ge{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ge.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let r=e.bones[s],i;if(!r.parent)i=new Xe(r,this,null);else{let h=this.bones[r.parent.index];i=new Xe(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let r=e.slots[s],i=this.bones[r.boneData.index],h=new ps(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let r=e.ikConstraints[s];this.ikConstraints.push(new ws(r,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let r=e.transformConstraints[s];this.transformConstraints.push(new ys(r,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let r=e.pathConstraints[s];this.pathConstraints.push(new bs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let r=e.physicsConstraints[s];this.physicsConstraints.push(new $s(r,this))}this.color=new q(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let u=s[d];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let w=this.bones[d[m].index];do w.sorted=!1,w.active=!0,w=w.parent;while(w)}}let r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,a=r.length,n=i.length,l=h.length,c=this.physicsConstraints.length,f=a+n+l+c;t:for(let d=0;d<f;d++){for(let m=0;m<a;m++){let u=r[m];if(u.data.order==d){this.sortIkConstraint(u);continue t}}for(let m=0;m<n;m++){let u=i[m];if(u.data.order==d){this.sortTransformConstraint(u);continue t}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==d){this.sortPhysicsConstraint(u);continue t}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let r=e.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let n=0,l=this.data.skins.length;n<l;n++)this.sortPathConstraintAttachment(this.data.skins[n],r,i);let h=s.getAttachment();h instanceof St&&this.sortPathConstraintAttachmentWith(h,i);let o=e.bones,a=o.length;for(let n=0;n<a;n++)this.sortBone(o[n]);this._updateCache.push(e);for(let n=0;n<a;n++)this.sortReset(o[n].children);for(let n=0;n<a;n++)o[n].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,r=s.length;if(e.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(e);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(e,s,r){let i=e.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof St))return;let r=e.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let a=r[h++];for(a+=h;h<a;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,r=e.length;s<r;s++){let i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let b=1,p=r.length;b<p;b++){let g=r[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,a=s.c,n=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=a*this.x+n*this.y+s.worldY;const l=(i.rotation+i.shearX)*R.degRad,c=(i.rotation+90+i.shearY)*R.degRad,f=Math.cos(l)*i.scaleX,d=Math.cos(c)*i.scaleY,m=Math.sin(l)*i.scaleX,u=Math.sin(c)*i.scaleY;i.a=(h*f+o*m)*this.scaleX,i.b=(h*d+o*u)*this.scaleX,i.c=(a*f+n*m)*this.scaleY,i.d=(a*d+n*u)*this.scaleY;let w=this._updateCache;for(let b=0,p=w.length;b<p;b++){let g=w[b];g!=i&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;P.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,r=e.length;s<r;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],o=h.data.attachmentName;if(o){let a=e.getAttachment(r,o);a&&h.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let r=this.data.findSlot(e);if(!r)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(r.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(e,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let o=r[i];if(o.data.name==e){let a=null;if(s&&(a=this.getAttachment(i,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Yt,r=new Yt;return this.getBounds(s,r,void 0,e),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(e,s,r=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,f=h.length;c<f;c++){let d=h[c];if(!d.bone.active)continue;let m=0,u=null,w=null,b=d.getAttachment();if(b instanceof Ye)m=8,u=P.setArraySize(r,m,0),b.computeWorldVertices(d,u,0,2),w=Ge.quadTriangles;else if(b instanceof Bt){let p=b;m=p.worldVerticesLength,u=P.setArraySize(r,m,0),p.computeWorldVertices(d,0,m,u,0,2),w=p.triangles}else if(b instanceof Ce&&i!=null){i.clipStart(d,b);continue}if(u&&w){i!=null&&i.isClipping()&&(i.clipTriangles(u,w,w.length),u=i.clippedVertices,m=i.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let x=u[p],y=u[p+1];o=Math.min(o,x),a=Math.min(a,y),n=Math.max(n,x),l=Math.max(l,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),e.set(o,a),s.set(n-o,l-a)}update(e){this.time+=e}physicsTranslate(e,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(e,s)}physicsRotate(e,s,r){const i=this.physicsConstraints;for(let h=0,o=i.length;h<o;h++)i[h].rotate(e,s,r)}},As=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(As||{}),Ss=class extends It{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},Ne=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}},De=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Lt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new q(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];s.attachment&&(s.attachment instanceof Bt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new De(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new De(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],h=i.getAttachment();if(h&&s<e.attachments.length){let o=e.attachments[s];for(let a in o){let n=o[a];if(h==n){let l=this.getAttachment(s,a);l&&i.setAttachment(l);break}}}s++}}},Oe=class{index=0;name;boneData;color=new q(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},qe=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(qe||{}),We=class extends It{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ne;s.name="";let r=new Is(t),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let a=0;a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let f=l==0?null:s.bones[r.readInt(!0)],d=new Me(l,c,f);d.rotation=r.readFloat(),d.x=r.readFloat()*e,d.y=r.readFloat()*e,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*e,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),o&&(q.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[r.readInt(!0)],d=new Oe(l,c,f);q.rgba8888ToColor(d.color,r.readInt32());let m=r.readInt32();m!=-1&&q.rgb888ToColor(d.darkColor=new q,m),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),o&&(d.visible=r.readBoolean()),s.slots.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Re(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(d.softness=r.readFloat()*e),s.ikConstraints.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new We(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=r.readFloat()),(m&16)!=0&&(d.offsetX=r.readFloat()*e),(m&32)!=0&&(d.offsetY=r.readFloat()*e),(m&64)!=0&&(d.offsetScaleX=r.readFloat()),(m&128)!=0&&(d.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(d.offsetShearY=r.readFloat()),(m&2)!=0&&(d.mixRotate=r.readFloat()),(m&4)!=0&&(d.mixX=r.readFloat()),(m&8)!=0&&(d.mixY=r.readFloat()),(m&16)!=0&&(d.mixScaleX=r.readFloat()),(m&32)!=0&&(d.mixScaleY=r.readFloat()),(m&64)!=0&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Pe(f);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const m=r.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=e),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=e),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){const f=r.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ss(f);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=r.readFloat()),(m&4)!=0&&(d.y=r.readFloat()),(m&8)!=0&&(d.rotate=r.readFloat()),(m&16)!=0&&(d.scaleX=r.readFloat()),(m&32)!=0&&(d.shearX=r.readFloat()),d.limit=((m&64)!=0?r.readFloat():5e3)*e,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=(m&128)!=0?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(d)}let n=this.readSkin(r,s,!0,o);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(P.setArraySize(s.skins,a=l+r.readInt(!0));l<a;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}a=this.linkedMeshes.length;for(let l=0;l<a;l++){let c=this.linkedMeshes[l];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.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,a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let f=new Ee(c);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(t,e,s,r){let i=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;i=new Lt("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");i=new Lt(o),r&&q.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let a=0,n=i.bones.length;a<n;a++)i.bones[a]=e.bones[t.readInt(!0)];for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let o=0;o<h;o++){let a=t.readInt(!0);for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(t,e,i,a,c,r);f&&i.setAttachment(a,c,f)}}return i}readAttachment(t,e,s,r,i,h){let o=this.scale,a=t.readByte();const n=(a&8)!=0?t.readStringRef():i;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let l=(a&16)!=0?t.readStringRef():null;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null;let d=(a&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),g=t.readFloat();l||(l=n);let x=this.attachmentLoader.newRegionAttachment(s,n,l,f);return x?(x.path=l,x.x=m*o,x.y=u*o,x.scaleX=w,x.scaleY=b,x.rotation=d,x.width=p*o,x.height=g*o,q.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let l=this.readVertices(t,(a&16)!=0),c=h?t.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,n);return f?(f.worldVerticesLength=l.length,f.vertices=l.vertices,f.bones=l.bones,h&&q.rgba8888ToColor(f.color,c),f):null}case 2:{let l=(a&16)!=0?t.readStringRef():n;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=t.readInt(!0),m=this.readVertices(t,(a&128)!=0),u=this.readFloatArray(t,m.length,1),w=this.readShortArray(t,(m.length-d-2)*3);let b=[],p=0,g=0;h&&(b=this.readShortArray(t,t.readInt(!0)),p=t.readFloat(),g=t.readFloat()),l||(l=n);let x=this.attachmentLoader.newMeshAttachment(s,n,l,f);return x?(x.path=l,q.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=w,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,h&&(x.edges=b,x.width=p*o,x.height=g*o),x):null}case 3:{const l=(a&16)!=0?t.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=(a&128)!=0,m=t.readInt(!0),u=t.readStringRef();let w=0,b=0;h&&(w=t.readFloat(),b=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,n,l,f);return p?(p.path=l,q.rgba8888ToColor(p.color,c),p.sequence=f,h&&(p.width=w*o,p.height=b*o),this.linkedMeshes.push(new js(p,m,r,u,d)),p):null}case 4:{const l=(a&16)!=0,c=(a&32)!=0,f=this.readVertices(t,(a&64)!=0),d=P.newArray(f.length/6,0);for(let w=0,b=d.length;w<b;w++)d[w]=t.readFloat()*o;const m=h?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=l,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,h&&q.rgba8888ToColor(u.color,m),u):null}case 5:{const l=t.readFloat(),c=t.readFloat(),f=t.readFloat(),d=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*o,m.y=f*o,m.rotation=l,h&&q.rgba8888ToColor(m.color,d),m):null}case 6:{const l=t.readInt(!0),c=this.readVertices(t,(a&16)!=0);let f=h?t.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,n);return d?(d.endSlot=e.slots[l],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&q.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(t){let e=new ts(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),i=new Js;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let h=new Array,o=new Array;for(let a=0;a<r;a++){let n=t.readInt(!0);o.push(n);for(let l=0;l<n;l++)o.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=o,i}readFloatArray(t,e,s){let r=new Array(e);if(s==1)for(let i=0;i<e;i++)r[i]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0),w=u-1;switch(m){case oi:{let b=new ut(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat(),t.readStringRef());r.push(b);break}case hi:{let b=t.readInt(!0),p=new ee(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,C=0;p.setFrame(I,g,x,y,v,A),I!=w;I++){let T=t.readFloat(),M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(I);break;case ht:z(t,p,C++,I,0,g,T,x,M,1),z(t,p,C++,I,1,g,T,y,Y,1),z(t,p,C++,I,2,g,T,v,F,1),z(t,p,C++,I,3,g,T,A,E,1)}g=T,x=M,y=Y,v=F,A=E}r.push(p);break}case ci:{let b=t.readInt(!0),p=new se(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,I=0;p.setFrame(A,g,x,y,v),A!=w;A++){let C=t.readFloat(),T=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(A);break;case ht:z(t,p,I++,A,0,g,C,x,T,1),z(t,p,I++,A,1,g,C,y,M,1),z(t,p,I++,A,2,g,C,v,Y,1)}g=C,x=T,y=M,v=Y}r.push(p);break}case di:{let b=t.readInt(!0),p=new re(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let M=0,Y=0;p.setFrame(M,g,x,y,v,A,I,C,T),M!=w;M++){let F=t.readFloat(),E=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(M);break;case ht:z(t,p,Y++,M,0,g,F,x,E,1),z(t,p,Y++,M,1,g,F,y,k,1),z(t,p,Y++,M,2,g,F,v,X,1),z(t,p,Y++,M,3,g,F,A,V,1),z(t,p,Y++,M,4,g,F,I,N,1),z(t,p,Y++,M,5,g,F,C,L,1),z(t,p,Y++,M,6,g,F,T,D,1)}g=F,x=E,y=k,v=X,A=V,I=N,C=L,T=D}r.push(p);break}case fi:{let b=t.readInt(!0),p=new ae(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let T=0,M=0;p.setFrame(T,g,x,y,v,A,I,C),T!=w;T++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(T);break;case ht:z(t,p,M++,T,0,g,Y,x,F,1),z(t,p,M++,T,1,g,Y,y,E,1),z(t,p,M++,T,2,g,Y,v,k,1),z(t,p,M++,T,3,g,Y,A,X,1),z(t,p,M++,T,4,g,Y,I,V,1),z(t,p,M++,T,5,g,Y,C,N,1)}g=Y,x=F,y=E,v=k,A=X,I=V,C=N}r.push(p);break}case ui:{let b=new ie(u,t.readInt(!0),c),p=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,p,g),x!=w;x++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(x);break;case ht:z(t,b,y++,x,0,p,v,g,A,1)}p=v,g=A}r.push(b)}}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0);if(m==li){let b=new te(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat(),t.readByte());r.push(b);continue}let w=t.readInt(!0);switch(m){case Ks:r.push(Z(t,new At(u,w,c),1));break;case Qs:r.push(ze(t,new _t(u,w,c),i));break;case Zs:r.push(Z(t,new Gt(u,w,c),i));break;case ti:r.push(Z(t,new $t(u,w,c),i));break;case ei:r.push(ze(t,new Ht(u,w,c),1));break;case si:r.push(Z(t,new jt(u,w,c),1));break;case ii:r.push(Z(t,new Jt(u,w,c),1));break;case ri:r.push(ze(t,new Kt(u,w,c),1));break;case ai:r.push(Z(t,new Qt(u,w,c),1));break;case ni:r.push(Z(t,new Zt(u,w,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new le(f,t.readInt(!0),c),u=t.readByte(),w=t.readFloat(),b=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,p=(u&4)!=0?t.readFloat()*i:0;for(let g=0,x=0;m.setFrame(g,w,b,p,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,A=(u&4)!=0?t.readFloat()*i:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(z(t,m,x++,g,0,w,y,b,v,1),z(t,m,x++,g,1,w,y,p,A,i)),w=y,b=v,p=A}r.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new oe(f,t.readInt(!0),c),u=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,b,p,g,x,y),v!=d;v++){let I=t.readFloat(),C=t.readFloat(),T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),E=t.readFloat();switch(t.readByte()){case ot:m.setStepped(v);break;case ht:z(t,m,A++,v,0,u,I,w,C,1),z(t,m,A++,v,1,u,I,b,T,1),z(t,m,A++,v,2,u,I,p,M,1),z(t,m,A++,v,3,u,I,g,Y,1),z(t,m,A++,v,4,u,I,x,F,1),z(t,m,A++,v,5,u,I,y,E,1)}u=I,w=C,b=T,p=M,g=Y,x=F,y=E}r.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=t.readInt(!0);d<m;d++){const u=t.readByte(),w=t.readInt(!0),b=t.readInt(!0);switch(u){case xi:r.push(Z(t,new he(w,b,c),f.positionMode==0?i:1));break;case wi:r.push(Z(t,new ce(w,b,c),f.spacingMode==0||f.spacingMode==1?i:1));break;case bi:let p=new de(w,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,I=0,C=p.getFrameCount()-1;p.setFrame(A,g,x,y,v),A!=C;A++){let T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case ot:p.setStepped(A);break;case ht:z(t,p,I++,A,0,g,T,x,M,1),z(t,p,I++,A,1,g,T,y,Y,1),z(t,p,I++,A,2,g,T,v,F,1)}g=T,x=M,y=Y,v=F}r.push(p)}}}for(let n=0,l=t.readInt(!0);n<l;n++){const c=t.readInt(!0)-1;for(let f=0,d=t.readInt(!0);f<d;f++){const m=t.readByte(),u=t.readInt(!0);if(m==ki){const b=new pe(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat());r.push(b);continue}const w=t.readInt(!0);switch(m){case pi:r.push(Z(t,new fe(u,w,c),1));break;case yi:r.push(Z(t,new ue(u,w,c),1));break;case vi:r.push(Z(t,new me(u,w,c),1));break;case Ai:r.push(Z(t,new ge(u,w,c),1));break;case Si:r.push(Z(t,new xe(u,w,c),1));break;case Ii:r.push(Z(t,new we(u,w,c),1));break;case Ci:r.push(Z(t,new be(u,w,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=s.skins[t.readInt(!0)];for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readInt(!0);for(let u=0,w=t.readInt(!0);u<w;u++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case mi:{let v=p,A=v.bones,I=v.vertices,C=A?I.length/3*2:I.length,T=t.readInt(!0),M=new ne(x,T,m,v),Y=t.readFloat();for(let F=0,E=0;;F++){let k,X=t.readInt(!0);if(X==0)k=A?P.newFloatArray(C):I;else{k=P.newFloatArray(C);let N=t.readInt(!0);if(X+=N,i==1)for(let L=N;L<X;L++)k[L]=t.readFloat();else for(let L=N;L<X;L++)k[L]=t.readFloat()*i;if(!A)for(let L=0,D=k.length;L<D;L++)k[L]+=I[L]}if(M.setFrame(F,Y,k),F==y)break;let V=t.readFloat();switch(t.readByte()){case ot:M.setStepped(F);break;case ht:z(t,M,E++,F,0,Y,V,0,1,1)}Y=V}r.push(M);break}case gi:{let v=new ye(x,m,p);for(let A=0;A<x;A++){let I=t.readFloat(),C=t.readInt32();v.setFrame(A,I,ss[C&15],C>>4,t.readFloat())}r.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let n=new wt(h),l=s.slots.length;for(let c=0;c<h;c++){let f=t.readFloat(),d=t.readInt(!0),m=P.newArray(l,0);for(let p=l-1;p>=0;p--)m[p]=-1;let u=P.newArray(l-d,0),w=0,b=0;for(let p=0;p<d;p++){let g=t.readInt(!0);for(;w!=g;)u[b++]=w++;m[w+t.readInt(!0)]=w++}for(;w<l;)u[b++]=w++;for(let p=l-1;p>=0;p--)m[p]==-1&&(m[p]=u[--b]);n.setFrame(c,f,m)}r.push(n)}let o=t.readInt(!0);if(o>0){let n=new Ft(o);for(let l=0;l<o;l++){let c=t.readFloat(),f=s.events[t.readInt(!0)],d=new Fe(c,f);d.intValue=t.readInt(!1),d.floatValue=t.readFloat(),d.stringValue=t.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=t.readFloat(),d.balance=t.readFloat()),n.setFrame(l,d)}r.push(n)}let a=0;for(let n=0,l=r.length;n<l;n++)a=Math.max(a,r[n].getDuration());return new Mt(e,r,a)}},Is=class{constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let r=0;r<t;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:e+=String.fromCharCode(i),r++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},js=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},Js=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let h=0,o=0,a=e.getFrameCount()-1;e.setFrame(h,r,i),h!=a;h++){let n=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(h);break;case ht:z(t,e,o++,h,0,r,n,i,l,s)}r=n,i=l}return e}function ze(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,h=t.readFloat()*s;for(let o=0,a=0,n=e.getFrameCount()-1;e.setFrame(o,r,i,h),o!=n;o++){let l=t.readFloat(),c=t.readFloat()*s,f=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(o);break;case ht:z(t,e,a++,o,0,r,l,i,c,s),z(t,e,a++,o,1,r,l,h,f,s)}r=l,i=c,h=f}return e}function z(t,e,s,r,i,h,o,a,n,l){e.setBezier(s,r,i,h,a,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,o,n)}var Ks=0,Qs=1,Zs=2,ti=3,ei=4,si=5,ii=6,ri=7,ai=8,ni=9,li=10,oi=0,hi=1,ci=2,di=3,fi=4,ui=5,mi=0,gi=1,xi=0,wi=1,bi=2,pi=0,yi=1,vi=2,Ai=4,Si=5,Ii=6,Ci=7,ki=8,ot=1,ht=2,Ti=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new vt(()=>P.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=t.slots,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let a=0;a<o;a++){let n=h[a];if(!n.bone.active)continue;let l=n.getAttachment();if(l instanceof Ie){let c=l;s.push(c);let f=i.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),r.push(f),c.computeWorldVertices(n,0,c.worldVerticesLength,f,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,o=i.length;h<o;h++){let a=i[h],n=a;for(let l=0,c=a.length;l<c;l+=2){let f=n[l],d=n[l+1];t=Math.min(t,f),e=Math.min(e,d),s=Math.max(s,f),r=Math.max(r,d)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,h=this.minY,o=this.maxX,a=this.maxY;if(t<=i&&s<=i||e<=h&&r<=h||t>=o&&s>=o||e>=a&&r>=a)return!1;let n=(r-e)/(s-t),l=n*(i-t)+e;if(l>h&&l<a||(l=n*(o-t)+e,l>h&&l<a))return!0;let c=(h-e)/n+t;return c>i&&c<o||(c=(a-e)/n+t,c>i&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,h=i-2,o=!1;for(let a=0;a<i;a+=2){let n=r[a+1],l=r[h+1];if(n<s&&l>=s||l<s&&n>=s){let c=r[a];c+(s-n)/(l-n)*(r[h]-c)<e&&(o=!o)}h=a}return o}intersectsSegment(t,e,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;h++)if(this.intersectsSegmentPolygon(i[h],t,e,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,r,i){let h=t,o=t.length,a=e-r,n=s-i,l=e*i-s*r,c=h[o-2],f=h[o-1];for(let d=0;d<o;d+=2){let m=h[d],u=h[d+1],w=c*u-f*m,b=c-m,p=f-u,g=a*p-n*b,x=(l*b-a*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let y=(l*p-n*w)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,f=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Cs=class et{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new vt(()=>new Array);polygonIndicesPool=new vt(()=>new Array);triangulate(e){let s=e,r=e.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<r;a++)i[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=r;a<n;++a)h[a]=et.isConcave(a,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let a=r-1,n=0,l=1;for(;;){t:if(!h[n]){let d=i[a]<<1,m=i[n]<<1,u=i[l]<<1,w=s[d],b=s[d+1],p=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(l+1)%r;v!=a;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,I=s[A],C=s[A+1];if(et.positiveArea(x,y,w,b,I,C)&&et.positiveArea(w,b,p,g,I,C)&&et.positiveArea(p,g,x,y,I,C))break t}break}if(l==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=l,l=(l+1)%r}o.push(i[(r+n-1)%r]),o.push(i[n]),o.push(i[(n+1)%r]),i.splice(n,1),h.splice(n,1),r--;let c=(r+n-1)%r,f=n==r?0:n;h[c]=et.isConcave(c,r,s,i),h[f]=et.isConcave(f,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(e,s){let r=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,l=0;for(let c=0,f=s.length;c<f;c+=3){let d=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,w=r[d],b=r[d+1],p=r[m],g=r[m+1],x=r[u],y=r[u+1],v=!1;if(n==d){let A=a.length-4,I=et.winding(a[A],a[A+1],a[A+2],a[A+3],x,y),C=et.winding(x,y,a[0],a[1],a[2],a[3]);I==l&&C==l&&(a.push(x),a.push(y),o.push(u),v=!0)}v||(a.length>0?(i.push(a),h.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(w),a.push(b),a.push(p),a.push(g),a.push(x),a.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),l=et.winding(w,b,p,g,x,y),n=d)}a.length>0&&(i.push(a),h.push(o));for(let c=0,f=i.length;c<f;c++){if(o=h[c],o.length==0)continue;let d=o[0],m=o[o.length-1];a=i[c];let u=a.length-4,w=a[u],b=a[u+1],p=a[u+2],g=a[u+3],x=a[0],y=a[1],v=a[2],A=a[3],I=et.winding(w,b,p,g,x,y);for(let C=0;C<f;C++){if(C==c)continue;let T=h[C];if(T.length!=3)continue;let M=T[0],Y=T[1],F=T[2],E=i[C],k=E[E.length-2],X=E[E.length-1];if(M!=d||Y!=m)continue;let V=et.winding(w,b,p,g,k,X),N=et.winding(k,X,x,y,v,A);V==I&&N==I&&(E.length=0,T.length=0,a.push(k),a.push(X),o.push(F),w=p,b=g,p=k,g=X,C=0)}}for(let c=i.length-1;c>=0;c--)a=i[c],a.length==0&&(i.splice(c,1),this.polygonPool.free(a),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(e,s,r,i){let h=i[(s+e-1)%s]<<1,o=i[e]<<1,a=i[(e+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[a],r[a+1])}static positiveArea(e,s,r,i,h,o){return e*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(e,s,r,i,h,o){let a=r-e,n=i-s;return h*n-o*a+a*s-e*n>=0?1:-1}},Yi=class $e{triangulator=new Cs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(e,0,r,i,0,2);let h=this.clippingPolygon;$e.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=o.length;a<n;a++){let l=o[a];$e.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,r,i,h,o,a,n){let l,c,f,d,m,u;typeof s=="number"?(l=r,c=i,f=h,d=o,m=a,u=n):(l=s,c=r,f=i,d=h,m=o,u=a),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,l,c,f,d,m,u):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,n=a.length,l=0;h.length=0,o.length=0;for(let c=0;c<r;c+=3){let f=s[c]<<1,d=e[f],m=e[f+1];f=s[c+1]<<1;let u=e[f],w=e[f+1];f=s[c+2]<<1;let b=e[f],p=e[f+1];for(let g=0;g<n;g++){let x=h.length;if(this.clip(d,m,u,w,b,p,a[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,I=P.setArraySize(h,x+v*2);for(let T=0;T<y;T+=2,x+=2){let M=A[T],Y=A[T+1];I[x]=M,I[x+1]=Y}x=o.length;let C=P.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)C[x]=l,C[x+1]=l+T,C[x+2]=l+T+1;l+=v+1}else{let y=P.setArraySize(h,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=w,y[x+4]=b,y[x+5]=p,x=o.length;let v=P.setArraySize(o,x+3);v[x]=l,v[x+1]=l+1,v[x+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,s,r,i,h,o,a){let n=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=a?12:8,u=0;l.length=0,c.length=0;for(let w=0;w<r;w+=3){let b=s[w]<<1,p=e[b],g=e[b+1],x=i[b],y=i[b+1];b=s[w+1]<<1;let v=e[b],A=e[b+1],I=i[b],C=i[b+1];b=s[w+2]<<1;let T=e[b],M=e[b+1],Y=i[b],F=i[b+1];for(let E=0;E<d;E++){let k=l.length;if(this.clip(p,g,v,A,T,M,f[E],n)){let X=n.length;if(X==0)continue;let V=A-M,N=T-v,L=p-T,D=M-g,$=1/(V*L+N*(g-M)),U=X>>1,j=this.clipOutput,B=P.setArraySize(l,k+U*m);for(let G=0;G<X;G+=2,k+=m){let tt=j[G],J=j[G+1];B[k]=tt,B[k+1]=J,B[k+2]=h.r,B[k+3]=h.g,B[k+4]=h.b,B[k+5]=h.a;let K=tt-T,Q=J-M,it=(V*K+N*Q)*$,gt=(D*K+L*Q)*$,pt=1-it-gt;B[k+6]=x*it+I*gt+Y*pt,B[k+7]=y*it+C*gt+F*pt,a&&(B[k+8]=o.r,B[k+9]=o.g,B[k+10]=o.b,B[k+11]=o.a)}k=c.length;let W=P.setArraySize(c,k+3*(U-2));U--;for(let G=1;G<U;G++,k+=3)W[k]=u,W[k+1]=u+G,W[k+2]=u+G+1;u+=U+1}else{let X=P.setArraySize(l,k+3*m);X[k]=p,X[k+1]=g,X[k+2]=h.r,X[k+3]=h.g,X[k+4]=h.b,X[k+5]=h.a,a?(X[k+6]=x,X[k+7]=y,X[k+8]=o.r,X[k+9]=o.g,X[k+10]=o.b,X[k+11]=o.a,X[k+12]=v,X[k+13]=A,X[k+14]=h.r,X[k+15]=h.g,X[k+16]=h.b,X[k+17]=h.a,X[k+18]=I,X[k+19]=C,X[k+20]=o.r,X[k+21]=o.g,X[k+22]=o.b,X[k+23]=o.a,X[k+24]=T,X[k+25]=M,X[k+26]=h.r,X[k+27]=h.g,X[k+28]=h.b,X[k+29]=h.a,X[k+30]=Y,X[k+31]=F,X[k+32]=o.r,X[k+33]=o.g,X[k+34]=o.b,X[k+35]=o.a):(X[k+6]=x,X[k+7]=y,X[k+8]=v,X[k+9]=A,X[k+10]=h.r,X[k+11]=h.g,X[k+12]=h.b,X[k+13]=h.a,X[k+14]=I,X[k+15]=C,X[k+16]=T,X[k+17]=M,X[k+18]=h.r,X[k+19]=h.g,X[k+20]=h.b,X[k+21]=h.a,X[k+22]=Y,X[k+23]=F),k=c.length;let V=P.setArraySize(c,k+3);V[k]=u,V[k+1]=u+1,V[k+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,r,i){let h=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,l=this.clippingPolygons,c=l.length,f=0;o.length=0,a.length=0,n.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,u=e[m],w=e[m+1],b=i[m],p=i[m+1];m=s[d+1]<<1;let g=e[m],x=e[m+1],y=i[m],v=i[m+1];m=s[d+2]<<1;let A=e[m],I=e[m+1],C=i[m],T=i[m+1];for(let M=0;M<c;M++){let Y=o.length;if(this.clip(u,w,g,x,A,I,l[M],h)){let F=h.length;if(F==0)continue;let E=x-I,k=A-g,X=u-A,V=I-w,N=1/(E*X+k*(w-I)),L=F>>1,D=this.clipOutput,$=P.setArraySize(o,Y+L*2),U=P.setArraySize(a,Y+L*2);for(let B=0;B<F;B+=2,Y+=2){let W=D[B],G=D[B+1];$[Y]=W,$[Y+1]=G;let tt=W-A,J=G-I,K=(E*tt+k*J)*N,Q=(V*tt+X*J)*N,it=1-K-Q;U[Y]=b*K+y*Q+C*it,U[Y+1]=p*K+v*Q+T*it}Y=n.length;let j=P.setArraySize(n,Y+3*(L-2));L--;for(let B=1;B<L;B++,Y+=3)j[Y]=f,j[Y+1]=f+B,j[Y+2]=f+B+1;f+=L+1}else{let F=P.setArraySize(o,Y+6);F[Y]=u,F[Y+1]=w,F[Y+2]=g,F[Y+3]=x,F[Y+4]=A,F[Y+5]=I;let E=P.setArraySize(a,Y+3*2);E[Y]=b,E[Y+1]=p,E[Y+2]=y,E[Y+3]=v,E[Y+4]=C,E[Y+5]=T,Y=n.length;let k=P.setArraySize(n,Y+3);k[Y]=f,k[Y+1]=f+1,k[Y+2]=f+2,f+=3;break}}}}clip(e,s,r,i,h,o,a,n){let l=n,c=!1,f;a.length%4>=2?(f=n,n=this.scratch):f=this.scratch,f.length=0,f.push(e),f.push(s),f.push(r),f.push(i),f.push(h),f.push(o),f.push(e),f.push(s),n.length=0;let d=a.length-4,m=a;for(let u=0;;u+=2){let w=m[u],b=m[u+1],p=w-m[u+2],g=b-m[u+3],x=n.length,y=f;for(let A=0,I=f.length-2;A<I;){let C=y[A],T=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(w-M)>p*(b-Y),E=g*(w-C)-p*(b-T);if(E>0){if(F){n.push(M),n.push(Y);continue}let k=M-C,X=Y-T,V=E/(k*g-X*p);if(V>=0&&V<=1)n.push(C+k*V),n.push(T+X*V);else{n.push(M),n.push(Y);continue}}else if(F){let k=M-C,X=Y-T,V=E/(k*g-X*p);if(V>=0&&V<=1)n.push(C+k*V),n.push(T+X*V),n.push(M),n.push(Y);else{n.push(M),n.push(Y);continue}}c=!0}if(x==n.length)return l.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==d)break;let v=n;n=f,n.length=0,f=v}if(l!=n){l.length=0;for(let u=0,w=n.length-2;u<w;u++)l[u]=n[u]}else l.length=l.length-2;return c}static makeClockwise(e){let s=e,r=e.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,o=0,a=0,n=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],a=s[l+2],n=s[l+3],i+=h*n-a*o;if(!(i<0))for(let l=0,c=r-2,f=r>>1;l<f;l+=2){let d=s[l],m=s[l+1],u=c-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=d,s[u+1]=m}}},Mi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ne,r=typeof t=="string"?JSON.parse(t):t,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=S(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let o=r.bones[h],a=null,n=S(o,"parent",null);n&&(a=s.findBone(n));let l=new Me(s.bones.length,o.name,a);l.length=S(o,"length",0)*e,l.x=S(o,"x",0)*e,l.y=S(o,"y",0)*e,l.rotation=S(o,"rotation",0),l.scaleX=S(o,"scaleX",1),l.scaleY=S(o,"scaleY",1),l.shearX=S(o,"shearX",0),l.shearY=S(o,"shearY",0),l.inherit=P.enumValue(Vt,S(o,"inherit","Normal")),l.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(r.slots)for(let h=0;h<r.slots.length;h++){let o=r.slots[h],a=o.name,n=s.findBone(o.bone);if(!n)throw new Error(`Couldn't find bone ${o.bone} for slot ${a}`);let l=new Oe(s.slots.length,a,n),c=S(o,"color",null);c&&l.color.setFromString(c);let f=S(o,"dark",null);f&&(l.darkColor=q.fromString(f)),l.attachmentName=S(o,"attachment",null),l.blendMode=P.enumValue(qe,S(o,"blend","normal")),l.visible=S(o,"visible",!0),s.slots.push(l)}if(r.ik)for(let h=0;h<r.ik.length;h++){let o=r.ik[h],a=new Re(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);a.bones.push(c)}let n=s.findBone(o.target);if(!n)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);a.target=n,a.mix=S(o,"mix",1),a.softness=S(o,"softness",0)*e,a.bendDirection=S(o,"bendPositive",!0)?1:-1,a.compress=S(o,"compress",!1),a.stretch=S(o,"stretch",!1),a.uniform=S(o,"uniform",!1),s.ikConstraints.push(a)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],a=new We(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${o.name}.`);a.bones.push(d)}let n=o.target,l=s.findBone(n);if(!l)throw new Error(`Couldn't find target bone ${n} for transform constraint ${o.name}.`);a.target=l,a.local=S(o,"local",!1),a.relative=S(o,"relative",!1),a.offsetRotation=S(o,"rotation",0),a.offsetX=S(o,"x",0)*e,a.offsetY=S(o,"y",0)*e,a.offsetScaleX=S(o,"scaleX",0),a.offsetScaleY=S(o,"scaleY",0),a.offsetShearY=S(o,"shearY",0),a.mixRotate=S(o,"mixRotate",1),a.mixX=S(o,"mixX",1),a.mixY=S(o,"mixY",a.mixX),a.mixScaleX=S(o,"mixScaleX",1),a.mixScaleY=S(o,"mixScaleY",a.mixScaleX),a.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(a)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],a=new Pe(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${o.name}.`);a.bones.push(d)}let n=o.target,l=s.findSlot(n);if(!l)throw new Error(`Couldn't find target slot ${n} for path constraint ${o.name}.`);a.target=l,a.positionMode=P.enumValue(Be,S(o,"positionMode","Percent")),a.spacingMode=P.enumValue(Ve,S(o,"spacingMode","Length")),a.rotateMode=P.enumValue(Le,S(o,"rotateMode","Tangent")),a.offsetRotation=S(o,"rotation",0),a.position=S(o,"position",0),a.positionMode==0&&(a.position*=e),a.spacing=S(o,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=e),a.mixRotate=S(o,"mixRotate",1),a.mixX=S(o,"mixX",1),a.mixY=S(o,"mixY",a.mixX),s.pathConstraints.push(a)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],a=new Ss(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);const n=o.bone,l=s.findBone(n);if(l==null)throw new Error("Physics bone not found: "+n);a.bone=l,a.x=S(o,"x",0),a.y=S(o,"y",0),a.rotate=S(o,"rotate",0),a.scaleX=S(o,"scaleX",0),a.shearX=S(o,"shearX",0),a.limit=S(o,"limit",5e3)*e,a.step=1/S(o,"fps",60),a.inertia=S(o,"inertia",1),a.strength=S(o,"strength",100),a.damping=S(o,"damping",1),a.massInverse=1/S(o,"mass",1),a.wind=S(o,"wind",0),a.gravity=S(o,"gravity",0),a.mix=S(o,"mix",1),a.inertiaGlobal=S(o,"inertiaGlobal",!1),a.strengthGlobal=S(o,"strengthGlobal",!1),a.dampingGlobal=S(o,"dampingGlobal",!1),a.massGlobal=S(o,"massGlobal",!1),a.windGlobal=S(o,"windGlobal",!1),a.gravityGlobal=S(o,"gravityGlobal",!1),a.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(a)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],a=new Lt(o.name);if(o.bones)for(let n=0;n<o.bones.length;n++){let l=o.bones[n],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);a.bones.push(c)}if(o.ik)for(let n=0;n<o.ik.length;n++){let l=o.ik[n],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.transform)for(let n=0;n<o.transform.length;n++){let l=o.transform[n],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.path)for(let n=0;n<o.path.length;n++){let l=o.path[n],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.physics)for(let n=0;n<o.physics.length;n++){let l=o.physics[n],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}for(let n in o.attachments){let l=s.findSlot(n);if(!l)throw new Error(`Couldn't find slot ${n} for skin ${o.name}.`);let c=o.attachments[n];for(let f in c){let d=this.readAttachment(c[f],a,l.index,f,s);d&&a.setAttachment(l.index,f,d)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let l=n.getAttachment(a.slotIndex,a.parent);if(!l)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?l:a.mesh,a.mesh.setParentMesh(l),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],a=new Ee(h);a.intValue=S(o,"int",0),a.floatValue=S(o,"float",0),a.stringValue=S(o,"string",""),a.audioPath=S(o,"audio",null),a.audioPath&&(a.volume=S(o,"volume",1),a.balance=S(o,"balance",0)),s.events.push(a)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(t,e,s,r,i){let h=this.scale;switch(r=S(t,"name",r),S(t,"type","region")){case"region":{let o=S(t,"path",r),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(e,r,o,a);if(!n)return null;n.path=o,n.x=S(t,"x",0)*h,n.y=S(t,"y",0)*h,n.scaleX=S(t,"scaleX",1),n.scaleY=S(t,"scaleY",1),n.rotation=S(t,"rotation",0),n.width=t.width*h,n.height=t.height*h,n.sequence=a;let l=S(t,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let a=S(t,"color",null);return a&&o.color.setFromString(a),o}case"mesh":case"linkedmesh":{let o=S(t,"path",r),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(e,r,o,a);if(!n)return null;n.path=o;let l=S(t,"color",null);l&&n.color.setFromString(l),n.width=S(t,"width",0)*h,n.height=S(t,"height",0)*h,n.sequence=a;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new Xi(n,S(t,"skin",null),s,c,S(t,"timelines",!0))),n;let f=t.uvs;return this.readVertices(t,n,f.length),n.triangles=t.triangles,n.regionUVs=f,n.region!=null&&n.updateRegion(),n.edges=S(t,"edges",null),n.hullLength=S(t,"hull",0)*2,n}case"path":{let o=this.attachmentLoader.newPathAttachment(e,r);if(!o)return null;o.closed=S(t,"closed",!1),o.constantSpeed=S(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,o,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<t.lengths.length;c++)n[c]=t.lengths[c]*h;o.lengths=n;let l=S(t,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,r);if(!o)return null;o.x=S(t,"x",0)*h,o.y=S(t,"y",0)*h,o.rotation=S(t,"rotation",0);let a=S(t,"color",null);return a&&o.color.setFromString(a),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,r);if(!o)return null;let a=S(t,"end",null);a&&(o.endSlot=i.findSlot(a));let n=t.vertexCount;this.readVertices(t,o,n<<1);let l=S(t,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(t){if(t==null)return null;let e=new ts(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let a=P.toFloatArray(i);if(r!=1)for(let n=0,l=i.length;n<l;n++)a[n]*=r;e.vertices=a;return}let h=new Array,o=new Array;for(let a=0,n=i.length;a<n;){let l=i[a++];o.push(l);for(let c=a+l*4;a<c;a+=4)o.push(i[a]),h.push(i[a+1]*r),h.push(i[a+2]*r),h.push(i[a+3])}e.bones=o,e.vertices=P.toFloatArray(h)}readAnimation(t,e,s){let r=this.scale,i=new Array;if(t.slots)for(let o in t.slots){let a=t.slots[o],n=s.findSlot(o);if(!n)throw new Error("Slot not found: "+o);let l=n.index;for(let c in a){let f=a[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ut(d,l);for(let u=0;u<d;u++){let w=f[u];m.setFrame(u,S(w,"time",0),S(w,"name",null))}i.push(m)}else if(c=="rgba"){let m=new ee(d,d<<2,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b,b.a);let x=f[p+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1),g=_(A,m,g,p,3,w,y,b.a,v.a,1)),w=y,b=v,u=x}i.push(m)}else if(c=="rgb"){let m=new se(d,d*3,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b);let x=f[p+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1)),w=y,b=v,u=x}i.push(m)}else if(c=="alpha")i.push(at(f,new ie(d,d,l),0,1));else if(c=="rgba2"){let m=new re(d,d*7,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.light),p=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,b.a,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,b.a,A.a,1),x=_(C,m,x,g,4,w,v,p.r,I.r,1),x=_(C,m,x,g,5,w,v,p.g,I.g,1),x=_(C,m,x,g,6,w,v,p.b,I.b,1)),w=v,b=A,p=I,u=y}i.push(m)}else if(c=="rgb2"){let m=new ae(d,d*6,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.light),p=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,p.r,I.r,1),x=_(C,m,x,g,4,w,v,p.g,I.g,1),x=_(C,m,x,g,5,w,v,p.b,I.b,1)),w=v,b=A,p=I,u=y}i.push(m)}}}if(t.bones)for(let o in t.bones){let a=t.bones[o],n=s.findBone(o);if(!n)throw new Error("Bone not found: "+o);let l=n.index;for(let c in a){let f=a[c],d=f.length;if(d!=0){if(c==="rotate")i.push(at(f,new At(d,d,l),0,1));else if(c==="translate"){let m=new _t(d,d<<1,l);i.push(Ue(f,m,"x","y",0,r))}else if(c==="translatex"){let m=new Gt(d,d,l);i.push(at(f,m,0,r))}else if(c==="translatey"){let m=new $t(d,d,l);i.push(at(f,m,0,r))}else if(c==="scale"){let m=new Ht(d,d<<1,l);i.push(Ue(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new jt(d,d,l);i.push(at(f,m,1,1))}else if(c==="scaley"){let m=new Jt(d,d,l);i.push(at(f,m,1,1))}else if(c==="shear"){let m=new Kt(d,d<<1,l);i.push(Ue(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new Qt(d,d,l);i.push(at(f,m,0,1))}else if(c==="sheary"){let m=new Zt(d,d,l);i.push(at(f,m,0,1))}else if(c==="inherit"){let m=new te(d,n.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,S(w,"time",0),P.enumValue(Vt,S(w,"inherit","Normal")))}i.push(m)}}}}if(t.ik)for(let o in t.ik){let a=t.ik[o],n=a[0];if(!n)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),f=new le(a.length,a.length<<1,c),d=S(n,"time",0),m=S(n,"mix",1),u=S(n,"softness",0)*r;for(let w=0,b=0;;w++){f.setFrame(w,d,m,u,S(n,"bendPositive",!0)?1:-1,S(n,"compress",!1),S(n,"stretch",!1));let p=a[w+1];if(!p){f.shrink(b);break}let g=S(p,"time",0),x=S(p,"mix",1),y=S(p,"softness",0)*r,v=n.curve;v&&(b=_(v,f,b,w,0,d,g,m,x,1),b=_(v,f,b,w,1,d,g,u,y,r)),d=g,m=x,u=y,n=p}i.push(f)}if(t.transform)for(let o in t.transform){let a=t.transform[o],n=a[0];if(!n)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),f=new oe(a.length,a.length*6,c),d=S(n,"time",0),m=S(n,"mixRotate",1),u=S(n,"mixX",1),w=S(n,"mixY",u),b=S(n,"mixScaleX",1),p=S(n,"mixScaleY",b),g=S(n,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,b,p,g);let v=a[x+1];if(!v){f.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),T=S(v,"mixY",C),M=S(v,"mixScaleX",1),Y=S(v,"mixScaleY",M),F=S(v,"mixShearY",1),E=n.curve;E&&(y=_(E,f,y,x,0,d,A,m,I,1),y=_(E,f,y,x,1,d,A,u,C,1),y=_(E,f,y,x,2,d,A,w,T,1),y=_(E,f,y,x,3,d,A,b,M,1),y=_(E,f,y,x,4,d,A,p,Y,1),y=_(E,f,y,x,5,d,A,g,F,1)),d=A,m=I,u=C,w=T,b=M,p=Y,b=M,n=v}i.push(f)}if(t.path)for(let o in t.path){let a=t.path[o],n=s.findPathConstraint(o);if(!n)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(n);for(let c in a){let f=a[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new he(m,m,l);i.push(at(f,u,0,n.positionMode==0?r:1))}else if(c==="spacing"){let u=new ce(m,m,l);i.push(at(f,u,0,n.spacingMode==0||n.spacingMode==1?r:1))}else if(c==="mix"){let u=new de(m,m*3,l),w=S(d,"time",0),b=S(d,"mixRotate",1),p=S(d,"mixX",1),g=S(d,"mixY",p);for(let x=0,y=0;;x++){u.setFrame(x,w,b,p,g);let v=f[x+1];if(!v){u.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),T=S(v,"mixY",C),M=d.curve;M&&(y=_(M,u,y,x,0,w,A,b,I,1),y=_(M,u,y,x,1,w,A,p,C,1),y=_(M,u,y,x,2,w,A,g,T,1)),w=A,b=I,p=C,g=T,d=v}i.push(u)}}}if(t.physics)for(let o in t.physics){let a=t.physics[o],n=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);n=s.physicsConstraints.indexOf(l)}for(let l in a){let c=a[l],f=c[0];if(!f)continue;let d=c.length;if(l=="reset"){const u=new pe(d,n);for(let w=0;f!=null;f=c[w+1],w++)u.setFrame(w,S(f,"time",0));i.push(u);continue}let m;if(l=="inertia")m=new fe(d,d,n);else if(l=="strength")m=new ue(d,d,n);else if(l=="damping")m=new me(d,d,n);else if(l=="mass")m=new ge(d,d,n);else if(l=="wind")m=new xe(d,d,n);else if(l=="gravity")m=new we(d,d,n);else if(l=="mix")m=new be(d,d,n);else continue;i.push(at(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let a=t.attachments[o],n=s.findSkin(o);if(!n)throw new Error("Skin not found: "+o);for(let l in a){let c=a[l],f=s.findSlot(l);if(!f)throw new Error("Slot not found: "+l);let d=f.index;for(let m in c){let u=c[m],w=n.getAttachment(d,m);for(let b in u){let p=u[b],g=p[0];if(g){if(b=="deform"){let x=w.bones,y=w.vertices,v=x?y.length/3*2:y.length,A=new ne(p.length,p.length,d,w),I=S(g,"time",0);for(let C=0,T=0;;C++){let M,Y=S(g,"vertices",null);if(!Y)M=x?P.newFloatArray(v):y;else{M=P.newFloatArray(v);let X=S(g,"offset",0);if(P.arrayCopy(Y,0,M,X,Y.length),r!=1)for(let V=X,N=V+Y.length;V<N;V++)M[V]*=r;if(!x)for(let V=0;V<v;V++)M[V]+=y[V]}A.setFrame(C,I,M);let F=p[C+1];if(!F){A.shrink(T);break}let E=S(F,"time",0),k=g.curve;k&&(T=_(k,A,T,C,0,I,E,0,1,1)),I=E,g=F}i.push(A)}else if(b=="sequence"){let x=new ye(p.length,d,w),y=0;for(let v=0;v<p.length;v++){let A=S(g,"delay",y),I=S(g,"time",0),C=es[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,I,C,T,A),y=A,g=p[v+1]}i.push(x)}}}}}}if(t.drawOrder){let o=new wt(t.drawOrder.length),a=s.slots.length,n=0;for(let l=0;l<t.drawOrder.length;l++,n++){let c=t.drawOrder[l],f=null,d=S(c,"offsets",null);if(d){f=P.newArray(a,-1);let m=P.newArray(a-d.length,0),u=0,w=0;for(let b=0;b<d.length;b++){let p=d[b],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[w++]=u++;f[u+p.offset]=u++}for(;u<a;)m[w++]=u++;for(let b=a-1;b>=0;b--)f[b]==-1&&(f[b]=m[--w])}o.setFrame(n,S(c,"time",0),f)}i.push(o)}if(t.events){let o=new Ft(t.events.length),a=0;for(let n=0;n<t.events.length;n++,a++){let l=t.events[n],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let f=new Fe(P.toSinglePrecision(S(l,"time",0)),c);f.intValue=S(l,"int",c.intValue),f.floatValue=S(l,"float",c.floatValue),f.stringValue=S(l,"string",c.stringValue),f.data.audioPath&&(f.volume=S(l,"volume",1),f.balance=S(l,"balance",0)),o.setFrame(a,f)}i.push(o)}let h=0;for(let o=0,a=i.length;o<a;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new Mt(e,i,h))}},Xi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function at(t,e,s,r){let i=t[0],h=S(i,"time",0),o=S(i,"value",s)*r,a=0;for(let n=0;;n++){e.setFrame(n,h,o);let l=t[n+1];if(!l)return e.shrink(a),e;let c=S(l,"time",0),f=S(l,"value",s)*r;i.curve&&(a=_(i.curve,e,a,n,0,h,c,o,f,r)),h=c,o=f,i=l}}function Ue(t,e,s,r,i,h){let o=t[0],a=S(o,"time",0),n=S(o,s,i)*h,l=S(o,r,i)*h,c=0;for(let f=0;;f++){e.setFrame(f,a,n,l);let d=t[f+1];if(!d)return e.shrink(c),e;let m=S(d,"time",0),u=S(d,s,i)*h,w=S(d,r,i)*h,b=o.curve;b&&(c=_(b,e,c,f,0,a,m,n,u,h),c=_(b,e,c,f,1,a,m,l,w,h)),a=m,n=u,l=w,o=d}}function _(t,e,s,r,i,h,o,a,n,l){if(t=="stepped")return e.setStepped(r),s;let c=i<<2,f=t[c],d=t[c+1]*l,m=t[c+2],u=t[c+3]*l;return e.setBezier(s,r,i,h,a,f,d,m,u,o,n),s+1}function S(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));export{ie as AlphaTimeline,Mt as Animation,Os as AnimationState,qs as AnimationStateAdapter,Ws as AnimationStateData,gs as AssetCache,Gs as AssetManagerBase,_s as AtlasAttachmentLoader,Ut as Attachment,ut as AttachmentTimeline,Is as BinaryInput,qe as BlendMode,Xe as Bone,Me as BoneData,Ie as BoundingBoxAttachment,hs as CURRENT,Ce as ClippingAttachment,q as Color,It as ConstraintData,rt as CurveTimeline,st as CurveTimeline1,Xt as CurveTimeline2,Ls as DebugUtils,ne as DeformTimeline,xs as Downloader,wt as DrawOrderTimeline,Fe as Event,Ee as EventData,ns as EventQueue,Ft as EventTimeline,ls as EventType,ve as FIRST,zs as FakeTexture,Rt as HOLD_FIRST,os as HOLD_MIX,Ae as HOLD_SUBSEQUENT,ws as IkConstraint,Re as IkConstraintData,le as IkConstraintTimeline,Vt as Inherit,te as InheritTimeline,Bs as IntSet,Qe as Interpolation,R as MathUtils,Bt as MeshAttachment,is as MixBlend,rs as MixDirection,St as PathAttachment,bs as PathConstraint,Pe as PathConstraintData,de as PathConstraintMixTimeline,he as PathConstraintPositionTimeline,ce as PathConstraintSpacingTimeline,As as Physics,me as PhysicsConstraintDampingTimeline,we as PhysicsConstraintGravityTimeline,fe as PhysicsConstraintInertiaTimeline,ge as PhysicsConstraintMassTimeline,be as PhysicsConstraintMixTimeline,pe as PhysicsConstraintResetTimeline,ue as PhysicsConstraintStrengthTimeline,ct as PhysicsConstraintTimeline,xe as PhysicsConstraintWindTimeline,ms as PointAttachment,vt as Pool,Be as PositionMode,Ze as Pow,Vs as PowOut,ae as RGB2Timeline,re as RGBA2Timeline,ee as RGBATimeline,se as RGBTimeline,Ye as RegionAttachment,Le as RotateMode,At as RotateTimeline,Se as SETUP,Et as SUBSEQUENT,Ht as ScaleTimeline,jt as ScaleXTimeline,Jt as ScaleYTimeline,ye as SequenceTimeline,Kt as ShearTimeline,Qt as ShearXTimeline,Zt as ShearYTimeline,vs as Skeleton,Hs as SkeletonBinary,Ti as SkeletonBounds,Yi as SkeletonClipping,Ne as SkeletonData,Mi as SkeletonJson,Lt as Skin,De as SkinEntry,ps as Slot,Oe as SlotData,Ve as SpacingMode,zt as StringSet,cs as Texture,ke as TextureAtlas,us as TextureAtlasPage,Te as TextureAtlasRegion,Pt as TextureFilter,fs as TextureRegion,ds as TextureWrap,Ns as TimeKeeper,H as Timeline,as as TrackEntry,ys as TransformConstraint,We as TransformConstraintData,oe as TransformConstraintTimeline,_t as TranslateTimeline,Gt as TranslateXTimeline,$t as TranslateYTimeline,Cs as Triangulator,P as Utils,Yt as Vector2,lt as VertexAttachment,Ds as WindowedMean};
|