@esotericsoftware/spine-pixi-v8 4.2.93 → 4.2.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";if(typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}var ur=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},ie=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},V=class wt{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new wt(1,1,1,1);static RED=new wt(1,0,0,1);static GREEN=new wt(0,1,0,1);static BLUE=new wt(0,0,1,1);static MAGENTA=new wt(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,r){return this.r+=t,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new wt){return s.setFromString(t)}},B=class lt{static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*lt.degRad)}static sinDeg(t){return Math.sin(t*lt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*lt.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return lt.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),l=s-t;return r<=(i-t)/l?t+Math.sqrt(r*l*(i-t)):s-Math.sqrt((1-r)*l*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ws=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ys=class extends ws{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},mr=class extends ys{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},E=class It{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,r,l){for(let o=s,n=r;o<s+l;o++,n++)i[n]=t[o]}static arrayFill(t,s,i,r){for(let l=s;l<i;l++)t[l]=r}static setArraySize(t,s,i=0){let r=t.length;if(r==s)return t;if(t.length=s,r<s)for(let l=r;l<s;l++)t[l]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:It.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r<t;r++)i[r]=s;return i}static newFloatArray(t){if(It.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(It.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return It.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return It.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,i=!0){for(var r=0;r<t.length;r++)if(t[r]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},gr=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Ct=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Xt=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},pr=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},xr=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},ne=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ht=class rr extends ne{static nextID=0;id=rr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,i,r,l,o){i=l+(i>>1)*o;let n=t.bone.skeleton,a=t.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let u=t.bone,p=u.worldX,b=u.worldY,w=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,C=l;C<i;v+=2,C+=o){let A=h[v],k=h[v+1];r[C]=A*w+k*g+p,r[C+1]=A*x+k*y+b}return}let f=0,d=0;for(let u=0;u<s;u+=2){let p=c[f];f+=p+1,d+=p}let m=n.bones;if(a.length==0)for(let u=l,p=d*3;u<i;u+=o){let b=0,w=0,g=c[f++];for(g+=f;f<g;f++,p+=3){let x=m[c[f]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}r[u]=b,r[u+1]=w}else{let u=a;for(let p=l,b=d*3,w=d<<1;p<i;p+=o){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,b+=3,w+=2){let v=m[c[f]],C=h[b]+u[w],A=h[b+1]+u[w+1],k=h[b+2];g+=(C*v.a+A*v.b+v.worldX)*k,x+=(C*v.c+A*v.d+v.worldY)*k}r[p]=g,r[p+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},vs=class Zt{static _nextID=0;id=Zt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Zt(this.regions.length);return E.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(t,s){let i=t,r=(this.start+s).toString();for(let l=this.digits-r.length;l>0;l--)i+="0";return i+=r,i}static nextID(){return Zt._nextID++}},Cs=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(Cs||{}),As=[0,1,2,3,4,5,6],Ot=class{name;timelines=[];timelineIds=new ie;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,r,l,o,n){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(e,t,s,r,l,o,n)}},Ss=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Ss||{}),ks=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ks||{}),_={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},$=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=E.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}},it=class extends ${curves;constructor(e,t,s){super(e,s),this.curves=E.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=E.newFloatArray(t);E.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,r,l,o,n,a,h,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(i-l*2+n)*.03,u=(r-o*2+a)*.03,p=((l-n)*3-i+h)*.006,b=((o-a)*3-r+c)*.006,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=(o-r)*.3+u+b*.16666667,v=i+x,C=r+y;for(let A=d+18;d<A;d+=2)f[d]=v,f[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(e,t,s,i){let r=this.curves;if(r[i]>e){let a=this.frames[t],h=this.frames[t+s];return h+(e-a)/(r[i]-a)*(r[i+1]-h)}let l=i+18;for(i+=2;i<l;i+=2)if(r[i]>=e){let a=r[i-2],h=r[i-1];return h+(e-a)/(r[i]-a)*(r[i+1]-h)}t+=this.getFrameEntries();let o=r[l-2],n=r[l-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},st=class extends it{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],l=t[s+1];return l+(e-r)/(t[s+2]-r)*(t[s+2+1]-l);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let l=this.getCurveValue(e);switch(s){case 0:return r+l*t;case 1:case 2:l+=r-i}return i+l*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let l=this.getCurveValue(e);return s==0?r+(l-r)*t:i+(l-i)*t}getAbsoluteValue2(e,t,s,i,r,l){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}return s==0?r+(l-r)*t:i+(l-i)*t}getScaleValue(e,t,s,i,r,l){const o=this.frames;if(e<o[0]){switch(s){case 0:return l;case 1:return r+(l-r)*t}return r}let n=this.getCurveValue(e)*l;if(t==1)return s==3?r+n-l:n;if(i==1)switch(s){case 0:return l+(Math.abs(n)*B.signum(l)-l)*t;case 1:case 2:return r+(Math.abs(n)*B.signum(r)-r)*t}else{let a=0;switch(s){case 0:return a=Math.abs(l)*B.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(r)*B.signum(n),a+(n-a)*t}}return r+(n-l)*t}},_t=class extends it{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Ft=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,l,n.rotation,n.data.rotation))}},ae=class extends _t{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let h=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);h+=(a[f+3+1]-h)*u,c+=(a[f+3+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(l){case 0:n.x=n.data.x+h*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+h-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=h*r,n.y+=c*r}}},oe=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,l,n.x,n.data.x))}},le=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,l,n.y,n.data.y))}},he=class extends _t{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let h,c,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);h+=(a[f+3+1]-h)*u,c+=(a[f+3+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,r==1)l==3?(n.scaleX+=h-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=h,n.scaleY=c);else{let m=0,u=0;if(o==1)switch(l){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case 3:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(l){case 0:m=Math.abs(n.data.scaleX)*B.signum(h),u=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*B.signum(h),u=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case 3:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},ce=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,l,o,n.scaleX,n.data.scaleX))}},de=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,l,o,n.scaleY,n.data.scaleY))}},fe=class extends _t{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let h=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);h+=(a[f+3+1]-h)*u,c+=(a[f+3+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(l){case 0:n.shearX=n.data.shearX+h*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+h-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=h*r,n.shearY+=c*r}}},ue=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,l,n.shearX,n.data.shearX))}},me=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,l,n.shearY,n.data.shearY))}},ge=class extends ${boneIndex=0;constructor(e,t){super(e,[_.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){l==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==0||l==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[$.search(a,s,2)+1]}},pe=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,r,l){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let b=n.data.color;switch(l){case 0:h.setFromColor(b);return;case 1:h.add((b.r-h.r)*r,(b.g-h.g)*r,(b.b-h.b)*r,(b.a-h.a)*r)}return}let c=0,f=0,d=0,m=0,u=$.search(a,s,5),p=this.curves[u/5];switch(p){case 0:let b=a[u];c=a[u+1],f=a[u+2],d=a[u+3],m=a[u+4];let w=(s-b)/(a[u+5]-b);c+=(a[u+5+1]-c)*w,f+=(a[u+5+2]-f)*w,d+=(a[u+5+3]-d)*w,m+=(a[u+5+4]-m)*w;break;case 1:c=a[u+1],f=a[u+2],d=a[u+3],m=a[u+4];break;default:c=this.getBezierValue(s,u,1,p-2),f=this.getBezierValue(s,u,2,p+18-2),d=this.getBezierValue(s,u,3,p+18*2-2),m=this.getBezierValue(s,u,4,p+18*3-2)}r==1?h.set(c,f,d,m):(l==0&&h.setFromColor(n.data.color),h.add((c-h.r)*r,(f-h.g)*r,(d-h.b)*r,(m-h.a)*r))}},xe=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let p=n.data.color;switch(l){case 0:h.r=p.r,h.g=p.g,h.b=p.b;return;case 1:h.r+=(p.r-h.r)*r,h.g+=(p.g-h.g)*r,h.b+=(p.b-h.b)*r}return}let c=0,f=0,d=0,m=$.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let p=a[m];c=a[m+1],f=a[m+2],d=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,f+=(a[m+4+2]-f)*b,d+=(a[m+4+3]-d)*b;break;case 1:c=a[m+1],f=a[m+2],d=a[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(r==1)h.r=c,h.g=f,h.b=d;else{if(l==0){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*r,h.g+=(f-h.g)*r,h.b+=(d-h.b)*r}}},be=class extends st{slotIndex=0;constructor(e,t,s){super(e,t,_.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(l){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let h=this.getCurveValue(s);r==1?a.a=h:(l==0&&(a.a=n.data.color.a),a.a+=(h-a.a)*r)}},we=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,r,l,o,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.add((y.r-h.r)*r,(y.g-h.g)*r,(y.b-h.b)*r,(y.a-h.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let f=0,d=0,m=0,u=0,p=0,b=0,w=0,g=$.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];let v=(s-y)/(a[g+8]-y);f+=(a[g+8+1]-f)*v,d+=(a[g+8+2]-d)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,p+=(a[g+8+5]-p)*v,b+=(a[g+8+6]-b)*v,w+=(a[g+8+7]-w)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[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),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),w=this.getBezierValue(s,g,7,x+18*6-2)}if(r==1)h.set(f,d,m,u),c.r=p,c.g=b,c.b=w;else{if(l==0){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((f-h.r)*r,(d-h.g)*r,(m-h.b)*r,(u-h.a)*r),c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},ye=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,l,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.r+=(y.r-h.r)*r,h.g+=(y.g-h.g)*r,h.b+=(y.b-h.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let f=0,d=0,m=0,u=0,p=0,b=0,w=0,g=$.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];let v=(s-y)/(a[g+7]-y);f+=(a[g+7+1]-f)*v,d+=(a[g+7+2]-d)*v,m+=(a[g+7+3]-m)*v,p+=(a[g+7+4]-p)*v,b+=(a[g+7+5]-b)*v,w+=(a[g+7+6]-w)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[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),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)h.r=f,h.g=d,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==0){let y=n.data.color,v=n.data.darkColor;h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}h.r+=(f-h.r)*r,h.g+=(d-h.g)*r,h.b+=(m-h.b)*r,c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},xt=class extends ${slotIndex=0;attachmentNames;constructor(e,t){super(e,[_.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){l==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==0||l==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[$.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ve=class extends it{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,r,l,o,n,a,h,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(i-l*2+n)*.03,u=a*.03-o*.06,p=((l-n)*3-i+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=o*.3+u+b*.16666667,v=i+x,C=y;for(let A=d+18;d<A;d+=2)f[d]=v,f[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>e){let n=this.frames[t];return s[i+1]*(e-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=e){let n=s[i-2],a=s[i-1];return a+(e-n)/(s[i]-n)*(s[i+1]-a)}let l=s[r-2],o=s[r-1];return o+(1-o)*(e-l)/(this.frames[t+this.getFrameEntries()]-l)}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof ht)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(l){case 0:h.length=0;return;case 1:if(r==1){h.length=0;return}h.length=f;let g=a;if(g.bones){r=1-r;for(var m=0;m<f;m++)h[m]*=r}else{let x=g.vertices;for(var m=0;m<f;m++)h[m]+=(x[m]-h[m])*r}}return}if(h.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(r==1)if(l==3){let x=a;if(x.bones)for(let y=0;y<f;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,f);else switch(l){case 0:{let y=a;if(y.bones)for(let v=0;v<f;v++)h[v]=g[v]*r;else{let v=y.vertices;for(let C=0;C<f;C++){let A=v[C];h[C]=A+(g[C]-A)*r}}break}case 1:case 2:for(let y=0;y<f;y++)h[y]+=(g[y]-h[y])*r;break;case 3:let x=a;if(x.bones)for(let y=0;y<f;y++)h[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<f;v++)h[v]+=(g[v]-y[v])*r}}return}let u=$.search1(d,s),p=this.getCurvePercent(s,u),b=c[u],w=c[u+1];if(r==1)if(l==3){let g=a;if(g.bones)for(let x=0;x<f;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<f;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case 0:{let x=a;if(x.bones)for(let y=0;y<f;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*r}else{let y=x.vertices;for(let v=0;v<f;v++){let C=b[v],A=y[v];h[v]=A+(C+(w[v]-C)*p-A)*r}}break}case 1:case 2:for(let x=0;x<f;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*r}break;case 3:let g=a;if(g.bones)for(let x=0;x<f;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*r}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*r}}}}},Ut=class ir extends ${static propertyIds=[""+_.event];events;constructor(t){super(t,ir.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,r,l,o,n){if(!r)return;let a=this.frames,h=this.frames.length;if(s>i)this.apply(t,s,Number.MAX_VALUE,r,l,o,n),s=-1;else if(s>=a[h-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=$.search1(a,s)+1;let f=a[c];for(;c>0&&a[c-1]==f;)c--}for(;c<h&&i>=a[c];c++)r.push(this.events[c])}},At=class nr extends ${static propertyIds=[""+_.drawOrder];drawOrders;constructor(t){super(t,nr.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,l,o,n){if(n==1){o==0&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(o==0||o==1)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=$.search1(this.frames,i),h=this.drawOrders[a];if(!h)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,f=t.slots;for(let d=0,m=h.length;d<m;d++)c[d]=f[h[d]]}}},Ce=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,r,l,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,r,l,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,f=$.search(a,s,6),d=this.curves[f/6];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+6]-m);h+=(a[f+6+1]-h)*u,c+=(a[f+6+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}l==0?(n.mix=n.data.mix+(h-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0)):(n.mix+=(h-n.mix)*r,n.softness+=(c-n.softness)*r,o==0&&(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0))}},Ae=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,l,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=i,a[e+3]=r,a[e+4]=l,a[e+5]=o,a[e+6]=n}apply(e,t,s,i,r,l,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case 0:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case 1:n.mixRotate+=(w.mixRotate-n.mixRotate)*r,n.mixX+=(w.mixX-n.mixX)*r,n.mixY+=(w.mixY-n.mixY)*r,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(w.mixShearY-n.mixShearY)*r}return}let h,c,f,d,m,u,p=$.search(a,s,7),b=this.curves[p/7];switch(b){case 0:let w=a[p];h=a[p+1],c=a[p+2],f=a[p+3],d=a[p+4],m=a[p+5],u=a[p+6];let g=(s-w)/(a[p+7]-w);h+=(a[p+7+1]-h)*g,c+=(a[p+7+2]-c)*g,f+=(a[p+7+3]-f)*g,d+=(a[p+7+4]-d)*g,m+=(a[p+7+5]-m)*g,u+=(a[p+7+6]-u)*g;break;case 1:h=a[p+1],c=a[p+2],f=a[p+3],d=a[p+4],m=a[p+5],u=a[p+6];break;default:h=this.getBezierValue(s,p,1,b-2),c=this.getBezierValue(s,p,2,b+18-2),f=this.getBezierValue(s,p,3,b+18*2-2),d=this.getBezierValue(s,p,4,b+18*3-2),m=this.getBezierValue(s,p,5,b+18*4-2),u=this.getBezierValue(s,p,6,b+18*5-2)}if(l==0){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*r,n.mixX=w.mixX+(c-w.mixX)*r,n.mixY=w.mixY+(f-w.mixY)*r,n.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*r,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*r,n.mixShearY=w.mixShearY+(u-w.mixShearY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(f-n.mixY)*r,n.mixScaleX+=(d-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(u-n.mixShearY)*r}},Se=class extends st{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,l,n.position,n.data.position))}},ke=class extends st{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,l,n.spacing,n.data.spacing))}},Te=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){let l=this.frames;e<<=2,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=r}apply(e,t,s,i,r,l,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let h,c,f,d=$.search(a,s,4),m=this.curves[d>>2];switch(m){case 0:let u=a[d];h=a[d+1],c=a[d+2],f=a[d+3];let p=(s-u)/(a[d+4]-u);h+=(a[d+4+1]-h)*p,c+=(a[d+4+2]-c)*p,f+=(a[d+4+3]-f)*p;break;case 1:h=a[d+1],c=a[d+2],f=a[d+3];break;default:h=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(l==0){let u=n.data;n.mixRotate=u.mixRotate+(h-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(f-u.mixY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(f-n.mixY)*r}},mt=class extends st{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of e.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,r,l,this.get(h),this.setup(h),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,l,this.get(n),this.setup(n)))}},Ie=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Me=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ye=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Xe=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Fe=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Pe=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Be=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ee=class ar extends ${static propertyIds=[_.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,ar.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,l,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(i<h[0])&&(s<h[0]||i>=h[$.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},Re=class gt extends ${static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[_.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return gt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,l){let o=this.frames;t*=gt.ENTRIES,o[t]=s,o[t+gt.MODE]=i|r<<4,o[t+gt.DELAY]=l}apply(t,s,i,r,l,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof ht)||h.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let f=this.frames;if(i<f[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let d=$.search(f,i,gt.ENTRIES),m=f[d],u=f[d+gt.MODE],p=f[d+gt.DELAY];if(!this.attachment.sequence)return;let b=u>>4,w=this.attachment.sequence.regions.length,g=As[u&15];if(g!=0)switch(b+=(i-m)/p+1e-5|0,g){case 1:b=Math.min(w-1,b);break;case 2:b%=w;break;case 3:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case 4:b=Math.max(w-1-b,0);break;case 5:b=w-1-b%w;break;case 6:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Le=class te{static _emptyAnimation=new Ot("<empty>",[],0);static emptyAnimation(){return te._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Is(this);propertyIDs=new ie;animationsChanged=!1;trackEntryPool=new Ct(()=>new Ts);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=t*l.timeScale;if(l.delay>0){if(l.delay-=o,l.delay>0)continue;o=-l.delay,l.delay=0}let n=l.next;if(n){let a=l.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=l.timeScale==0?0:(a/l.timeScale+t)*n.timeScale,l.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[i]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,t)){let a=l.mixingFrom;for(l.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}l.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let d=0,m=i.length;d<m;d++){let u=i[d];if(!u||u.delay>0)continue;r=!0;let p=d==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,t,p):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let w=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let C=u.animation.timelines,A=C.length;if(d==0&&b==1||p==3){d==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof xt?this.applyAttachmentTimeline(l,t,y,p,w):l.apply(t,g,y,v,b,p,0)}}else{let k=u.timelineMode,T=u.shortestRotation,Y=!T&&u.timelinesRotation.length!=A<<1;Y&&(u.timelinesRotation.length=A<<1);for(let M=0;M<A;M++){let F=C[M],P=k[M]==qt?p:0;!T&&F instanceof Ft?this.applyRotateTimeline(F,t,y,b,P,u.timelinesRotation,M<<1,Y):F instanceof xt?this.applyAttachmentTimeline(F,t,y,p,w):(E.webkit602BugfixHelper(b,p),F.apply(t,g,y,v,b,P,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Ne,n=t.slots,a=0,h=t.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var f=c.data.attachmentName;c.setAttachment(f?t.getAttachment(c.data.index,f):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,s,i){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let l=0;t.mixDuration==0?(l=1,i==1&&(i=0)):(l=t.mixTime/t.mixDuration,l>1&&(l=1),i!=1&&(i=r.mixBlend));let o=l<r.mixAttachmentThreshold,n=l<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,c=r.alpha*t.interruptAlpha,f=c*(1-l),d=r.animationLast,m=r.getAnimationTime(),u=m,p=null;if(r.reverse?u=r.animation.duration-u:l<r.eventThreshold&&(p=this.events),i==3)for(let b=0;b<h;b++)a[b].apply(s,d,u,p,f,i,1);else{let b=r.timelineMode,w=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=1,A,k=0;switch(b[y]){case qt:if(!n&&v instanceof At)continue;A=i,k=f;break;case De:A=0,k=f;break;case Ve:A=i,k=c;break;case Wt:A=0,k=c;break;default:A=0;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=k,!g&&v instanceof Ft?this.applyRotateTimeline(v,s,u,k,A,r.timelinesRotation,y<<1,x):v instanceof xt?this.applyAttachmentTimeline(v,s,u,A,o&&k>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,i),n&&v instanceof At&&A==0&&(C=0),v.apply(s,d,u,p,k,A,C))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,l}applyAttachmentTimeline(t,s,i,r,l){var o=s.slots[t.slotIndex];o.bone.active&&(i<t.frames[0]?(r==0||r==1)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,t.attachmentNames[$.search1(t.frames,i)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Ne))}setAttachment(t,s,i,r){s.setAttachment(i?t.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Xs)}applyRotateTimeline(t,s,i,r,l,o,n,a){if(a&&(o[n]=0),r==1){t.apply(s,0,i,null,1,l,0);return}let h=s.bones[t.boneIndex];if(!h.active)return;let c=t.frames,f=0,d=0;if(i<c[0])switch(l){case 0:h.rotation=h.data.rotation;default:return;case 1:f=h.rotation,d=h.data.rotation}else f=l==0?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(i);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let p=0,b=0;a?(p=0,b=u):(p=o[n],b=o[n+1]);let w=p-p%360;m=u+w;let g=u>=0,x=p>=0;Math.abs(b)<=90&&B.signum(b)!=B.signum(u)&&(Math.abs(p-w)>180?(m+=360*B.signum(p),x=g):w!=0?m-=360*B.signum(p):x=g),x!=g&&(m+=360*B.signum(p)),o[n]=m}o[n+1]=u,h.rotation=f+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,l=r-i,o=t.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let f=n[a];if(f.time<o)break;f.time>r||this.queue.event(t,f)}let c=!1;if(t.loop)if(l==0)c=!0;else{const f=Math.floor(t.trackTime/l);c=f>0&&f>Math.floor(t.trackLast/l)}else c=s>=r&&t.animationLast<r;for(c&&this.queue.complete(t);a<h;a++){let f=n[a];f.time<i||this.queue.event(t,f)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,l=this.expandToIndex(t);l&&(l.nextTrackLast==-1?(this.tracks[t]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,r=!1):this.clearNext(l));let o=this.trackEntry(t,s,i,l);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,s,i=!1,r=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,l,i,r)}addAnimationWith(t,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(t);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(t,s,i,l);return l?(l.next=o,o.previous=l,r<=0&&(r=Math.max(r+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,te.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,te.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let l=this.tracks[i];l&&this.setEmptyAnimation(l.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,r){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=t,l.animation=s,l.loop=i,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=r?this.data.getMix(r.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=2,l}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let s=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,l=t.timelineMode;l.length=r;let o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)l[a]=n.addAll(i[a].getPropertyIds())?Wt:Ve;return}t:for(let a=0;a<r;a++){let h=i[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=qt;else if(!s||h instanceof xt||h instanceof At||h instanceof Ut||!s.animation.hasTimeline(c))l[a]=De;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(t.mixDuration>0){l[a]=Ys,o[a]=f;continue t}break}l[a]=Wt}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ts=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Is=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],r=e[s+1];switch(i){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++){let n=t[o];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case 4:r.listener&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(r)}break;case 5:let l=e[s+++2];r.listener&&r.listener.event&&r.listener.event(r,l);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(r,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Ms=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Ms||{}),br=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},qt=0,De=1,Ve=2,Wt=3,Ys=4,Ne=1,Xs=2,Fs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Oe=class or extends ht{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new or(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},bt=class lr extends ht{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new lr(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},_e=class{_image;constructor(e){this._image=e}getImage(){return this._image}},zt=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(zt||{}),Ps=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Ps||{}),Bs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},wr=class extends _e{setFilters(e,t){}setWraps(e,t){}dispose(){}},Gt=class{pages=new Array;regions=new Array;constructor(e){let t=new yr(e),s=new Array(4),i={};i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.format=()=>{},i.filter=h=>{h.minFilter=E.enumValue(zt,s[1]),h.magFilter=E.enumValue(zt,s[2])},i.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=10497),s[1].indexOf("y")!=-1&&(h.vWrap=10497)},i.pma=h=>{h.pma=s[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},r.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},r.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},r.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},r.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},r.index=h=>{h.index=parseInt(s[1])};let l=t.readLine();for(;l&&l.trim().length==0;)l=t.readLine();for(;!(!l||l.trim().length==0||t.readEntry(s,l)==0);)l=t.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=t.readLine();else if(o){let h=new Ue(o,l);for(;;){let c=t.readEntry(s,l=t.readLine());if(c==0)break;let f=r[s[0]];if(f)f(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));a.push(d)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Es(l.trim());t.readEntry(s,l=t.readLine())!=0;){let h=i[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},yr=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let l=t.indexOf(",",r);if(l==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,l-r).trim(),r=l+1,i==4)return 4}}},Es=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Ue=class extends Bs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ct=class ds extends ht{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=E.newFloatArray(t.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof Ue){let a=this.region,h=a.page,c=h.width,f=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<i;d+=2)s[d]=r+t[d+1]*o,s[d+1]=l+(1-t[d])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/f,o=a.originalWidth/c,n=a.originalHeight/f;for(let d=0;d<i;d+=2)s[d]=r+(1-t[d])*o,s[d+1]=l+(1-t[d+1])*n;return;case 270:r-=a.offsetY/c,l-=a.offsetX/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<i;d+=2)s[d]=r+(1-t[d+1])*o,s[d+1]=l+t[d]*n;return}r-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/f,o=a.originalWidth/c,n=a.originalHeight/f}else this.region?(o=this.region.u2-r,n=this.region.v2-l):(r=l=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+t[a]*o,s[a+1]=l+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new ds(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,i,r,l,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,l,o)}newLinkedMesh(){let t=new ds(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},St=class hr extends ht{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new hr(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Rs=class cr extends ht{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*B.degRad,i=Math.cos(s),r=Math.sin(s),l=i*t.a+r*t.b,o=i*t.c+r*t.d;return B.atan2Deg(o,l)}copy(){let t=new cr(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},nt=class dr extends ne{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=l+this.region.width*i,a=o+this.region.height*r,h=this.rotation*B.degRad,c=Math.cos(h),f=Math.sin(h),d=this.x,m=this.y,u=l*c+d,p=l*f,b=o*c+m,w=o*f,g=n*c+d,x=n*f,y=a*c+m,v=a*f,C=this.offset;C[0]=u-w,C[1]=b+p,C[2]=u-v,C[3]=y+p,C[4]=g-v,C[5]=y+x,C[6]=g-w,C[7]=b+x,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,i,r){this.sequence!=null&&this.sequence.apply(t,this);let l=t.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,f=l.c,d=l.d,m=0,u=0;m=o[0],u=o[1],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a,i+=r,m=o[2],u=o[3],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a,i+=r,m=o[4],u=o[5],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a,i+=r,m=o[6],u=o[7],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a}copy(){let t=new dr(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Ls=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,l=i.length;r<l;r++){let o=s.getPath(t,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[r]=n}}newRegionAttachment(e,t,s,i){let r=new nt(t,s);if(i!=null)this.loadSequence(t,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=l}return r}newMeshAttachment(e,t,s,i){let r=new ct(t,s);if(i!=null)this.loadSequence(t,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=l}return r}newBoundingBoxAttachment(e,t){return new Oe(t)}newPathAttachment(e,t){return new St(t)}newPointAttachment(e,t){return new Rs(t)}newClippingAttachment(e,t){return new bt(t)}},qe=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 V;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Ht=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Ht||{}),We=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,r,l,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,p=(s+l)*B.degRad,b=(s+90+o)*B.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*u,this.d=Math.sin(b)*r*u,this.worldX=e*m+d.x,this.worldY=t*u+d.y;return}let a=n.a,h=n.b,c=n.c,f=n.d;switch(this.worldX=a*e+h*t+n.worldX,this.worldY=c*e+f*t+n.worldY,this.inherit){case 0:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad,u=Math.cos(d)*i,p=Math.cos(m)*r,b=Math.sin(d)*i,w=Math.sin(m)*r;this.a=a*u+h*b,this.b=a*p+h*w,this.c=c*u+f*b,this.d=c*p+f*w;return}case 1:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(m)*r,this.c=Math.sin(d)*i,this.d=Math.sin(m)*r;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=d,c*=m;let u=a*a+c*c,p=0;u>1e-4?(u=Math.abs(a*f*m-h*d*c)/u,h=c*u,f=a*u,p=Math.atan2(c,a)*B.radDeg):(a=0,c=0,p=90-Math.atan2(f,h)*B.radDeg);const b=(s+l-p)*B.degRad,w=(s+o-p+90)*B.degRad,g=Math.cos(b)*i,x=Math.cos(w)*r,y=Math.sin(b)*i,v=Math.sin(w)*r;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=B.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(a*d+h*m)/this.skeleton.scaleX,p=(c*d+f*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+p*p);b>1e-5&&(b=1/b),u*=b,p*=b,b=Math.sqrt(u*u+p*p),this.inherit==3&&a*f-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,u);const w=Math.cos(s)*b,g=Math.sin(s)*b;l*=B.degRad,o=(90+o)*B.degRad;const x=Math.cos(l)*i,y=Math.cos(o)*r,v=Math.sin(l)*i,C=Math.sin(o)*r;this.a=u*x+w*v,this.b=u*y+w*C,this.c=p*x+g*v,this.d=p*y+g*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.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)*B.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,l=1/(t*r-s*i),o=r*l,n=s*l,a=i*l,h=t*l,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*o-f*n,this.ay=f*h-c*a;let d,m,u,p;if(this.inherit==1)d=this.a,m=this.b,u=this.c,p=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=t*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(t*r-s*i),o=r*l,n=s*l;break}case 3:case 4:let b=B.cosDeg(this.rotation),w=B.sinDeg(this.rotation);t=(t*b+s*w)/this.skeleton.scaleX,i=(i*b+r*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.inherit==3&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=B.PI/2+Math.atan2(i,t);s=Math.cos(x)*g,r=Math.sin(x)*g,l=1/(t*r-s*i),o=r*l,n=s*l,a=i*l,h=t*l}d=o*this.a-n*this.c,m=o*this.b-n*this.d,u=h*this.c-a*this.a,p=h*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let b=d*p-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*p,b)*B.radDeg,this.arotation=Math.atan2(u,d)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*B.radDeg}rotateWorld(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},Pt=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},vr=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Vs,i=new Ds){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,l=>{this.success(t,e,l),i(l)},(l,o)=>{const n=`Couldn't load binary ${e}: status ${l}, ${o}`;this.error(s,e,n),r(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,l=>{this.success(t,e,l),i(l)},(l,o)=>{const n=`Couldn't load JSON ${e}: status ${l}, ${o}`;this.error(s,e,n),r(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[e],r=i!==void 0;return r&&(this.cache.assetsLoaded[e]=i.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(t,e,l),l)).catch(l=>this.error(s,e,l))),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(t,e,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(t,e,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),l=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,n)=>{this.downloader.downloadText(e,a=>{try{let h=new Gt(a),c=h.pages.length,f=!1;for(let d of h.pages)this.loadTexture(i?i[d.name]:l+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(t,e,h),o(h)))},(m,u)=>{if(!f){const p=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,p),n(p)}f=!0})}catch(h){const c=`Couldn't parse texture atlas ${e}: ${h.message}`;this.error(s,e,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${h}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,l)=>{this.downloader.downloadText(e,o=>{try{const n=new Gt(o);this.success(t,e,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),l(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(r))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
- `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){--this.cache.assetsRefCount[e]===0&&this.remove(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Ds=class ee{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ee.AVAILABLE_CACHES.get(t);if(s)return s;const i=new ee;return ee.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Vs=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let l=()=>{this.finish(e,r.status,r.responseText)};r.onload=l,r.onerror=l,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let l=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):l()},r.onerror=l,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let l=r.length-1,o=i.length;l<o;l+=2)i[l].apply(null,r)}},ze=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Ge=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Ns=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,l,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,f=n.d,d=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*B.signum(e.skeleton.scaleX),u=(s-e.worldY)*B.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(a*f-h*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;h=-x*w*e.skeleton.scaleX,f=g*w*e.skeleton.scaleY,d+=Math.atan2(x,g)*B.radDeg;default:let y=t-n.worldX,v=s-n.worldY,C=a*f-h*c;Math.abs(C)<=1e-4?(m=0,u=0):(m=(y*f-v*h)/C-e.ax,u=(v*a-y*c)/C-e.ay)}d+=Math.atan2(u,m)*B.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let p=e.ascaleX,b=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const w=e.data.length*p;if(w>1e-4){const g=m*m+u*u;if(i&&g<w*w||r&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,p,b,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,l,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let h=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,u=d,p=t.ascaleX,b=0,w=0,g=0;f<0?(f=-f,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),p<0?(p=-p,w=180):w=0;let x=t.ax,y=0,v=0,C=0,A=e.a,k=e.b,T=e.c,Y=e.d,M=Math.abs(f-d)<=1e-4;!M||l?(y=0,v=A*x+e.worldX,C=T*x+e.worldY):(y=t.ay,v=A*x+k*y+e.worldX,C=T*x+Y*y+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");A=F.a,k=F.b,T=F.c,Y=F.d;let P=A*Y-k*T,I=v-F.worldX,X=C-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let L=(I*Y-X*k)*P-h,N=(X*A-I*T)*P-c,D=Math.sqrt(L*L+N*N),O=t.data.length*p,H,W;if(D<1e-4){this.apply1(e,s,i,!1,l,!1,a),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-F.worldX,X=i-F.worldY;let j=(I*Y-X*k)*P-h,R=(X*A-I*T)*P-c,U=j*j+R*R;if(n!=0){n*=f*(p+1)*.5;let J=Math.sqrt(U),K=J-D-O*f+n;if(K>0){let Q=Math.min(1,K/(n*2))-1;Q=(K-n*(1-Q*Q))/J,j-=Q*j,R-=Q*R,U=j*j+R*R}}t:if(M){O*=f;let J=(U-D*D-O*O)/(2*D*O);J<-1?(J=-1,W=Math.PI*r):J>1?(J=1,W=0,l&&(A=(Math.sqrt(U)/(D+O)-1)*a+1,m*=A,o&&(u*=A))):W=Math.acos(J)*r,A=D+O*J,k=O*Math.sin(W),H=Math.atan2(R*A-j*k,j*A+R*k)}else{A=f*O,k=d*O;let J=A*A,K=k*k,Q=Math.atan2(R,j);T=K*D*D+J*U-J*K;let rt=-2*K*D,yt=K-J;if(Y=rt*rt-4*yt*T,Y>=0){let vt=Math.sqrt(Y);rt<0&&(vt=-vt),vt=-(rt+vt)*.5;let Yt=vt/yt,bs=T/vt,Nt=Math.abs(Yt)<Math.abs(bs)?Yt:bs;if(Yt=U-Nt*Nt,Yt>=0){X=Math.sqrt(Yt)*r,H=Q-Math.atan2(X,Nt),W=Math.atan2(X/d,(Nt-D)/f);break t}}let Mt=B.PI,Dt=D-A,se=Dt*Dt,gs=0,ps=0,Vt=D+A,re=Vt*Vt,xs=0;T=-A*D/(J-K),T>=-1&&T<=1&&(T=Math.acos(T),I=A*Math.cos(T)+D,X=k*Math.sin(T),Y=I*I+X*X,Y<se&&(Mt=T,se=Y,Dt=I,gs=X),Y>re&&(ps=T,re=Y,Vt=I,xs=X)),U<=(se+re)*.5?(H=Q-Math.atan2(gs*r,Dt),W=Mt*r):(H=Q-Math.atan2(xs*r,Vt),W=ps*r)}let G=Math.atan2(y,x)*g,tt=e.arotation;H=(H-G)*B.radDeg+b-tt,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(h,c,tt+H*a,m,u,0,0),tt=t.arotation,W=((W+G)*B.radDeg-t.ashearX)*g+w-tt,W>180?W-=360:W<-180&&(W+=360),t.updateWorldTransformWith(x,y,tt+W*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},He=class extends Pt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},$e=class extends Pt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},je=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(je||{}),Je=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Je||{}),Ke=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Ke||{}),Os=class pt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0,l=t.bones.length;r<l;r++){let o=s.findBone(t.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof St))return;let i=this.mixRotate,r=this.mixX,l=this.mixY;if(i==0&&r==0&&l==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,h=this.bones,c=h.length,f=n?c:c+1,d=E.setArraySize(this.spaces,f),m=a?this.lengths=E.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(a)for(let C=0,A=f-1;C<A;C++){let k=h[C],T=k.data.length,Y=T*k.a,M=T*k.c;m[C]=Math.sqrt(Y*Y+M*M)}E.arrayFill(d,1,f,u);break;case 3:let y=0;for(let C=0,A=f-1;C<A;){let k=h[C],T=k.data.length;if(T<pt.epsilon)a&&(m[C]=0),d[++C]=u;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),d[++C]=F,y+=F}}if(y>0){y=f/y*u;for(let C=1;C<f;C++)d[C]*=y}break;default:let v=o.spacingMode==0;for(let C=0,A=f-1;C<A;){let k=h[C],T=k.data.length;if(T<pt.epsilon)a&&(m[C]=0),d[++C]=u;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),d[++C]=(v?T+u:u)*F/T}}}let p=this.computeWorldPositions(s,f,n),b=p[0],w=p[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?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*r,C.worldY+=(w-C.worldY)*l;let A=p[v],k=p[v+1],T=A-b,Y=k-w;if(a){let M=m[y];if(M!=0){let F=(Math.sqrt(T*T+Y*Y)/M-1)*i+1;C.a*=F,C.c*=F}}if(b=A,w=k,i>0){let M=C.a,F=C.b,P=C.c,I=C.d,X=0,L=0,N=0;if(n?X=p[v-1]:d[y+1]==0?X=p[v+2]:X=Math.atan2(Y,T),X-=Math.atan2(P,M),x){L=Math.cos(X),N=Math.sin(X);let D=C.data.length;b+=(D*(L*M-N*P)-T)*i,w+=(D*(N*M+L*P)-Y)*i}else X+=g;X>B.PI?X-=B.PI2:X<-B.PI&&(X+=B.PI2),X*=i,L=Math.cos(X),N=Math.sin(X),C.a=L*M-N*P,C.b=L*F-N*I,C.c=N*M+L*P,C.d=N*F+L*I}C.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=t.closed,c=t.worldVerticesLength,f=c/6,d=pt.NONE;if(!t.constantSpeed){let D=t.lengths;f-=h?1:2;let O=D[f];this.data.positionMode==1&&(l*=O);let H;switch(this.data.spacingMode){case 2:H=O;break;case 3:H=O/s;break;default:H=1}a=E.setArraySize(this.world,8);for(let W=0,j=0,R=0;W<s;W++,j+=3){let U=o[W]*H;l+=U;let G=l;if(h)G%=O,G<0&&(G+=O),R=0;else if(G<0){d!=pt.BEFORE&&(d=pt.BEFORE,t.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>O){d!=pt.AFTER&&(d=pt.AFTER,t.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(G-O,a,0,n,j);continue}for(;;R++){let tt=D[R];if(!(G>tt)){if(R==0)G/=tt;else{let J=D[R-1];G=(G-J)/(tt-J)}break}}R!=d&&(d=R,h&&R==f?(t.computeWorldVertices(r,c-4,4,a,0,2),t.computeWorldVertices(r,0,4,a,4,2)):t.computeWorldVertices(r,R*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,j,i||W>0&&U==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,a,0,2),t.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(f--,c-=4,a=E.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,a,0,2));let m=E.setArraySize(this.curves,f),u=0,p=a[0],b=a[1],w=0,g=0,x=0,y=0,v=0,C=0,A=0,k=0,T=0,Y=0,M=0,F=0,P=0,I=0;for(let D=0,O=2;D<f;D++,O+=6)w=a[O],g=a[O+1],x=a[O+2],y=a[O+3],v=a[O+4],C=a[O+5],A=(p-w*2+x)*.1875,k=(b-g*2+y)*.1875,T=((w-x)*3-p+v)*.09375,Y=((g-y)*3-b+C)*.09375,M=A*2+T,F=k*2+Y,P=(w-p)*.75+A+T*.16666667,I=(g-b)*.75+k+Y*.16666667,u+=Math.sqrt(P*P+I*I),P+=M,I+=F,M+=T,F+=Y,u+=Math.sqrt(P*P+I*I),P+=M,I+=F,u+=Math.sqrt(P*P+I*I),P+=M+T,I+=F+Y,u+=Math.sqrt(P*P+I*I),m[D]=u,p=v,b=C;this.data.positionMode==1&&(l*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let L=this.segments,N=0;for(let D=0,O=0,H=0,W=0;D<s;D++,O+=3){let j=o[D]*X;l+=j;let R=l;if(h)R%=u,R<0&&(R+=u),H=0;else if(R<0){this.addBeforePosition(R,a,0,n,O);continue}else if(R>u){this.addAfterPosition(R-u,a,c-4,n,O);continue}for(;;H++){let U=m[H];if(!(R>U)){if(H==0)R/=U;else{let G=m[H-1];R=(R-G)/(U-G)}break}}if(H!=d){d=H;let U=H*6;for(p=a[U],b=a[U+1],w=a[U+2],g=a[U+3],x=a[U+4],y=a[U+5],v=a[U+6],C=a[U+7],A=(p-w*2+x)*.03,k=(b-g*2+y)*.03,T=((w-x)*3-p+v)*.006,Y=((g-y)*3-b+C)*.006,M=A*2+T,F=k*2+Y,P=(w-p)*.3+A+T*.16666667,I=(g-b)*.3+k+Y*.16666667,N=Math.sqrt(P*P+I*I),L[0]=N,U=1;U<8;U++)P+=M,I+=F,M+=T,F+=Y,N+=Math.sqrt(P*P+I*I),L[U]=N;P+=M,I+=F,N+=Math.sqrt(P*P+I*I),L[8]=N,P+=M+T,I+=F+Y,N+=Math.sqrt(P*P+I*I),L[9]=N,W=0}for(R*=N;;W++){let U=L[W];if(!(R>U)){if(W==0)R/=U;else{let G=L[W-1];R=W+(R-G)/(U-G)}break}}this.addCurvePosition(R*.1,p,b,w,g,x,y,v,C,n,O,i||D>0&&j==0)}return n}addBeforePosition(t,s,i,r,l){let o=s[i],n=s[i+1],a=s[i+2]-o,h=s[i+3]-n,c=Math.atan2(h,a);r[l]=o+t*Math.cos(c),r[l+1]=n+t*Math.sin(c),r[l+2]=c}addAfterPosition(t,s,i,r,l){let o=s[i+2],n=s[i+3],a=o-s[i],h=n-s[i+1],c=Math.atan2(h,a);r[l]=o+t*Math.cos(c),r[l+1]=n+t*Math.sin(c),r[l+2]=c}addCurvePosition(t,s,i,r,l,o,n,a,h,c,f,d){if(t==0||isNaN(t)){c[f]=s,c[f+1]=i,c[f+2]=Math.atan2(l-i,r-s);return}let m=t*t,u=m*t,p=1-t,b=p*p,w=b*p,g=p*t,x=g*3,y=p*x,v=x*t,C=s*w+r*y+o*v+a*u,A=i*w+l*y+n*v+h*u;c[f]=C,c[f+1]=A,d&&(t<.001?c[f+2]=Math.atan2(l-i,r-s):c[f+2]=Math.atan2(A-(i*b+l*g*2+n*m),C-(s*b+r*g*2+o*m)))}},Cr=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.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,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(i){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*p*a.scaleX,C=this.gravity*p*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),i&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),d-=u;while(d>=u)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r||l){let x=Math.atan2(o.c,o.a),y=0,v=0,C=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),r){C=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(k+this.ty,A+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*B.invPI2-.5)*B.PI2)*m,T=this.rotateOffset*C+x,y=Math.cos(T),v=Math.sin(T),l&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(A*y+k*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(A*y+k*v)*m/T)}if(d=this.remaining,d>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,Y=this.strength,M=this.wind,F=kt.yDown?-this.gravity:this.gravity,P=n/p;for(;;)if(d-=u,l&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+F*y)*P+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,d<u)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r){let a=this.rotateOffset*t,h=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*this.data.rotate,h=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-h*o.d,o.d=h*f+c*o.d),d+=a*this.data.shearX,h=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-h*o.c,o.c=h*f+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),f=o.a,o.a=c*f-h*o.c,o.c=h*f+c*o.c,f=o.b,o.b=c*f-h*o.d,o.d=h*f+c*o.d}if(l){const a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*B.degRad,r=Math.cos(i),l=Math.sin(i),o=this.cx-e,n=this.cy-t;this.translate(o*r-n*l-o,o*l+n*r-n)}},_s=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new V,this.darkColor=e.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ht)||!(this.attachment instanceof ht)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Us=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Xt;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,f=n.d,d=a*f-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)-Math.atan2(v,x)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*t,g.worldY+=(x.y-g.worldY)*s}if(i!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.c*=x}if(r!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+f*f)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(f,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+u)*l;let A=Math.sqrt(x*x+y*y);g.b=Math.cos(C)*A,g.d=Math.sin(C)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,f=n.d,d=a*f-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*t,g.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(h*h+f*f)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(f,h)-Math.atan2(c,a);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-B.PI/2+u)*l;let C=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*C,g.d=Math.sin(x)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],f=c.arotation;e!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,p=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(d,m,f,u,p,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],f=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(d,m,f,u,p,c.ashearX,b)}}},kt=class fs{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 fs.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=t.bones[s],r;if(!i.parent)r=new We(i,this,null);else{let l=this.bones[i.parent.index];r=new We(i,this,l),l.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let i=t.slots[s],r=this.bones[i.boneData.index],l=new _s(i,r);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let i=t.ikConstraints[s];this.ikConstraints.push(new Ns(i,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let i=t.transformConstraints[s];this.transformConstraints.push(new Us(i,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let i=t.pathConstraints[s];this.pathConstraints.push(new Os(i,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let i=t.physicsConstraints[s];this.physicsConstraints.push(new Cr(i,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.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 p=this.bones[d[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,r=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,h=l.length,c=this.physicsConstraints.length,f=n+a+h+c;t:for(let d=0;d<f;d++){for(let m=0;m<n;m++){let u=i[m];if(u.data.order==d){this.sortIkConstraint(u);continue t}}for(let m=0;m<a;m++){let u=r[m];if(u.data.order==d){this.sortTransformConstraint(u);continue t}}for(let m=0;m<h;m++){let u=l[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(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let i=t.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let l=i[i.length-1];this.sortBone(l),this._updateCache.push(t),this.sortReset(r.children),l.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let l=s.getAttachment();l instanceof St&&this.sortPathConstraintAttachmentWith(l,r);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,i=s.length;if(t.data.local)for(let r=0;r<i;r++){let l=s[r];this.sortBone(l.parent),this.sortBone(l)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(t);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(t,s,i){let r=t.attachments[s];if(r)for(let l in r)this.sortPathConstraintAttachmentWith(r[l],i)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof St))return;let i=t.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let l=0,o=i.length;l<o;){let n=i[l++];for(n+=l;l<n;)this.sortBone(r[i[l++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){let r=t[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,l=s.length;r<l;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,l=i.length;r<l;r++)i[r].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,w=i.length;b<w;b++){let g=i[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 r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;r.worldX=l*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const h=(r.rotation+r.shearX)*B.degRad,c=(r.rotation+90+r.shearY)*B.degRad,f=Math.cos(h)*r.scaleX,d=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(l*f+o*m)*this.scaleX,r.b=(l*d+o*u)*this.scaleX,r.c=(n*f+a*m)*this.scaleY,r.d=(n*d+a*u)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=r&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;E.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,i=t.length;s<i;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==t)return l}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==t)return l}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i],o=l.data.attachmentName;if(o){let n=t.getAttachment(i,o);n&&l.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,l=i.length;r<l;r++){let o=i[r];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Xt,i=new Xt;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let l=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let c=0,f=l.length;c<f;c++){let d=l[c];if(!d.bone.active)continue;let m=0,u=null,p=null,b=d.getAttachment();if(b instanceof nt)m=8,u=E.setArraySize(i,m,0),b.computeWorldVertices(d,u,0,2),p=fs.quadTriangles;else if(b instanceof ct){let w=b;m=w.worldVerticesLength,u=E.setArraySize(i,m,0),w.computeWorldVertices(d,0,m,u,0,2),p=w.triangles}else if(b instanceof bt&&r!=null){r.clipStart(d,b);continue}if(u&&p){r!=null&&r.isClipping()&&(r.clipTriangles(u,p,p.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let w=0,g=u.length;w<g;w+=2){let x=u[w],y=u[w+1];o=Math.min(o,x),n=Math.min(n,y),a=Math.max(a,x),h=Math.max(h,y)}}r?.clipEndWithSlot(d)}r?.clipEnd(),t.set(o,n),s.set(a-o,h-n)}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physicsConstraints;for(let r=0,l=i.length;r<l;r++)i[r].translate(t,s)}physicsRotate(t,s,i){const r=this.physicsConstraints;for(let l=0,o=r.length;l<o;l++)r[l].rotate(t,s,i)}},qs=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(qs||{}),Ws=class extends Pt{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Bt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}},Qe=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Et=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof ct?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Qe(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Qe(e,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let r=e.slots[i],l=r.getAttachment();if(l&&s<t.attachments.length){let o=t.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&r.setAttachment(h);break}}}s++}}},Ze=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},ts=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(ts||{}),es=class extends Pt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},zs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Bt;s.name="";let i=new Gs(e),r=i.readInt32(),l=i.readInt32();s.hash=l==0&&r==0?null:l.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let f=h==0?null:s.bones[i.readInt(!0)],d=new qe(h,c,f);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.inherit=i.readByte(),d.skinRequired=i.readBoolean(),o&&(V.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new Ze(h,c,f);V.rgba8888ToColor(d.color,i.readInt32());let m=i.readInt32();m!=-1&&V.rgb888ToColor(d.darkColor=new V,m),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new He(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let m=i.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?i.readFloat():1),(m&128)!=0&&(d.softness=i.readFloat()*t),s.ikConstraints.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new es(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=i.readFloat()),(m&16)!=0&&(d.offsetX=i.readFloat()*t),(m&32)!=0&&(d.offsetY=i.readFloat()*t),(m&64)!=0&&(d.offsetScaleX=i.readFloat()),(m&128)!=0&&(d.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(d.offsetShearY=i.readFloat()),(m&2)!=0&&(d.mixRotate=i.readFloat()),(m&4)!=0&&(d.mixX=i.readFloat()),(m&8)!=0&&(d.mixY=i.readFloat()),(m&16)!=0&&(d.mixScaleX=i.readFloat()),(m&32)!=0&&(d.mixScaleY=i.readFloat()),(m&64)!=0&&(d.mixShearY=i.readFloat()),s.transformConstraints.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new $e(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)];const m=i.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=i.readFloat()),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ws(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=i.readFloat()),(m&4)!=0&&(d.y=i.readFloat()),(m&8)!=0&&(d.rotate=i.readFloat()),(m&16)!=0&&(d.scaleX=i.readFloat()),(m&32)!=0&&(d.shearX=i.readFloat()),d.limit=((m&64)!=0?i.readFloat():5e3)*t,d.step=1/i.readUnsignedByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=(m&128)!=0?i.readFloat():1,d.wind=i.readFloat(),d.gravity=i.readFloat(),m=i.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?i.readFloat():1,s.physicsConstraints.push(d)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+i.readInt(!0));h<n;h++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];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,n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let f=new Ge(c);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let r=null,l=0;if(s){if(l=e.readInt(!0),l==0)return null;r=new Et("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Et(o),i&&V.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);l=e.readInt(!0)}for(let o=0;o<l;o++){let n=e.readInt(!0);for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,r,n,c,i);f&&r.setAttachment(n,c,f)}}return r}readAttachment(e,t,s,i,r,l){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let h=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null;let d=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,f);return x?(x.path=h,x.x=m*o,x.y=u*o,x.scaleX=p,x.scaleY=b,x.rotation=d,x.width=w*o,x.height=g*o,V.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let h=this.readVertices(e,(n&16)!=0),c=l?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,a);return f?(f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,l&&V.rgba8888ToColor(f.color,c),f):null}case 2:{let h=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),p=this.readShortArray(e,(m.length-d-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,f);return x?(x.path=h,V.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case 3:{const h=(n&16)!=0?e.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let p=0,b=0;l&&(p=e.readFloat(),b=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,f);return w?(w.path=h,V.rgba8888ToColor(w.color,c),w.sequence=f,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Ar(w,m,i,u,d)),w):null}case 4:{const h=(n&16)!=0,c=(n&32)!=0,f=this.readVertices(e,(n&64)!=0),d=E.newArray(f.length/6,0);for(let p=0,b=d.length;p<b;p++)d[p]=e.readFloat()*o;const m=l?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=h,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,l&&V.rgba8888ToColor(u.color,m),u):null}case 5:{const h=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=l?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=f*o,m.rotation=h,l&&V.rgba8888ToColor(m.color,d),m):null}case 6:{const h=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let f=l?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,a);return d?(d.endSlot=t.slots[h],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,l&&V.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){let t=new vs(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),r=new Sr;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let l=new Array,o=new Array;for(let n=0;n<i;n++){let a=e.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(e.readInt(!0)),l.push(e.readFloat()*s),l.push(e.readFloat()*s),l.push(e.readFloat())}return r.vertices=E.toFloatArray(l),r.bones=o,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,r=this.scale;for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),u=e.readInt(!0),p=u-1;switch(m){case Lr:{let b=new xt(u,c);for(let w=0;w<u;w++)b.setFrame(w,e.readFloat(),e.readStringRef());i.push(b);break}case Dr:{let b=e.readInt(!0),w=new pe(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,x,y,v,C),A!=p;A++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(A);break;case ft:q(e,w,k++,A,0,g,T,x,Y,1),q(e,w,k++,A,1,g,T,y,M,1),q(e,w,k++,A,2,g,T,v,F,1),q(e,w,k++,A,3,g,T,C,P,1)}g=T,x=Y,y=M,v=F,C=P}i.push(w);break}case Vr:{let b=e.readInt(!0),w=new xe(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let C=0,A=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(C);break;case ft:q(e,w,A++,C,0,g,k,x,T,1),q(e,w,A++,C,1,g,k,y,Y,1),q(e,w,A++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}i.push(w);break}case Nr:{let b=e.readInt(!0),w=new we(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,A,k,T),Y!=p;Y++){let F=e.readFloat(),P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(Y);break;case ft:q(e,w,M++,Y,0,g,F,x,P,1),q(e,w,M++,Y,1,g,F,y,I,1),q(e,w,M++,Y,2,g,F,v,X,1),q(e,w,M++,Y,3,g,F,C,L,1),q(e,w,M++,Y,4,g,F,A,N,1),q(e,w,M++,Y,5,g,F,k,D,1),q(e,w,M++,Y,6,g,F,T,O,1)}g=F,x=P,y=I,v=X,C=L,A=N,k=D,T=O}i.push(w);break}case Or:{let b=e.readInt(!0),w=new ye(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,A,k),T!=p;T++){let M=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(T);break;case ft:q(e,w,Y++,T,0,g,M,x,F,1),q(e,w,Y++,T,1,g,M,y,P,1),q(e,w,Y++,T,2,g,M,v,I,1),q(e,w,Y++,T,3,g,M,C,X,1),q(e,w,Y++,T,4,g,M,A,L,1),q(e,w,Y++,T,5,g,M,k,N,1)}g=M,x=F,y=P,v=I,C=X,A=L,k=N}i.push(w);break}case _r:{let b=new be(u,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case dt:b.setStepped(x);break;case ft:q(e,b,y++,x,0,w,v,g,C,1)}w=v,g=C}i.push(b)}}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),u=e.readInt(!0);if(m==Rr){let b=new ge(u,c);for(let w=0;w<u;w++)b.setFrame(w,e.readFloat(),e.readByte());i.push(b);continue}let p=e.readInt(!0);switch(m){case kr:i.push(Z(e,new Ft(u,p,c),1));break;case Tr:i.push(ss(e,new ae(u,p,c),r));break;case Ir:i.push(Z(e,new oe(u,p,c),r));break;case Mr:i.push(Z(e,new le(u,p,c),r));break;case Yr:i.push(ss(e,new he(u,p,c),1));break;case Xr:i.push(Z(e,new ce(u,p,c),1));break;case Fr:i.push(Z(e,new de(u,p,c),1));break;case Pr:i.push(ss(e,new fe(u,p,c),1));break;case Br:i.push(Z(e,new ue(u,p,c),1));break;case Er:i.push(Z(e,new me(u,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new Ce(f,e.readInt(!0),c),u=e.readByte(),p=e.readFloat(),b=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,w=(u&4)!=0?e.readFloat()*r:0;for(let g=0,x=0;m.setFrame(g,p,b,w,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=e.readByte();const y=e.readFloat(),v=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,C=(u&4)!=0?e.readFloat()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(q(e,m,x++,g,0,p,y,b,v,1),q(e,m,x++,g,1,p,y,w,C,r)),p=y,b=v,w=C}i.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new Ae(f,e.readInt(!0),c),u=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,C=0;m.setFrame(v,u,p,b,w,g,x,y),v!=d;v++){let A=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case dt:m.setStepped(v);break;case ft:q(e,m,C++,v,0,u,A,p,k,1),q(e,m,C++,v,1,u,A,b,T,1),q(e,m,C++,v,2,u,A,w,Y,1),q(e,m,C++,v,3,u,A,g,M,1),q(e,m,C++,v,4,u,A,x,F,1),q(e,m,C++,v,5,u,A,y,P,1)}u=A,p=k,b=T,w=Y,g=M,x=F,y=P}i.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=e.readInt(!0);d<m;d++){const u=e.readByte(),p=e.readInt(!0),b=e.readInt(!0);switch(u){case Wr:i.push(Z(e,new Se(p,b,c),f.positionMode==0?r:1));break;case zr:i.push(Z(e,new ke(p,b,c),f.spacingMode==0||f.spacingMode==1?r:1));break;case Gr:let w=new Te(p,b,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let C=0,A=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat();switch(e.readByte()){case dt:w.setStepped(C);break;case ft:q(e,w,A++,C,0,g,T,x,Y,1),q(e,w,A++,C,1,g,T,y,M,1),q(e,w,A++,C,2,g,T,v,F,1)}g=T,x=Y,y=M,v=F}i.push(w)}}}for(let a=0,h=e.readInt(!0);a<h;a++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const m=e.readByte(),u=e.readInt(!0);if(m==ti){const b=new Ee(u,c);for(let w=0;w<u;w++)b.setFrame(w,e.readFloat());i.push(b);continue}const p=e.readInt(!0);switch(m){case Hr:i.push(Z(e,new Ie(u,p,c),1));break;case $r:i.push(Z(e,new Me(u,p,c),1));break;case jr:i.push(Z(e,new Ye(u,p,c),1));break;case Jr:i.push(Z(e,new Xe(u,p,c),1));break;case Kr:i.push(Z(e,new Fe(u,p,c),1));break;case Qr:i.push(Z(e,new Pe(u,p,c),1));break;case Zr:i.push(Z(e,new Be(u,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readInt(!0);for(let u=0,p=e.readInt(!0);u<p;u++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case Ur:{let v=w,C=v.bones,A=v.vertices,k=C?A.length/3*2:A.length,T=e.readInt(!0),Y=new ve(x,T,m,v),M=e.readFloat();for(let F=0,P=0;;F++){let I,X=e.readInt(!0);if(X==0)I=C?E.newFloatArray(k):A;else{I=E.newFloatArray(k);let N=e.readInt(!0);if(X+=N,r==1)for(let D=N;D<X;D++)I[D]=e.readFloat();else for(let D=N;D<X;D++)I[D]=e.readFloat()*r;if(!C)for(let D=0,O=I.length;D<O;D++)I[D]+=A[D]}if(Y.setFrame(F,M,I),F==y)break;let L=e.readFloat();switch(e.readByte()){case dt:Y.setStepped(F);break;case ft:q(e,Y,P++,F,0,M,L,0,1,1)}M=L}i.push(Y);break}case qr:{let v=new Re(x,m,w);for(let C=0;C<x;C++){let A=e.readFloat(),k=e.readInt32();v.setFrame(C,A,As[k&15],k>>4,e.readFloat())}i.push(v);break}}}}}let l=e.readInt(!0);if(l>0){let a=new At(l),h=s.slots.length;for(let c=0;c<l;c++){let f=e.readFloat(),d=e.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let u=E.newArray(h-d,0),p=0,b=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;p!=g;)u[b++]=p++;m[p+e.readInt(!0)]=p++}for(;p<h;)u[b++]=p++;for(let w=h-1;w>=0;w--)m[w]==-1&&(m[w]=u[--b]);a.setFrame(c,f,m)}i.push(a)}let o=e.readInt(!0);if(o>0){let a=new Ut(o);for(let h=0;h<o;h++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new ze(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),a.setFrame(h,d)}i.push(a)}let n=0;for(let a=0,h=i.length;a<h;a++)n=Math.max(n,i[a].getDuration());return new Ot(t,i,n)}},Gs=class{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ar=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Sr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function Z(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let l=0,o=0,n=t.getFrameCount()-1;t.setFrame(l,i,r),l!=n;l++){let a=e.readFloat(),h=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(l);break;case ft:q(e,t,o++,l,0,i,a,r,h,s)}i=a,r=h}return t}function ss(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,l=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,i,r,l),o!=a;o++){let h=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(o);break;case ft:q(e,t,n++,o,0,i,h,r,c,s),q(e,t,n++,o,1,i,h,l,f,s)}i=h,r=c,l=f}return t}function q(e,t,s,i,r,l,o,n,a,h){t.setBezier(s,i,r,l,n,e.readFloat(),e.readFloat()*h,e.readFloat(),e.readFloat()*h,o,a)}var kr=0,Tr=1,Ir=2,Mr=3,Yr=4,Xr=5,Fr=6,Pr=7,Br=8,Er=9,Rr=10,Lr=0,Dr=1,Vr=2,Nr=3,Or=4,_r=5,Ur=0,qr=1,Wr=0,zr=1,Gr=2,Hr=0,$r=1,jr=2,Jr=4,Kr=5,Qr=6,Zr=7,ti=8,dt=1,ft=2,rs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ct(()=>E.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,l=e.slots,o=l.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof Oe){let c=h;s.push(c);let f=r.obtain();f.length!=c.worldVerticesLength&&(f=E.newFloatArray(c.worldVerticesLength)),i.push(f),c.computeWorldVertices(a,0,c.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let l=0,o=r.length;l<o;l++){let n=r[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let f=a[h],d=a[h+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(e<=r&&s<=r||t<=l&&i<=l||e>=o&&s>=o||t>=n&&i>=n)return!1;let a=(i-t)/(s-e),h=a*(r-e)+t;if(h>l&&h<n||(h=a*(o-e)+t,h>l&&h<n))return!0;let c=(l-t)/a+e;return c>r&&c<o||(c=(n-t)/a+e,c>r&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.length,l=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],h=i[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=i[n];c+(s-a)/(h-a)*(i[l]-c)<t&&(o=!o)}l=n}return o}intersectsSegment(e,t,s,i){let r=this.polygons;for(let l=0,o=r.length;l<o;l++)if(this.intersectsSegmentPolygon(r[l],e,t,s,i))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(e,t,s,i,r){let l=e,o=e.length,n=t-i,a=s-r,h=t*r-s*i,c=l[o-2],f=l[o-1];for(let d=0;d<o;d+=2){let m=l[d],u=l[d+1],p=c*u-f*m,b=c-m,w=f-u,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=i||x>=i&&x<=t)){let y=(h*w-a*p)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,f=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Hs=class et{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ct(()=>new Array);polygonIndicesPool=new Ct(()=>new Array);triangulate(t){let s=t,i=t.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=i;n<a;++n)l[n]=et.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,h=1;for(;;){t:if(!l[a]){let d=r[n]<<1,m=r[a]<<1,u=r[h]<<1,p=s[d],b=s[d+1],w=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(h+1)%i;v!=n;v=(v+1)%i){if(!l[v])continue;let C=r[v]<<1,A=s[C],k=s[C+1];if(et.positiveArea(x,y,p,b,A,k)&&et.positiveArea(p,b,w,g,A,k)&&et.positiveArea(w,g,x,y,A,k))break t}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),l.splice(a,1),i--;let c=(i+a-1)%i,f=a==i?0:a;l[c]=et.isConcave(c,i,s,r),l[f]=et.isConcave(f,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(t,s){let i=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=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,p=i[d],b=i[d+1],w=i[m],g=i[m+1],x=i[u],y=i[u+1],v=!1;if(a==d){let C=n.length-4,A=et.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=et.winding(x,y,n[0],n[1],n[2],n[3]);A==h&&k==h&&(n.push(x),n.push(y),o.push(u),v=!0)}v||(n.length>0?(r.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),h=et.winding(p,b,w,g,x,y),a=d)}n.length>0&&(r.push(n),l.push(o));for(let c=0,f=r.length;c<f;c++){if(o=l[c],o.length==0)continue;let d=o[0],m=o[o.length-1];n=r[c];let u=n.length-4,p=n[u],b=n[u+1],w=n[u+2],g=n[u+3],x=n[0],y=n[1],v=n[2],C=n[3],A=et.winding(p,b,w,g,x,y);for(let k=0;k<f;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],F=T[2],P=r[k],I=P[P.length-2],X=P[P.length-1];if(Y!=d||M!=m)continue;let L=et.winding(p,b,w,g,I,X),N=et.winding(I,X,x,y,v,C);L==A&&N==A&&(P.length=0,T.length=0,n.push(I),n.push(X),o.push(F),p=w,b=g,w=I,g=X,k=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(t,s,i,r){let l=r[(s+t-1)%s]<<1,o=r[t]<<1,n=r[(t+1)%s]<<1;return!this.positiveArea(i[l],i[l+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(t,s,i,r,l,o){return t*(o-r)+i*(s-o)+l*(r-s)>=0}static winding(t,s,i,r,l,o){let n=i-t,a=r-s;return l*a-o*n+n*s-t*a>=0?1:-1}},$t=class us{triangulator=new Hs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let l=this.clippingPolygon;us.makeClockwise(l);let o=this.clippingPolygons=this.triangulator.decompose(l,this.triangulator.triangulate(l));for(let n=0,a=o.length;n<a;n++){let h=o[n];us.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,s,i,r,l,o,n,a){let h,c,f,d,m,u;typeof s=="number"?(h=i,c=r,f=l,d=o,m=n,u=a):(h=s,c=i,f=r,d=l,m=o,u=n),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,h,c,f,d,m,u):this.clipTrianglesNoRender(t,h,c)}clipTrianglesNoRender(t,s,i){let r=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<i;c+=3){let f=s[c]<<1,d=t[f],m=t[f+1];f=s[c+1]<<1;let u=t[f],p=t[f+1];f=s[c+2]<<1;let b=t[f],w=t[f+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(d,m,u,p,b,w,n[g],r)){let y=r.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,A=E.setArraySize(l,x+v*2);for(let T=0;T<y;T+=2,x+=2){let Y=C[T],M=C[T+1];A[x]=Y,A[x+1]=M}x=o.length;let k=E.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)k[x]=h,k[x+1]=h+T,k[x+2]=h+T+1;h+=v+1}else{let y=E.setArraySize(l,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=p,y[x+4]=b,y[x+5]=w,x=o.length;let v=E.setArraySize(o,x+3);v[x]=h,v[x+1]=h+1,v[x+2]=h+2,h+=3;break}}}}clipTrianglesRender(t,s,i,r,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=n?12:8,u=0;h.length=0,c.length=0;for(let p=0;p<i;p+=3){let b=s[p]<<1,w=t[b],g=t[b+1],x=r[b],y=r[b+1];b=s[p+1]<<1;let v=t[b],C=t[b+1],A=r[b],k=r[b+1];b=s[p+2]<<1;let T=t[b],Y=t[b+1],M=r[b],F=r[b+1];for(let P=0;P<d;P++){let I=h.length;if(this.clip(w,g,v,C,T,Y,f[P],a)){let X=a.length;if(X==0)continue;let L=C-Y,N=T-v,D=w-T,O=Y-g,H=1/(L*D+N*(g-Y)),W=X>>1,j=this.clipOutput,R=E.setArraySize(h,I+W*m);for(let G=0;G<X;G+=2,I+=m){let tt=j[G],J=j[G+1];R[I]=tt,R[I+1]=J,R[I+2]=l.r,R[I+3]=l.g,R[I+4]=l.b,R[I+5]=l.a;let K=tt-T,Q=J-Y,rt=(L*K+N*Q)*H,yt=(O*K+D*Q)*H,Mt=1-rt-yt;R[I+6]=x*rt+A*yt+M*Mt,R[I+7]=y*rt+k*yt+F*Mt,n&&(R[I+8]=o.r,R[I+9]=o.g,R[I+10]=o.b,R[I+11]=o.a)}I=c.length;let U=E.setArraySize(c,I+3*(W-2));W--;for(let G=1;G<W;G++,I+=3)U[I]=u,U[I+1]=u+G,U[I+2]=u+G+1;u+=W+1}else{let X=E.setArraySize(h,I+3*m);X[I]=w,X[I+1]=g,X[I+2]=l.r,X[I+3]=l.g,X[I+4]=l.b,X[I+5]=l.a,n?(X[I+6]=x,X[I+7]=y,X[I+8]=o.r,X[I+9]=o.g,X[I+10]=o.b,X[I+11]=o.a,X[I+12]=v,X[I+13]=C,X[I+14]=l.r,X[I+15]=l.g,X[I+16]=l.b,X[I+17]=l.a,X[I+18]=A,X[I+19]=k,X[I+20]=o.r,X[I+21]=o.g,X[I+22]=o.b,X[I+23]=o.a,X[I+24]=T,X[I+25]=Y,X[I+26]=l.r,X[I+27]=l.g,X[I+28]=l.b,X[I+29]=l.a,X[I+30]=M,X[I+31]=F,X[I+32]=o.r,X[I+33]=o.g,X[I+34]=o.b,X[I+35]=o.a):(X[I+6]=x,X[I+7]=y,X[I+8]=v,X[I+9]=C,X[I+10]=l.r,X[I+11]=l.g,X[I+12]=l.b,X[I+13]=l.a,X[I+14]=A,X[I+15]=k,X[I+16]=T,X[I+17]=Y,X[I+18]=l.r,X[I+19]=l.g,X[I+20]=l.b,X[I+21]=l.a,X[I+22]=M,X[I+23]=F),I=c.length;let L=E.setArraySize(c,I+3);L[I]=u,L[I+1]=u+1,L[I+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,i,r){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,f=0;o.length=0,n.length=0,a.length=0;for(let d=0;d<i;d+=3){let m=s[d]<<1,u=t[m],p=t[m+1],b=r[m],w=r[m+1];m=s[d+1]<<1;let g=t[m],x=t[m+1],y=r[m],v=r[m+1];m=s[d+2]<<1;let C=t[m],A=t[m+1],k=r[m],T=r[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(u,p,g,x,C,A,h[Y],l)){let F=l.length;if(F==0)continue;let P=x-A,I=C-g,X=u-C,L=A-p,N=1/(P*X+I*(p-A)),D=F>>1,O=this.clipOutput,H=E.setArraySize(o,M+D*2),W=E.setArraySize(n,M+D*2);for(let R=0;R<F;R+=2,M+=2){let U=O[R],G=O[R+1];H[M]=U,H[M+1]=G;let tt=U-C,J=G-A,K=(P*tt+I*J)*N,Q=(L*tt+X*J)*N,rt=1-K-Q;W[M]=b*K+y*Q+k*rt,W[M+1]=w*K+v*Q+T*rt}M=a.length;let j=E.setArraySize(a,M+3*(D-2));D--;for(let R=1;R<D;R++,M+=3)j[M]=f,j[M+1]=f+R,j[M+2]=f+R+1;f+=D+1}else{let F=E.setArraySize(o,M+6);F[M]=u,F[M+1]=p,F[M+2]=g,F[M+3]=x,F[M+4]=C,F[M+5]=A;let P=E.setArraySize(n,M+3*2);P[M]=b,P[M+1]=w,P[M+2]=y,P[M+3]=v,P[M+4]=k,P[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=f,I[M+1]=f+1,I[M+2]=f+2,f+=3;break}}}}clip(t,s,i,r,l,o,n,a){let h=a,c=!1,f;n.length%4>=2?(f=a,a=this.scratch):f=this.scratch,f.length=0,f.push(t),f.push(s),f.push(i),f.push(r),f.push(l),f.push(o),f.push(t),f.push(s),a.length=0;let d=n.length-4,m=n;for(let u=0;;u+=2){let p=m[u],b=m[u+1],w=p-m[u+2],g=b-m[u+3],x=a.length,y=f;for(let C=0,A=f.length-2;C<A;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],F=g*(p-Y)>w*(b-M),P=g*(p-k)-w*(b-T);if(P>0){if(F){a.push(Y),a.push(M);continue}let I=Y-k,X=M-T,L=P/(I*g-X*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+X*L);else{a.push(Y),a.push(M);continue}}else if(F){let I=Y-k,X=M-T,L=P/(I*g-X*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+X*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==d)break;let v=a;a=f,a.length=0,f=v}if(h!=a){h.length=0;for(let u=0,p=a.length-2;u<p;u++)h[u]=a[u]}else h.length=h.length-2;return c}static makeClockwise(t){let s=t,i=t.length,r=s[i-2]*s[1]-s[0]*s[i-1],l=0,o=0,n=0,a=0;for(let h=0,c=i-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],r+=l*a-n*o;if(!(r<0))for(let h=0,c=i-2,f=i>>1;h<f;h+=2){let d=s[h],m=s[h+1],u=c-h;s[h]=s[u],s[h+1]=s[u+1],s[u]=d,s[u+1]=m}}},$s=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Bt,i=typeof e=="string"?JSON.parse(e):e,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=S(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let l=0;l<i.bones.length;l++){let o=i.bones[l],n=null,a=S(o,"parent",null);a&&(n=s.findBone(a));let h=new qe(s.bones.length,o.name,n);h.length=S(o,"length",0)*t,h.x=S(o,"x",0)*t,h.y=S(o,"y",0)*t,h.rotation=S(o,"rotation",0),h.scaleX=S(o,"scaleX",1),h.scaleY=S(o,"scaleY",1),h.shearX=S(o,"shearX",0),h.shearY=S(o,"shearY",0),h.inherit=E.enumValue(Ht,S(o,"inherit","Normal")),h.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&h.color.setFromString(c),s.bones.push(h)}if(i.slots)for(let l=0;l<i.slots.length;l++){let o=i.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new Ze(s.slots.length,n,a),c=S(o,"color",null);c&&h.color.setFromString(c);let f=S(o,"dark",null);f&&(h.darkColor=V.fromString(f)),h.attachmentName=S(o,"attachment",null),h.blendMode=E.enumValue(ts,S(o,"blend","normal")),h.visible=S(o,"visible",!0),s.slots.push(h)}if(i.ik)for(let l=0;l<i.ik.length;l++){let o=i.ik[l],n=new He(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let c=s.findBone(o.bones[h]);if(!c)throw new Error(`Couldn't find bone ${o.bones[h]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=S(o,"mix",1),n.softness=S(o,"softness",0)*t,n.bendDirection=S(o,"bendPositive",!0)?1:-1,n.compress=S(o,"compress",!1),n.stretch=S(o,"stretch",!1),n.uniform=S(o,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let l=0;l<i.transform.length;l++){let o=i.transform[l],n=new es(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=h,n.local=S(o,"local",!1),n.relative=S(o,"relative",!1),n.offsetRotation=S(o,"rotation",0),n.offsetX=S(o,"x",0)*t,n.offsetY=S(o,"y",0)*t,n.offsetScaleX=S(o,"scaleX",0),n.offsetScaleY=S(o,"scaleY",0),n.offsetShearY=S(o,"shearY",0),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),n.mixScaleX=S(o,"mixScaleX",1),n.mixScaleY=S(o,"mixScaleY",n.mixScaleX),n.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let l=0;l<i.path.length;l++){let o=i.path[l],n=new $e(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=h,n.positionMode=E.enumValue(je,S(o,"positionMode","Percent")),n.spacingMode=E.enumValue(Je,S(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Ke,S(o,"rotateMode","Tangent")),n.offsetRotation=S(o,"rotation",0),n.position=S(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=S(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let l=0;l<i.physics.length;l++){const o=i.physics[l],n=new Ws(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);const a=o.bone,h=s.findBone(a);if(h==null)throw new Error("Physics bone not found: "+a);n.bone=h,n.x=S(o,"x",0),n.y=S(o,"y",0),n.rotate=S(o,"rotate",0),n.scaleX=S(o,"scaleX",0),n.shearX=S(o,"shearX",0),n.limit=S(o,"limit",5e3)*t,n.step=1/S(o,"fps",60),n.inertia=S(o,"inertia",1),n.strength=S(o,"strength",100),n.damping=S(o,"damping",1),n.massInverse=1/S(o,"mass",1),n.wind=S(o,"wind",0),n.gravity=S(o,"gravity",0),n.mix=S(o,"mix",1),n.inertiaGlobal=S(o,"inertiaGlobal",!1),n.strengthGlobal=S(o,"strengthGlobal",!1),n.dampingGlobal=S(o,"dampingGlobal",!1),n.massGlobal=S(o,"massGlobal",!1),n.windGlobal=S(o,"windGlobal",!1),n.gravityGlobal=S(o,"gravityGlobal",!1),n.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let l=0;l<i.skins.length;l++){let o=i.skins[l],n=new Et(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let f in c){let d=this.readAttachment(c[f],n,h.index,f,s);d&&n.setAttachment(h.index,f,d)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let l in i.events){let o=i.events[l],n=new Ge(l);n.intValue=S(o,"int",0),n.floatValue=S(o,"float",0),n.stringValue=S(o,"string",""),n.audioPath=S(o,"audio",null),n.audioPath&&(n.volume=S(o,"volume",1),n.balance=S(o,"balance",0)),s.events.push(n)}if(i.animations)for(let l in i.animations){let o=i.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(e,t,s,i,r){let l=this.scale;switch(i=S(e,"name",i),S(e,"type","region")){case"region":{let o=S(e,"path",i),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,i,o,n);if(!a)return null;a.path=o,a.x=S(e,"x",0)*l,a.y=S(e,"y",0)*l,a.scaleX=S(e,"scaleX",1),a.scaleY=S(e,"scaleY",1),a.rotation=S(e,"rotation",0),a.width=e.width*l,a.height=e.height*l,a.sequence=n;let h=S(e,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=S(e,"path",i),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,i,o,n);if(!a)return null;a.path=o;let h=S(e,"color",null);h&&a.color.setFromString(h),a.width=S(e,"width",0)*l,a.height=S(e,"height",0)*l,a.sequence=n;let c=S(e,"parent",null);if(c)return this.linkedMeshes.push(new ei(a,S(e,"skin",null),s,c,S(e,"timelines",!0))),a;let f=e.uvs;return this.readVertices(e,a,f.length),a.triangles=e.triangles,a.regionUVs=f,a.region!=null&&a.updateRegion(),a.edges=S(e,"edges",null),a.hullLength=S(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=S(e,"closed",!1),o.constantSpeed=S(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*l;o.lengths=a;let h=S(e,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=S(e,"x",0)*l,o.y=S(e,"y",0)*l,o.rotation=S(e,"rotation",0);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let n=S(e,"end",null);n&&(o.endSlot=r.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let h=S(e,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(e){if(e==null)return null;let t=new vs(S(e,"count",0));return t.start=S(e,"start",1),t.digits=S(e,"digits",0),t.setupIndex=S(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let n=E.toFloatArray(r);if(i!=1)for(let a=0,h=r.length;a<h;a++)n[a]*=i;t.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let h=r[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(r[n]),l.push(r[n+1]*i),l.push(r[n+2]*i),l.push(r[n+3])}t.bones=o,t.vertices=E.toFloatArray(l)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let h=a.index;for(let c in n){let f=n[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new xt(d,h);for(let u=0;u<d;u++){let p=f[u];m.setFrame(u,S(p,"time",0),S(p,"name",null))}r.push(m)}else if(c=="rgba"){let m=new pe(d,d<<2,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=f[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=V.fromString(x.color),C=u.curve;C&&(g=z(C,m,g,w,0,p,y,b.r,v.r,1),g=z(C,m,g,w,1,p,y,b.g,v.g,1),g=z(C,m,g,w,2,p,y,b.b,v.b,1),g=z(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,u=x}r.push(m)}else if(c=="rgb"){let m=new xe(d,d*3,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=f[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=V.fromString(x.color),C=u.curve;C&&(g=z(C,m,g,w,0,p,y,b.r,v.r,1),g=z(C,m,g,w,1,p,y,b.g,v.g,1),g=z(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,u=x}r.push(m)}else if(c=="alpha")r.push(at(f,new be(d,d,h),0,1));else if(c=="rgba2"){let m=new we(d,d*7,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.light),w=V.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=V.fromString(y.light),A=V.fromString(y.dark),k=u.curve;k&&(x=z(k,m,x,g,0,p,v,b.r,C.r,1),x=z(k,m,x,g,1,p,v,b.g,C.g,1),x=z(k,m,x,g,2,p,v,b.b,C.b,1),x=z(k,m,x,g,3,p,v,b.a,C.a,1),x=z(k,m,x,g,4,p,v,w.r,A.r,1),x=z(k,m,x,g,5,p,v,w.g,A.g,1),x=z(k,m,x,g,6,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}else if(c=="rgb2"){let m=new ye(d,d*6,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.light),w=V.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,w.r,w.g,w.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=V.fromString(y.light),A=V.fromString(y.dark),k=u.curve;k&&(x=z(k,m,x,g,0,p,v,b.r,C.r,1),x=z(k,m,x,g,1,p,v,b.g,C.g,1),x=z(k,m,x,g,2,p,v,b.b,C.b,1),x=z(k,m,x,g,3,p,v,w.r,A.r,1),x=z(k,m,x,g,4,p,v,w.g,A.g,1),x=z(k,m,x,g,5,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let h=a.index;for(let c in n){let f=n[c],d=f.length;if(d!=0){if(c==="rotate")r.push(at(f,new Ft(d,d,h),0,1));else if(c==="translate"){let m=new ae(d,d<<1,h);r.push(is(f,m,"x","y",0,i))}else if(c==="translatex"){let m=new oe(d,d,h);r.push(at(f,m,0,i))}else if(c==="translatey"){let m=new le(d,d,h);r.push(at(f,m,0,i))}else if(c==="scale"){let m=new he(d,d<<1,h);r.push(is(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new ce(d,d,h);r.push(at(f,m,1,1))}else if(c==="scaley"){let m=new de(d,d,h);r.push(at(f,m,1,1))}else if(c==="shear"){let m=new fe(d,d<<1,h);r.push(is(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new ue(d,d,h);r.push(at(f,m,0,1))}else if(c==="sheary"){let m=new me(d,d,h);r.push(at(f,m,0,1))}else if(c==="inherit"){let m=new ge(d,a.index);for(let u=0;u<f.length;u++){let p=f[u];m.setFrame(u,S(p,"time",0),E.enumValue(Ht,S(p,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let h=s.findIkConstraint(o);if(!h)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(h),f=new Ce(n.length,n.length<<1,c),d=S(a,"time",0),m=S(a,"mix",1),u=S(a,"softness",0)*i;for(let p=0,b=0;;p++){f.setFrame(p,d,m,u,S(a,"bendPositive",!0)?1:-1,S(a,"compress",!1),S(a,"stretch",!1));let w=n[p+1];if(!w){f.shrink(b);break}let g=S(w,"time",0),x=S(w,"mix",1),y=S(w,"softness",0)*i,v=a.curve;v&&(b=z(v,f,b,p,0,d,g,m,x,1),b=z(v,f,b,p,1,d,g,u,y,i)),d=g,m=x,u=y,a=w}r.push(f)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let h=s.findTransformConstraint(o);if(!h)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(h),f=new Ae(n.length,n.length*6,c),d=S(a,"time",0),m=S(a,"mixRotate",1),u=S(a,"mixX",1),p=S(a,"mixY",u),b=S(a,"mixScaleX",1),w=S(a,"mixScaleY",b),g=S(a,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,p,b,w,g);let v=n[x+1];if(!v){f.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=S(v,"mixScaleX",1),M=S(v,"mixScaleY",Y),F=S(v,"mixShearY",1),P=a.curve;P&&(y=z(P,f,y,x,0,d,C,m,A,1),y=z(P,f,y,x,1,d,C,u,k,1),y=z(P,f,y,x,2,d,C,p,T,1),y=z(P,f,y,x,3,d,C,b,Y,1),y=z(P,f,y,x,4,d,C,w,M,1),y=z(P,f,y,x,5,d,C,g,F,1)),d=C,m=A,u=k,p=T,b=Y,w=M,b=Y,a=v}r.push(f)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let h=s.pathConstraints.indexOf(a);for(let c in n){let f=n[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new Se(m,m,h);r.push(at(f,u,0,a.positionMode==0?i:1))}else if(c==="spacing"){let u=new ke(m,m,h);r.push(at(f,u,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let u=new Te(m,m*3,h),p=S(d,"time",0),b=S(d,"mixRotate",1),w=S(d,"mixX",1),g=S(d,"mixY",w);for(let x=0,y=0;;x++){u.setFrame(x,p,b,w,g);let v=f[x+1];if(!v){u.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=d.curve;Y&&(y=z(Y,u,y,x,0,p,C,b,A,1),y=z(Y,u,y,x,1,p,C,w,k,1),y=z(Y,u,y,x,2,p,C,g,T,1)),p=C,b=A,w=k,g=T,d=v}r.push(u)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let h=s.findPhysicsConstraint(o);if(!h)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(h)}for(let h in n){let c=n[h],f=c[0];if(!f)continue;let d=c.length;if(h=="reset"){const u=new Ee(d,a);for(let p=0;f!=null;f=c[p+1],p++)u.setFrame(p,S(f,"time",0));r.push(u);continue}let m;if(h=="inertia")m=new Ie(d,d,a);else if(h=="strength")m=new Me(d,d,a);else if(h=="damping")m=new Ye(d,d,a);else if(h=="mass")m=new Xe(d,d,a);else if(h=="wind")m=new Fe(d,d,a);else if(h=="gravity")m=new Pe(d,d,a);else if(h=="mix")m=new Be(d,d,a);else continue;r.push(at(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],f=s.findSlot(h);if(!f)throw new Error("Slot not found: "+h);let d=f.index;for(let m in c){let u=c[m],p=a.getAttachment(d,m);for(let b in u){let w=u[b],g=w[0];if(g){if(b=="deform"){let x=p.bones,y=p.vertices,v=x?y.length/3*2:y.length,C=new ve(w.length,w.length,d,p),A=S(g,"time",0);for(let k=0,T=0;;k++){let Y,M=S(g,"vertices",null);if(!M)Y=x?E.newFloatArray(v):y;else{Y=E.newFloatArray(v);let X=S(g,"offset",0);if(E.arrayCopy(M,0,Y,X,M.length),i!=1)for(let L=X,N=L+M.length;L<N;L++)Y[L]*=i;if(!x)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(k,A,Y);let F=w[k+1];if(!F){C.shrink(T);break}let P=S(F,"time",0),I=g.curve;I&&(T=z(I,C,T,k,0,A,P,0,1,1)),A=P,g=F}r.push(C)}else if(b=="sequence"){let x=new Re(w.length,d,p),y=0;for(let v=0;v<w.length;v++){let C=S(g,"delay",y),A=S(g,"time",0),k=Cs[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,A,k,T,C),y=C,g=w[v+1]}r.push(x)}}}}}}if(e.drawOrder){let o=new At(e.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<e.drawOrder.length;h++,a++){let c=e.drawOrder[h],f=null,d=S(c,"offsets",null);if(d){f=E.newArray(n,-1);let m=E.newArray(n-d.length,0),u=0,p=0;for(let b=0;b<d.length;b++){let w=d[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[p++]=u++;f[u+w.offset]=u++}for(;u<n;)m[p++]=u++;for(let b=n-1;b>=0;b--)f[b]==-1&&(f[b]=m[--p])}o.setFrame(a,S(c,"time",0),f)}r.push(o)}if(e.events){let o=new Ut(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let h=e.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let f=new ze(E.toSinglePrecision(S(h,"time",0)),c);f.intValue=S(h,"int",c.intValue),f.floatValue=S(h,"float",c.floatValue),f.stringValue=S(h,"string",c.stringValue),f.data.audioPath&&(f.volume=S(h,"volume",1),f.balance=S(h,"balance",0)),o.setFrame(n,f)}r.push(o)}let l=0;for(let o=0,n=r.length;o<n;o++)l=Math.max(l,r[o].getDuration());s.animations.push(new Ot(t,r,l))}},ei=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function at(e,t,s,i){let r=e[0],l=S(r,"time",0),o=S(r,"value",s)*i,n=0;for(let a=0;;a++){t.setFrame(a,l,o);let h=e[a+1];if(!h)return t.shrink(n),t;let c=S(h,"time",0),f=S(h,"value",s)*i;r.curve&&(n=z(r.curve,t,n,a,0,l,c,o,f,i)),l=c,o=f,r=h}}function is(e,t,s,i,r,l){let o=e[0],n=S(o,"time",0),a=S(o,s,r)*l,h=S(o,i,r)*l,c=0;for(let f=0;;f++){t.setFrame(f,n,a,h);let d=e[f+1];if(!d)return t.shrink(c),t;let m=S(d,"time",0),u=S(d,s,r)*l,p=S(d,i,r)*l,b=o.curve;b&&(c=z(b,t,c,f,0,n,m,a,u,l),c=z(b,t,c,f,1,n,m,h,p,l)),n=m,a=u,h=p,o=d}}function z(e,t,s,i,r,l,o,n,a,h){if(e=="stepped")return t.setStepped(i),s;let c=r<<2,f=e[c],d=e[c+1]*h,m=e[c+2],u=e[c+3]*h;return t.setBezier(s,i,r,l,n,f,d,m,u,o,a),s+1}function S(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));import{checkExtension as ns,copySearchParams as si,DOMAdapter as ri,ExtensionType as js,extensions as ii,LoaderParserPriority as ni,path as jt,Resolver as ai,TextureSource as Js}from"pixi.js";import{Texture as oi}from"pixi.js";var as=class ut extends _e{static textureMap=new Map;static from(t){return ut.textureMap.has(t)?ut.textureMap.get(t):new ut(t)}texture;constructor(t){super(t.resource),this.texture=oi.from(t)}setFilters(t,s){const i=this.texture.source.style;i.minFilter=ut.toPixiTextureFilter(t),i.magFilter=ut.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=ut.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,s){const i=this.texture.source.style;i.addressModeU=ut.toPixiTextureWrap(t),i.addressModeV=ut.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Rt="spineTextureAtlasLoader",li={extension:js.Asset,resolver:{test:e=>ns(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(ai.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{id:Rt,name:Rt,extension:{type:js.LoadParser,priority:ni.Normal,name:Rt},test(e){return ns(e,".atlas")},async load(e){return await(await ri.get().fetch(e)).text()},testParse(e,t){const s=ns(t.src,".atlas"),i=typeof e=="string",r=t.parser===Rt||t.loadParser===Rt;return Promise.resolve((s||r)&&i)},unload(e){e.dispose()},async parse(e,t,s){const i=t.data||{};let r=jt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const l=new Gt(e);if(i.images instanceof Js||typeof i.images=="string"){const n=i.images;i.images={},i.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=i?.images?i.images[a]:void 0;if(h instanceof Js)n.setTexture(as.from(h));else{const c=h??jt.normalize([...r.split(jt.sep),a].join(jt.sep)),f={src:si(c,t.src),data:{...i.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=s.load(f).then(m=>{n.setTexture(as.from(m.source))});o.push(d)}}return await Promise.all(o),l}}};ii.add(li);import{checkExtension as os,DOMAdapter as hi,ExtensionType as Ks,extensions as ci,LoaderParserPriority as di}from"pixi.js";var Lt="spineSkeletonLoader";function fi(e){return Object.prototype.hasOwnProperty.call(e,"bones")}function ui(e){return e instanceof Uint8Array}var mi={extension:Ks.Asset,loader:{id:Lt,name:Lt,extension:{type:Ks.LoadParser,priority:di.Normal,name:Lt},test(e){return os(e,".skel")},async load(e){const t=await hi.get().fetch(e);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=os(t.src,".json")&&fi(e),i=os(t.src,".skel")&&ui(e),r=t.parser===Lt||t.loadParser===Lt;return Promise.resolve(s||i||r)}}};ci.add(mi);import{Batcher as gi,Color as pi,extensions as xi,ExtensionType as bi}from"pixi.js";import{Buffer as Qs,BufferUsage as Jt,Geometry as wi}from"pixi.js";var yi=new Float32Array(1),vi=new Uint32Array(1),Ci=class extends wi{constructor(){const t=new Qs({data:yi,label:"attribute-batch-buffer",usage:Jt.VERTEX|Jt.COPY_DST,shrinkToFit:!1}),s=new Qs({data:vi,label:"index-batch-buffer",usage:Jt.INDEX|Jt.COPY_DST,shrinkToFit:!1}),i=7*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:4*4},aDarkColor:{buffer:t,format:"unorm8x4",stride:i,offset:5*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:6*4}},indexBuffer:s})}};import{colorBit as Ai,colorBitGl as Si,compileHighShaderGlProgram as ki,compileHighShaderGpuProgram as Ti,generateTextureBatchBit as Ii,generateTextureBatchBitGl as Mi,getBatchSamplersUniformGroup as Yi,roundPixelsBit as Xi,roundPixelsBitGl as Fi,Shader as Pi}from"pixi.js";var Bi={name:"color-bit",vertex:{header:`
1
+ "use strict";if(typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}var ur=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},ie=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},V=class wt{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new wt(1,1,1,1);static RED=new wt(1,0,0,1);static GREEN=new wt(0,1,0,1);static BLUE=new wt(0,0,1,1);static MAGENTA=new wt(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,r){return this.r+=t,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new wt){return s.setFromString(t)}},B=class lt{static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*lt.degRad)}static sinDeg(t){return Math.sin(t*lt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*lt.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return lt.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),l=s-t;return r<=(i-t)/l?t+Math.sqrt(r*l*(i-t)):s-Math.sqrt((1-r)*l*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ws=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ys=class extends ws{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},mr=class extends ys{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},E=class It{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,r,l){for(let o=s,n=r;o<s+l;o++,n++)i[n]=t[o]}static arrayFill(t,s,i,r){for(let l=s;l<i;l++)t[l]=r}static setArraySize(t,s,i=0){let r=t.length;if(r==s)return t;if(t.length=s,r<s)for(let l=r;l<s;l++)t[l]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:It.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r<t;r++)i[r]=s;return i}static newFloatArray(t){if(It.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(It.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return It.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return It.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,i=!0){for(var r=0;r<t.length;r++)if(t[r]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},gr=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Ct=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Xt=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},pr=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},xr=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},ne=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ht=class rr extends ne{static nextID=0;id=rr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,i,r,l,o){i=l+(i>>1)*o;let n=t.bone.skeleton,a=t.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let u=t.bone,p=u.worldX,b=u.worldY,w=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,C=l;C<i;v+=2,C+=o){let A=h[v],k=h[v+1];r[C]=A*w+k*g+p,r[C+1]=A*x+k*y+b}return}let f=0,d=0;for(let u=0;u<s;u+=2){let p=c[f];f+=p+1,d+=p}let m=n.bones;if(a.length==0)for(let u=l,p=d*3;u<i;u+=o){let b=0,w=0,g=c[f++];for(g+=f;f<g;f++,p+=3){let x=m[c[f]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}r[u]=b,r[u+1]=w}else{let u=a;for(let p=l,b=d*3,w=d<<1;p<i;p+=o){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,b+=3,w+=2){let v=m[c[f]],C=h[b]+u[w],A=h[b+1]+u[w+1],k=h[b+2];g+=(C*v.a+A*v.b+v.worldX)*k,x+=(C*v.c+A*v.d+v.worldY)*k}r[p]=g,r[p+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},vs=class Zt{static _nextID=0;id=Zt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Zt(this.regions.length);return E.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(t,s){let i=t,r=(this.start+s).toString();for(let l=this.digits-r.length;l>0;l--)i+="0";return i+=r,i}static nextID(){return Zt._nextID++}},Cs=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(Cs||{}),As=[0,1,2,3,4,5,6],Ot=class{name;timelines=[];timelineIds=new ie;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,r,l,o,n){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(e,t,s,r,l,o,n)}},Ss=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Ss||{}),ks=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ks||{}),_={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},$=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=E.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}},it=class extends ${curves;constructor(e,t,s){super(e,s),this.curves=E.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=E.newFloatArray(t);E.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,r,l,o,n,a,h,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(i-l*2+n)*.03,u=(r-o*2+a)*.03,p=((l-n)*3-i+h)*.006,b=((o-a)*3-r+c)*.006,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=(o-r)*.3+u+b*.16666667,v=i+x,C=r+y;for(let A=d+18;d<A;d+=2)f[d]=v,f[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(e,t,s,i){let r=this.curves;if(r[i]>e){let a=this.frames[t],h=this.frames[t+s];return h+(e-a)/(r[i]-a)*(r[i+1]-h)}let l=i+18;for(i+=2;i<l;i+=2)if(r[i]>=e){let a=r[i-2],h=r[i-1];return h+(e-a)/(r[i]-a)*(r[i+1]-h)}t+=this.getFrameEntries();let o=r[l-2],n=r[l-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},st=class extends it{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],l=t[s+1];return l+(e-r)/(t[s+2]-r)*(t[s+2+1]-l);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let l=this.getCurveValue(e);switch(s){case 0:return r+l*t;case 1:case 2:l+=r-i}return i+l*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let l=this.getCurveValue(e);return s==0?r+(l-r)*t:i+(l-i)*t}getAbsoluteValue2(e,t,s,i,r,l){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}return s==0?r+(l-r)*t:i+(l-i)*t}getScaleValue(e,t,s,i,r,l){const o=this.frames;if(e<o[0]){switch(s){case 0:return l;case 1:return r+(l-r)*t}return r}let n=this.getCurveValue(e)*l;if(t==1)return s==3?r+n-l:n;if(i==1)switch(s){case 0:return l+(Math.abs(n)*B.signum(l)-l)*t;case 1:case 2:return r+(Math.abs(n)*B.signum(r)-r)*t}else{let a=0;switch(s){case 0:return a=Math.abs(l)*B.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(r)*B.signum(n),a+(n-a)*t}}return r+(n-l)*t}},_t=class extends it{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Ft=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,l,n.rotation,n.data.rotation))}},ae=class extends _t{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let h=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);h+=(a[f+3+1]-h)*u,c+=(a[f+3+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(l){case 0:n.x=n.data.x+h*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+h-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=h*r,n.y+=c*r}}},oe=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,l,n.x,n.data.x))}},le=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,l,n.y,n.data.y))}},he=class extends _t{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let h,c,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);h+=(a[f+3+1]-h)*u,c+=(a[f+3+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,r==1)l==3?(n.scaleX+=h-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=h,n.scaleY=c);else{let m=0,u=0;if(o==1)switch(l){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case 3:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(l){case 0:m=Math.abs(n.data.scaleX)*B.signum(h),u=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*B.signum(h),u=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case 3:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},ce=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,l,o,n.scaleX,n.data.scaleX))}},de=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,l,o,n.scaleY,n.data.scaleY))}},fe=class extends _t{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let h=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);h+=(a[f+3+1]-h)*u,c+=(a[f+3+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(l){case 0:n.shearX=n.data.shearX+h*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+h-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=h*r,n.shearY+=c*r}}},ue=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,l,n.shearX,n.data.shearX))}},me=class extends st{boneIndex=0;constructor(e,t,s){super(e,t,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,l,n.shearY,n.data.shearY))}},ge=class extends ${boneIndex=0;constructor(e,t){super(e,[_.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,r,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){l==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==0||l==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[$.search(a,s,2)+1]}},pe=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,r,l){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let b=n.data.color;switch(l){case 0:h.setFromColor(b);return;case 1:h.add((b.r-h.r)*r,(b.g-h.g)*r,(b.b-h.b)*r,(b.a-h.a)*r)}return}let c=0,f=0,d=0,m=0,u=$.search(a,s,5),p=this.curves[u/5];switch(p){case 0:let b=a[u];c=a[u+1],f=a[u+2],d=a[u+3],m=a[u+4];let w=(s-b)/(a[u+5]-b);c+=(a[u+5+1]-c)*w,f+=(a[u+5+2]-f)*w,d+=(a[u+5+3]-d)*w,m+=(a[u+5+4]-m)*w;break;case 1:c=a[u+1],f=a[u+2],d=a[u+3],m=a[u+4];break;default:c=this.getBezierValue(s,u,1,p-2),f=this.getBezierValue(s,u,2,p+18-2),d=this.getBezierValue(s,u,3,p+18*2-2),m=this.getBezierValue(s,u,4,p+18*3-2)}r==1?h.set(c,f,d,m):(l==0&&h.setFromColor(n.data.color),h.add((c-h.r)*r,(f-h.g)*r,(d-h.b)*r,(m-h.a)*r))}},xe=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let p=n.data.color;switch(l){case 0:h.r=p.r,h.g=p.g,h.b=p.b;return;case 1:h.r+=(p.r-h.r)*r,h.g+=(p.g-h.g)*r,h.b+=(p.b-h.b)*r}return}let c=0,f=0,d=0,m=$.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let p=a[m];c=a[m+1],f=a[m+2],d=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,f+=(a[m+4+2]-f)*b,d+=(a[m+4+3]-d)*b;break;case 1:c=a[m+1],f=a[m+2],d=a[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(r==1)h.r=c,h.g=f,h.b=d;else{if(l==0){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*r,h.g+=(f-h.g)*r,h.b+=(d-h.b)*r}}},be=class extends st{slotIndex=0;constructor(e,t,s){super(e,t,_.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(l){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let h=this.getCurveValue(s);r==1?a.a=h:(l==0&&(a.a=n.data.color.a),a.a+=(h-a.a)*r)}},we=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,r,l,o,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.add((y.r-h.r)*r,(y.g-h.g)*r,(y.b-h.b)*r,(y.a-h.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let f=0,d=0,m=0,u=0,p=0,b=0,w=0,g=$.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];let v=(s-y)/(a[g+8]-y);f+=(a[g+8+1]-f)*v,d+=(a[g+8+2]-d)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,p+=(a[g+8+5]-p)*v,b+=(a[g+8+6]-b)*v,w+=(a[g+8+7]-w)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[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),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),w=this.getBezierValue(s,g,7,x+18*6-2)}if(r==1)h.set(f,d,m,u),c.r=p,c.g=b,c.b=w;else{if(l==0){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((f-h.r)*r,(d-h.g)*r,(m-h.b)*r,(u-h.a)*r),c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},ye=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,l,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.r+=(y.r-h.r)*r,h.g+=(y.g-h.g)*r,h.b+=(y.b-h.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let f=0,d=0,m=0,u=0,p=0,b=0,w=0,g=$.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];let v=(s-y)/(a[g+7]-y);f+=(a[g+7+1]-f)*v,d+=(a[g+7+2]-d)*v,m+=(a[g+7+3]-m)*v,p+=(a[g+7+4]-p)*v,b+=(a[g+7+5]-b)*v,w+=(a[g+7+6]-w)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[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),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)h.r=f,h.g=d,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==0){let y=n.data.color,v=n.data.darkColor;h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}h.r+=(f-h.r)*r,h.g+=(d-h.g)*r,h.b+=(m-h.b)*r,c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},xt=class extends ${slotIndex=0;attachmentNames;constructor(e,t){super(e,[_.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){l==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==0||l==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[$.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ve=class extends it{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,r,l,o,n,a,h,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(i-l*2+n)*.03,u=a*.03-o*.06,p=((l-n)*3-i+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=o*.3+u+b*.16666667,v=i+x,C=y;for(let A=d+18;d<A;d+=2)f[d]=v,f[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>e){let n=this.frames[t];return s[i+1]*(e-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=e){let n=s[i-2],a=s[i-1];return a+(e-n)/(s[i]-n)*(s[i+1]-a)}let l=s[r-2],o=s[r-1];return o+(1-o)*(e-l)/(this.frames[t+this.getFrameEntries()]-l)}apply(e,t,s,i,r,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof ht)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(l){case 0:h.length=0;return;case 1:if(r==1){h.length=0;return}h.length=f;let g=a;if(g.bones){r=1-r;for(var m=0;m<f;m++)h[m]*=r}else{let x=g.vertices;for(var m=0;m<f;m++)h[m]+=(x[m]-h[m])*r}}return}if(h.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(r==1)if(l==3){let x=a;if(x.bones)for(let y=0;y<f;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,f);else switch(l){case 0:{let y=a;if(y.bones)for(let v=0;v<f;v++)h[v]=g[v]*r;else{let v=y.vertices;for(let C=0;C<f;C++){let A=v[C];h[C]=A+(g[C]-A)*r}}break}case 1:case 2:for(let y=0;y<f;y++)h[y]+=(g[y]-h[y])*r;break;case 3:let x=a;if(x.bones)for(let y=0;y<f;y++)h[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<f;v++)h[v]+=(g[v]-y[v])*r}}return}let u=$.search1(d,s),p=this.getCurvePercent(s,u),b=c[u],w=c[u+1];if(r==1)if(l==3){let g=a;if(g.bones)for(let x=0;x<f;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<f;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case 0:{let x=a;if(x.bones)for(let y=0;y<f;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*r}else{let y=x.vertices;for(let v=0;v<f;v++){let C=b[v],A=y[v];h[v]=A+(C+(w[v]-C)*p-A)*r}}break}case 1:case 2:for(let x=0;x<f;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*r}break;case 3:let g=a;if(g.bones)for(let x=0;x<f;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*r}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*r}}}}},Ut=class ir extends ${static propertyIds=[""+_.event];events;constructor(t){super(t,ir.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,r,l,o,n){if(!r)return;let a=this.frames,h=this.frames.length;if(s>i)this.apply(t,s,Number.MAX_VALUE,r,l,o,n),s=-1;else if(s>=a[h-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=$.search1(a,s)+1;let f=a[c];for(;c>0&&a[c-1]==f;)c--}for(;c<h&&i>=a[c];c++)r.push(this.events[c])}},At=class nr extends ${static propertyIds=[""+_.drawOrder];drawOrders;constructor(t){super(t,nr.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,l,o,n){if(n==1){o==0&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(o==0||o==1)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=$.search1(this.frames,i),h=this.drawOrders[a];if(!h)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,f=t.slots;for(let d=0,m=h.length;d<m;d++)c[d]=f[h[d]]}}},Ce=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,r,l,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=l?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,r,l,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,f=$.search(a,s,6),d=this.curves[f/6];switch(d){case 0:let m=a[f];h=a[f+1],c=a[f+2];let u=(s-m)/(a[f+6]-m);h+=(a[f+6+1]-h)*u,c+=(a[f+6+2]-c)*u;break;case 1:h=a[f+1],c=a[f+2];break;default:h=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}l==0?(n.mix=n.data.mix+(h-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0)):(n.mix+=(h-n.mix)*r,n.softness+=(c-n.softness)*r,o==0&&(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0))}},Ae=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,l,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=i,a[e+3]=r,a[e+4]=l,a[e+5]=o,a[e+6]=n}apply(e,t,s,i,r,l,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case 0:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case 1:n.mixRotate+=(w.mixRotate-n.mixRotate)*r,n.mixX+=(w.mixX-n.mixX)*r,n.mixY+=(w.mixY-n.mixY)*r,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(w.mixShearY-n.mixShearY)*r}return}let h,c,f,d,m,u,p=$.search(a,s,7),b=this.curves[p/7];switch(b){case 0:let w=a[p];h=a[p+1],c=a[p+2],f=a[p+3],d=a[p+4],m=a[p+5],u=a[p+6];let g=(s-w)/(a[p+7]-w);h+=(a[p+7+1]-h)*g,c+=(a[p+7+2]-c)*g,f+=(a[p+7+3]-f)*g,d+=(a[p+7+4]-d)*g,m+=(a[p+7+5]-m)*g,u+=(a[p+7+6]-u)*g;break;case 1:h=a[p+1],c=a[p+2],f=a[p+3],d=a[p+4],m=a[p+5],u=a[p+6];break;default:h=this.getBezierValue(s,p,1,b-2),c=this.getBezierValue(s,p,2,b+18-2),f=this.getBezierValue(s,p,3,b+18*2-2),d=this.getBezierValue(s,p,4,b+18*3-2),m=this.getBezierValue(s,p,5,b+18*4-2),u=this.getBezierValue(s,p,6,b+18*5-2)}if(l==0){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*r,n.mixX=w.mixX+(c-w.mixX)*r,n.mixY=w.mixY+(f-w.mixY)*r,n.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*r,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*r,n.mixShearY=w.mixShearY+(u-w.mixShearY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(f-n.mixY)*r,n.mixScaleX+=(d-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(u-n.mixShearY)*r}},Se=class extends st{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,l,n.position,n.data.position))}},ke=class extends st{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,l,n.spacing,n.data.spacing))}},Te=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){let l=this.frames;e<<=2,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=r}apply(e,t,s,i,r,l,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let h,c,f,d=$.search(a,s,4),m=this.curves[d>>2];switch(m){case 0:let u=a[d];h=a[d+1],c=a[d+2],f=a[d+3];let p=(s-u)/(a[d+4]-u);h+=(a[d+4+1]-h)*p,c+=(a[d+4+2]-c)*p,f+=(a[d+4+3]-f)*p;break;case 1:h=a[d+1],c=a[d+2],f=a[d+3];break;default:h=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(l==0){let u=n.data;n.mixRotate=u.mixRotate+(h-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(f-u.mixY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(f-n.mixY)*r}},mt=class extends st{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of e.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,r,l,this.get(h),this.setup(h),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,l,this.get(n),this.setup(n)))}},Ie=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Me=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ye=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Xe=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Fe=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Pe=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Be=class extends mt{constructor(e,t,s){super(e,t,s,_.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ee=class ar extends ${static propertyIds=[_.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,ar.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,l,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(i<h[0])&&(s<h[0]||i>=h[$.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},Re=class gt extends ${static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[_.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return gt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,l){let o=this.frames;t*=gt.ENTRIES,o[t]=s,o[t+gt.MODE]=i|r<<4,o[t+gt.DELAY]=l}apply(t,s,i,r,l,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof ht)||h.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let f=this.frames;if(i<f[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let d=$.search(f,i,gt.ENTRIES),m=f[d],u=f[d+gt.MODE],p=f[d+gt.DELAY];if(!this.attachment.sequence)return;let b=u>>4,w=this.attachment.sequence.regions.length,g=As[u&15];if(g!=0)switch(b+=(i-m)/p+1e-5|0,g){case 1:b=Math.min(w-1,b);break;case 2:b%=w;break;case 3:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case 4:b=Math.max(w-1-b,0);break;case 5:b=w-1-b%w;break;case 6:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},De=class te{static _emptyAnimation=new Ot("<empty>",[],0);static emptyAnimation(){return te._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Is(this);propertyIDs=new ie;animationsChanged=!1;trackEntryPool=new Ct(()=>new Ts);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=t*l.timeScale;if(l.delay>0){if(l.delay-=o,l.delay>0)continue;o=-l.delay,l.delay=0}let n=l.next;if(n){let a=l.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=l.timeScale==0?0:(a/l.timeScale+t)*n.timeScale,l.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[i]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,t)){let a=l.mixingFrom;for(l.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}l.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let d=0,m=i.length;d<m;d++){let u=i[d];if(!u||u.delay>0)continue;r=!0;let p=d==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,t,p):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let w=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let C=u.animation.timelines,A=C.length;if(d==0&&b==1||p==3){d==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof xt?this.applyAttachmentTimeline(l,t,y,p,w):l.apply(t,g,y,v,b,p,0)}}else{let k=u.timelineMode,T=u.shortestRotation,Y=!T&&u.timelinesRotation.length!=A<<1;Y&&(u.timelinesRotation.length=A<<1);for(let M=0;M<A;M++){let F=C[M],P=k[M]==qt?p:0;!T&&F instanceof Ft?this.applyRotateTimeline(F,t,y,b,P,u.timelinesRotation,M<<1,Y):F instanceof xt?this.applyAttachmentTimeline(F,t,y,p,w):(E.webkit602BugfixHelper(b,p),F.apply(t,g,y,v,b,P,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Ne,n=t.slots,a=0,h=t.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var f=c.data.attachmentName;c.setAttachment(f?t.getAttachment(c.data.index,f):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,s,i){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let l=0;t.mixDuration==0?(l=1,i==1&&(i=0)):(l=t.mixTime/t.mixDuration,l>1&&(l=1),i!=1&&(i=r.mixBlend));let o=l<r.mixAttachmentThreshold,n=l<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,c=r.alpha*t.interruptAlpha,f=c*(1-l),d=r.animationLast,m=r.getAnimationTime(),u=m,p=null;if(r.reverse?u=r.animation.duration-u:l<r.eventThreshold&&(p=this.events),i==3)for(let b=0;b<h;b++)a[b].apply(s,d,u,p,f,i,1);else{let b=r.timelineMode,w=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=1,A,k=0;switch(b[y]){case qt:if(!n&&v instanceof At)continue;A=i,k=f;break;case Le:A=0,k=f;break;case Ve:A=i,k=c;break;case Wt:A=0,k=c;break;default:A=0;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=k,!g&&v instanceof Ft?this.applyRotateTimeline(v,s,u,k,A,r.timelinesRotation,y<<1,x):v instanceof xt?this.applyAttachmentTimeline(v,s,u,A,o&&k>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,i),n&&v instanceof At&&A==0&&(C=0),v.apply(s,d,u,p,k,A,C))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,l}applyAttachmentTimeline(t,s,i,r,l){var o=s.slots[t.slotIndex];o.bone.active&&(i<t.frames[0]?(r==0||r==1)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,t.attachmentNames[$.search1(t.frames,i)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Ne))}setAttachment(t,s,i,r){s.setAttachment(i?t.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Xs)}applyRotateTimeline(t,s,i,r,l,o,n,a){if(a&&(o[n]=0),r==1){t.apply(s,0,i,null,1,l,0);return}let h=s.bones[t.boneIndex];if(!h.active)return;let c=t.frames,f=0,d=0;if(i<c[0])switch(l){case 0:h.rotation=h.data.rotation;default:return;case 1:f=h.rotation,d=h.data.rotation}else f=l==0?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(i);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let p=0,b=0;a?(p=0,b=u):(p=o[n],b=o[n+1]);let w=p-p%360;m=u+w;let g=u>=0,x=p>=0;Math.abs(b)<=90&&B.signum(b)!=B.signum(u)&&(Math.abs(p-w)>180?(m+=360*B.signum(p),x=g):w!=0?m-=360*B.signum(p):x=g),x!=g&&(m+=360*B.signum(p)),o[n]=m}o[n+1]=u,h.rotation=f+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,l=r-i,o=t.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let f=n[a];if(f.time<o)break;f.time>r||this.queue.event(t,f)}let c=!1;if(t.loop)if(l==0)c=!0;else{const f=Math.floor(t.trackTime/l);c=f>0&&f>Math.floor(t.trackLast/l)}else c=s>=r&&t.animationLast<r;for(c&&this.queue.complete(t);a<h;a++){let f=n[a];f.time<i||this.queue.event(t,f)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,l=this.expandToIndex(t);l&&(l.nextTrackLast==-1?(this.tracks[t]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,r=!1):this.clearNext(l));let o=this.trackEntry(t,s,i,l);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,s,i=!1,r=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,l,i,r)}addAnimationWith(t,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(t);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(t,s,i,l);return l?(l.next=o,o.previous=l,r<=0&&(r=Math.max(r+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,te.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,te.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let l=this.tracks[i];l&&this.setEmptyAnimation(l.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,r){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=t,l.animation=s,l.loop=i,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=r?this.data.getMix(r.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=2,l}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let s=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,l=t.timelineMode;l.length=r;let o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)l[a]=n.addAll(i[a].getPropertyIds())?Wt:Ve;return}t:for(let a=0;a<r;a++){let h=i[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=qt;else if(!s||h instanceof xt||h instanceof At||h instanceof Ut||!s.animation.hasTimeline(c))l[a]=Le;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(t.mixDuration>0){l[a]=Ys,o[a]=f;continue t}break}l[a]=Wt}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ts=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Is=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],r=e[s+1];switch(i){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++){let n=t[o];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case 4:r.listener&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(r)}break;case 5:let l=e[s+++2];r.listener&&r.listener.event&&r.listener.event(r,l);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(r,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Ms=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Ms||{}),br=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},qt=0,Le=1,Ve=2,Wt=3,Ys=4,Ne=1,Xs=2,Fs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Oe=class or extends ht{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new or(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},bt=class lr extends ht{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new lr(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},_e=class{_image;constructor(e){this._image=e}getImage(){return this._image}},zt=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(zt||{}),Ps=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Ps||{}),Bs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},wr=class extends _e{setFilters(e,t){}setWraps(e,t){}dispose(){}},Gt=class{pages=new Array;regions=new Array;constructor(e){let t=new yr(e),s=new Array(4),i={};i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.format=()=>{},i.filter=h=>{h.minFilter=E.enumValue(zt,s[1]),h.magFilter=E.enumValue(zt,s[2])},i.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=10497),s[1].indexOf("y")!=-1&&(h.vWrap=10497)},i.pma=h=>{h.pma=s[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},r.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},r.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},r.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},r.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},r.index=h=>{h.index=parseInt(s[1])};let l=t.readLine();for(;l&&l.trim().length==0;)l=t.readLine();for(;!(!l||l.trim().length==0||t.readEntry(s,l)==0);)l=t.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=t.readLine();else if(o){let h=new Ue(o,l);for(;;){let c=t.readEntry(s,l=t.readLine());if(c==0)break;let f=r[s[0]];if(f)f(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));a.push(d)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Es(l.trim());t.readEntry(s,l=t.readLine())!=0;){let h=i[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},yr=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let l=t.indexOf(",",r);if(l==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,l-r).trim(),r=l+1,i==4)return 4}}},Es=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Ue=class extends Bs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ct=class ds extends ht{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=E.newFloatArray(t.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof Ue){let a=this.region,h=a.page,c=h.width,f=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<i;d+=2)s[d]=r+t[d+1]*o,s[d+1]=l+(1-t[d])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/f,o=a.originalWidth/c,n=a.originalHeight/f;for(let d=0;d<i;d+=2)s[d]=r+(1-t[d])*o,s[d+1]=l+(1-t[d+1])*n;return;case 270:r-=a.offsetY/c,l-=a.offsetX/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<i;d+=2)s[d]=r+(1-t[d+1])*o,s[d+1]=l+t[d]*n;return}r-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/f,o=a.originalWidth/c,n=a.originalHeight/f}else this.region?(o=this.region.u2-r,n=this.region.v2-l):(r=l=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+t[a]*o,s[a+1]=l+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new ds(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,i,r,l,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,l,o)}newLinkedMesh(){let t=new ds(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},St=class hr extends ht{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new hr(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Rs=class cr extends ht{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*B.degRad,i=Math.cos(s),r=Math.sin(s),l=i*t.a+r*t.b,o=i*t.c+r*t.d;return B.atan2Deg(o,l)}copy(){let t=new cr(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},nt=class dr extends ne{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=l+this.region.width*i,a=o+this.region.height*r,h=this.rotation*B.degRad,c=Math.cos(h),f=Math.sin(h),d=this.x,m=this.y,u=l*c+d,p=l*f,b=o*c+m,w=o*f,g=n*c+d,x=n*f,y=a*c+m,v=a*f,C=this.offset;C[0]=u-w,C[1]=b+p,C[2]=u-v,C[3]=y+p,C[4]=g-v,C[5]=y+x,C[6]=g-w,C[7]=b+x,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,i,r){this.sequence!=null&&this.sequence.apply(t,this);let l=t.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,f=l.c,d=l.d,m=0,u=0;m=o[0],u=o[1],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a,i+=r,m=o[2],u=o[3],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a,i+=r,m=o[4],u=o[5],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a,i+=r,m=o[6],u=o[7],s[i]=m*h+u*c+n,s[i+1]=m*f+u*d+a}copy(){let t=new dr(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Ds=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,l=i.length;r<l;r++){let o=s.getPath(t,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[r]=n}}newRegionAttachment(e,t,s,i){let r=new nt(t,s);if(i!=null)this.loadSequence(t,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=l}return r}newMeshAttachment(e,t,s,i){let r=new ct(t,s);if(i!=null)this.loadSequence(t,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=l}return r}newBoundingBoxAttachment(e,t){return new Oe(t)}newPathAttachment(e,t){return new St(t)}newPointAttachment(e,t){return new Rs(t)}newClippingAttachment(e,t){return new bt(t)}},qe=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 V;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Ht=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Ht||{}),We=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,r,l,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,p=(s+l)*B.degRad,b=(s+90+o)*B.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*u,this.d=Math.sin(b)*r*u,this.worldX=e*m+d.x,this.worldY=t*u+d.y;return}let a=n.a,h=n.b,c=n.c,f=n.d;switch(this.worldX=a*e+h*t+n.worldX,this.worldY=c*e+f*t+n.worldY,this.inherit){case 0:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad,u=Math.cos(d)*i,p=Math.cos(m)*r,b=Math.sin(d)*i,w=Math.sin(m)*r;this.a=a*u+h*b,this.b=a*p+h*w,this.c=c*u+f*b,this.d=c*p+f*w;return}case 1:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(m)*r,this.c=Math.sin(d)*i,this.d=Math.sin(m)*r;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=d,c*=m;let u=a*a+c*c,p=0;u>1e-4?(u=Math.abs(a*f*m-h*d*c)/u,h=c*u,f=a*u,p=Math.atan2(c,a)*B.radDeg):(a=0,c=0,p=90-Math.atan2(f,h)*B.radDeg);const b=(s+l-p)*B.degRad,w=(s+o-p+90)*B.degRad,g=Math.cos(b)*i,x=Math.cos(w)*r,y=Math.sin(b)*i,v=Math.sin(w)*r;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=B.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(a*d+h*m)/this.skeleton.scaleX,p=(c*d+f*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+p*p);b>1e-5&&(b=1/b),u*=b,p*=b,b=Math.sqrt(u*u+p*p),this.inherit==3&&a*f-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,u);const w=Math.cos(s)*b,g=Math.sin(s)*b;l*=B.degRad,o=(90+o)*B.degRad;const x=Math.cos(l)*i,y=Math.cos(o)*r,v=Math.sin(l)*i,C=Math.sin(o)*r;this.a=u*x+w*v,this.b=u*y+w*C,this.c=p*x+g*v,this.d=p*y+g*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.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)*B.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,l=1/(t*r-s*i),o=r*l,n=s*l,a=i*l,h=t*l,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*o-f*n,this.ay=f*h-c*a;let d,m,u,p;if(this.inherit==1)d=this.a,m=this.b,u=this.c,p=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=t*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(t*r-s*i),o=r*l,n=s*l;break}case 3:case 4:let b=B.cosDeg(this.rotation),w=B.sinDeg(this.rotation);t=(t*b+s*w)/this.skeleton.scaleX,i=(i*b+r*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.inherit==3&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=B.PI/2+Math.atan2(i,t);s=Math.cos(x)*g,r=Math.sin(x)*g,l=1/(t*r-s*i),o=r*l,n=s*l,a=i*l,h=t*l}d=o*this.a-n*this.c,m=o*this.b-n*this.d,u=h*this.c-a*this.a,p=h*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let b=d*p-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*p,b)*B.radDeg,this.arotation=Math.atan2(u,d)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*B.radDeg}rotateWorld(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},Pt=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},vr=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Vs,i=new Ls){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,l=>{this.success(t,e,l),i(l)},(l,o)=>{const n=`Couldn't load binary ${e}: status ${l}, ${o}`;this.error(s,e,n),r(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,l=>{this.success(t,e,l),i(l)},(l,o)=>{const n=`Couldn't load JSON ${e}: status ${l}, ${o}`;this.error(s,e,n),r(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[e],r=i!==void 0;return r&&(this.cache.assetsLoaded[e]=i.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(t,e,l),l)).catch(l=>this.error(s,e,l))),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(e,n);this.success(t,e,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(e,n);this.success(t,e,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),l=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,n)=>{this.downloader.downloadText(e,a=>{try{const h=this.createTextureAtlas(e,a);let c=h.pages.length,f=!1;for(let d of h.pages)this.loadTexture(i?i[d.name]:l+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(t,e,h),o(h)))},(m,u)=>{if(!f){const p=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,p),n(p)}f=!0})}catch(h){const c=`Couldn't parse texture atlas ${e}: ${h.message}`;this.error(s,e,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${h}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,l)=>{this.downloader.downloadText(e,o=>{try{const n=this.createTextureAtlas(e,o);this.success(t,e,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),l(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(r))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
+ `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof Gt){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new Gt(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&i()},s}},Ls=class ee{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ee.AVAILABLE_CACHES.get(t);if(s)return s;const i=new ee;return ee.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Vs=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let l=()=>{this.finish(e,r.status,r.responseText)};r.onload=l,r.onerror=l,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let l=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):l()},r.onerror=l,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let l=r.length-1,o=i.length;l<o;l+=2)i[l].apply(null,r)}},ze=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Ge=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Ns=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,l,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,f=n.d,d=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*B.signum(e.skeleton.scaleX),u=(s-e.worldY)*B.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(a*f-h*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;h=-x*w*e.skeleton.scaleX,f=g*w*e.skeleton.scaleY,d+=Math.atan2(x,g)*B.radDeg;default:let y=t-n.worldX,v=s-n.worldY,C=a*f-h*c;Math.abs(C)<=1e-4?(m=0,u=0):(m=(y*f-v*h)/C-e.ax,u=(v*a-y*c)/C-e.ay)}d+=Math.atan2(u,m)*B.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let p=e.ascaleX,b=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const w=e.data.length*p;if(w>1e-4){const g=m*m+u*u;if(i&&g<w*w||r&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,p,b,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,l,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let h=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,u=d,p=t.ascaleX,b=0,w=0,g=0;f<0?(f=-f,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),p<0?(p=-p,w=180):w=0;let x=t.ax,y=0,v=0,C=0,A=e.a,k=e.b,T=e.c,Y=e.d,M=Math.abs(f-d)<=1e-4;!M||l?(y=0,v=A*x+e.worldX,C=T*x+e.worldY):(y=t.ay,v=A*x+k*y+e.worldX,C=T*x+Y*y+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");A=F.a,k=F.b,T=F.c,Y=F.d;let P=A*Y-k*T,I=v-F.worldX,X=C-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let D=(I*Y-X*k)*P-h,N=(X*A-I*T)*P-c,L=Math.sqrt(D*D+N*N),O=t.data.length*p,H,W;if(L<1e-4){this.apply1(e,s,i,!1,l,!1,a),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-F.worldX,X=i-F.worldY;let j=(I*Y-X*k)*P-h,R=(X*A-I*T)*P-c,U=j*j+R*R;if(n!=0){n*=f*(p+1)*.5;let J=Math.sqrt(U),K=J-L-O*f+n;if(K>0){let Q=Math.min(1,K/(n*2))-1;Q=(K-n*(1-Q*Q))/J,j-=Q*j,R-=Q*R,U=j*j+R*R}}t:if(M){O*=f;let J=(U-L*L-O*O)/(2*L*O);J<-1?(J=-1,W=Math.PI*r):J>1?(J=1,W=0,l&&(A=(Math.sqrt(U)/(L+O)-1)*a+1,m*=A,o&&(u*=A))):W=Math.acos(J)*r,A=L+O*J,k=O*Math.sin(W),H=Math.atan2(R*A-j*k,j*A+R*k)}else{A=f*O,k=d*O;let J=A*A,K=k*k,Q=Math.atan2(R,j);T=K*L*L+J*U-J*K;let rt=-2*K*L,yt=K-J;if(Y=rt*rt-4*yt*T,Y>=0){let vt=Math.sqrt(Y);rt<0&&(vt=-vt),vt=-(rt+vt)*.5;let Yt=vt/yt,bs=T/vt,Nt=Math.abs(Yt)<Math.abs(bs)?Yt:bs;if(Yt=U-Nt*Nt,Yt>=0){X=Math.sqrt(Yt)*r,H=Q-Math.atan2(X,Nt),W=Math.atan2(X/d,(Nt-L)/f);break t}}let Mt=B.PI,Lt=L-A,se=Lt*Lt,gs=0,ps=0,Vt=L+A,re=Vt*Vt,xs=0;T=-A*L/(J-K),T>=-1&&T<=1&&(T=Math.acos(T),I=A*Math.cos(T)+L,X=k*Math.sin(T),Y=I*I+X*X,Y<se&&(Mt=T,se=Y,Lt=I,gs=X),Y>re&&(ps=T,re=Y,Vt=I,xs=X)),U<=(se+re)*.5?(H=Q-Math.atan2(gs*r,Lt),W=Mt*r):(H=Q-Math.atan2(xs*r,Vt),W=ps*r)}let G=Math.atan2(y,x)*g,tt=e.arotation;H=(H-G)*B.radDeg+b-tt,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(h,c,tt+H*a,m,u,0,0),tt=t.arotation,W=((W+G)*B.radDeg-t.ashearX)*g+w-tt,W>180?W-=360:W<-180&&(W+=360),t.updateWorldTransformWith(x,y,tt+W*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},He=class extends Pt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},$e=class extends Pt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},je=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(je||{}),Je=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Je||{}),Ke=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Ke||{}),Os=class pt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0,l=t.bones.length;r<l;r++){let o=s.findBone(t.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof St))return;let i=this.mixRotate,r=this.mixX,l=this.mixY;if(i==0&&r==0&&l==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,h=this.bones,c=h.length,f=n?c:c+1,d=E.setArraySize(this.spaces,f),m=a?this.lengths=E.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(a)for(let C=0,A=f-1;C<A;C++){let k=h[C],T=k.data.length,Y=T*k.a,M=T*k.c;m[C]=Math.sqrt(Y*Y+M*M)}E.arrayFill(d,1,f,u);break;case 3:let y=0;for(let C=0,A=f-1;C<A;){let k=h[C],T=k.data.length;if(T<pt.epsilon)a&&(m[C]=0),d[++C]=u;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),d[++C]=F,y+=F}}if(y>0){y=f/y*u;for(let C=1;C<f;C++)d[C]*=y}break;default:let v=o.spacingMode==0;for(let C=0,A=f-1;C<A;){let k=h[C],T=k.data.length;if(T<pt.epsilon)a&&(m[C]=0),d[++C]=u;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),d[++C]=(v?T+u:u)*F/T}}}let p=this.computeWorldPositions(s,f,n),b=p[0],w=p[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?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*r,C.worldY+=(w-C.worldY)*l;let A=p[v],k=p[v+1],T=A-b,Y=k-w;if(a){let M=m[y];if(M!=0){let F=(Math.sqrt(T*T+Y*Y)/M-1)*i+1;C.a*=F,C.c*=F}}if(b=A,w=k,i>0){let M=C.a,F=C.b,P=C.c,I=C.d,X=0,D=0,N=0;if(n?X=p[v-1]:d[y+1]==0?X=p[v+2]:X=Math.atan2(Y,T),X-=Math.atan2(P,M),x){D=Math.cos(X),N=Math.sin(X);let L=C.data.length;b+=(L*(D*M-N*P)-T)*i,w+=(L*(N*M+D*P)-Y)*i}else X+=g;X>B.PI?X-=B.PI2:X<-B.PI&&(X+=B.PI2),X*=i,D=Math.cos(X),N=Math.sin(X),C.a=D*M-N*P,C.b=D*F-N*I,C.c=N*M+D*P,C.d=N*F+D*I}C.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=t.closed,c=t.worldVerticesLength,f=c/6,d=pt.NONE;if(!t.constantSpeed){let L=t.lengths;f-=h?1:2;let O=L[f];this.data.positionMode==1&&(l*=O);let H;switch(this.data.spacingMode){case 2:H=O;break;case 3:H=O/s;break;default:H=1}a=E.setArraySize(this.world,8);for(let W=0,j=0,R=0;W<s;W++,j+=3){let U=o[W]*H;l+=U;let G=l;if(h)G%=O,G<0&&(G+=O),R=0;else if(G<0){d!=pt.BEFORE&&(d=pt.BEFORE,t.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>O){d!=pt.AFTER&&(d=pt.AFTER,t.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(G-O,a,0,n,j);continue}for(;;R++){let tt=L[R];if(!(G>tt)){if(R==0)G/=tt;else{let J=L[R-1];G=(G-J)/(tt-J)}break}}R!=d&&(d=R,h&&R==f?(t.computeWorldVertices(r,c-4,4,a,0,2),t.computeWorldVertices(r,0,4,a,4,2)):t.computeWorldVertices(r,R*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,j,i||W>0&&U==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,a,0,2),t.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(f--,c-=4,a=E.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,a,0,2));let m=E.setArraySize(this.curves,f),u=0,p=a[0],b=a[1],w=0,g=0,x=0,y=0,v=0,C=0,A=0,k=0,T=0,Y=0,M=0,F=0,P=0,I=0;for(let L=0,O=2;L<f;L++,O+=6)w=a[O],g=a[O+1],x=a[O+2],y=a[O+3],v=a[O+4],C=a[O+5],A=(p-w*2+x)*.1875,k=(b-g*2+y)*.1875,T=((w-x)*3-p+v)*.09375,Y=((g-y)*3-b+C)*.09375,M=A*2+T,F=k*2+Y,P=(w-p)*.75+A+T*.16666667,I=(g-b)*.75+k+Y*.16666667,u+=Math.sqrt(P*P+I*I),P+=M,I+=F,M+=T,F+=Y,u+=Math.sqrt(P*P+I*I),P+=M,I+=F,u+=Math.sqrt(P*P+I*I),P+=M+T,I+=F+Y,u+=Math.sqrt(P*P+I*I),m[L]=u,p=v,b=C;this.data.positionMode==1&&(l*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let D=this.segments,N=0;for(let L=0,O=0,H=0,W=0;L<s;L++,O+=3){let j=o[L]*X;l+=j;let R=l;if(h)R%=u,R<0&&(R+=u),H=0;else if(R<0){this.addBeforePosition(R,a,0,n,O);continue}else if(R>u){this.addAfterPosition(R-u,a,c-4,n,O);continue}for(;;H++){let U=m[H];if(!(R>U)){if(H==0)R/=U;else{let G=m[H-1];R=(R-G)/(U-G)}break}}if(H!=d){d=H;let U=H*6;for(p=a[U],b=a[U+1],w=a[U+2],g=a[U+3],x=a[U+4],y=a[U+5],v=a[U+6],C=a[U+7],A=(p-w*2+x)*.03,k=(b-g*2+y)*.03,T=((w-x)*3-p+v)*.006,Y=((g-y)*3-b+C)*.006,M=A*2+T,F=k*2+Y,P=(w-p)*.3+A+T*.16666667,I=(g-b)*.3+k+Y*.16666667,N=Math.sqrt(P*P+I*I),D[0]=N,U=1;U<8;U++)P+=M,I+=F,M+=T,F+=Y,N+=Math.sqrt(P*P+I*I),D[U]=N;P+=M,I+=F,N+=Math.sqrt(P*P+I*I),D[8]=N,P+=M+T,I+=F+Y,N+=Math.sqrt(P*P+I*I),D[9]=N,W=0}for(R*=N;;W++){let U=D[W];if(!(R>U)){if(W==0)R/=U;else{let G=D[W-1];R=W+(R-G)/(U-G)}break}}this.addCurvePosition(R*.1,p,b,w,g,x,y,v,C,n,O,i||L>0&&j==0)}return n}addBeforePosition(t,s,i,r,l){let o=s[i],n=s[i+1],a=s[i+2]-o,h=s[i+3]-n,c=Math.atan2(h,a);r[l]=o+t*Math.cos(c),r[l+1]=n+t*Math.sin(c),r[l+2]=c}addAfterPosition(t,s,i,r,l){let o=s[i+2],n=s[i+3],a=o-s[i],h=n-s[i+1],c=Math.atan2(h,a);r[l]=o+t*Math.cos(c),r[l+1]=n+t*Math.sin(c),r[l+2]=c}addCurvePosition(t,s,i,r,l,o,n,a,h,c,f,d){if(t==0||isNaN(t)){c[f]=s,c[f+1]=i,c[f+2]=Math.atan2(l-i,r-s);return}let m=t*t,u=m*t,p=1-t,b=p*p,w=b*p,g=p*t,x=g*3,y=p*x,v=x*t,C=s*w+r*y+o*v+a*u,A=i*w+l*y+n*v+h*u;c[f]=C,c[f+1]=A,d&&(t<.001?c[f+2]=Math.atan2(l-i,r-s):c[f+2]=Math.atan2(A-(i*b+l*g*2+n*m),C-(s*b+r*g*2+o*m)))}},Cr=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.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,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(i){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*p*a.scaleX,C=this.gravity*p*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),i&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),d-=u;while(d>=u)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r||l){let x=Math.atan2(o.c,o.a),y=0,v=0,C=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),r){C=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(k+this.ty,A+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*B.invPI2-.5)*B.PI2)*m,T=this.rotateOffset*C+x,y=Math.cos(T),v=Math.sin(T),l&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(A*y+k*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(A*y+k*v)*m/T)}if(d=this.remaining,d>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,Y=this.strength,M=this.wind,F=kt.yDown?-this.gravity:this.gravity,P=n/p;for(;;)if(d-=u,l&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+F*y)*P+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,d<u)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r){let a=this.rotateOffset*t,h=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*this.data.rotate,h=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-h*o.d,o.d=h*f+c*o.d),d+=a*this.data.shearX,h=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-h*o.c,o.c=h*f+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),f=o.a,o.a=c*f-h*o.c,o.c=h*f+c*o.c,f=o.b,o.b=c*f-h*o.d,o.d=h*f+c*o.d}if(l){const a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*B.degRad,r=Math.cos(i),l=Math.sin(i),o=this.cx-e,n=this.cy-t;this.translate(o*r-n*l-o,o*l+n*r-n)}},_s=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new V,this.darkColor=e.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ht)||!(this.attachment instanceof ht)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Us=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Xt;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,f=n.d,d=a*f-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)-Math.atan2(v,x)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*t,g.worldY+=(x.y-g.worldY)*s}if(i!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.c*=x}if(r!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+f*f)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(f,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+u)*l;let A=Math.sqrt(x*x+y*y);g.b=Math.cos(C)*A,g.d=Math.sin(C)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,f=n.d,d=a*f-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*t,g.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(h*h+f*f)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(f,h)-Math.atan2(c,a);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-B.PI/2+u)*l;let C=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*C,g.d=Math.sin(x)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],f=c.arotation;e!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,p=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(d,m,f,u,p,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],f=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(d,m,f,u,p,c.ashearX,b)}}},kt=class fs{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 fs.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=t.bones[s],r;if(!i.parent)r=new We(i,this,null);else{let l=this.bones[i.parent.index];r=new We(i,this,l),l.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let i=t.slots[s],r=this.bones[i.boneData.index],l=new _s(i,r);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let i=t.ikConstraints[s];this.ikConstraints.push(new Ns(i,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let i=t.transformConstraints[s];this.transformConstraints.push(new Us(i,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let i=t.pathConstraints[s];this.pathConstraints.push(new Os(i,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let i=t.physicsConstraints[s];this.physicsConstraints.push(new Cr(i,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.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 p=this.bones[d[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,r=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,h=l.length,c=this.physicsConstraints.length,f=n+a+h+c;t:for(let d=0;d<f;d++){for(let m=0;m<n;m++){let u=i[m];if(u.data.order==d){this.sortIkConstraint(u);continue t}}for(let m=0;m<a;m++){let u=r[m];if(u.data.order==d){this.sortTransformConstraint(u);continue t}}for(let m=0;m<h;m++){let u=l[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(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let i=t.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let l=i[i.length-1];this.sortBone(l),this._updateCache.push(t),this.sortReset(r.children),l.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let l=s.getAttachment();l instanceof St&&this.sortPathConstraintAttachmentWith(l,r);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,i=s.length;if(t.data.local)for(let r=0;r<i;r++){let l=s[r];this.sortBone(l.parent),this.sortBone(l)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(t);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(t,s,i){let r=t.attachments[s];if(r)for(let l in r)this.sortPathConstraintAttachmentWith(r[l],i)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof St))return;let i=t.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let l=0,o=i.length;l<o;){let n=i[l++];for(n+=l;l<n;)this.sortBone(r[i[l++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){let r=t[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,l=s.length;r<l;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,l=i.length;r<l;r++)i[r].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,w=i.length;b<w;b++){let g=i[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 r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;r.worldX=l*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const h=(r.rotation+r.shearX)*B.degRad,c=(r.rotation+90+r.shearY)*B.degRad,f=Math.cos(h)*r.scaleX,d=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(l*f+o*m)*this.scaleX,r.b=(l*d+o*u)*this.scaleX,r.c=(n*f+a*m)*this.scaleY,r.d=(n*d+a*u)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=r&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;E.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,i=t.length;s<i;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==t)return l}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==t)return l}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i],o=l.data.attachmentName;if(o){let n=t.getAttachment(i,o);n&&l.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,l=i.length;r<l;r++){let o=i[r];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Xt,i=new Xt;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let l=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let c=0,f=l.length;c<f;c++){let d=l[c];if(!d.bone.active)continue;let m=0,u=null,p=null,b=d.getAttachment();if(b instanceof nt)m=8,u=E.setArraySize(i,m,0),b.computeWorldVertices(d,u,0,2),p=fs.quadTriangles;else if(b instanceof ct){let w=b;m=w.worldVerticesLength,u=E.setArraySize(i,m,0),w.computeWorldVertices(d,0,m,u,0,2),p=w.triangles}else if(b instanceof bt&&r!=null){r.clipStart(d,b);continue}if(u&&p){r!=null&&r.isClipping()&&(r.clipTriangles(u,p,p.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let w=0,g=u.length;w<g;w+=2){let x=u[w],y=u[w+1];o=Math.min(o,x),n=Math.min(n,y),a=Math.max(a,x),h=Math.max(h,y)}}r?.clipEndWithSlot(d)}r?.clipEnd(),t.set(o,n),s.set(a-o,h-n)}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physicsConstraints;for(let r=0,l=i.length;r<l;r++)i[r].translate(t,s)}physicsRotate(t,s,i){const r=this.physicsConstraints;for(let l=0,o=r.length;l<o;l++)r[l].rotate(t,s,i)}},qs=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(qs||{}),Ws=class extends Pt{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Bt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}},Qe=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Et=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof ct?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Qe(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Qe(e,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let r=e.slots[i],l=r.getAttachment();if(l&&s<t.attachments.length){let o=t.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&r.setAttachment(h);break}}}s++}}},Ze=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},ts=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(ts||{}),es=class extends Pt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},zs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Bt;s.name="";let i=new Gs(e),r=i.readInt32(),l=i.readInt32();s.hash=l==0&&r==0?null:l.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let f=h==0?null:s.bones[i.readInt(!0)],d=new qe(h,c,f);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.inherit=i.readByte(),d.skinRequired=i.readBoolean(),o&&(V.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new Ze(h,c,f);V.rgba8888ToColor(d.color,i.readInt32());let m=i.readInt32();m!=-1&&V.rgb888ToColor(d.darkColor=new V,m),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new He(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let m=i.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?i.readFloat():1),(m&128)!=0&&(d.softness=i.readFloat()*t),s.ikConstraints.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new es(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=i.readFloat()),(m&16)!=0&&(d.offsetX=i.readFloat()*t),(m&32)!=0&&(d.offsetY=i.readFloat()*t),(m&64)!=0&&(d.offsetScaleX=i.readFloat()),(m&128)!=0&&(d.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(d.offsetShearY=i.readFloat()),(m&2)!=0&&(d.mixRotate=i.readFloat()),(m&4)!=0&&(d.mixX=i.readFloat()),(m&8)!=0&&(d.mixY=i.readFloat()),(m&16)!=0&&(d.mixScaleX=i.readFloat()),(m&32)!=0&&(d.mixScaleY=i.readFloat()),(m&64)!=0&&(d.mixShearY=i.readFloat()),s.transformConstraints.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new $e(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)];const m=i.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=i.readFloat()),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}n=i.readInt(!0);for(let h=0,c;h<n;h++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ws(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=i.readFloat()),(m&4)!=0&&(d.y=i.readFloat()),(m&8)!=0&&(d.rotate=i.readFloat()),(m&16)!=0&&(d.scaleX=i.readFloat()),(m&32)!=0&&(d.shearX=i.readFloat()),d.limit=((m&64)!=0?i.readFloat():5e3)*t,d.step=1/i.readUnsignedByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=(m&128)!=0?i.readFloat():1,d.wind=i.readFloat(),d.gravity=i.readFloat(),m=i.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?i.readFloat():1,s.physicsConstraints.push(d)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+i.readInt(!0));h<n;h++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];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,n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let f=new Ge(c);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let r=null,l=0;if(s){if(l=e.readInt(!0),l==0)return null;r=new Et("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Et(o),i&&V.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);l=e.readInt(!0)}for(let o=0;o<l;o++){let n=e.readInt(!0);for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,r,n,c,i);f&&r.setAttachment(n,c,f)}}return r}readAttachment(e,t,s,i,r,l){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let h=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null;let d=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,f);return x?(x.path=h,x.x=m*o,x.y=u*o,x.scaleX=p,x.scaleY=b,x.rotation=d,x.width=w*o,x.height=g*o,V.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let h=this.readVertices(e,(n&16)!=0),c=l?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,a);return f?(f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,l&&V.rgba8888ToColor(f.color,c),f):null}case 2:{let h=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),p=this.readShortArray(e,(m.length-d-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,f);return x?(x.path=h,V.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case 3:{const h=(n&16)!=0?e.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let p=0,b=0;l&&(p=e.readFloat(),b=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,f);return w?(w.path=h,V.rgba8888ToColor(w.color,c),w.sequence=f,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Ar(w,m,i,u,d)),w):null}case 4:{const h=(n&16)!=0,c=(n&32)!=0,f=this.readVertices(e,(n&64)!=0),d=E.newArray(f.length/6,0);for(let p=0,b=d.length;p<b;p++)d[p]=e.readFloat()*o;const m=l?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=h,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,l&&V.rgba8888ToColor(u.color,m),u):null}case 5:{const h=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=l?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=f*o,m.rotation=h,l&&V.rgba8888ToColor(m.color,d),m):null}case 6:{const h=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let f=l?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,a);return d?(d.endSlot=t.slots[h],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,l&&V.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){let t=new vs(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),r=new Sr;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let l=new Array,o=new Array;for(let n=0;n<i;n++){let a=e.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(e.readInt(!0)),l.push(e.readFloat()*s),l.push(e.readFloat()*s),l.push(e.readFloat())}return r.vertices=E.toFloatArray(l),r.bones=o,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,r=this.scale;for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),u=e.readInt(!0),p=u-1;switch(m){case Dr:{let b=new xt(u,c);for(let w=0;w<u;w++)b.setFrame(w,e.readFloat(),e.readStringRef());i.push(b);break}case Lr:{let b=e.readInt(!0),w=new pe(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,x,y,v,C),A!=p;A++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(A);break;case ft:q(e,w,k++,A,0,g,T,x,Y,1),q(e,w,k++,A,1,g,T,y,M,1),q(e,w,k++,A,2,g,T,v,F,1),q(e,w,k++,A,3,g,T,C,P,1)}g=T,x=Y,y=M,v=F,C=P}i.push(w);break}case Vr:{let b=e.readInt(!0),w=new xe(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let C=0,A=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(C);break;case ft:q(e,w,A++,C,0,g,k,x,T,1),q(e,w,A++,C,1,g,k,y,Y,1),q(e,w,A++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}i.push(w);break}case Nr:{let b=e.readInt(!0),w=new we(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,A,k,T),Y!=p;Y++){let F=e.readFloat(),P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(Y);break;case ft:q(e,w,M++,Y,0,g,F,x,P,1),q(e,w,M++,Y,1,g,F,y,I,1),q(e,w,M++,Y,2,g,F,v,X,1),q(e,w,M++,Y,3,g,F,C,D,1),q(e,w,M++,Y,4,g,F,A,N,1),q(e,w,M++,Y,5,g,F,k,L,1),q(e,w,M++,Y,6,g,F,T,O,1)}g=F,x=P,y=I,v=X,C=D,A=N,k=L,T=O}i.push(w);break}case Or:{let b=e.readInt(!0),w=new ye(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,A,k),T!=p;T++){let M=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case dt:w.setStepped(T);break;case ft:q(e,w,Y++,T,0,g,M,x,F,1),q(e,w,Y++,T,1,g,M,y,P,1),q(e,w,Y++,T,2,g,M,v,I,1),q(e,w,Y++,T,3,g,M,C,X,1),q(e,w,Y++,T,4,g,M,A,D,1),q(e,w,Y++,T,5,g,M,k,N,1)}g=M,x=F,y=P,v=I,C=X,A=D,k=N}i.push(w);break}case _r:{let b=new be(u,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case dt:b.setStepped(x);break;case ft:q(e,b,y++,x,0,w,v,g,C,1)}w=v,g=C}i.push(b)}}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),u=e.readInt(!0);if(m==Rr){let b=new ge(u,c);for(let w=0;w<u;w++)b.setFrame(w,e.readFloat(),e.readByte());i.push(b);continue}let p=e.readInt(!0);switch(m){case kr:i.push(Z(e,new Ft(u,p,c),1));break;case Tr:i.push(ss(e,new ae(u,p,c),r));break;case Ir:i.push(Z(e,new oe(u,p,c),r));break;case Mr:i.push(Z(e,new le(u,p,c),r));break;case Yr:i.push(ss(e,new he(u,p,c),1));break;case Xr:i.push(Z(e,new ce(u,p,c),1));break;case Fr:i.push(Z(e,new de(u,p,c),1));break;case Pr:i.push(ss(e,new fe(u,p,c),1));break;case Br:i.push(Z(e,new ue(u,p,c),1));break;case Er:i.push(Z(e,new me(u,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new Ce(f,e.readInt(!0),c),u=e.readByte(),p=e.readFloat(),b=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,w=(u&4)!=0?e.readFloat()*r:0;for(let g=0,x=0;m.setFrame(g,p,b,w,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=e.readByte();const y=e.readFloat(),v=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,C=(u&4)!=0?e.readFloat()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(q(e,m,x++,g,0,p,y,b,v,1),q(e,m,x++,g,1,p,y,w,C,r)),p=y,b=v,w=C}i.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new Ae(f,e.readInt(!0),c),u=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,C=0;m.setFrame(v,u,p,b,w,g,x,y),v!=d;v++){let A=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case dt:m.setStepped(v);break;case ft:q(e,m,C++,v,0,u,A,p,k,1),q(e,m,C++,v,1,u,A,b,T,1),q(e,m,C++,v,2,u,A,w,Y,1),q(e,m,C++,v,3,u,A,g,M,1),q(e,m,C++,v,4,u,A,x,F,1),q(e,m,C++,v,5,u,A,y,P,1)}u=A,p=k,b=T,w=Y,g=M,x=F,y=P}i.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=e.readInt(!0);d<m;d++){const u=e.readByte(),p=e.readInt(!0),b=e.readInt(!0);switch(u){case Wr:i.push(Z(e,new Se(p,b,c),f.positionMode==0?r:1));break;case zr:i.push(Z(e,new ke(p,b,c),f.spacingMode==0||f.spacingMode==1?r:1));break;case Gr:let w=new Te(p,b,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let C=0,A=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat();switch(e.readByte()){case dt:w.setStepped(C);break;case ft:q(e,w,A++,C,0,g,T,x,Y,1),q(e,w,A++,C,1,g,T,y,M,1),q(e,w,A++,C,2,g,T,v,F,1)}g=T,x=Y,y=M,v=F}i.push(w)}}}for(let a=0,h=e.readInt(!0);a<h;a++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const m=e.readByte(),u=e.readInt(!0);if(m==ti){const b=new Ee(u,c);for(let w=0;w<u;w++)b.setFrame(w,e.readFloat());i.push(b);continue}const p=e.readInt(!0);switch(m){case Hr:i.push(Z(e,new Ie(u,p,c),1));break;case $r:i.push(Z(e,new Me(u,p,c),1));break;case jr:i.push(Z(e,new Ye(u,p,c),1));break;case Jr:i.push(Z(e,new Xe(u,p,c),1));break;case Kr:i.push(Z(e,new Fe(u,p,c),1));break;case Qr:i.push(Z(e,new Pe(u,p,c),1));break;case Zr:i.push(Z(e,new Be(u,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readInt(!0);for(let u=0,p=e.readInt(!0);u<p;u++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case Ur:{let v=w,C=v.bones,A=v.vertices,k=C?A.length/3*2:A.length,T=e.readInt(!0),Y=new ve(x,T,m,v),M=e.readFloat();for(let F=0,P=0;;F++){let I,X=e.readInt(!0);if(X==0)I=C?E.newFloatArray(k):A;else{I=E.newFloatArray(k);let N=e.readInt(!0);if(X+=N,r==1)for(let L=N;L<X;L++)I[L]=e.readFloat();else for(let L=N;L<X;L++)I[L]=e.readFloat()*r;if(!C)for(let L=0,O=I.length;L<O;L++)I[L]+=A[L]}if(Y.setFrame(F,M,I),F==y)break;let D=e.readFloat();switch(e.readByte()){case dt:Y.setStepped(F);break;case ft:q(e,Y,P++,F,0,M,D,0,1,1)}M=D}i.push(Y);break}case qr:{let v=new Re(x,m,w);for(let C=0;C<x;C++){let A=e.readFloat(),k=e.readInt32();v.setFrame(C,A,As[k&15],k>>4,e.readFloat())}i.push(v);break}}}}}let l=e.readInt(!0);if(l>0){let a=new At(l),h=s.slots.length;for(let c=0;c<l;c++){let f=e.readFloat(),d=e.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let u=E.newArray(h-d,0),p=0,b=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;p!=g;)u[b++]=p++;m[p+e.readInt(!0)]=p++}for(;p<h;)u[b++]=p++;for(let w=h-1;w>=0;w--)m[w]==-1&&(m[w]=u[--b]);a.setFrame(c,f,m)}i.push(a)}let o=e.readInt(!0);if(o>0){let a=new Ut(o);for(let h=0;h<o;h++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new ze(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),a.setFrame(h,d)}i.push(a)}let n=0;for(let a=0,h=i.length;a<h;a++)n=Math.max(n,i[a].getDuration());return new Ot(t,i,n)}},Gs=class{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ar=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Sr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function Z(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let l=0,o=0,n=t.getFrameCount()-1;t.setFrame(l,i,r),l!=n;l++){let a=e.readFloat(),h=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(l);break;case ft:q(e,t,o++,l,0,i,a,r,h,s)}i=a,r=h}return t}function ss(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,l=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,i,r,l),o!=a;o++){let h=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(o);break;case ft:q(e,t,n++,o,0,i,h,r,c,s),q(e,t,n++,o,1,i,h,l,f,s)}i=h,r=c,l=f}return t}function q(e,t,s,i,r,l,o,n,a,h){t.setBezier(s,i,r,l,n,e.readFloat(),e.readFloat()*h,e.readFloat(),e.readFloat()*h,o,a)}var kr=0,Tr=1,Ir=2,Mr=3,Yr=4,Xr=5,Fr=6,Pr=7,Br=8,Er=9,Rr=10,Dr=0,Lr=1,Vr=2,Nr=3,Or=4,_r=5,Ur=0,qr=1,Wr=0,zr=1,Gr=2,Hr=0,$r=1,jr=2,Jr=4,Kr=5,Qr=6,Zr=7,ti=8,dt=1,ft=2,rs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ct(()=>E.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,l=e.slots,o=l.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof Oe){let c=h;s.push(c);let f=r.obtain();f.length!=c.worldVerticesLength&&(f=E.newFloatArray(c.worldVerticesLength)),i.push(f),c.computeWorldVertices(a,0,c.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let l=0,o=r.length;l<o;l++){let n=r[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let f=a[h],d=a[h+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(e<=r&&s<=r||t<=l&&i<=l||e>=o&&s>=o||t>=n&&i>=n)return!1;let a=(i-t)/(s-e),h=a*(r-e)+t;if(h>l&&h<n||(h=a*(o-e)+t,h>l&&h<n))return!0;let c=(l-t)/a+e;return c>r&&c<o||(c=(n-t)/a+e,c>r&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.length,l=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],h=i[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=i[n];c+(s-a)/(h-a)*(i[l]-c)<t&&(o=!o)}l=n}return o}intersectsSegment(e,t,s,i){let r=this.polygons;for(let l=0,o=r.length;l<o;l++)if(this.intersectsSegmentPolygon(r[l],e,t,s,i))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(e,t,s,i,r){let l=e,o=e.length,n=t-i,a=s-r,h=t*r-s*i,c=l[o-2],f=l[o-1];for(let d=0;d<o;d+=2){let m=l[d],u=l[d+1],p=c*u-f*m,b=c-m,w=f-u,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=i||x>=i&&x<=t)){let y=(h*w-a*p)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,f=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Hs=class et{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ct(()=>new Array);polygonIndicesPool=new Ct(()=>new Array);triangulate(t){let s=t,i=t.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=i;n<a;++n)l[n]=et.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,h=1;for(;;){t:if(!l[a]){let d=r[n]<<1,m=r[a]<<1,u=r[h]<<1,p=s[d],b=s[d+1],w=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(h+1)%i;v!=n;v=(v+1)%i){if(!l[v])continue;let C=r[v]<<1,A=s[C],k=s[C+1];if(et.positiveArea(x,y,p,b,A,k)&&et.positiveArea(p,b,w,g,A,k)&&et.positiveArea(w,g,x,y,A,k))break t}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),l.splice(a,1),i--;let c=(i+a-1)%i,f=a==i?0:a;l[c]=et.isConcave(c,i,s,r),l[f]=et.isConcave(f,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(t,s){let i=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=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,p=i[d],b=i[d+1],w=i[m],g=i[m+1],x=i[u],y=i[u+1],v=!1;if(a==d){let C=n.length-4,A=et.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=et.winding(x,y,n[0],n[1],n[2],n[3]);A==h&&k==h&&(n.push(x),n.push(y),o.push(u),v=!0)}v||(n.length>0?(r.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),h=et.winding(p,b,w,g,x,y),a=d)}n.length>0&&(r.push(n),l.push(o));for(let c=0,f=r.length;c<f;c++){if(o=l[c],o.length==0)continue;let d=o[0],m=o[o.length-1];n=r[c];let u=n.length-4,p=n[u],b=n[u+1],w=n[u+2],g=n[u+3],x=n[0],y=n[1],v=n[2],C=n[3],A=et.winding(p,b,w,g,x,y);for(let k=0;k<f;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],F=T[2],P=r[k],I=P[P.length-2],X=P[P.length-1];if(Y!=d||M!=m)continue;let D=et.winding(p,b,w,g,I,X),N=et.winding(I,X,x,y,v,C);D==A&&N==A&&(P.length=0,T.length=0,n.push(I),n.push(X),o.push(F),p=w,b=g,w=I,g=X,k=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(t,s,i,r){let l=r[(s+t-1)%s]<<1,o=r[t]<<1,n=r[(t+1)%s]<<1;return!this.positiveArea(i[l],i[l+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(t,s,i,r,l,o){return t*(o-r)+i*(s-o)+l*(r-s)>=0}static winding(t,s,i,r,l,o){let n=i-t,a=r-s;return l*a-o*n+n*s-t*a>=0?1:-1}},$t=class us{triangulator=new Hs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let l=this.clippingPolygon;us.makeClockwise(l);let o=this.clippingPolygons=this.triangulator.decompose(l,this.triangulator.triangulate(l));for(let n=0,a=o.length;n<a;n++){let h=o[n];us.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,s,i,r,l,o,n,a){let h,c,f,d,m,u;typeof s=="number"?(h=i,c=r,f=l,d=o,m=n,u=a):(h=s,c=i,f=r,d=l,m=o,u=n),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,h,c,f,d,m,u):this.clipTrianglesNoRender(t,h,c)}clipTrianglesNoRender(t,s,i){let r=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<i;c+=3){let f=s[c]<<1,d=t[f],m=t[f+1];f=s[c+1]<<1;let u=t[f],p=t[f+1];f=s[c+2]<<1;let b=t[f],w=t[f+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(d,m,u,p,b,w,n[g],r)){let y=r.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,A=E.setArraySize(l,x+v*2);for(let T=0;T<y;T+=2,x+=2){let Y=C[T],M=C[T+1];A[x]=Y,A[x+1]=M}x=o.length;let k=E.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)k[x]=h,k[x+1]=h+T,k[x+2]=h+T+1;h+=v+1}else{let y=E.setArraySize(l,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=p,y[x+4]=b,y[x+5]=w,x=o.length;let v=E.setArraySize(o,x+3);v[x]=h,v[x+1]=h+1,v[x+2]=h+2,h+=3;break}}}}clipTrianglesRender(t,s,i,r,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=n?12:8,u=0;h.length=0,c.length=0;for(let p=0;p<i;p+=3){let b=s[p]<<1,w=t[b],g=t[b+1],x=r[b],y=r[b+1];b=s[p+1]<<1;let v=t[b],C=t[b+1],A=r[b],k=r[b+1];b=s[p+2]<<1;let T=t[b],Y=t[b+1],M=r[b],F=r[b+1];for(let P=0;P<d;P++){let I=h.length;if(this.clip(w,g,v,C,T,Y,f[P],a)){let X=a.length;if(X==0)continue;let D=C-Y,N=T-v,L=w-T,O=Y-g,H=1/(D*L+N*(g-Y)),W=X>>1,j=this.clipOutput,R=E.setArraySize(h,I+W*m);for(let G=0;G<X;G+=2,I+=m){let tt=j[G],J=j[G+1];R[I]=tt,R[I+1]=J,R[I+2]=l.r,R[I+3]=l.g,R[I+4]=l.b,R[I+5]=l.a;let K=tt-T,Q=J-Y,rt=(D*K+N*Q)*H,yt=(O*K+L*Q)*H,Mt=1-rt-yt;R[I+6]=x*rt+A*yt+M*Mt,R[I+7]=y*rt+k*yt+F*Mt,n&&(R[I+8]=o.r,R[I+9]=o.g,R[I+10]=o.b,R[I+11]=o.a)}I=c.length;let U=E.setArraySize(c,I+3*(W-2));W--;for(let G=1;G<W;G++,I+=3)U[I]=u,U[I+1]=u+G,U[I+2]=u+G+1;u+=W+1}else{let X=E.setArraySize(h,I+3*m);X[I]=w,X[I+1]=g,X[I+2]=l.r,X[I+3]=l.g,X[I+4]=l.b,X[I+5]=l.a,n?(X[I+6]=x,X[I+7]=y,X[I+8]=o.r,X[I+9]=o.g,X[I+10]=o.b,X[I+11]=o.a,X[I+12]=v,X[I+13]=C,X[I+14]=l.r,X[I+15]=l.g,X[I+16]=l.b,X[I+17]=l.a,X[I+18]=A,X[I+19]=k,X[I+20]=o.r,X[I+21]=o.g,X[I+22]=o.b,X[I+23]=o.a,X[I+24]=T,X[I+25]=Y,X[I+26]=l.r,X[I+27]=l.g,X[I+28]=l.b,X[I+29]=l.a,X[I+30]=M,X[I+31]=F,X[I+32]=o.r,X[I+33]=o.g,X[I+34]=o.b,X[I+35]=o.a):(X[I+6]=x,X[I+7]=y,X[I+8]=v,X[I+9]=C,X[I+10]=l.r,X[I+11]=l.g,X[I+12]=l.b,X[I+13]=l.a,X[I+14]=A,X[I+15]=k,X[I+16]=T,X[I+17]=Y,X[I+18]=l.r,X[I+19]=l.g,X[I+20]=l.b,X[I+21]=l.a,X[I+22]=M,X[I+23]=F),I=c.length;let D=E.setArraySize(c,I+3);D[I]=u,D[I+1]=u+1,D[I+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,i,r){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,f=0;o.length=0,n.length=0,a.length=0;for(let d=0;d<i;d+=3){let m=s[d]<<1,u=t[m],p=t[m+1],b=r[m],w=r[m+1];m=s[d+1]<<1;let g=t[m],x=t[m+1],y=r[m],v=r[m+1];m=s[d+2]<<1;let C=t[m],A=t[m+1],k=r[m],T=r[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(u,p,g,x,C,A,h[Y],l)){let F=l.length;if(F==0)continue;let P=x-A,I=C-g,X=u-C,D=A-p,N=1/(P*X+I*(p-A)),L=F>>1,O=this.clipOutput,H=E.setArraySize(o,M+L*2),W=E.setArraySize(n,M+L*2);for(let R=0;R<F;R+=2,M+=2){let U=O[R],G=O[R+1];H[M]=U,H[M+1]=G;let tt=U-C,J=G-A,K=(P*tt+I*J)*N,Q=(D*tt+X*J)*N,rt=1-K-Q;W[M]=b*K+y*Q+k*rt,W[M+1]=w*K+v*Q+T*rt}M=a.length;let j=E.setArraySize(a,M+3*(L-2));L--;for(let R=1;R<L;R++,M+=3)j[M]=f,j[M+1]=f+R,j[M+2]=f+R+1;f+=L+1}else{let F=E.setArraySize(o,M+6);F[M]=u,F[M+1]=p,F[M+2]=g,F[M+3]=x,F[M+4]=C,F[M+5]=A;let P=E.setArraySize(n,M+3*2);P[M]=b,P[M+1]=w,P[M+2]=y,P[M+3]=v,P[M+4]=k,P[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=f,I[M+1]=f+1,I[M+2]=f+2,f+=3;break}}}}clip(t,s,i,r,l,o,n,a){let h=a,c=!1,f;n.length%4>=2?(f=a,a=this.scratch):f=this.scratch,f.length=0,f.push(t),f.push(s),f.push(i),f.push(r),f.push(l),f.push(o),f.push(t),f.push(s),a.length=0;let d=n.length-4,m=n;for(let u=0;;u+=2){let p=m[u],b=m[u+1],w=p-m[u+2],g=b-m[u+3],x=a.length,y=f;for(let C=0,A=f.length-2;C<A;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],F=g*(p-Y)>w*(b-M),P=g*(p-k)-w*(b-T);if(P>0){if(F){a.push(Y),a.push(M);continue}let I=Y-k,X=M-T,D=P/(I*g-X*w);if(D>=0&&D<=1)a.push(k+I*D),a.push(T+X*D);else{a.push(Y),a.push(M);continue}}else if(F){let I=Y-k,X=M-T,D=P/(I*g-X*w);if(D>=0&&D<=1)a.push(k+I*D),a.push(T+X*D),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==d)break;let v=a;a=f,a.length=0,f=v}if(h!=a){h.length=0;for(let u=0,p=a.length-2;u<p;u++)h[u]=a[u]}else h.length=h.length-2;return c}static makeClockwise(t){let s=t,i=t.length,r=s[i-2]*s[1]-s[0]*s[i-1],l=0,o=0,n=0,a=0;for(let h=0,c=i-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],r+=l*a-n*o;if(!(r<0))for(let h=0,c=i-2,f=i>>1;h<f;h+=2){let d=s[h],m=s[h+1],u=c-h;s[h]=s[u],s[h+1]=s[u+1],s[u]=d,s[u+1]=m}}},$s=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Bt,i=typeof e=="string"?JSON.parse(e):e,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=S(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let l=0;l<i.bones.length;l++){let o=i.bones[l],n=null,a=S(o,"parent",null);a&&(n=s.findBone(a));let h=new qe(s.bones.length,o.name,n);h.length=S(o,"length",0)*t,h.x=S(o,"x",0)*t,h.y=S(o,"y",0)*t,h.rotation=S(o,"rotation",0),h.scaleX=S(o,"scaleX",1),h.scaleY=S(o,"scaleY",1),h.shearX=S(o,"shearX",0),h.shearY=S(o,"shearY",0),h.inherit=E.enumValue(Ht,S(o,"inherit","Normal")),h.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&h.color.setFromString(c),s.bones.push(h)}if(i.slots)for(let l=0;l<i.slots.length;l++){let o=i.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new Ze(s.slots.length,n,a),c=S(o,"color",null);c&&h.color.setFromString(c);let f=S(o,"dark",null);f&&(h.darkColor=V.fromString(f)),h.attachmentName=S(o,"attachment",null),h.blendMode=E.enumValue(ts,S(o,"blend","normal")),h.visible=S(o,"visible",!0),s.slots.push(h)}if(i.ik)for(let l=0;l<i.ik.length;l++){let o=i.ik[l],n=new He(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let c=s.findBone(o.bones[h]);if(!c)throw new Error(`Couldn't find bone ${o.bones[h]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=S(o,"mix",1),n.softness=S(o,"softness",0)*t,n.bendDirection=S(o,"bendPositive",!0)?1:-1,n.compress=S(o,"compress",!1),n.stretch=S(o,"stretch",!1),n.uniform=S(o,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let l=0;l<i.transform.length;l++){let o=i.transform[l],n=new es(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=h,n.local=S(o,"local",!1),n.relative=S(o,"relative",!1),n.offsetRotation=S(o,"rotation",0),n.offsetX=S(o,"x",0)*t,n.offsetY=S(o,"y",0)*t,n.offsetScaleX=S(o,"scaleX",0),n.offsetScaleY=S(o,"scaleY",0),n.offsetShearY=S(o,"shearY",0),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),n.mixScaleX=S(o,"mixScaleX",1),n.mixScaleY=S(o,"mixScaleY",n.mixScaleX),n.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let l=0;l<i.path.length;l++){let o=i.path[l],n=new $e(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=h,n.positionMode=E.enumValue(je,S(o,"positionMode","Percent")),n.spacingMode=E.enumValue(Je,S(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Ke,S(o,"rotateMode","Tangent")),n.offsetRotation=S(o,"rotation",0),n.position=S(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=S(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let l=0;l<i.physics.length;l++){const o=i.physics[l],n=new Ws(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);const a=o.bone,h=s.findBone(a);if(h==null)throw new Error("Physics bone not found: "+a);n.bone=h,n.x=S(o,"x",0),n.y=S(o,"y",0),n.rotate=S(o,"rotate",0),n.scaleX=S(o,"scaleX",0),n.shearX=S(o,"shearX",0),n.limit=S(o,"limit",5e3)*t,n.step=1/S(o,"fps",60),n.inertia=S(o,"inertia",1),n.strength=S(o,"strength",100),n.damping=S(o,"damping",1),n.massInverse=1/S(o,"mass",1),n.wind=S(o,"wind",0),n.gravity=S(o,"gravity",0),n.mix=S(o,"mix",1),n.inertiaGlobal=S(o,"inertiaGlobal",!1),n.strengthGlobal=S(o,"strengthGlobal",!1),n.dampingGlobal=S(o,"dampingGlobal",!1),n.massGlobal=S(o,"massGlobal",!1),n.windGlobal=S(o,"windGlobal",!1),n.gravityGlobal=S(o,"gravityGlobal",!1),n.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let l=0;l<i.skins.length;l++){let o=i.skins[l],n=new Et(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let f in c){let d=this.readAttachment(c[f],n,h.index,f,s);d&&n.setAttachment(h.index,f,d)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let l in i.events){let o=i.events[l],n=new Ge(l);n.intValue=S(o,"int",0),n.floatValue=S(o,"float",0),n.stringValue=S(o,"string",""),n.audioPath=S(o,"audio",null),n.audioPath&&(n.volume=S(o,"volume",1),n.balance=S(o,"balance",0)),s.events.push(n)}if(i.animations)for(let l in i.animations){let o=i.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(e,t,s,i,r){let l=this.scale;switch(i=S(e,"name",i),S(e,"type","region")){case"region":{let o=S(e,"path",i),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,i,o,n);if(!a)return null;a.path=o,a.x=S(e,"x",0)*l,a.y=S(e,"y",0)*l,a.scaleX=S(e,"scaleX",1),a.scaleY=S(e,"scaleY",1),a.rotation=S(e,"rotation",0),a.width=e.width*l,a.height=e.height*l,a.sequence=n;let h=S(e,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=S(e,"path",i),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,i,o,n);if(!a)return null;a.path=o;let h=S(e,"color",null);h&&a.color.setFromString(h),a.width=S(e,"width",0)*l,a.height=S(e,"height",0)*l,a.sequence=n;let c=S(e,"parent",null);if(c)return this.linkedMeshes.push(new ei(a,S(e,"skin",null),s,c,S(e,"timelines",!0))),a;let f=e.uvs;return this.readVertices(e,a,f.length),a.triangles=e.triangles,a.regionUVs=f,a.region!=null&&a.updateRegion(),a.edges=S(e,"edges",null),a.hullLength=S(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=S(e,"closed",!1),o.constantSpeed=S(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*l;o.lengths=a;let h=S(e,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=S(e,"x",0)*l,o.y=S(e,"y",0)*l,o.rotation=S(e,"rotation",0);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let n=S(e,"end",null);n&&(o.endSlot=r.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let h=S(e,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(e){if(e==null)return null;let t=new vs(S(e,"count",0));return t.start=S(e,"start",1),t.digits=S(e,"digits",0),t.setupIndex=S(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let n=E.toFloatArray(r);if(i!=1)for(let a=0,h=r.length;a<h;a++)n[a]*=i;t.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let h=r[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(r[n]),l.push(r[n+1]*i),l.push(r[n+2]*i),l.push(r[n+3])}t.bones=o,t.vertices=E.toFloatArray(l)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let h=a.index;for(let c in n){let f=n[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new xt(d,h);for(let u=0;u<d;u++){let p=f[u];m.setFrame(u,S(p,"time",0),S(p,"name",null))}r.push(m)}else if(c=="rgba"){let m=new pe(d,d<<2,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=f[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=V.fromString(x.color),C=u.curve;C&&(g=z(C,m,g,w,0,p,y,b.r,v.r,1),g=z(C,m,g,w,1,p,y,b.g,v.g,1),g=z(C,m,g,w,2,p,y,b.b,v.b,1),g=z(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,u=x}r.push(m)}else if(c=="rgb"){let m=new xe(d,d*3,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=f[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=V.fromString(x.color),C=u.curve;C&&(g=z(C,m,g,w,0,p,y,b.r,v.r,1),g=z(C,m,g,w,1,p,y,b.g,v.g,1),g=z(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,u=x}r.push(m)}else if(c=="alpha")r.push(at(f,new be(d,d,h),0,1));else if(c=="rgba2"){let m=new we(d,d*7,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.light),w=V.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=V.fromString(y.light),A=V.fromString(y.dark),k=u.curve;k&&(x=z(k,m,x,g,0,p,v,b.r,C.r,1),x=z(k,m,x,g,1,p,v,b.g,C.g,1),x=z(k,m,x,g,2,p,v,b.b,C.b,1),x=z(k,m,x,g,3,p,v,b.a,C.a,1),x=z(k,m,x,g,4,p,v,w.r,A.r,1),x=z(k,m,x,g,5,p,v,w.g,A.g,1),x=z(k,m,x,g,6,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}else if(c=="rgb2"){let m=new ye(d,d*6,h),u=f[0],p=S(u,"time",0),b=V.fromString(u.light),w=V.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,w.r,w.g,w.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=V.fromString(y.light),A=V.fromString(y.dark),k=u.curve;k&&(x=z(k,m,x,g,0,p,v,b.r,C.r,1),x=z(k,m,x,g,1,p,v,b.g,C.g,1),x=z(k,m,x,g,2,p,v,b.b,C.b,1),x=z(k,m,x,g,3,p,v,w.r,A.r,1),x=z(k,m,x,g,4,p,v,w.g,A.g,1),x=z(k,m,x,g,5,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let h=a.index;for(let c in n){let f=n[c],d=f.length;if(d!=0){if(c==="rotate")r.push(at(f,new Ft(d,d,h),0,1));else if(c==="translate"){let m=new ae(d,d<<1,h);r.push(is(f,m,"x","y",0,i))}else if(c==="translatex"){let m=new oe(d,d,h);r.push(at(f,m,0,i))}else if(c==="translatey"){let m=new le(d,d,h);r.push(at(f,m,0,i))}else if(c==="scale"){let m=new he(d,d<<1,h);r.push(is(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new ce(d,d,h);r.push(at(f,m,1,1))}else if(c==="scaley"){let m=new de(d,d,h);r.push(at(f,m,1,1))}else if(c==="shear"){let m=new fe(d,d<<1,h);r.push(is(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new ue(d,d,h);r.push(at(f,m,0,1))}else if(c==="sheary"){let m=new me(d,d,h);r.push(at(f,m,0,1))}else if(c==="inherit"){let m=new ge(d,a.index);for(let u=0;u<f.length;u++){let p=f[u];m.setFrame(u,S(p,"time",0),E.enumValue(Ht,S(p,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let h=s.findIkConstraint(o);if(!h)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(h),f=new Ce(n.length,n.length<<1,c),d=S(a,"time",0),m=S(a,"mix",1),u=S(a,"softness",0)*i;for(let p=0,b=0;;p++){f.setFrame(p,d,m,u,S(a,"bendPositive",!0)?1:-1,S(a,"compress",!1),S(a,"stretch",!1));let w=n[p+1];if(!w){f.shrink(b);break}let g=S(w,"time",0),x=S(w,"mix",1),y=S(w,"softness",0)*i,v=a.curve;v&&(b=z(v,f,b,p,0,d,g,m,x,1),b=z(v,f,b,p,1,d,g,u,y,i)),d=g,m=x,u=y,a=w}r.push(f)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let h=s.findTransformConstraint(o);if(!h)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(h),f=new Ae(n.length,n.length*6,c),d=S(a,"time",0),m=S(a,"mixRotate",1),u=S(a,"mixX",1),p=S(a,"mixY",u),b=S(a,"mixScaleX",1),w=S(a,"mixScaleY",b),g=S(a,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,p,b,w,g);let v=n[x+1];if(!v){f.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=S(v,"mixScaleX",1),M=S(v,"mixScaleY",Y),F=S(v,"mixShearY",1),P=a.curve;P&&(y=z(P,f,y,x,0,d,C,m,A,1),y=z(P,f,y,x,1,d,C,u,k,1),y=z(P,f,y,x,2,d,C,p,T,1),y=z(P,f,y,x,3,d,C,b,Y,1),y=z(P,f,y,x,4,d,C,w,M,1),y=z(P,f,y,x,5,d,C,g,F,1)),d=C,m=A,u=k,p=T,b=Y,w=M,b=Y,a=v}r.push(f)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let h=s.pathConstraints.indexOf(a);for(let c in n){let f=n[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new Se(m,m,h);r.push(at(f,u,0,a.positionMode==0?i:1))}else if(c==="spacing"){let u=new ke(m,m,h);r.push(at(f,u,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let u=new Te(m,m*3,h),p=S(d,"time",0),b=S(d,"mixRotate",1),w=S(d,"mixX",1),g=S(d,"mixY",w);for(let x=0,y=0;;x++){u.setFrame(x,p,b,w,g);let v=f[x+1];if(!v){u.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=d.curve;Y&&(y=z(Y,u,y,x,0,p,C,b,A,1),y=z(Y,u,y,x,1,p,C,w,k,1),y=z(Y,u,y,x,2,p,C,g,T,1)),p=C,b=A,w=k,g=T,d=v}r.push(u)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let h=s.findPhysicsConstraint(o);if(!h)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(h)}for(let h in n){let c=n[h],f=c[0];if(!f)continue;let d=c.length;if(h=="reset"){const u=new Ee(d,a);for(let p=0;f!=null;f=c[p+1],p++)u.setFrame(p,S(f,"time",0));r.push(u);continue}let m;if(h=="inertia")m=new Ie(d,d,a);else if(h=="strength")m=new Me(d,d,a);else if(h=="damping")m=new Ye(d,d,a);else if(h=="mass")m=new Xe(d,d,a);else if(h=="wind")m=new Fe(d,d,a);else if(h=="gravity")m=new Pe(d,d,a);else if(h=="mix")m=new Be(d,d,a);else continue;r.push(at(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],f=s.findSlot(h);if(!f)throw new Error("Slot not found: "+h);let d=f.index;for(let m in c){let u=c[m],p=a.getAttachment(d,m);for(let b in u){let w=u[b],g=w[0];if(g){if(b=="deform"){let x=p.bones,y=p.vertices,v=x?y.length/3*2:y.length,C=new ve(w.length,w.length,d,p),A=S(g,"time",0);for(let k=0,T=0;;k++){let Y,M=S(g,"vertices",null);if(!M)Y=x?E.newFloatArray(v):y;else{Y=E.newFloatArray(v);let X=S(g,"offset",0);if(E.arrayCopy(M,0,Y,X,M.length),i!=1)for(let D=X,N=D+M.length;D<N;D++)Y[D]*=i;if(!x)for(let D=0;D<v;D++)Y[D]+=y[D]}C.setFrame(k,A,Y);let F=w[k+1];if(!F){C.shrink(T);break}let P=S(F,"time",0),I=g.curve;I&&(T=z(I,C,T,k,0,A,P,0,1,1)),A=P,g=F}r.push(C)}else if(b=="sequence"){let x=new Re(w.length,d,p),y=0;for(let v=0;v<w.length;v++){let C=S(g,"delay",y),A=S(g,"time",0),k=Cs[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,A,k,T,C),y=C,g=w[v+1]}r.push(x)}}}}}}if(e.drawOrder){let o=new At(e.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<e.drawOrder.length;h++,a++){let c=e.drawOrder[h],f=null,d=S(c,"offsets",null);if(d){f=E.newArray(n,-1);let m=E.newArray(n-d.length,0),u=0,p=0;for(let b=0;b<d.length;b++){let w=d[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[p++]=u++;f[u+w.offset]=u++}for(;u<n;)m[p++]=u++;for(let b=n-1;b>=0;b--)f[b]==-1&&(f[b]=m[--p])}o.setFrame(a,S(c,"time",0),f)}r.push(o)}if(e.events){let o=new Ut(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let h=e.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let f=new ze(E.toSinglePrecision(S(h,"time",0)),c);f.intValue=S(h,"int",c.intValue),f.floatValue=S(h,"float",c.floatValue),f.stringValue=S(h,"string",c.stringValue),f.data.audioPath&&(f.volume=S(h,"volume",1),f.balance=S(h,"balance",0)),o.setFrame(n,f)}r.push(o)}let l=0;for(let o=0,n=r.length;o<n;o++)l=Math.max(l,r[o].getDuration());s.animations.push(new Ot(t,r,l))}},ei=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function at(e,t,s,i){let r=e[0],l=S(r,"time",0),o=S(r,"value",s)*i,n=0;for(let a=0;;a++){t.setFrame(a,l,o);let h=e[a+1];if(!h)return t.shrink(n),t;let c=S(h,"time",0),f=S(h,"value",s)*i;r.curve&&(n=z(r.curve,t,n,a,0,l,c,o,f,i)),l=c,o=f,r=h}}function is(e,t,s,i,r,l){let o=e[0],n=S(o,"time",0),a=S(o,s,r)*l,h=S(o,i,r)*l,c=0;for(let f=0;;f++){t.setFrame(f,n,a,h);let d=e[f+1];if(!d)return t.shrink(c),t;let m=S(d,"time",0),u=S(d,s,r)*l,p=S(d,i,r)*l,b=o.curve;b&&(c=z(b,t,c,f,0,n,m,a,u,l),c=z(b,t,c,f,1,n,m,h,p,l)),n=m,a=u,h=p,o=d}}function z(e,t,s,i,r,l,o,n,a,h){if(e=="stepped")return t.setStepped(i),s;let c=r<<2,f=e[c],d=e[c+1]*h,m=e[c+2],u=e[c+3]*h;return t.setBezier(s,i,r,l,n,f,d,m,u,o,a),s+1}function S(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));import{checkExtension as ns,copySearchParams as si,DOMAdapter as ri,ExtensionType as js,extensions as ii,LoaderParserPriority as ni,path as jt,Resolver as ai,TextureSource as Js}from"pixi.js";import{Texture as oi}from"pixi.js";var as=class ut extends _e{static textureMap=new Map;static from(t){return ut.textureMap.has(t)?ut.textureMap.get(t):new ut(t)}texture;constructor(t){super(t.resource),this.texture=oi.from(t)}setFilters(t,s){const i=this.texture.source.style;i.minFilter=ut.toPixiTextureFilter(t),i.magFilter=ut.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=ut.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,s){const i=this.texture.source.style;i.addressModeU=ut.toPixiTextureWrap(t),i.addressModeV=ut.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Rt="spineTextureAtlasLoader",li={extension:js.Asset,resolver:{test:e=>ns(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(ai.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{id:Rt,name:Rt,extension:{type:js.LoadParser,priority:ni.Normal,name:Rt},test(e){return ns(e,".atlas")},async load(e){return await(await ri.get().fetch(e)).text()},testParse(e,t){const s=ns(t.src,".atlas"),i=typeof e=="string",r=t.parser===Rt||t.loadParser===Rt;return Promise.resolve((s||r)&&i)},unload(e){e.dispose()},async parse(e,t,s){const i=t.data||{};let r=jt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const l=new Gt(e);if(i.images instanceof Js||typeof i.images=="string"){const n=i.images;i.images={},i.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=i?.images?i.images[a]:void 0;if(h instanceof Js)n.setTexture(as.from(h));else{const c=h??jt.normalize([...r.split(jt.sep),a].join(jt.sep)),f={src:si(c,t.src),data:{...i.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=s.load(f).then(m=>{n.setTexture(as.from(m.source))});o.push(d)}}return await Promise.all(o),l}}};ii.add(li);import{checkExtension as os,DOMAdapter as hi,ExtensionType as Ks,extensions as ci,LoaderParserPriority as di}from"pixi.js";var Dt="spineSkeletonLoader";function fi(e){return Object.prototype.hasOwnProperty.call(e,"bones")}function ui(e){return e instanceof Uint8Array}var mi={extension:Ks.Asset,loader:{id:Dt,name:Dt,extension:{type:Ks.LoadParser,priority:di.Normal,name:Dt},test(e){return os(e,".skel")},async load(e){const t=await hi.get().fetch(e);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=os(t.src,".json")&&fi(e),i=os(t.src,".skel")&&ui(e),r=t.parser===Dt||t.loadParser===Dt;return Promise.resolve(s||i||r)}}};ci.add(mi);import{Batcher as gi,Color as pi,extensions as xi,ExtensionType as bi}from"pixi.js";import{Buffer as Qs,BufferUsage as Jt,Geometry as wi}from"pixi.js";var yi=new Float32Array(1),vi=new Uint32Array(1),Ci=class extends wi{constructor(){const t=new Qs({data:yi,label:"attribute-batch-buffer",usage:Jt.VERTEX|Jt.COPY_DST,shrinkToFit:!1}),s=new Qs({data:vi,label:"index-batch-buffer",usage:Jt.INDEX|Jt.COPY_DST,shrinkToFit:!1}),i=7*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:4*4},aDarkColor:{buffer:t,format:"unorm8x4",stride:i,offset:5*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:6*4}},indexBuffer:s})}};import{colorBit as Ai,colorBitGl as Si,compileHighShaderGlProgram as ki,compileHighShaderGpuProgram as Ti,generateTextureBatchBit as Ii,generateTextureBatchBitGl as Mi,getBatchSamplersUniformGroup as Yi,roundPixelsBit as Xi,roundPixelsBitGl as Fi,Shader as Pi}from"pixi.js";var Bi={name:"color-bit",vertex:{header:`
3
3
  @in aDarkColor: vec4<f32>;
4
4
  @out vDarkColor: vec4<f32>;
5
5
  `,main:`
@@ -24,4 +24,4 @@
24
24
 
25
25
  finalColor.a = outColor.a * vColor.a;
26
26
  finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
27
- `}},Ri=class extends Pi{constructor(e){const t=ki({name:"dark-tint-batch",bits:[Si,Ei,Mi(e),Fi]}),s=Ti({name:"dark-tint-batch",bits:[Ai,Bi,Ii(e),Xi]});super({glProgram:t,gpuProgram:s,resources:{batchSamplers:Yi(e)}})}},Zs=null,Li=class fr extends gi{static extension={type:[bi.Batcher],name:"darkTint"};geometry=new Ci;shader=Zs||(Zs=new Ri(this.maxTextures));name=fr.extension.name;vertexSize=7;packAttributes(t,s,i,r,l){const o=l<<16|t.roundPixels&65535,n=t.transform,a=n.a,h=n.b,c=n.c,f=n.d,d=n.tx,m=n.ty,{positions:u,uvs:p}=t,b=t.color,w=(b>>24&255)/255,g=pi.shared.setValue(t.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=t.attributeOffset,y=x+t.attributeSize;for(let v=x;v<y;v++){const C=v*2,A=u[C],k=u[C+1];s[r++]=a*A+c*k+d,s[r++]=f*k+h*A+m,s[r++]=p[C],s[r++]=p[C+1],i[r++]=b,i[r++]=g,i[r++]=o}}packQuadAttributes(t,s,i,r,l){const o=t.texture,n=t.transform,a=n.a,h=n.b,c=n.c,f=n.d,d=n.tx,m=n.ty,u=t.bounds,p=u.maxX,b=u.minX,w=u.maxY,g=u.minY,x=o.uvs,y=t.color,v=t.darkColor,C=l<<16|t.roundPixels&65535;s[r+0]=a*b+c*g+d,s[r+1]=f*g+h*b+m,s[r+2]=x.x0,s[r+3]=x.y0,i[r+4]=y,i[r+5]=v,i[r+6]=C,s[r+7]=a*p+c*g+d,s[r+8]=f*g+h*p+m,s[r+9]=x.x1,s[r+10]=x.y1,i[r+11]=y,i[r+12]=v,i[r+13]=C,s[r+14]=a*p+c*w+d,s[r+15]=f*w+h*p+m,s[r+16]=x.x2,s[r+17]=x.y2,i[r+18]=y,i[r+19]=v,i[r+20]=C,s[r+21]=a*b+c*w+d,s[r+22]=f*w+h*b+m,s[r+23]=x.x3,s[r+24]=x.y3,i[r+25]=y,i[r+26]=v,i[r+27]=C}};xi.add(Li);import{ExtensionType as ls,extensions as Di}from"pixi.js";var Vi=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const e=this.data.color,t=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const r=e.a*s*255;if(t!==16777215){const l=t>>16&255,o=t>>8&255,n=t&255,a=e.r*n,h=e.g*o,c=e.b*l;i=r<<24|c<<16|h<<8|a}else i=r<<24|e.b*255<<16|e.g*255<<8|e.r*255;return i}get darkColor(){const e=this.data.darkColor;return e.b*255<<16|e.g*255<<8|e.r*255}get groupTransform(){return this.renderable.groupTransform}setData(e,t,s,i){if(this.renderable=e,this.transform=e.groupTransform,this.data=t,t.clipped){const r=t.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.uvs}else this.indexSize=t.indices.length,this.attributeSize=t.vertices.length/2,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs;this.texture=t.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=t.darkTint?"darkTint":"default"}},Ni={0:"normal",1:"add",2:"multiply",3:"screen"},tr=class{static extension={type:[ls.WebGLPipes,ls.WebGPUPipes,ls.CanvasPipes],name:"spine"};renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(e){this.renderer=e}validateRenderable(e){if(e._validateAndTransformAttachments(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let i=0,r=t.length;i<r;i++){const l=t[i],o=l.getAttachment();if(o instanceof nt||o instanceof ct){const n=e._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a.texture&&!a._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}addRenderable(e,t){const s=this._getSpineData(e),i=this.renderer.renderPipes.batch,r=e.skeleton.drawOrder,l=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let o=0,n=r.length;o<n;o++){const a=r[o],h=a.getAttachment(),c=Ni[a.data.blendMode];let f=!1;if(h instanceof nt||h instanceof ct){const m=e._getCachedData(a,h),u=s.slotBatches[m.id]||=new Vi;u.setData(e,m,c,l),f=m.skipRender,f||i.addToBatch(u,t)}const d=e._slotsObject[a.data.name];if(d){const m=d.container;f||(m.includeInBuild=!0,m.collectRenderables(t,this.renderer,null)),m.includeInBuild=!1}}}updateRenderable(e){const t=this.gpuSpineData[e.uid];e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;const s=e.skeleton.drawOrder;for(let i=0,r=s.length;i<r;i++){const l=s[i],o=l.getAttachment();if((o instanceof nt||o instanceof ct)&&!e._getCachedData(l,o).skipRender){const a=t.slotBatches[e._getCachedData(l,o).id];a._batcher?.updateElement(a)}}}destroyRenderable(e){this.gpuSpineData[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(e){return this.gpuSpineData[e.uid]||this._initMeshData(e)}_initMeshData(e){return this.gpuSpineData[e.uid]={slotBatches:{}},e.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[e.uid]}};Di.add(tr);import{Assets as er,Cache as hs,Container as Oi,fastCopy as _i,Graphics as Ui,Texture as qi,Ticker as Kt,ViewContainer as Wi}from"pixi.js";var Qt=new Xt;kt.yDown=!0;var Tt=new $t,zi=class{constructor(e,t,s,i){this.x=e,this.y=t,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Gi=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new kt(e.skeleton.data);t.setToSetupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new $t:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Hi=class{constructor(e,t=[],s=.05,i=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=i}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new Le(e.state.data),s=new kt(e.skeleton.data),i=this.clipping?new $t:void 0,r=s.data;if(this.skins.length>0){let o=new Et("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?r.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(2);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let d=0;d<c;d++){const m=d>0?this.timeStep:0;t.update(m),t.apply(s),s.update(m),s.updateWorldTransform(2);const u=s.getBoundsRect(i);o=Math.min(o,u.x),n=Math.min(n,u.y),a=Math.max(a,u.x+u.width),h=Math.max(h,u.y+u.height)}const f={x:o,y:n,width:a-o,height:h-n};return f.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:f}}},sr=new Ct(()=>new Ui),$i=class ms extends Wi{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!1;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?Kt.shared.add(this.internalUpdate,this):!t&&this._autoUpdate&&Kt.shared.remove(this.internalUpdate,this),this._autoUpdate=t}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Bt&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const s=t instanceof Bt?t:t.skeletonData;this.skeleton=new kt(s),this.state=new Le(new Fs(s)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):t?.darkTint;const i=this.skeleton.slots;for(let r=0;r<i.length;r++)this.attachmentCacheData[r]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(s??Kt.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,s){const i=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(i)} not found`);if(Qt.set(s.x,s.y),t.parent){const r=t.parent.worldToLocal(Qt);t.x=r.x,t.y=-r.y}else t.x=Qt.x,t.y=Qt.y}getBonePosition(t,s){const i=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(s||(s={x:0,y:0}),s.x=t.worldX,s.y=t.worldY,s):(console.error(`Cant set bone position! Bone ${String(i)} not found`),s)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,s=this._lastAttachments;let i=0,r=!1;for(let l=0;l<t.length;l++){const n=t[l].getAttachment();n&&(n!==s[i]&&(r=!0,s[i]=n),i++)}i!==s.length&&(r=!0,s.length=i),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(t,s){const i=t.attachment;if(i&&i instanceof bt){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot,l=this._slotsObject[t.data.name];if(r&&l){let o=r.mask;if(o||(o=sr.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const h=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof bt)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),sr.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const t=this.skeleton.drawOrder;for(let s=0;s<t.length;s++){const i=t[s];this.updateAndSetPixiMask(i,s===t.length-1);const r=i.getAttachment();if(r){if(r instanceof ct||r instanceof nt){const l=this._getCachedData(i,r);r instanceof nt?r.computeWorldVertices(i,l.vertices,0,2):r.computeWorldVertices(i,0,r.worldVerticesLength,l.vertices,0,2),l.uvs.length<r.uvs.length&&(l.uvs=new Float32Array(r.uvs.length)),_i(r.uvs.buffer,l.uvs.buffer);const n=i.bone.skeleton.color,a=i.color,h=r.color,c=n.a*a.a*h.a;if(l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,c),this.alpha===0||c===0)l.skipRender||(this.spineAttachmentsDirty=!0),l.skipRender=!0;else{l.skipRender&&(this.spineAttachmentsDirty=!0),l.skipRender=l.clipped=!1,i.darkColor&&l.darkColor.setFromColor(i.darkColor);const f=r.region?.texture.texture||qi.EMPTY;l.texture!==f&&(l.texture=f,this.spineTexturesDirty=!0),Tt.isClipping()&&this.updateClippingData(l)}}else if(r instanceof bt){Tt.clipStart(i,r);continue}}Tt.clipEndWithSlot(i)}Tt.clipEnd()}updateClippingData(t){t.clipped=!0,Tt.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:s,clippedUVs:i,clippedTriangles:r}=Tt,l=s.length/2,o=r.length;t.clippedData||(t.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=t.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;t.skipRender=l===0,a&&(this.spineAttachmentsDirty=!0,n.vertexCount<l&&(n.vertices=new Float32Array(l*2),n.uvs=new Float32Array(l*2)),n.indices.length<o&&(n.indices=new Uint16Array(o)));const{vertices:h,uvs:c,indices:f}=n;for(let d=0;d<l;d++)h[d*2]=s[d*2],h[d*2+1]=s[d*2+1],c[d*2]=i[d*2],c[d*2+1]=i[d*2+1];n.vertexCount=l;for(let d=0;d<o;d++)f[d]!==r[d]&&(this.spineAttachmentsDirty=!0,f[d]=r[d]);n.indicesCount=o}updateSlotObjects(){for(const t in this._slotsObject){const s=this._slotsObject[t];s&&this.updateSlotObject(s)}}updateSlotObject(t){const{slot:s,container:i}=t,r=t.followAttachmentTimeline?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&r,i.visible){let l=s.bone;i.position.set(l.worldX,l.worldY),i.angle=l.getWorldRotationX();let o=1,n=1;for(;l;)o*=l.scaleX,n*=l.scaleY,l=l.parent;o<0&&(i.angle-=180),i.scale.set(s.bone.getWorldScaleX()*Math.sign(o),s.bone.getWorldScaleY()*Math.sign(n)),i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,s){return this.attachmentCacheData[t.data.index][s.name]||this.initCachedData(t,s)}initCachedData(t,s){let i;return s instanceof nt?(i=new Float32Array(8),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:i,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(i=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:i,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[t.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,s,i){t=this.getSlotFromRef(t);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(t),s.includeInBuild=!1,this.addChild(s);const r={container:s,slot:t,followAttachmentTimeline:i?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=r,this.updateSlotObject(r)}removeSlotObject(t){let s;if(t instanceof Oi){for(const i in this._slotsObject)if(this._slotsObject[i]?.container===t){this._slotsObject[i]=null,s=t;break}}else{const i=this.getSlotFromRef(t);s=this._slotsObject[i.data.name]?.container,this._slotsObject[i.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([t,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[t]})}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new rs;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),i=this._bounds;i.clear(),i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,i=this._bounds;i.clear();for(let r=0;r<s.length;r++){const l=s[r],o=l.getAttachment();if(o&&(o instanceof nt||o instanceof ct)){const n=this._getCachedData(l,o);i.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),Kt.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.worldToLocal(t):s.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:i=1,darkTint:r,autoUpdate:l=!0,boundsProvider:o}){const n=`${t}-${s}-${i}`;if(hs.has(n))return new ms({skeletonData:hs.get(n),darkTint:r,autoUpdate:l,boundsProvider:o});const a=er.get(t),h=er.get(s),c=new Ls(h),f=a instanceof Uint8Array?new zs(c):new $s(c);f.scale=i;const d=f.readSkeletonData(a);return hs.set(n,d),new ms({skeletonData:d,darkTint:r,autoUpdate:l,boundsProvider:o})}};import{Container as cs,Graphics as ot,Text as ji}from"pixi.js";var Ji=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new cs,bones:new cs,skeletonXY:new ot,regionAttachmentsShape:new ot,meshTrianglesLine:new ot,meshHullLine:new ot,clippingPolygon:new ot,boundingBoxesRect:new ot,boundingBoxesCircle:new ot,boundingBoxesPolygon:new ot,pathsCurve:new ot,pathsLine:new ot,eventText:new cs,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(e.scale.x||e.scale.y||1),l=new ji({text:i.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(e.scale.x),l.anchor.set(.5),t.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let r=t.bones.children.length;r>0;r--)t.bones.children[r-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(e.scale.x||e.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,i,s),this.drawPaths&&this.drawPathsFunc(e,t,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,i),this.drawClipping&&this.drawClippingFunc(e,t,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,i),this.drawEvents)for(const r of t.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(e,t,s,i){const r=e.skeleton,l=r.x,o=r.y,n=r.bones;t.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const f=n[h],d=f.data.length,m=l+f.worldX,u=o+f.worldY,p=l+d*f.a+f.worldX,b=o+d*f.b+f.worldY;if(f.data.name==="root"||f.data.parent===null)continue;const w=Math.abs(m-p),g=Math.abs(u-b),x=Math.pow(w,2),y=g,v=Math.pow(g,2),C=Math.sqrt(x+v),A=Math.pow(C,2),k=Math.PI/180,T=Math.acos((A+v-x)/(2*y*C))||0;if(C===0)continue;const Y=new ot;t.bones.addChild(Y);const M=C/50/i;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=u,Y.pivot.y=C;let F=0;m<p&&u<b?F=-T+180*k:m>p&&u<b?F=180*k+T:m>p&&u>b?F=-T:m<p&&u>b?F=T:u===b&&m<p?F=90*k:u===b&&m>p?F=-90*k:m===p&&u<b?F=180*k:m===p&&u>b&&(F=0),Y.rotation=F,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;t.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l],a=n.getAttachment();if(a===null||!(a instanceof nt))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),t.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}t.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof ct))continue;const h=a,c=new Float32Array(h.worldVerticesLength),f=h.triangles;let d=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,u=f.length;m<u;m+=3){const p=f[m]*2,b=f[m+1]*2,w=f[m+2]*2;t.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&d>0){d=(d>>1)*2;let m=c[d-2],u=c[d-1];for(let p=0,b=d;p<b;p+=2){const w=c[p],g=c[p+1];t.meshHullLine.context.moveTo(w,g).lineTo(m,u),m=w,u=g}}}t.meshHullLine.stroke({width:s,color:this.meshHullColor}),t.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof bt))continue;const h=a,c=h.worldVerticesLength,f=new Float32Array(c);h.computeWorldVertices(n,0,c,f,0,2),t.clippingPolygon.poly(Array.from(f))}t.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(e,t,s){const i=new rs;i.update(e.skeleton,!0),i.minX!==1/0&&t.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const r=i.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let f=0,d=o.length;f<d;f+=2){const m=o[f],u=o[f+1];t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(m,u,c),t.boundingBoxesCircle.fill(0),t.boundingBoxesCircle.circle(m,u,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,u)}t.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=r.length;o<n;o++){const a=r[o];l(a,0,a.length)}}drawPathsFunc(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof St))continue;const h=a;let c=h.worldVerticesLength;const f=new Float32Array(c);h.computeWorldVertices(n,0,c,f,0,2);let d=f[2],m=f[3],u=0,p=0;if(h.closed){const b=f[0],w=f[1],g=f[c-2],x=f[c-1];u=f[c-4],p=f[c-3],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(b,w,g,x,u,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(b,w),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=f[b],g=f[b+1],x=f[b+2],y=f[b+3];u=f[b+4],p=f[b+5],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(w,g,x,y,u,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(w,g),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(x,y),d=u,m=p}}t.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),t.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};export{zi as AABBRectangleBoundsProvider,be as AlphaTimeline,Ot as Animation,Le as AnimationState,br as AnimationStateAdapter,Fs as AnimationStateData,Ds as AssetCache,vr as AssetManagerBase,Ls as AtlasAttachmentLoader,ne as Attachment,xt as AttachmentTimeline,Gs as BinaryInput,ts as BlendMode,We as Bone,qe as BoneData,Oe as BoundingBoxAttachment,Xs as CURRENT,bt as ClippingAttachment,V as Color,Pt as ConstraintData,it as CurveTimeline,st as CurveTimeline1,_t as CurveTimeline2,gr as DebugUtils,ve as DeformTimeline,Vs as Downloader,At as DrawOrderTimeline,ze as Event,Ge as EventData,Is as EventQueue,Ut as EventTimeline,Ms as EventType,De as FIRST,wr as FakeTexture,Wt as HOLD_FIRST,Ys as HOLD_MIX,Ve as HOLD_SUBSEQUENT,Ns as IkConstraint,He as IkConstraintData,Ce as IkConstraintTimeline,Ht as Inherit,ge as InheritTimeline,ur as IntSet,ws as Interpolation,B as MathUtils,ct as MeshAttachment,Ss as MixBlend,ks as MixDirection,St as PathAttachment,Os as PathConstraint,$e as PathConstraintData,Te as PathConstraintMixTimeline,Se as PathConstraintPositionTimeline,ke as PathConstraintSpacingTimeline,qs as Physics,Ye as PhysicsConstraintDampingTimeline,Pe as PhysicsConstraintGravityTimeline,Ie as PhysicsConstraintInertiaTimeline,Xe as PhysicsConstraintMassTimeline,Be as PhysicsConstraintMixTimeline,Ee as PhysicsConstraintResetTimeline,Me as PhysicsConstraintStrengthTimeline,mt as PhysicsConstraintTimeline,Fe as PhysicsConstraintWindTimeline,Rs as PointAttachment,Ct as Pool,je as PositionMode,ys as Pow,mr as PowOut,ye as RGB2Timeline,we as RGBA2Timeline,pe as RGBATimeline,xe as RGBTimeline,nt as RegionAttachment,Ke as RotateMode,Ft as RotateTimeline,Ne as SETUP,qt as SUBSEQUENT,he as ScaleTimeline,ce as ScaleXTimeline,de as ScaleYTimeline,Re as SequenceTimeline,Gi as SetupPoseBoundsProvider,fe as ShearTimeline,ue as ShearXTimeline,me as ShearYTimeline,kt as Skeleton,zs as SkeletonBinary,rs as SkeletonBounds,$t as SkeletonClipping,Bt as SkeletonData,$s as SkeletonJson,Et as Skin,Qe as SkinEntry,Hi as SkinsAndAnimationBoundsProvider,_s as Slot,Ze as SlotData,Je as SpacingMode,$i as Spine,Ji as SpineDebugRenderer,tr as SpinePipe,as as SpineTexture,ie as StringSet,_e as Texture,Gt as TextureAtlas,Es as TextureAtlasPage,Ue as TextureAtlasRegion,zt as TextureFilter,Bs as TextureRegion,Ps as TextureWrap,pr as TimeKeeper,$ as Timeline,Ts as TrackEntry,Us as TransformConstraint,es as TransformConstraintData,Ae as TransformConstraintTimeline,ae as TranslateTimeline,oe as TranslateXTimeline,le as TranslateYTimeline,Hs as Triangulator,E as Utils,Xt as Vector2,ht as VertexAttachment,xr as WindowedMean};
27
+ `}},Ri=class extends Pi{constructor(e){const t=ki({name:"dark-tint-batch",bits:[Si,Ei,Mi(e),Fi]}),s=Ti({name:"dark-tint-batch",bits:[Ai,Bi,Ii(e),Xi]});super({glProgram:t,gpuProgram:s,resources:{batchSamplers:Yi(e)}})}},Zs=null,Di=class fr extends gi{static extension={type:[bi.Batcher],name:"darkTint"};geometry=new Ci;shader=Zs||(Zs=new Ri(this.maxTextures));name=fr.extension.name;vertexSize=7;packAttributes(t,s,i,r,l){const o=l<<16|t.roundPixels&65535,n=t.transform,a=n.a,h=n.b,c=n.c,f=n.d,d=n.tx,m=n.ty,{positions:u,uvs:p}=t,b=t.color,w=(b>>24&255)/255,g=pi.shared.setValue(t.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=t.attributeOffset,y=x+t.attributeSize;for(let v=x;v<y;v++){const C=v*2,A=u[C],k=u[C+1];s[r++]=a*A+c*k+d,s[r++]=f*k+h*A+m,s[r++]=p[C],s[r++]=p[C+1],i[r++]=b,i[r++]=g,i[r++]=o}}packQuadAttributes(t,s,i,r,l){const o=t.texture,n=t.transform,a=n.a,h=n.b,c=n.c,f=n.d,d=n.tx,m=n.ty,u=t.bounds,p=u.maxX,b=u.minX,w=u.maxY,g=u.minY,x=o.uvs,y=t.color,v=t.darkColor,C=l<<16|t.roundPixels&65535;s[r+0]=a*b+c*g+d,s[r+1]=f*g+h*b+m,s[r+2]=x.x0,s[r+3]=x.y0,i[r+4]=y,i[r+5]=v,i[r+6]=C,s[r+7]=a*p+c*g+d,s[r+8]=f*g+h*p+m,s[r+9]=x.x1,s[r+10]=x.y1,i[r+11]=y,i[r+12]=v,i[r+13]=C,s[r+14]=a*p+c*w+d,s[r+15]=f*w+h*p+m,s[r+16]=x.x2,s[r+17]=x.y2,i[r+18]=y,i[r+19]=v,i[r+20]=C,s[r+21]=a*b+c*w+d,s[r+22]=f*w+h*b+m,s[r+23]=x.x3,s[r+24]=x.y3,i[r+25]=y,i[r+26]=v,i[r+27]=C}};xi.add(Di);import{ExtensionType as ls,extensions as Li}from"pixi.js";var Vi=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const e=this.data.color,t=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const r=e.a*s*255;if(t!==16777215){const l=t>>16&255,o=t>>8&255,n=t&255,a=e.r*n,h=e.g*o,c=e.b*l;i=r<<24|c<<16|h<<8|a}else i=r<<24|e.b*255<<16|e.g*255<<8|e.r*255;return i}get darkColor(){const e=this.data.darkColor;return e.b*255<<16|e.g*255<<8|e.r*255}get groupTransform(){return this.renderable.groupTransform}setData(e,t,s,i){if(this.renderable=e,this.transform=e.groupTransform,this.data=t,t.clipped){const r=t.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.uvs}else this.indexSize=t.indices.length,this.attributeSize=t.vertices.length/2,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs;this.texture=t.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=t.darkTint?"darkTint":"default"}},Ni={0:"normal",1:"add",2:"multiply",3:"screen"},tr=class{static extension={type:[ls.WebGLPipes,ls.WebGPUPipes,ls.CanvasPipes],name:"spine"};renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(e){this.renderer=e}validateRenderable(e){if(e._validateAndTransformAttachments(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let i=0,r=t.length;i<r;i++){const l=t[i],o=l.getAttachment();if(o instanceof nt||o instanceof ct){const n=e._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a.texture&&!a._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}addRenderable(e,t){const s=this._getSpineData(e),i=this.renderer.renderPipes.batch,r=e.skeleton.drawOrder,l=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let o=0,n=r.length;o<n;o++){const a=r[o],h=a.getAttachment(),c=Ni[a.data.blendMode];let f=!1;if(h instanceof nt||h instanceof ct){const m=e._getCachedData(a,h),u=s.slotBatches[m.id]||=new Vi;u.setData(e,m,c,l),f=m.skipRender,f||i.addToBatch(u,t)}const d=e._slotsObject[a.data.name];if(d){const m=d.container;f||(m.includeInBuild=!0,m.collectRenderables(t,this.renderer,null)),m.includeInBuild=!1}}}updateRenderable(e){const t=this.gpuSpineData[e.uid];e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;const s=e.skeleton.drawOrder;for(let i=0,r=s.length;i<r;i++){const l=s[i],o=l.getAttachment();if((o instanceof nt||o instanceof ct)&&!e._getCachedData(l,o).skipRender){const a=t.slotBatches[e._getCachedData(l,o).id];a._batcher?.updateElement(a)}}}destroyRenderable(e){this.gpuSpineData[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(e){return this.gpuSpineData[e.uid]||this._initMeshData(e)}_initMeshData(e){return this.gpuSpineData[e.uid]={slotBatches:{}},e.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[e.uid]}};Li.add(tr);import{Assets as er,Cache as hs,Container as Oi,fastCopy as _i,Graphics as Ui,Texture as qi,Ticker as Kt,ViewContainer as Wi}from"pixi.js";var Qt=new Xt;kt.yDown=!0;var Tt=new $t,zi=class{constructor(e,t,s,i){this.x=e,this.y=t,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Gi=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new kt(e.skeleton.data);t.setToSetupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new $t:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Hi=class{constructor(e,t=[],s=.05,i=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=i}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new De(e.state.data),s=new kt(e.skeleton.data),i=this.clipping?new $t:void 0,r=s.data;if(this.skins.length>0){let o=new Et("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?r.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(2);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let d=0;d<c;d++){const m=d>0?this.timeStep:0;t.update(m),t.apply(s),s.update(m),s.updateWorldTransform(2);const u=s.getBoundsRect(i);o=Math.min(o,u.x),n=Math.min(n,u.y),a=Math.max(a,u.x+u.width),h=Math.max(h,u.y+u.height)}const f={x:o,y:n,width:a-o,height:h-n};return f.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:f}}},sr=new Ct(()=>new Ui),$i=class ms extends Wi{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!1;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?Kt.shared.add(this.internalUpdate,this):!t&&this._autoUpdate&&Kt.shared.remove(this.internalUpdate,this),this._autoUpdate=t}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Bt&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const s=t instanceof Bt?t:t.skeletonData;this.skeleton=new kt(s),this.state=new De(new Fs(s)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):t?.darkTint;const i=this.skeleton.slots;for(let r=0;r<i.length;r++)this.attachmentCacheData[r]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(s??Kt.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,s){const i=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(i)} not found`);if(Qt.set(s.x,s.y),t.parent){const r=t.parent.worldToLocal(Qt);t.x=r.x,t.y=-r.y}else t.x=Qt.x,t.y=Qt.y}getBonePosition(t,s){const i=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(s||(s={x:0,y:0}),s.x=t.worldX,s.y=t.worldY,s):(console.error(`Cant set bone position! Bone ${String(i)} not found`),s)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,s=this._lastAttachments;let i=0,r=!1;for(let l=0;l<t.length;l++){const n=t[l].getAttachment();n&&(n!==s[i]&&(r=!0,s[i]=n),i++)}i!==s.length&&(r=!0,s.length=i),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(t,s){const i=t.attachment;if(i&&i instanceof bt){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot,l=this._slotsObject[t.data.name];if(r&&l){let o=r.mask;if(o||(o=sr.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const h=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof bt)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),sr.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const t=this.skeleton.drawOrder;for(let s=0;s<t.length;s++){const i=t[s];this.updateAndSetPixiMask(i,s===t.length-1);const r=i.getAttachment();if(r){if(r instanceof ct||r instanceof nt){const l=this._getCachedData(i,r);r instanceof nt?r.computeWorldVertices(i,l.vertices,0,2):r.computeWorldVertices(i,0,r.worldVerticesLength,l.vertices,0,2),l.uvs.length<r.uvs.length&&(l.uvs=new Float32Array(r.uvs.length)),_i(r.uvs.buffer,l.uvs.buffer);const n=i.bone.skeleton.color,a=i.color,h=r.color,c=n.a*a.a*h.a;if(l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,c),this.alpha===0||c===0)l.skipRender||(this.spineAttachmentsDirty=!0),l.skipRender=!0;else{l.skipRender&&(this.spineAttachmentsDirty=!0),l.skipRender=l.clipped=!1,i.darkColor&&l.darkColor.setFromColor(i.darkColor);const f=r.region?.texture.texture||qi.EMPTY;l.texture!==f&&(l.texture=f,this.spineTexturesDirty=!0),Tt.isClipping()&&this.updateClippingData(l)}}else if(r instanceof bt){Tt.clipStart(i,r);continue}}Tt.clipEndWithSlot(i)}Tt.clipEnd()}updateClippingData(t){t.clipped=!0,Tt.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:s,clippedUVs:i,clippedTriangles:r}=Tt,l=s.length/2,o=r.length;t.clippedData||(t.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=t.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;t.skipRender=l===0,a&&(this.spineAttachmentsDirty=!0,n.vertexCount<l&&(n.vertices=new Float32Array(l*2),n.uvs=new Float32Array(l*2)),n.indices.length<o&&(n.indices=new Uint16Array(o)));const{vertices:h,uvs:c,indices:f}=n;for(let d=0;d<l;d++)h[d*2]=s[d*2],h[d*2+1]=s[d*2+1],c[d*2]=i[d*2],c[d*2+1]=i[d*2+1];n.vertexCount=l;for(let d=0;d<o;d++)f[d]!==r[d]&&(this.spineAttachmentsDirty=!0,f[d]=r[d]);n.indicesCount=o}updateSlotObjects(){for(const t in this._slotsObject){const s=this._slotsObject[t];s&&this.updateSlotObject(s)}}updateSlotObject(t){const{slot:s,container:i}=t,r=t.followAttachmentTimeline?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&r,i.visible){let l=s.bone;i.position.set(l.worldX,l.worldY),i.angle=l.getWorldRotationX();let o=1,n=1;for(;l;)o*=l.scaleX,n*=l.scaleY,l=l.parent;o<0&&(i.angle-=180),i.scale.set(s.bone.getWorldScaleX()*Math.sign(o),s.bone.getWorldScaleY()*Math.sign(n)),i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,s){return this.attachmentCacheData[t.data.index][s.name]||this.initCachedData(t,s)}initCachedData(t,s){let i;return s instanceof nt?(i=new Float32Array(8),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:i,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(i=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:i,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[t.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,s,i){t=this.getSlotFromRef(t);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(t),s.includeInBuild=!1,this.addChild(s);const r={container:s,slot:t,followAttachmentTimeline:i?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=r,this.updateSlotObject(r)}removeSlotObject(t){let s;if(t instanceof Oi){for(const i in this._slotsObject)if(this._slotsObject[i]?.container===t){this._slotsObject[i]=null,s=t;break}}else{const i=this.getSlotFromRef(t);s=this._slotsObject[i.data.name]?.container,this._slotsObject[i.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([t,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[t]})}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new rs;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),i=this._bounds;i.clear(),i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,i=this._bounds;i.clear();for(let r=0;r<s.length;r++){const l=s[r],o=l.getAttachment();if(o&&(o instanceof nt||o instanceof ct)){const n=this._getCachedData(l,o);i.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),Kt.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.worldToLocal(t):s.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:i=1,darkTint:r,autoUpdate:l=!0,boundsProvider:o}){const n=`${t}-${s}-${i}`;if(hs.has(n))return new ms({skeletonData:hs.get(n),darkTint:r,autoUpdate:l,boundsProvider:o});const a=er.get(t),h=er.get(s),c=new Ds(h),f=a instanceof Uint8Array?new zs(c):new $s(c);f.scale=i;const d=f.readSkeletonData(a);return hs.set(n,d),new ms({skeletonData:d,darkTint:r,autoUpdate:l,boundsProvider:o})}};import{Container as cs,Graphics as ot,Text as ji}from"pixi.js";var Ji=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new cs,bones:new cs,skeletonXY:new ot,regionAttachmentsShape:new ot,meshTrianglesLine:new ot,meshHullLine:new ot,clippingPolygon:new ot,boundingBoxesRect:new ot,boundingBoxesCircle:new ot,boundingBoxesPolygon:new ot,pathsCurve:new ot,pathsLine:new ot,eventText:new cs,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(e.scale.x||e.scale.y||1),l=new ji({text:i.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(e.scale.x),l.anchor.set(.5),t.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let r=t.bones.children.length;r>0;r--)t.bones.children[r-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(e.scale.x||e.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,i,s),this.drawPaths&&this.drawPathsFunc(e,t,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,i),this.drawClipping&&this.drawClippingFunc(e,t,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,i),this.drawEvents)for(const r of t.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(e,t,s,i){const r=e.skeleton,l=r.x,o=r.y,n=r.bones;t.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const f=n[h],d=f.data.length,m=l+f.worldX,u=o+f.worldY,p=l+d*f.a+f.worldX,b=o+d*f.b+f.worldY;if(f.data.name==="root"||f.data.parent===null)continue;const w=Math.abs(m-p),g=Math.abs(u-b),x=Math.pow(w,2),y=g,v=Math.pow(g,2),C=Math.sqrt(x+v),A=Math.pow(C,2),k=Math.PI/180,T=Math.acos((A+v-x)/(2*y*C))||0;if(C===0)continue;const Y=new ot;t.bones.addChild(Y);const M=C/50/i;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=u,Y.pivot.y=C;let F=0;m<p&&u<b?F=-T+180*k:m>p&&u<b?F=180*k+T:m>p&&u>b?F=-T:m<p&&u>b?F=T:u===b&&m<p?F=90*k:u===b&&m>p?F=-90*k:m===p&&u<b?F=180*k:m===p&&u>b&&(F=0),Y.rotation=F,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;t.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l],a=n.getAttachment();if(a===null||!(a instanceof nt))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),t.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}t.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof ct))continue;const h=a,c=new Float32Array(h.worldVerticesLength),f=h.triangles;let d=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,u=f.length;m<u;m+=3){const p=f[m]*2,b=f[m+1]*2,w=f[m+2]*2;t.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&d>0){d=(d>>1)*2;let m=c[d-2],u=c[d-1];for(let p=0,b=d;p<b;p+=2){const w=c[p],g=c[p+1];t.meshHullLine.context.moveTo(w,g).lineTo(m,u),m=w,u=g}}}t.meshHullLine.stroke({width:s,color:this.meshHullColor}),t.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof bt))continue;const h=a,c=h.worldVerticesLength,f=new Float32Array(c);h.computeWorldVertices(n,0,c,f,0,2),t.clippingPolygon.poly(Array.from(f))}t.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(e,t,s){const i=new rs;i.update(e.skeleton,!0),i.minX!==1/0&&t.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const r=i.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let f=0,d=o.length;f<d;f+=2){const m=o[f],u=o[f+1];t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(m,u,c),t.boundingBoxesCircle.fill(0),t.boundingBoxesCircle.circle(m,u,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,u)}t.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=r.length;o<n;o++){const a=r[o];l(a,0,a.length)}}drawPathsFunc(e,t,s){const r=e.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof St))continue;const h=a;let c=h.worldVerticesLength;const f=new Float32Array(c);h.computeWorldVertices(n,0,c,f,0,2);let d=f[2],m=f[3],u=0,p=0;if(h.closed){const b=f[0],w=f[1],g=f[c-2],x=f[c-1];u=f[c-4],p=f[c-3],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(b,w,g,x,u,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(b,w),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=f[b],g=f[b+1],x=f[b+2],y=f[b+3];u=f[b+4],p=f[b+5],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(w,g,x,y,u,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(w,g),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(x,y),d=u,m=p}}t.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),t.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};export{zi as AABBRectangleBoundsProvider,be as AlphaTimeline,Ot as Animation,De as AnimationState,br as AnimationStateAdapter,Fs as AnimationStateData,Ls as AssetCache,vr as AssetManagerBase,Ds as AtlasAttachmentLoader,ne as Attachment,xt as AttachmentTimeline,Gs as BinaryInput,ts as BlendMode,We as Bone,qe as BoneData,Oe as BoundingBoxAttachment,Xs as CURRENT,bt as ClippingAttachment,V as Color,Pt as ConstraintData,it as CurveTimeline,st as CurveTimeline1,_t as CurveTimeline2,gr as DebugUtils,ve as DeformTimeline,Vs as Downloader,At as DrawOrderTimeline,ze as Event,Ge as EventData,Is as EventQueue,Ut as EventTimeline,Ms as EventType,Le as FIRST,wr as FakeTexture,Wt as HOLD_FIRST,Ys as HOLD_MIX,Ve as HOLD_SUBSEQUENT,Ns as IkConstraint,He as IkConstraintData,Ce as IkConstraintTimeline,Ht as Inherit,ge as InheritTimeline,ur as IntSet,ws as Interpolation,B as MathUtils,ct as MeshAttachment,Ss as MixBlend,ks as MixDirection,St as PathAttachment,Os as PathConstraint,$e as PathConstraintData,Te as PathConstraintMixTimeline,Se as PathConstraintPositionTimeline,ke as PathConstraintSpacingTimeline,qs as Physics,Ye as PhysicsConstraintDampingTimeline,Pe as PhysicsConstraintGravityTimeline,Ie as PhysicsConstraintInertiaTimeline,Xe as PhysicsConstraintMassTimeline,Be as PhysicsConstraintMixTimeline,Ee as PhysicsConstraintResetTimeline,Me as PhysicsConstraintStrengthTimeline,mt as PhysicsConstraintTimeline,Fe as PhysicsConstraintWindTimeline,Rs as PointAttachment,Ct as Pool,je as PositionMode,ys as Pow,mr as PowOut,ye as RGB2Timeline,we as RGBA2Timeline,pe as RGBATimeline,xe as RGBTimeline,nt as RegionAttachment,Ke as RotateMode,Ft as RotateTimeline,Ne as SETUP,qt as SUBSEQUENT,he as ScaleTimeline,ce as ScaleXTimeline,de as ScaleYTimeline,Re as SequenceTimeline,Gi as SetupPoseBoundsProvider,fe as ShearTimeline,ue as ShearXTimeline,me as ShearYTimeline,kt as Skeleton,zs as SkeletonBinary,rs as SkeletonBounds,$t as SkeletonClipping,Bt as SkeletonData,$s as SkeletonJson,Et as Skin,Qe as SkinEntry,Hi as SkinsAndAnimationBoundsProvider,_s as Slot,Ze as SlotData,Je as SpacingMode,$i as Spine,Ji as SpineDebugRenderer,tr as SpinePipe,as as SpineTexture,ie as StringSet,_e as Texture,Gt as TextureAtlas,Es as TextureAtlasPage,Ue as TextureAtlasRegion,zt as TextureFilter,Bs as TextureRegion,Ps as TextureWrap,pr as TimeKeeper,$ as Timeline,Ts as TrackEntry,Us as TransformConstraint,es as TransformConstraintData,Ae as TransformConstraintTimeline,ae as TranslateTimeline,oe as TranslateXTimeline,le as TranslateYTimeline,Hs as Triangulator,E as Utils,Xt as Vector2,ht as VertexAttachment,xr as WindowedMean};