Files
SpineParticlesWeb/vendor/spine/spine-pixi-v7/dist/esm/spine-pixi-v7.min.mjs
T

73 lines
190 KiB
JavaScript

"use strict";if(typeof window<"u"&&window.PIXI){let e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/"))return window.PIXI}}var Tr=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}},he=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},D=class wt{constructor(t=0,s=0,r=0,i=0){this.r=t,this.g=s,this.b=r,this.a=i}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,r,i){return this.r=t,this.g=s,this.b=r,this.a=i,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,r,i){return this.r+=t,this.g+=s,this.b+=r,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(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)}},X=class ht{static PI=3.1415927;static PI2=ht.PI*2;static invPI2=1/ht.PI2;static radiansToDegrees=180/ht.PI;static radDeg=ht.radiansToDegrees;static degreesToRadians=ht.PI/180;static degRad=ht.degreesToRadians;static clamp(t,s,r){return t<s?s:t>r?r:t}static cosDeg(t){return Math.cos(t*ht.degRad)}static sinDeg(t){return Math.sin(t*ht.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ht.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 ht.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,r){let i=Math.random(),h=s-t;return i<=(r-t)/h?t+Math.sqrt(i*h*(r-t)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ks=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},As=class extends ks{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}},Ir=class extends As{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},B=class Mt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,h){for(let o=s,n=i;o<s+h;o++,n++)r[n]=t[o]}static arrayFill(t,s,r,i){for(let h=s;h<r;h++)t[h]=i}static setArraySize(t,s,r=0){let i=t.length;if(i==s)return t;if(t.length=s,i<s)for(let h=i;h<s;h++)t[h]=r;return t}static ensureArrayCapacity(t,s,r=0){return t.length>=s?t:Mt.setArraySize(t,s,r)}static newArray(t,s){let r=new Array(t);for(let i=0;i<t;i++)r[i]=s;return r}static newFloatArray(t){if(Mt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(t){if(Mt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(t){return Mt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Mt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,r=!0){for(var i=0;i<t.length;i++)if(t[i]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Mr=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)}}},St=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}},Pt=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}},Yr=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)}},Fr=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}},ce=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ct=class pr extends ce{static nextID=0;id=pr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,h,o){r=h+(r>>1)*o;let n=t.bone.skeleton,a=t.deform,l=this.vertices,c=this.bones;if(!c){a.length>0&&(l=a);let f=t.bone,g=f.worldX,p=f.worldY,b=f.a,x=f.b,w=f.c,y=f.d;for(let v=s,C=h;C<r;v+=2,C+=o){let S=l[v],A=l[v+1];i[C]=S*b+A*x+g,i[C+1]=S*w+A*y+p}return}let d=0,u=0;for(let f=0;f<s;f+=2){let g=c[d];d+=g+1,u+=g}let m=n.bones;if(a.length==0)for(let f=h,g=u*3;f<r;f+=o){let p=0,b=0,x=c[d++];for(x+=d;d<x;d++,g+=3){let w=m[c[d]],y=l[g],v=l[g+1],C=l[g+2];p+=(y*w.a+v*w.b+w.worldX)*C,b+=(y*w.c+v*w.d+w.worldY)*C}i[f]=p,i[f+1]=b}else{let f=a;for(let g=h,p=u*3,b=u<<1;g<r;g+=o){let x=0,w=0,y=c[d++];for(y+=d;d<y;d++,p+=3,b+=2){let v=m[c[d]],C=l[p]+f[b],S=l[p+1]+f[b+1],A=l[p+2];x+=(C*v.a+S*v.b+v.worldX)*A,w+=(C*v.c+S*v.d+v.worldY)*A}i[g]=x,i[g+1]=w}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},Ts=class ie{static _nextID=0;id=ie.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new ie(this.regions.length);return B.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 r=t.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(t,s){let r=t,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return ie._nextID++}},Is=(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))(Is||{}),Ms=[0,1,2,3,4,5,6],Ut=class{name;timelines=[];timelineIds=new he;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,i,h,o,n){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l<c;l++)a[l].apply(e,t,s,i,h,o,n)}},Ys=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Ys||{}),Fs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Fs||{}),O={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},H=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=B.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let i=s;i<r;i+=s)if(e[i]>t)return i-s;return r-s}},at=class extends H{curves;constructor(e,t,s){super(e,s),this.curves=B.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=B.newFloatArray(t);B.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,i,h,o,n,a,l,c){let d=this.curves,u=this.getFrameCount()+e*18;s==0&&(d[t]=2+u);let m=(r-h*2+n)*.03,f=(i-o*2+a)*.03,g=((h-n)*3-r+l)*.006,p=((o-a)*3-i+c)*.006,b=m*2+g,x=f*2+p,w=(h-r)*.3+m+g*.16666667,y=(o-i)*.3+f+p*.16666667,v=r+w,C=i+y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,w+=b,y+=x,b+=g,x+=p,v+=w,C+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let a=this.frames[t],l=this.frames[t+s];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=e){let a=i[r-2],l=i[r-1];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}t+=this.getFrameEntries();let o=i[h-2],n=i[h-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},it=class extends at{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 i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=t[s],h=t[s+1];return h+(e-i)/(t[s+2]-i)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let h=this.getCurveValue(e);switch(s){case 0:return i+h*t;case 1:case 2:h+=i-r}return r+h*t}getAbsoluteValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let h=this.getCurveValue(e);return s==0?i+(h-i)*t:r+(h-r)*t}getAbsoluteValue2(e,t,s,r,i,h){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}return s==0?i+(h-i)*t:r+(h-r)*t}getScaleValue(e,t,s,r,i,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*t}return i}let n=this.getCurveValue(e)*h;if(t==1)return s==3?i+n-h:n;if(r==1)switch(s){case 0:return h+(Math.abs(n)*X.signum(h)-h)*t;case 1:case 2:return i+(Math.abs(n)*X.signum(i)-i)*t}else{let a=0;switch(s){case 0:return a=Math.abs(h)*X.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(i)*X.signum(n),a+(n-a)*t}}return i+(n-h)*t}},qt=class extends at{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Et=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,i,h,n.rotation,n.data.rotation))}},de=class extends qt{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*i,n.y+=(n.data.y-n.y)*i}return}let l=0,c=0,d=H.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*f,c+=(a[d+3+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.x=n.data.x+l*i,n.y=n.data.y+c*i;break;case 1:case 2:n.x+=(n.data.x+l-n.x)*i,n.y+=(n.data.y+c-n.y)*i;break;case 3:n.x+=l*i,n.y+=c*i}}},ue=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,i,h,n.x,n.data.x))}},fe=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,i,h,n.y,n.data.y))}},me=class extends qt{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*i,n.scaleY+=(n.data.scaleY-n.scaleY)*i}return}let l,c,d=H.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*f,c+=(a[d+3+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(l*=n.data.scaleX,c*=n.data.scaleY,i==1)h==3?(n.scaleX+=l-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=l,n.scaleY=c);else{let m=0,f=0;if(o==1)switch(h){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(l)*X.signum(m)-m)*i,n.scaleY=f+(Math.abs(c)*X.signum(f)-f)*i;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(l)*X.signum(m)-m)*i,n.scaleY=f+(Math.abs(c)*X.signum(f)-f)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}else switch(h){case 0:m=Math.abs(n.data.scaleX)*X.signum(l),f=Math.abs(n.data.scaleY)*X.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=f+(c-f)*i;break;case 1:case 2:m=Math.abs(n.scaleX)*X.signum(l),f=Math.abs(n.scaleY)*X.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=f+(c-f)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}}}},ge=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,i,h,o,n.scaleX,n.data.scaleX))}},xe=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,i,h,o,n.scaleY,n.data.scaleY))}},pe=class extends qt{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*i,n.shearY+=(n.data.shearY-n.shearY)*i}return}let l=0,c=0,d=H.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*f,c+=(a[d+3+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.shearX=n.data.shearX+l*i,n.shearY=n.data.shearY+c*i;break;case 1:case 2:n.shearX+=(n.data.shearX+l-n.shearX)*i,n.shearY+=(n.data.shearY+c-n.shearY)*i;break;case 3:n.shearX+=l*i,n.shearY+=c*i}}},we=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,i,h,n.shearX,n.data.shearX))}},be=class extends it{boneIndex=0;constructor(e,t,s){super(e,t,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,i,h,n.shearY,n.data.shearY))}},ye=class extends H{boneIndex=0;constructor(e,t){super(e,[O.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[H.search(a,s,2)+1]}},ve=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,r,i,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let p=n.data.color;switch(h){case 0:l.setFromColor(p);return;case 1:l.add((p.r-l.r)*i,(p.g-l.g)*i,(p.b-l.b)*i,(p.a-l.a)*i)}return}let c=0,d=0,u=0,m=0,f=H.search(a,s,5),g=this.curves[f/5];switch(g){case 0:let p=a[f];c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];let b=(s-p)/(a[f+5]-p);c+=(a[f+5+1]-c)*b,d+=(a[f+5+2]-d)*b,u+=(a[f+5+3]-u)*b,m+=(a[f+5+4]-m)*b;break;case 1:c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+18*2-2),m=this.getBezierValue(s,f,4,g+18*3-2)}i==1?l.set(c,d,u,m):(h==0&&l.setFromColor(n.data.color),l.add((c-l.r)*i,(d-l.g)*i,(u-l.b)*i,(m-l.a)*i))}},Ce=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let g=n.data.color;switch(h){case 0:l.r=g.r,l.g=g.g,l.b=g.b;return;case 1:l.r+=(g.r-l.r)*i,l.g+=(g.g-l.g)*i,l.b+=(g.b-l.b)*i}return}let c=0,d=0,u=0,m=H.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let g=a[m];c=a[m+1],d=a[m+2],u=a[m+3];let p=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*p,d+=(a[m+4+2]-d)*p,u+=(a[m+4+3]-u)*p;break;case 1:c=a[m+1],d=a[m+2],u=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+18*2-2)}if(i==1)l.r=c,l.g=d,l.b=u;else{if(h==0){let g=n.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*i,l.g+=(d-l.g)*i,l.b+=(u-l.b)*i}}},Se=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,O.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,h,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(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*i}return}let l=this.getCurveValue(s);i==1?a.a=l:(h==0&&(a.a=n.data.color.a),a.a+=(l-a.a)*i)}},ke=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,i,h,o,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*i,(y.g-l.g)*i,(y.b-l.b)*i,(y.a-l.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let d=0,u=0,m=0,f=0,g=0,p=0,b=0,x=H.search(a,s,8),w=this.curves[x>>3];switch(w){case 0:let y=a[x];d=a[x+1],u=a[x+2],m=a[x+3],f=a[x+4],g=a[x+5],p=a[x+6],b=a[x+7];let v=(s-y)/(a[x+8]-y);d+=(a[x+8+1]-d)*v,u+=(a[x+8+2]-u)*v,m+=(a[x+8+3]-m)*v,f+=(a[x+8+4]-f)*v,g+=(a[x+8+5]-g)*v,p+=(a[x+8+6]-p)*v,b+=(a[x+8+7]-b)*v;break;case 1:d=a[x+1],u=a[x+2],m=a[x+3],f=a[x+4],g=a[x+5],p=a[x+6],b=a[x+7];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+18*2-2),f=this.getBezierValue(s,x,4,w+18*3-2),g=this.getBezierValue(s,x,5,w+18*4-2),p=this.getBezierValue(s,x,6,w+18*5-2),b=this.getBezierValue(s,x,7,w+18*6-2)}if(i==1)l.set(d,u,m,f),c.r=g,c.g=p,c.b=b;else{if(h==0){l.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*i,(u-l.g)*i,(m-l.b)*i,(f-l.a)*i),c.r+=(g-c.r)*i,c.g+=(p-c.g)*i,c.b+=(b-c.b)*i}}},Ae=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*i,l.g+=(y.g-l.g)*i,l.b+=(y.b-l.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let d=0,u=0,m=0,f=0,g=0,p=0,b=0,x=H.search(a,s,7),w=this.curves[x/7];switch(w){case 0:let y=a[x];d=a[x+1],u=a[x+2],m=a[x+3],g=a[x+4],p=a[x+5],b=a[x+6];let v=(s-y)/(a[x+7]-y);d+=(a[x+7+1]-d)*v,u+=(a[x+7+2]-u)*v,m+=(a[x+7+3]-m)*v,g+=(a[x+7+4]-g)*v,p+=(a[x+7+5]-p)*v,b+=(a[x+7+6]-b)*v;break;case 1:d=a[x+1],u=a[x+2],m=a[x+3],g=a[x+4],p=a[x+5],b=a[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+18*2-2),g=this.getBezierValue(s,x,4,w+18*3-2),p=this.getBezierValue(s,x,5,w+18*4-2),b=this.getBezierValue(s,x,6,w+18*5-2)}if(i==1)l.r=d,l.g=u,l.b=m,c.r=g,c.g=p,c.b=b;else{if(h==0){let y=n.data.color,v=n.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(d-l.r)*i,l.g+=(u-l.g)*i,l.b+=(m-l.b)*i,c.r+=(g-c.r)*i,c.g+=(p-c.g)*i,c.b+=(b-c.b)*i}}},xt=class extends H{slotIndex=0;attachmentNames;constructor(e,t){super(e,[O.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){h==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Te=class extends at{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[O.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,r,i,h,o,n,a,l,c){let d=this.curves,u=this.getFrameCount()+e*18;s==0&&(d[t]=2+u);let m=(r-h*2+n)*.03,f=a*.03-o*.06,g=((h-n)*3-r+l)*.006,p=(o-a+.33333333)*.018,b=m*2+g,x=f*2+p,w=(h-r)*.3+m+g*.16666667,y=o*.3+f+p*.16666667,v=r+w,C=y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,w+=b,y+=x,b+=g,x+=p,v+=w,C+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,s[r]>e){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let h=s[i-2],o=s[i-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof ct)||a.timelineAttachment!=this.attachment)return;let l=n.deform;l.length==0&&(h=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case 0:l.length=0;return;case 1:if(i==1){l.length=0;return}l.length=d;let x=a;if(x.bones){i=1-i;for(var m=0;m<d;m++)l[m]*=i}else{let w=x.vertices;for(var m=0;m<d;m++)l[m]+=(w[m]-l[m])*i}}return}if(l.length=d,s>=u[u.length-1]){let x=c[u.length-1];if(i==1)if(h==3){let w=a;if(w.bones)for(let y=0;y<d;y++)l[y]+=x[y];else{let y=w.vertices;for(let v=0;v<d;v++)l[v]+=x[v]-y[v]}}else B.arrayCopy(x,0,l,0,d);else switch(h){case 0:{let y=a;if(y.bones)for(let v=0;v<d;v++)l[v]=x[v]*i;else{let v=y.vertices;for(let C=0;C<d;C++){let S=v[C];l[C]=S+(x[C]-S)*i}}break}case 1:case 2:for(let y=0;y<d;y++)l[y]+=(x[y]-l[y])*i;break;case 3:let w=a;if(w.bones)for(let y=0;y<d;y++)l[y]+=x[y]*i;else{let y=w.vertices;for(let v=0;v<d;v++)l[v]+=(x[v]-y[v])*i}}return}let f=H.search1(u,s),g=this.getCurvePercent(s,f),p=c[f],b=c[f+1];if(i==1)if(h==3){let x=a;if(x.bones)for(let w=0;w<d;w++){let y=p[w];l[w]+=y+(b[w]-y)*g}else{let w=x.vertices;for(let y=0;y<d;y++){let v=p[y];l[y]+=v+(b[y]-v)*g-w[y]}}}else for(let x=0;x<d;x++){let w=p[x];l[x]=w+(b[x]-w)*g}else switch(h){case 0:{let w=a;if(w.bones)for(let y=0;y<d;y++){let v=p[y];l[y]=(v+(b[y]-v)*g)*i}else{let y=w.vertices;for(let v=0;v<d;v++){let C=p[v],S=y[v];l[v]=S+(C+(b[v]-C)*g-S)*i}}break}case 1:case 2:for(let w=0;w<d;w++){let y=p[w];l[w]+=(y+(b[w]-y)*g-l[w])*i}break;case 3:let x=a;if(x.bones)for(let w=0;w<d;w++){let y=p[w];l[w]+=(y+(b[w]-y)*g)*i}else{let w=x.vertices;for(let y=0;y<d;y++){let v=p[y];l[y]+=(v+(b[y]-v)*g-w[y])*i}}}}},Wt=class wr extends H{static propertyIds=[""+O.event];events;constructor(t){super(t,wr.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,r,i,h,o,n){if(!i)return;let a=this.frames,l=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,h,o,n),s=-1;else if(s>=a[l-1])return;if(r<a[0])return;let c=0;if(s<a[0])c=0;else{c=H.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<l&&r>=a[c];c++)i.push(this.events[c])}},kt=class br extends H{static propertyIds=[""+O.drawOrder];drawOrders;constructor(t){super(t,br.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,r){this.frames[t]=s,this.drawOrders[t]=r}apply(t,s,r,i,h,o,n){if(n==1){o==0&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=H.search1(this.frames,r),l=this.drawOrders[a];if(!l)B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,d=t.slots;for(let u=0,m=l.length;u<m;u++)c[u]=d[l[u]]}}},Ie=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,i,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,i,h,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){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)*i,n.softness+=(n.data.softness-n.softness)*i,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let l=0,c=0,d=H.search(a,s,6),u=this.curves[d/6];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+6]-m);l+=(a[d+6+1]-l)*f,c+=(a[d+6+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==0?(n.mix=n.data.mix+(l-n.data.mix)*i,n.softness=n.data.softness+(c-n.data.softness)*i,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(l-n.mix)*i,n.softness+=(c-n.softness)*i,o==0&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},Me=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=r,a[e+3]=i,a[e+4]=h,a[e+5]=o,a[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*i,n.mixX+=(b.mixX-n.mixX)*i,n.mixY+=(b.mixY-n.mixY)*i,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*i,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*i,n.mixShearY+=(b.mixShearY-n.mixShearY)*i}return}let l,c,d,u,m,f,g=H.search(a,s,7),p=this.curves[g/7];switch(p){case 0:let b=a[g];l=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];let x=(s-b)/(a[g+7]-b);l+=(a[g+7+1]-l)*x,c+=(a[g+7+2]-c)*x,d+=(a[g+7+3]-d)*x,u+=(a[g+7+4]-u)*x,m+=(a[g+7+5]-m)*x,f+=(a[g+7+6]-f)*x;break;case 1:l=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),c=this.getBezierValue(s,g,2,p+18-2),d=this.getBezierValue(s,g,3,p+18*2-2),u=this.getBezierValue(s,g,4,p+18*3-2),m=this.getBezierValue(s,g,5,p+18*4-2),f=this.getBezierValue(s,g,6,p+18*5-2)}if(h==0){let b=n.data;n.mixRotate=b.mixRotate+(l-b.mixRotate)*i,n.mixX=b.mixX+(c-b.mixX)*i,n.mixY=b.mixY+(d-b.mixY)*i,n.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*i,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*i,n.mixShearY=b.mixShearY+(f-b.mixShearY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(d-n.mixY)*i,n.mixScaleX+=(u-n.mixScaleX)*i,n.mixScaleY+=(m-n.mixScaleY)*i,n.mixShearY+=(f-n.mixShearY)*i}},Ye=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,i,h,n.position,n.data.position))}},Fe=class extends it{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,i,h,n.spacing,n.data.spacing))}},Pe=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=r,h[e+3]=i}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){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)*i,n.mixX+=(n.data.mixX-n.mixX)*i,n.mixY+=(n.data.mixY-n.mixY)*i}return}let l,c,d,u=H.search(a,s,4),m=this.curves[u>>2];switch(m){case 0:let f=a[u];l=a[u+1],c=a[u+2],d=a[u+3];let g=(s-f)/(a[u+4]-f);l+=(a[u+4+1]-l)*g,c+=(a[u+4+2]-c)*g,d+=(a[u+4+3]-d)*g;break;case 1:l=a[u+1],c=a[u+2],d=a[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(h==0){let f=n.data;n.mixRotate=f.mixRotate+(l-f.mixRotate)*i,n.mixX=f.mixX+(c-f.mixX)*i,n.mixY=f.mixY+(d-f.mixY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(d-n.mixY)*i}},ft=class extends it{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,h,this.get(n),this.setup(n)))}},Ee=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Xe=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Be=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Re=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Le=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ve=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},De=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ne=class yr extends H{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,yr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,h,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const l=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],h,o,n),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[H.search1(l,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},_e=class mt extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[O.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return mt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,r,i,h){let o=this.frames;t*=mt.ENTRIES,o[t]=s,o[t+mt.MODE]=r|i<<4,o[t+mt.DELAY]=h}apply(t,s,r,i,h,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let l=a.attachment,c=this.attachment;if(l!=c&&(!(l instanceof ct)||l.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(r<d[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let u=H.search(d,r,mt.ENTRIES),m=d[u],f=d[u+mt.MODE],g=d[u+mt.DELAY];if(!this.attachment.sequence)return;let p=f>>4,b=this.attachment.sequence.regions.length,x=Ms[f&15];if(x!=0)switch(p+=(r-m)/g+1e-5|0,x){case 1:p=Math.min(b-1,p);break;case 2:p%=b;break;case 3:{let w=(b<<1)-2;p=w==0?0:p%w,p>=b&&(p=w-p);break}case 4:p=Math.max(b-1-p,0);break;case 5:p=b-1-p%b;break;case 6:{let w=(b<<1)-2;p=w==0?0:(p+b-1)%w,p>=b&&(p=w-p)}}a.sequenceIndex=p}},Oe=class ne{static _emptyAnimation=new Ut("<empty>",[],0);static emptyAnimation(){return ne._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Es(this);propertyIDs=new he;animationsChanged=!1;trackEntryPool=new St(()=>new Ps);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=t*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let r=t.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((r.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let u=0,m=r.length;u<m;u++){let f=r[u];if(!f||f.delay>0)continue;i=!0;let g=u==0?1:f.mixBlend,p=f.alpha;f.mixingFrom?p*=this.applyMixingFrom(f,t,g):f.trackTime>=f.trackEnd&&!f.next&&(p=0);let b=p>=f.alphaAttachmentThreshold,x=f.animationLast,w=f.getAnimationTime(),y=w,v=s;f.reverse&&(y=f.animation.duration-y,v=null);let C=f.animation.timelines,S=C.length;if(u==0&&p==1||g==3){u==0&&(b=!0);for(let A=0;A<S;A++){B.webkit602BugfixHelper(p,g);var h=C[A];h instanceof xt?this.applyAttachmentTimeline(h,t,y,g,b):h.apply(t,x,y,v,p,g,0)}}else{let A=f.timelineMode,T=f.shortestRotation,Y=!T&&f.timelinesRotation.length!=S<<1;Y&&(f.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let P=C[M],E=A[M]==zt?g:0;!T&&P instanceof Et?this.applyRotateTimeline(P,t,y,p,E,f.timelinesRotation,M<<1,Y):P instanceof xt?this.applyAttachmentTimeline(P,t,y,g,b):(B.webkit602BugfixHelper(p,g),P.apply(t,x,y,v,p,E,0))}}this.queueEvents(f,w),s.length=0,f.nextAnimationLast=w,f.nextTrackLast=f.trackTime}for(var o=this.unkeyedState+We,n=t.slots,a=0,l=t.slots.length;a<l;a++){var c=n[a];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,s,r){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;t.mixDuration==0?(h=1,r==1&&(r=0)):(h=t.mixTime/t.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let o=h<i.mixAttachmentThreshold,n=h<i.mixDrawOrderThreshold,a=i.animation.timelines,l=a.length,c=i.alpha*t.interruptAlpha,d=c*(1-h),u=i.animationLast,m=i.getAnimationTime(),f=m,g=null;if(i.reverse?f=i.animation.duration-f:h<i.eventThreshold&&(g=this.events),r==3)for(let p=0;p<l;p++)a[p].apply(s,u,f,g,d,r,1);else{let p=i.timelineMode,b=i.timelineHoldMix,x=i.shortestRotation,w=!x&&i.timelinesRotation.length!=l<<1;w&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let y=0;y<l;y++){let v=a[y],C=1,S,A=0;switch(p[y]){case zt:if(!n&&v instanceof kt)continue;S=r,A=d;break;case Ue:S=0,A=d;break;case qe:S=r,A=c;break;case Gt:S=0,A=c;break;default:S=0;let T=b[y];A=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=A,!x&&v instanceof Et?this.applyRotateTimeline(v,s,f,A,S,i.timelinesRotation,y<<1,w):v instanceof xt?this.applyAttachmentTimeline(v,s,f,S,o&&A>=i.alphaAttachmentThreshold):(B.webkit602BugfixHelper(A,r),n&&v instanceof kt&&S==0&&(C=0),v.apply(s,u,f,g,A,S,C))}}return t.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(t,s,r,i,h){var o=s.slots[t.slotIndex];o.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,t.attachmentNames[H.search1(t.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+We))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+Rs)}applyRotateTimeline(t,s,r,i,h,o,n,a){if(a&&(o[n]=0),i==1){t.apply(s,0,r,null,1,h,0);return}let l=s.bones[t.boneIndex];if(!l.active)return;let c=t.frames,d=0,u=0;if(r<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:d=l.rotation,u=l.data.rotation}else d=h==0?l.data.rotation:l.rotation,u=l.data.rotation+t.getCurveValue(r);let m=0,f=u-d;if(f-=Math.ceil(f/360-.5)*360,f==0)m=o[n];else{let g=0,p=0;a?(g=0,p=f):(g=o[n],p=o[n+1]);let b=g-g%360;m=f+b;let x=f>=0,w=g>=0;Math.abs(p)<=90&&X.signum(p)!=X.signum(f)&&(Math.abs(g-b)>180?(m+=360*X.signum(g),w=x):b!=0?m-=360*X.signum(g):w=x),w!=x&&(m+=360*X.signum(g)),o[n]=m}o[n+1]=f,l.rotation=d+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,h=i-r,o=t.trackLast%h,n=this.events,a=0,l=n.length;for(;a<l;a++){let d=n[a];if(d.time<o)break;d.time>i||this.queue.event(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=i&&t.animationLast<i;for(c&&this.queue.complete(t);a<l;a++){let d=n[a];d.time<r||this.queue.event(t,d)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=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 r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,r){let i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,i,r)}setAnimationWith(t,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let o=this.trackEntry(t,s,r,h);return this.setCurrent(t,o,i),this.queue.drain(),o}addAnimation(t,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,r,i)}addAnimationWith(t,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(t,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,ne.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,ne.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(B.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(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,r=t.length;s<r;s++){let i=t[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let s=t.mixingTo,r=t.animation.timelines,i=t.animation.timelines.length,h=t.timelineMode;h.length=i;let o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<i;a++)h[a]=n.addAll(r[a].getPropertyIds())?Gt:qe;return}t:for(let a=0;a<i;a++){let l=r[a],c=l.getPropertyIds();if(!n.addAll(c))h[a]=zt;else if(!s||l instanceof xt||l instanceof kt||l instanceof Wt||!s.animation.hasTimeline(c))h[a]=Ue;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(t.mixDuration>0){h[a]=Bs,o[a]=d;continue t}break}h[a]=Gt}}}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()}},Ps=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}},Es=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t<e.length;t+=2){let s=e[t],r=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<i.length;o++){let n=i[o];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<i.length;o++){let n=i[o];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<i.length;o++){let n=i[o];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<i.length;o++){let n=i[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<i.length;o++){let n=i[o];n.complete&&n.complete(r)}break;case 5:let h=e[t+++2];r.listener&&r.listener.event&&r.listener.event(r,h);for(let o=0;o<i.length;o++){let n=i[o];n.event&&n.event(r,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Xs=(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))(Xs||{}),Pr=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},zt=0,Ue=1,qe=2,Gt=3,Bs=4,We=1,Rs=2,Ls=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);this.setMixWith(r,i,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},ze=class vr extends ct{color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new vr(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},pt=class Cr extends ct{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Cr(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Ge=class{_image;constructor(e){this._image=e}getImage(){return this._image}},$t=(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))($t||{}),Vs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Vs||{}),Ds=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Er=class extends Ge{setFilters(e,t){}setWraps(e,t){}dispose(){}},Ht=class{pages=new Array;regions=new Array;constructor(e){let t=new Xr(e),s=new Array(4),r={};r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.format=()=>{},r.filter=l=>{l.minFilter=B.enumValue($t,s[1]),l.magFilter=B.enumValue($t,s[2])},r.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},r.pma=l=>{l.pma=s[1]=="true"};var i={};i.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},i.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},i.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},i.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},i.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},i.index=l=>{l.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let o=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let l=new $e(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=i[s[0]];if(d)d(l);else{n||(n=[]),a||(a=[]),n.push(s[0]);let u=[];for(let m=0;m<c;m++)u.push(parseInt(s[m+1]));a.push(u)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),n&&n.length>0&&a&&a.length>0&&(l.names=n,l.values=a,n=null,a=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new Ns(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Xr=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=t.indexOf(",",i);if(h==-1)return e[r]=t.substr(i).trim(),r;if(e[r]=t.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},Ns=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}},$e=class extends Ds{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)}},At=class ps extends ct{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=B.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,n=0;if(this.region instanceof $e){let a=this.region,l=a.page,c=l.width,d=l.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<r;u+=2)s[u]=i+t[u+1]*o,s[u+1]=h+(1-t[u])*n;return;case 180:i-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let u=0;u<r;u+=2)s[u]=i+(1-t[u])*o,s[u+1]=h+(1-t[u+1])*n;return;case 270:i-=a.offsetY/c,h-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<r;u+=2)s[u]=i+(1-t[u+1])*o,s[u+1]=h+t[u]*n;return}i-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-i,n=this.region.v2-h):(i=h=0,o=n=1);for(let a=0;a<r;a+=2)s[a]=i+t[a]*o,s[a+1]=h+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 ps(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?B.newFloatArray(this.uvs.length):new Array(this.uvs.length),B.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),B.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),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,r,i,h,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,h,o)}newLinkedMesh(){let t=new ps(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}},Tt=class Sr extends ct{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Sr(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},_s=class kr extends ct{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*X.degRad,r=Math.cos(s),i=Math.sin(s),h=r*t.a+i*t.b,o=r*t.c+i*t.d;return X.atan2Deg(o,h)}copy(){let t=new kr(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Xt=class Ar extends ce{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=B.newFloatArray(8);uvs=B.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,n=h+this.region.width*r,a=o+this.region.height*i,l=this.rotation*X.degRad,c=Math.cos(l),d=Math.sin(l),u=this.x,m=this.y,f=h*c+u,g=h*d,p=o*c+m,b=o*d,x=n*c+u,w=n*d,y=a*c+m,v=a*d,C=this.offset;C[0]=f-b,C[1]=p+g,C[2]=f-v,C[3]=y+g,C[4]=x-v,C[5]=y+w,C[6]=x-b,C[7]=p+w,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,r,i){this.sequence!=null&&this.sequence.apply(t,this);let h=t.bone,o=this.offset,n=h.worldX,a=h.worldY,l=h.a,c=h.b,d=h.c,u=h.d,m=0,f=0;m=o[0],f=o[1],s[r]=m*l+f*c+n,s[r+1]=m*d+f*u+a,r+=i,m=o[2],f=o[3],s[r]=m*l+f*c+n,s[r+1]=m*d+f*u+a,r+=i,m=o[4],f=o[5],s[r]=m*l+f*c+n,s[r+1]=m*d+f*u+a,r+=i,m=o[6],f=o[7],s[r]=m*l+f*c+n,s[r+1]=m*d+f*u+a}copy(){let t=new Ar(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,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.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},He=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let o=s.getPath(t,i),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[i]=n}}newRegionAttachment(e,t,s,r){let i=new Xt(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");i.region=h}return i}newMeshAttachment(e,t,s,r){let i=new At(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");i.region=h}return i}newBoundingBoxAttachment(e,t){return new ze(t)}newPathAttachment(e,t){return new Tt(t)}newPointAttachment(e,t){return new _s(t)}newClippingAttachment(e,t){return new pt(t)}},Ke=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Kt=(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))(Kt||{}),je=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,r,i,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,g=(s+h)*X.degRad,p=(s+90+o)*X.degRad;this.a=Math.cos(g)*r*m,this.b=Math.cos(p)*i*m,this.c=Math.sin(g)*r*f,this.d=Math.sin(p)*i*f,this.worldX=e*m+u.x,this.worldY=t*f+u.y;return}let a=n.a,l=n.b,c=n.c,d=n.d;switch(this.worldX=a*e+l*t+n.worldX,this.worldY=c*e+d*t+n.worldY,this.inherit){case 0:{const u=(s+h)*X.degRad,m=(s+90+o)*X.degRad,f=Math.cos(u)*r,g=Math.cos(m)*i,p=Math.sin(u)*r,b=Math.sin(m)*i;this.a=a*f+l*p,this.b=a*g+l*b,this.c=c*f+d*p,this.d=c*g+d*b;return}case 1:{const u=(s+h)*X.degRad,m=(s+90+o)*X.degRad;this.a=Math.cos(u)*r,this.b=Math.cos(m)*i,this.c=Math.sin(u)*r,this.d=Math.sin(m)*i;break}case 2:{let u=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=u,c*=m;let f=a*a+c*c,g=0;f>1e-4?(f=Math.abs(a*d*m-l*u*c)/f,l=c*f,d=a*f,g=Math.atan2(c,a)*X.radDeg):(a=0,c=0,g=90-Math.atan2(d,l)*X.radDeg);const p=(s+h-g)*X.degRad,b=(s+o-g+90)*X.degRad,x=Math.cos(p)*r,w=Math.cos(b)*i,y=Math.sin(p)*r,v=Math.sin(b)*i;this.a=a*x-l*y,this.b=a*w-l*v,this.c=c*x+d*y,this.d=c*w+d*v;break}case 3:case 4:{s*=X.degRad;const u=Math.cos(s),m=Math.sin(s);let f=(a*u+l*m)/this.skeleton.scaleX,g=(c*u+d*m)/this.skeleton.scaleY,p=Math.sqrt(f*f+g*g);p>1e-5&&(p=1/p),f*=p,g*=p,p=Math.sqrt(f*f+g*g),this.inherit==3&&a*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(g,f);const b=Math.cos(s)*p,x=Math.sin(s)*p;h*=X.degRad,o=(90+o)*X.degRad;const w=Math.cos(h)*r,y=Math.cos(o)*i,v=Math.sin(h)*r,C=Math.sin(o)*i;this.a=f*w+b*v,this.b=f*y+b*C,this.c=g*w+x*v,this.d=g*y+x*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)*X.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)*X.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*o-d*n,this.ay=d*l-c*a;let u,m,f,g;if(this.inherit==1)u=this.a,m=this.b,f=this.c,g=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*i-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*i-s*r),o=i*h,n=s*h;break}case 3:case 4:let p=X.cosDeg(this.rotation),b=X.sinDeg(this.rotation);t=(t*p+s*b)/this.skeleton.scaleX,r=(r*p+i*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+r*r);x>1e-5&&(x=1/x),t*=x,r*=x,x=Math.sqrt(t*t+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let w=X.PI/2+Math.atan2(r,t);s=Math.cos(w)*x,i=Math.sin(w)*x,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h}u=o*this.a-n*this.c,m=o*this.b-n*this.d,f=l*this.c-a*this.a,g=l*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){let p=u*g-m*f;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(u*m+f*g,p)*X.radDeg,this.arotation=Math.atan2(f,u)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*X.radDeg}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,i=this.b;this.a=s*r-t*this.c,this.b=s*i-t*this.d,this.c=t*r+s*this.c,this.d=t*i+s*this.d}},Bt=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},Br=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Us,r=new Os){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=r}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 r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),r(h)},(h,o)=>{const n=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),r(h)},(h,o)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[e],i=r!==void 0;return i&&(this.cache.assetsLoaded[e]=r.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(t,e,h),h)).catch(h=>this.error(s,e,h))),i}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{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}`),i(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),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(e,n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let i=e.lastIndexOf("/"),h=i>=0?e.substring(0,i+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 l=this.createTextureAtlas(e,a);let c=l.pages.length,d=!1;if(c===0){this.success(t,e,l),o(l);return}for(let u of l.pages)this.loadTexture(r?r[u.name]:h+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(t,e,l),o(l)))},(m,f)=>{if(!d){const g=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,g),n(g)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),n(c)}},(a,l)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${l}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},r){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,h)=>{this.downloader.downloadText(e,o=>{try{const n=this.createTextureAtlas(e,o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),h(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(r,i)=>t(i),(r,i)=>s(i))})}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?`
`+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 Ht){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 Ht(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const r of s.pages)r.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),r=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&r()},s}},Os=class ae{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ae.AVAILABLE_CACHES.get(t);if(s)return s;const r=new ae;return ae.AVAILABLE_CACHES.set(t,r),r}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Us=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=t.charCodeAt(i);return r}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToString(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||e,!0);let h=()=>{this.finish(e,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||e,!0),i.responseType="arraybuffer";let h=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let i=t==200||t==0?[s]:[t,s];for(let h=i.length-1,o=r.length;h<o;h+=2)r[h].apply(null,i)}},Je=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}},Qe=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},qs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,r,i,h,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,l=n.b,c=n.c,d=n.d,u=-e.ashearX-e.arotation,m=0,f=0;switch(e.inherit){case 1:m=(t-e.worldX)*X.signum(e.skeleton.scaleX),f=(s-e.worldY)*X.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(a*d-l*c)/Math.max(1e-4,a*a+c*c),x=a/e.skeleton.scaleX,w=c/e.skeleton.scaleY;l=-w*b*e.skeleton.scaleX,d=x*b*e.skeleton.scaleY,u+=Math.atan2(w,x)*X.radDeg;default:let y=t-n.worldX,v=s-n.worldY,C=a*d-l*c;Math.abs(C)<=1e-4?(m=0,f=0):(m=(y*d-v*l)/C-e.ax,f=(v*a-y*c)/C-e.ay)}u+=Math.atan2(f,m)*X.radDeg,e.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=e.ascaleX,p=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,f=s-e.worldY}const b=e.data.length*g;if(b>1e-4){const x=m*m+f*f;if(r&&x<b*b||i&&x>b*b){const w=(Math.sqrt(x)/b-1)*o+1;g*=w,h&&(p*=w)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+u*o,g,p,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,h,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,d=e.ascaleX,u=e.ascaleY,m=d,f=u,g=t.ascaleX,p=0,b=0,x=0;d<0?(d=-d,p=180,x=-1):(p=0,x=1),u<0&&(u=-u,x=-x),g<0?(g=-g,b=180):b=0;let w=t.ax,y=0,v=0,C=0,S=e.a,A=e.b,T=e.c,Y=e.d,M=Math.abs(d-u)<=1e-4;!M||h?(y=0,v=S*w+e.worldX,C=T*w+e.worldY):(y=t.ay,v=S*w+A*y+e.worldX,C=T*w+Y*y+e.worldY);let P=e.parent;if(!P)throw new Error("IK parent must itself have a parent.");S=P.a,A=P.b,T=P.c,Y=P.d;let E=S*Y-A*T,I=v-P.worldX,F=C-P.worldY;E=Math.abs(E)<=1e-4?0:1/E;let L=(I*Y-F*A)*E-l,N=(F*S-I*T)*E-c,V=Math.sqrt(L*L+N*N),_=t.data.length*g,$,W;if(V<1e-4){this.apply1(e,s,r,!1,h,!1,a),t.updateWorldTransformWith(w,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-P.worldX,F=r-P.worldY;let j=(I*Y-F*A)*E-l,R=(F*S-I*T)*E-c,U=j*j+R*R;if(n!=0){n*=d*(g+1)*.5;let J=Math.sqrt(U),Z=J-V-_*d+n;if(Z>0){let tt=Math.min(1,Z/(n*2))-1;tt=(Z-n*(1-tt*tt))/J,j-=tt*j,R-=tt*R,U=j*j+R*R}}t:if(M){_*=d;let J=(U-V*V-_*_)/(2*V*_);J<-1?(J=-1,W=Math.PI*i):J>1?(J=1,W=0,h&&(S=(Math.sqrt(U)/(V+_)-1)*a+1,m*=S,o&&(f*=S))):W=Math.acos(J)*i,S=V+_*J,A=_*Math.sin(W),$=Math.atan2(R*S-j*A,j*S+R*A)}else{S=d*_,A=u*_;let J=S*S,Z=A*A,tt=Math.atan2(R,j);T=Z*V*V+J*U-J*Z;let nt=-2*Z*V,vt=Z-J;if(Y=nt*nt-4*vt*T,Y>=0){let Ct=Math.sqrt(Y);nt<0&&(Ct=-Ct),Ct=-(nt+Ct)*.5;let Ft=Ct/vt,Ss=T/Ct,Ot=Math.abs(Ft)<Math.abs(Ss)?Ft:Ss;if(Ft=U-Ot*Ot,Ft>=0){F=Math.sqrt(Ft)*i,$=tt-Math.atan2(F,Ot),W=Math.atan2(F/u,(Ot-V)/d);break t}}let Yt=X.PI,Nt=V-S,oe=Nt*Nt,ys=0,vs=0,_t=V+S,le=_t*_t,Cs=0;T=-S*V/(J-Z),T>=-1&&T<=1&&(T=Math.acos(T),I=S*Math.cos(T)+V,F=A*Math.sin(T),Y=I*I+F*F,Y<oe&&(Yt=T,oe=Y,Nt=I,ys=F),Y>le&&(vs=T,le=Y,_t=I,Cs=F)),U<=(oe+le)*.5?($=tt-Math.atan2(ys*i,Nt),W=Yt*i):($=tt-Math.atan2(Cs*i,_t),W=vs*i)}let G=Math.atan2(y,w)*x,st=e.arotation;$=($-G)*X.radDeg+p-st,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(l,c,st+$*a,m,f,0,0),st=t.arotation,W=((W+G)*X.radDeg-t.ashearX)*x+b-st,W>180?W-=360:W<-180&&(W+=360),t.updateWorldTransformWith(w,y,st+W*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ze=class extends Bt{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)}},ts=class extends Bt{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)}},es=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(es||{}),ss=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ss||{}),rs=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(rs||{}),Ws=class gt{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 i=0,h=t.bones.length;i<h;i++){let o=s.findBone(t.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(t.target.name);if(!r)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=r,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 Tt))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,l=this.bones,c=l.length,d=n?c:c+1,u=B.setArraySize(this.spaces,d),m=a?this.lengths=B.setArraySize(this.lengths,c):[],f=this.spacing;switch(o.spacingMode){case 2:if(a)for(let C=0,S=d-1;C<S;C++){let A=l[C],T=A.data.length,Y=T*A.a,M=T*A.c;m[C]=Math.sqrt(Y*Y+M*M)}B.arrayFill(u,1,d,f);break;case 3:let y=0;for(let C=0,S=d-1;C<S;){let A=l[C],T=A.data.length;if(T<gt.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=T*A.a,M=T*A.c,P=Math.sqrt(Y*Y+M*M);a&&(m[C]=P),u[++C]=P,y+=P}}if(y>0){y=d/y*f;for(let C=1;C<d;C++)u[C]*=y}break;default:let v=o.spacingMode==0;for(let C=0,S=d-1;C<S;){let A=l[C],T=A.data.length;if(T<gt.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=T*A.a,M=T*A.c,P=Math.sqrt(Y*Y+M*M);a&&(m[C]=P),u[++C]=(v?T+f:f)*P/T}}}let g=this.computeWorldPositions(s,d,n),p=g[0],b=g[1],x=o.offsetRotation,w=!1;if(x==0)w=o.rotateMode==1;else{w=!1;let y=this.target.bone;x*=y.a*y.d-y.b*y.c>0?X.degRad:-X.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=l[y];C.worldX+=(p-C.worldX)*i,C.worldY+=(b-C.worldY)*h;let S=g[v],A=g[v+1],T=S-p,Y=A-b;if(a){let M=m[y];if(M!=0){let P=(Math.sqrt(T*T+Y*Y)/M-1)*r+1;C.a*=P,C.c*=P}}if(p=S,b=A,r>0){let M=C.a,P=C.b,E=C.c,I=C.d,F=0,L=0,N=0;if(n?F=g[v-1]:u[y+1]==0?F=g[v+2]:F=Math.atan2(Y,T),F-=Math.atan2(E,M),w){L=Math.cos(F),N=Math.sin(F);let V=C.data.length;p+=(V*(L*M-N*E)-T)*r,b+=(V*(N*M+L*E)-Y)*r}else F+=x;F>X.PI?F-=X.PI2:F<-X.PI&&(F+=X.PI2),F*=r,L=Math.cos(F),N=Math.sin(F),C.a=L*M-N*E,C.b=L*P-N*I,C.c=N*M+L*E,C.d=N*P+L*I}C.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,h=this.position,o=this.spaces,n=B.setArraySize(this.positions,s*3+2),a=this.world,l=t.closed,c=t.worldVerticesLength,d=c/6,u=gt.NONE;if(!t.constantSpeed){let V=t.lengths;d-=l?1:2;let _=V[d];this.data.positionMode==1&&(h*=_);let $;switch(this.data.spacingMode){case 2:$=_;break;case 3:$=_/s;break;default:$=1}a=B.setArraySize(this.world,8);for(let W=0,j=0,R=0;W<s;W++,j+=3){let U=o[W]*$;h+=U;let G=h;if(l)G%=_,G<0&&(G+=_),R=0;else if(G<0){u!=gt.BEFORE&&(u=gt.BEFORE,t.computeWorldVertices(i,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>_){u!=gt.AFTER&&(u=gt.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-_,a,0,n,j);continue}for(;;R++){let st=V[R];if(!(G>st)){if(R==0)G/=st;else{let J=V[R-1];G=(G-J)/(st-J)}break}}R!=u&&(u=R,l&&R==d?(t.computeWorldVertices(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,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,r||W>0&&U==0)}return n}l?(c+=2,a=B.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=B.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=B.setArraySize(this.curves,d),f=0,g=a[0],p=a[1],b=0,x=0,w=0,y=0,v=0,C=0,S=0,A=0,T=0,Y=0,M=0,P=0,E=0,I=0;for(let V=0,_=2;V<d;V++,_+=6)b=a[_],x=a[_+1],w=a[_+2],y=a[_+3],v=a[_+4],C=a[_+5],S=(g-b*2+w)*.1875,A=(p-x*2+y)*.1875,T=((b-w)*3-g+v)*.09375,Y=((x-y)*3-p+C)*.09375,M=S*2+T,P=A*2+Y,E=(b-g)*.75+S+T*.16666667,I=(x-p)*.75+A+Y*.16666667,f+=Math.sqrt(E*E+I*I),E+=M,I+=P,M+=T,P+=Y,f+=Math.sqrt(E*E+I*I),E+=M,I+=P,f+=Math.sqrt(E*E+I*I),E+=M+T,I+=P+Y,f+=Math.sqrt(E*E+I*I),m[V]=f,g=v,p=C;this.data.positionMode==1&&(h*=f);let F;switch(this.data.spacingMode){case 2:F=f;break;case 3:F=f/s;break;default:F=1}let L=this.segments,N=0;for(let V=0,_=0,$=0,W=0;V<s;V++,_+=3){let j=o[V]*F;h+=j;let R=h;if(l)R%=f,R<0&&(R+=f),$=0;else if(R<0){this.addBeforePosition(R,a,0,n,_);continue}else if(R>f){this.addAfterPosition(R-f,a,c-4,n,_);continue}for(;;$++){let U=m[$];if(!(R>U)){if($==0)R/=U;else{let G=m[$-1];R=(R-G)/(U-G)}break}}if($!=u){u=$;let U=$*6;for(g=a[U],p=a[U+1],b=a[U+2],x=a[U+3],w=a[U+4],y=a[U+5],v=a[U+6],C=a[U+7],S=(g-b*2+w)*.03,A=(p-x*2+y)*.03,T=((b-w)*3-g+v)*.006,Y=((x-y)*3-p+C)*.006,M=S*2+T,P=A*2+Y,E=(b-g)*.3+S+T*.16666667,I=(x-p)*.3+A+Y*.16666667,N=Math.sqrt(E*E+I*I),L[0]=N,U=1;U<8;U++)E+=M,I+=P,M+=T,P+=Y,N+=Math.sqrt(E*E+I*I),L[U]=N;E+=M,I+=P,N+=Math.sqrt(E*E+I*I),L[8]=N,E+=M+T,I+=P+Y,N+=Math.sqrt(E*E+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,g,p,b,x,w,y,v,C,n,_,r||V>0&&j==0)}return n}addBeforePosition(t,s,r,i,h){let o=s[r],n=s[r+1],a=s[r+2]-o,l=s[r+3]-n,c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addAfterPosition(t,s,r,i,h){let o=s[r+2],n=s[r+3],a=o-s[r],l=n-s[r+1],c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addCurvePosition(t,s,r,i,h,o,n,a,l,c,d,u){if(t==0||isNaN(t)){c[d]=s,c[d+1]=r,c[d+2]=Math.atan2(h-r,i-s);return}let m=t*t,f=m*t,g=1-t,p=g*g,b=p*g,x=g*t,w=x*3,y=g*w,v=w*t,C=s*b+i*y+o*v+a*f,S=r*b+h*y+n*v+l*f;c[d]=C,c[d+1]=S,u&&(t<.001?c[d+2]=Math.atan2(h-r,i-s):c[d+2]=Math.atan2(S-(r*p+h*x*2+n*m),C-(s*p+i*x*2+o*m)))}},Rr=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=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,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,p=-1,b=this.data.limit*l,x=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||r){if(s){const w=(this.ux-c)*m;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=c}if(r){const w=(this.uy-d)*m;this.yOffset+=w>x?x:w<-x?-x:w,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const w=this.massInverse*f,y=this.strength,v=this.wind*g*a.scaleX,C=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*w,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),r&&(this.yVelocity-=(C+this.yOffset*y)*w,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f;while(u>=f)}s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||h){let w=Math.atan2(o.c,o.a),y=0,v=0,C=0,S=this.cx-o.worldX,A=this.cy-o.worldY;if(S>b?S=b:S<-b&&(S=-b),A>x?A=x:A<-x&&(A=-x),i){C=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(A+this.ty,S+this.tx)-w-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*X.invPI2-.5)*X.PI2)*m,T=this.rotateOffset*C+w,y=Math.cos(T),v=Math.sin(T),h&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(S*y+A*v)*m/T))}else{y=Math.cos(w),v=Math.sin(w);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(S*y+A*v)*m/T)}if(u=this.remaining,u>=f){p==-1&&(p=Math.pow(this.damping,60*f));const T=this.massInverse*f,Y=this.strength,M=this.wind,P=It.yDown?-this.gravity:this.gravity,E=n/g;for(;;)if(u-=f,h&&(this.scaleVelocity+=(M*y-P*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),i){if(this.rotateVelocity-=((M*v+P*y)*E+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const I=this.rotateOffset*C+w;y=Math.cos(I),v=Math.sin(I)}else if(u<f)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i){let a=this.rotateOffset*t,l=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=a*this.data.rotate,l=Math.sin(u),c=Math.cos(u),d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d),u+=a*this.data.shearX,l=Math.sin(u),c=Math.cos(u),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c}else a*=this.data.rotate,l=Math.sin(a),c=Math.cos(a),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c,d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d}if(h){const 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 r=s*X.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*h-o,o*h+n*i-n)}},zs=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ct)||!(this.attachment instanceof ct)||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}},Gs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Pt;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,u=a*d-l*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;p<b;p++){let x=g[p];if(e!=0){let w=x.a,y=x.b,v=x.c,C=x.d,S=Math.atan2(c,a)-Math.atan2(v,w)+m;S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=e;let A=Math.cos(S),T=Math.sin(S);x.a=A*w-T*v,x.b=A*y-T*C,x.c=T*w+A*v,x.d=T*y+A*C}if(o){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(w.x-x.worldX)*t,x.worldY+=(w.y-x.worldY)*s}if(r!=0){let w=Math.sqrt(x.a*x.a+x.c*x.c);w!=0&&(w=(w+(Math.sqrt(a*a+c*c)-w+this.data.offsetScaleX)*r)/w),x.a*=w,x.c*=w}if(i!=0){let w=Math.sqrt(x.b*x.b+x.d*x.d);w!=0&&(w=(w+(Math.sqrt(l*l+d*d)-w+this.data.offsetScaleY)*i)/w),x.b*=w,x.d*=w}if(h>0){let w=x.b,y=x.d,v=Math.atan2(y,w),C=Math.atan2(d,l)-Math.atan2(c,a)-(v-Math.atan2(x.c,x.a));C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C=v+(C+f)*h;let S=Math.sqrt(w*w+y*y);x.b=Math.cos(C)*S,x.d=Math.sin(C)*S}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,u=a*d-l*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;p<b;p++){let x=g[p];if(e!=0){let w=x.a,y=x.b,v=x.c,C=x.d,S=Math.atan2(c,a)+m;S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=e;let A=Math.cos(S),T=Math.sin(S);x.a=A*w-T*v,x.b=A*y-T*C,x.c=T*w+A*v,x.d=T*y+A*C}if(o){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=w.x*t,x.worldY+=w.y*s}if(r!=0){let w=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*r+1;x.a*=w,x.c*=w}if(i!=0){let w=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*i+1;x.b*=w,x.d*=w}if(h>0){let w=Math.atan2(d,l)-Math.atan2(c,a);w>X.PI?w-=X.PI2:w<-X.PI&&(w+=X.PI2);let y=x.b,v=x.d;w=Math.atan2(v,y)+(w-X.PI/2+f)*h;let C=Math.sqrt(y*y+v*v);x.b=Math.cos(w)*C,x.d=Math.sin(w)*C}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],d=c.arotation;e!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*e);let u=c.ax,m=c.ay;u+=(o.ax-u+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let f=c.ascaleX,g=c.ascaleY;r!=0&&f!=0&&(f=(f+(o.ascaleX-f+this.data.offsetScaleX)*r)/f),i!=0&&g!=0&&(g=(g+(o.ascaleY-g+this.data.offsetScaleY)*i)/g);let p=c.ashearY;h!=0&&(p+=(o.ashearY-p+this.data.offsetShearY)*h),c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],d=c.arotation+(o.arotation+this.data.offsetRotation)*e,u=c.ax+(o.ax+this.data.offsetX)*t,m=c.ay+(o.ay+this.data.offsetY)*s,f=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),g=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),p=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,p)}}},It=class ws{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 ws.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 r=t.bones[s],i;if(!r.parent)i=new je(r,this,null);else{let h=this.bones[r.parent.index];i=new je(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let r=t.slots[s],i=this.bones[r.boneData.index],h=new zs(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let r=t.ikConstraints[s];this.ikConstraints.push(new qs(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new Gs(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new Ws(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new Rr(r,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let u=0,m=s.length;u<m;u++){let f=s[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let g=this.bones[u[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,n=r.length,a=i.length,l=h.length,c=this.physicsConstraints.length,d=n+a+l+c;t:for(let u=0;u<d;u++){for(let m=0;m<n;m++){let f=r[m];if(f.data.order==u){this.sortIkConstraint(f);continue t}}for(let m=0;m<a;m++){let f=i[m];if(f.data.order==u){this.sortTransformConstraint(f);continue t}}for(let m=0;m<l;m++){let f=h[m];if(f.data.order==u){this.sortPathConstraint(f);continue t}}for(let m=0;m<c;m++){const f=o[m];if(f.data.order==u){this.sortPhysicsConstraint(f);continue t}}}for(let u=0,m=s.length;u<m;u++)this.sortBone(s[u])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&B.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let r=t.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&B.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let a=0,l=this.data.skins.length;a<l;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,i);let h=s.getAttachment();h instanceof Tt&&this.sortPathConstraintAttachmentWith(h,i);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&&B.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,r=s.length;if(t.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(t);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(t,s,r){let i=t.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Tt))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let n=r[h++];for(n+=h;h<n;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&B.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,r=t.length;s<r;s++){let i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let p=1,b=r.length;p<b;p++){let x=r[p];x.ax=x.x,x.ay=x.y,x.arotation=x.rotation,x.ascaleX=x.scaleX,x.ascaleY=x.scaleY,x.ashearX=x.shearX,x.ashearY=x.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,n=s.c,a=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=n*this.x+a*this.y+s.worldY;const l=(i.rotation+i.shearX)*X.degRad,c=(i.rotation+90+i.shearY)*X.degRad,d=Math.cos(l)*i.scaleX,u=Math.cos(c)*i.scaleY,m=Math.sin(l)*i.scaleX,f=Math.sin(c)*i.scaleY;i.a=(h*d+o*m)*this.scaleX,i.b=(h*u+o*f)*this.scaleX,i.c=(n*d+a*m)*this.scaleY,i.d=(n*u+a*f)*this.scaleY;let g=this._updateCache;for(let p=0,b=g.length;p<b;p++){let x=g[p];x!=i&&x.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;B.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,r=t.length;s<r;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 r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==t)return h}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==t)return h}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],o=h.data.attachmentName;if(o){let n=t.getAttachment(r,o);n&&h.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let r=this.data.findSlot(t);if(!r)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(r.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(t,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let o=r[i];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(i,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 Pt,r=new Pt;return this.getBounds(s,r,void 0,t),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(t,s,r=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let u=h[c];if(!u.bone.active)continue;let m=0,f=null,g=null,p=u.getAttachment();if(p instanceof Xt)m=8,f=B.setArraySize(r,m,0),p.computeWorldVertices(u,f,0,2),g=ws.quadTriangles;else if(p instanceof At){let b=p;m=b.worldVerticesLength,f=B.setArraySize(r,m,0),b.computeWorldVertices(u,0,m,f,0,2),g=b.triangles}else if(p instanceof pt&&i!=null){i.clipStart(u,p);continue}if(f&&g){i!=null&&i.isClipping()&&(i.clipTriangles(f,g,g.length),f=i.clippedVertices,m=i.clippedVertices.length);for(let b=0,x=f.length;b<x;b+=2){let w=f[b],y=f[b+1];o=Math.min(o,w),n=Math.min(n,y),a=Math.max(a,w),l=Math.max(l,y)}}i?.clipEndWithSlot(u)}i?.clipEnd(),t.set(o,n),s.set(a-o,l-n)}update(t){this.time+=t}physicsTranslate(t,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(t,s)}physicsRotate(t,s,r){const i=this.physicsConstraints;for(let h=0,o=i.length;h<o;h++)i[h].rotate(t,s,r)}},$s=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))($s||{}),Hs=class extends Bt{_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)}},Rt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}},is=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Lt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new D(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof At?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new is(t,r,i))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new is(e,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let i=e.slots[r],h=i.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let n in o){let a=o[n];if(h==a){let l=this.getAttachment(s,n);l&&i.setAttachment(l);break}}}s++}}},ns=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},as=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(as||{}),os=class extends Bt{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)}},ls=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Rt;s.name="";let r=new Ks(e),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[r.readInt(!0)],u=new Ke(l,c,d);u.rotation=r.readFloat(),u.x=r.readFloat()*t,u.y=r.readFloat()*t,u.scaleX=r.readFloat(),u.scaleY=r.readFloat(),u.shearX=r.readFloat(),u.shearY=r.readFloat(),u.length=r.readFloat()*t,u.inherit=r.readByte(),u.skinRequired=r.readBoolean(),o&&(D.rgba8888ToColor(u.color,r.readInt32()),u.icon=r.readString()??void 0,u.visible=r.readBoolean()),s.bones.push(u)}n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[r.readInt(!0)],u=new ns(l,c,d);D.rgba8888ToColor(u.color,r.readInt32());let m=r.readInt32();m!=-1&&D.rgb888ToColor(u.darkColor=new D,m),u.attachmentName=r.readStringRef(),u.blendMode=r.readInt(!0),o&&(u.visible=r.readBoolean()),s.slots.push(u)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let d=r.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new Ze(d);u.order=r.readInt(!0),c=r.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[r.readInt(!0)]);u.target=s.bones[r.readInt(!0)];let m=r.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=(m&2)!=0?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,(m&32)!=0&&(u.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(u.softness=r.readFloat()*t),s.ikConstraints.push(u)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let d=r.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new os(d);u.order=r.readInt(!0),c=r.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[r.readInt(!0)]);u.target=s.bones[r.readInt(!0)];let m=r.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,(m&8)!=0&&(u.offsetRotation=r.readFloat()),(m&16)!=0&&(u.offsetX=r.readFloat()*t),(m&32)!=0&&(u.offsetY=r.readFloat()*t),(m&64)!=0&&(u.offsetScaleX=r.readFloat()),(m&128)!=0&&(u.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(u.offsetShearY=r.readFloat()),(m&2)!=0&&(u.mixRotate=r.readFloat()),(m&4)!=0&&(u.mixX=r.readFloat()),(m&8)!=0&&(u.mixY=r.readFloat()),(m&16)!=0&&(u.mixScaleX=r.readFloat()),(m&32)!=0&&(u.mixScaleY=r.readFloat()),(m&64)!=0&&(u.mixShearY=r.readFloat()),s.transformConstraints.push(u)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let d=r.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new ts(d);u.order=r.readInt(!0),u.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[r.readInt(!0)]);u.target=s.slots[r.readInt(!0)];const m=r.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=r.readFloat()),u.position=r.readFloat(),u.positionMode==0&&(u.position*=t),u.spacing=r.readFloat(),(u.spacingMode==0||u.spacingMode==1)&&(u.spacing*=t),u.mixRotate=r.readFloat(),u.mixX=r.readFloat(),u.mixY=r.readFloat(),s.pathConstraints.push(u)}n=r.readInt(!0);for(let l=0,c;l<n;l++){const d=r.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Hs(d);u.order=r.readInt(!0),u.bone=s.bones[r.readInt(!0)];let m=r.readByte();u.skinRequired=(m&1)!=0,(m&2)!=0&&(u.x=r.readFloat()),(m&4)!=0&&(u.y=r.readFloat()),(m&8)!=0&&(u.rotate=r.readFloat()),(m&16)!=0&&(u.scaleX=r.readFloat()),(m&32)!=0&&(u.shearX=r.readFloat()),u.limit=((m&64)!=0?r.readFloat():5e3)*t,u.step=1/r.readUnsignedByte(),u.inertia=r.readFloat(),u.strength=r.readFloat(),u.damping=r.readFloat(),u.massInverse=(m&128)!=0?r.readFloat():1,u.wind=r.readFloat(),u.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(u.inertiaGlobal=!0),(m&2)!=0&&(u.strengthGlobal=!0),(m&4)!=0&&(u.dampingGlobal=!0),(m&8)!=0&&(u.massGlobal=!0),(m&16)!=0&&(u.windGlobal=!0),(m&32)!=0&&(u.gravityGlobal=!0),(m&64)!=0&&(u.mixGlobal=!0),u.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(u)}let a=this.readSkin(r,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let l=s.skins.length;for(B.setArraySize(s.skins,n=l+r.readInt(!0));l<n;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}n=this.linkedMeshes.length;for(let l=0;l<n;l++){let c=this.linkedMeshes[l];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let d=new Qe(c);d.intValue=r.readInt(!1),d.floatValue=r.readFloat(),d.stringValue=r.readString(),d.audioPath=r.readString(),d.audioPath&&(d.volume=r.readFloat(),d.balance=r.readFloat()),s.events.push(d)}n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(e,t,s,r){let i=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;i=new Lt("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");i=new Lt(o),r&&D.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let n=0,a=i.bones.length;n<a;n++)i.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let n=e.readInt(!0);for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,i,n,c,r);d&&i.setAttachment(n,c,d)}}return i}readAttachment(e,t,s,r,i,h){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():i;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let l=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null;let u=(n&128)!=0?e.readFloat():0,m=e.readFloat(),f=e.readFloat(),g=e.readFloat(),p=e.readFloat(),b=e.readFloat(),x=e.readFloat();l||(l=a);let w=this.attachmentLoader.newRegionAttachment(s,a,l,d);return w?(w.path=l,w.x=m*o,w.y=f*o,w.scaleX=g,w.scaleY=p,w.rotation=u,w.width=b*o,w.height=x*o,D.rgba8888ToColor(w.color,c),w.sequence=d,d==null&&w.updateRegion(),w):null}case 1:{let l=this.readVertices(e,(n&16)!=0),c=h?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&D.rgba8888ToColor(d.color,c),d):null}case 2:{let l=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,u=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),f=this.readFloatArray(e,m.length,1),g=this.readShortArray(e,(m.length-u-2)*3);let p=[],b=0,x=0;h&&(p=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),x=e.readFloat()),l||(l=a);let w=this.attachmentLoader.newMeshAttachment(s,a,l,d);return w?(w.path=l,D.rgba8888ToColor(w.color,c),w.bones=m.bones,w.vertices=m.vertices,w.worldVerticesLength=m.length,w.triangles=g,w.regionUVs=f,d==null&&w.updateRegion(),w.hullLength=u<<1,w.sequence=d,h&&(w.edges=p,w.width=b*o,w.height=x*o),w):null}case 3:{const l=(n&16)!=0?e.readStringRef():a;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,u=(n&128)!=0,m=e.readInt(!0),f=e.readStringRef();let g=0,p=0;h&&(g=e.readFloat(),p=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,l,d);return b?(b.path=l,D.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*o,b.height=p*o),this.linkedMeshes.push(new Lr(b,m,r,f,u)),b):null}case 4:{const l=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(e,(n&64)!=0),u=B.newArray(d.length/6,0);for(let g=0,p=u.length;g<p;g++)u[g]=e.readFloat()*o;const m=h?e.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=l,f.constantSpeed=c,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,h&&D.rgba8888ToColor(f.color,m),f):null}case 5:{const l=e.readFloat(),c=e.readFloat(),d=e.readFloat(),u=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=d*o,m.rotation=l,h&&D.rgba8888ToColor(m.color,u),m):null}case 6:{const l=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let d=h?e.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,a);return u?(u.endSlot=t.slots[l],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,h&&D.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(e){let t=new Ts(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,r=e.readInt(!0),i=new Vr;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let h=new Array,o=new Array;for(let n=0;n<r;n++){let a=e.readInt(!0);o.push(a);for(let l=0;l<a;l++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return i.vertices=B.toFloatArray(h),i.bones=o,i}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let i=0;i<t;i++)r[i]=e.readFloat();else for(let i=0;i<t;i++)r[i]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,i=this.scale;for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0);for(let d=0,u=e.readInt(!0);d<u;d++){let m=e.readByte(),f=e.readInt(!0),g=f-1;switch(m){case Kr:{let p=new xt(f,c);for(let b=0;b<f;b++)p.setFrame(b,e.readFloat(),e.readStringRef());r.push(p);break}case jr:{let p=e.readInt(!0),b=new ve(f,p,c),x=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let S=0,A=0;b.setFrame(S,x,w,y,v,C),S!=g;S++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case dt:b.setStepped(S);break;case ut:q(e,b,A++,S,0,x,T,w,Y,1),q(e,b,A++,S,1,x,T,y,M,1),q(e,b,A++,S,2,x,T,v,P,1),q(e,b,A++,S,3,x,T,C,E,1)}x=T,w=Y,y=M,v=P,C=E}r.push(b);break}case Jr:{let p=e.readInt(!0),b=new Ce(f,p,c),x=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let C=0,S=0;b.setFrame(C,x,w,y,v),C!=g;C++){let A=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case dt:b.setStepped(C);break;case ut:q(e,b,S++,C,0,x,A,w,T,1),q(e,b,S++,C,1,x,A,y,Y,1),q(e,b,S++,C,2,x,A,v,M,1)}x=A,w=T,y=Y,v=M}r.push(b);break}case Qr:{let p=e.readInt(!0),b=new ke(f,p,c),x=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,M=0;b.setFrame(Y,x,w,y,v,C,S,A,T),Y!=g;Y++){let P=e.readFloat(),E=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case dt:b.setStepped(Y);break;case ut:q(e,b,M++,Y,0,x,P,w,E,1),q(e,b,M++,Y,1,x,P,y,I,1),q(e,b,M++,Y,2,x,P,v,F,1),q(e,b,M++,Y,3,x,P,C,L,1),q(e,b,M++,Y,4,x,P,S,N,1),q(e,b,M++,Y,5,x,P,A,V,1),q(e,b,M++,Y,6,x,P,T,_,1)}x=P,w=E,y=I,v=F,C=L,S=N,A=V,T=_}r.push(b);break}case Zr:{let p=e.readInt(!0),b=new Ae(f,p,c),x=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let T=0,Y=0;b.setFrame(T,x,w,y,v,C,S,A),T!=g;T++){let M=e.readFloat(),P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case dt:b.setStepped(T);break;case ut:q(e,b,Y++,T,0,x,M,w,P,1),q(e,b,Y++,T,1,x,M,y,E,1),q(e,b,Y++,T,2,x,M,v,I,1),q(e,b,Y++,T,3,x,M,C,F,1),q(e,b,Y++,T,4,x,M,S,L,1),q(e,b,Y++,T,5,x,M,A,N,1)}x=M,w=P,y=E,v=I,C=F,S=L,A=N}r.push(b);break}case ti:{let p=new Se(f,e.readInt(!0),c),b=e.readFloat(),x=e.readUnsignedByte()/255;for(let w=0,y=0;p.setFrame(w,b,x),w!=g;w++){let v=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case dt:p.setStepped(w);break;case ut:q(e,p,y++,w,0,b,v,x,C,1)}b=v,x=C}r.push(p)}}}}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0);for(let d=0,u=e.readInt(!0);d<u;d++){let m=e.readByte(),f=e.readInt(!0);if(m==Hr){let p=new ye(f,c);for(let b=0;b<f;b++)p.setFrame(b,e.readFloat(),e.readByte());r.push(p);continue}let g=e.readInt(!0);switch(m){case Dr:r.push(et(e,new Et(f,g,c),1));break;case Nr:r.push(hs(e,new de(f,g,c),i));break;case _r:r.push(et(e,new ue(f,g,c),i));break;case Or:r.push(et(e,new fe(f,g,c),i));break;case Ur:r.push(hs(e,new me(f,g,c),1));break;case qr:r.push(et(e,new ge(f,g,c),1));break;case Wr:r.push(et(e,new xe(f,g,c),1));break;case zr:r.push(hs(e,new pe(f,g,c),1));break;case Gr:r.push(et(e,new we(f,g,c),1));break;case $r:r.push(et(e,new be(f,g,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),d=e.readInt(!0),u=d-1,m=new Ie(d,e.readInt(!0),c),f=e.readByte(),g=e.readFloat(),p=(f&1)!=0?(f&2)!=0?e.readFloat():1:0,b=(f&4)!=0?e.readFloat()*i:0;for(let x=0,w=0;m.setFrame(x,g,p,b,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),x!=u;x++){f=e.readByte();const y=e.readFloat(),v=(f&1)!=0?(f&2)!=0?e.readFloat():1:0,C=(f&4)!=0?e.readFloat()*i:0;(f&64)!=0?m.setStepped(x):(f&128)!=0&&(q(e,m,w++,x,0,g,y,p,v,1),q(e,m,w++,x,1,g,y,b,C,i)),g=y,p=v,b=C}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),d=e.readInt(!0),u=d-1,m=new Me(d,e.readInt(!0),c),f=e.readFloat(),g=e.readFloat(),p=e.readFloat(),b=e.readFloat(),x=e.readFloat(),w=e.readFloat(),y=e.readFloat();for(let v=0,C=0;m.setFrame(v,f,g,p,b,x,w,y),v!=u;v++){let S=e.readFloat(),A=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),P=e.readFloat(),E=e.readFloat();switch(e.readByte()){case dt:m.setStepped(v);break;case ut:q(e,m,C++,v,0,f,S,g,A,1),q(e,m,C++,v,1,f,S,p,T,1),q(e,m,C++,v,2,f,S,b,Y,1),q(e,m,C++,v,3,f,S,x,M,1),q(e,m,C++,v,4,f,S,w,P,1),q(e,m,C++,v,5,f,S,y,E,1)}f=S,g=A,p=T,b=Y,x=M,w=P,y=E}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),d=s.pathConstraints[c];for(let u=0,m=e.readInt(!0);u<m;u++){const f=e.readByte(),g=e.readInt(!0),p=e.readInt(!0);switch(f){case ri:r.push(et(e,new Ye(g,p,c),d.positionMode==0?i:1));break;case ii:r.push(et(e,new Fe(g,p,c),d.spacingMode==0||d.spacingMode==1?i:1));break;case ni:let b=new Pe(g,p,c),x=e.readFloat(),w=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let C=0,S=0,A=b.getFrameCount()-1;b.setFrame(C,x,w,y,v),C!=A;C++){let T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),P=e.readFloat();switch(e.readByte()){case dt:b.setStepped(C);break;case ut:q(e,b,S++,C,0,x,T,w,Y,1),q(e,b,S++,C,1,x,T,y,M,1),q(e,b,S++,C,2,x,T,v,P,1)}x=T,w=Y,y=M,v=P}r.push(b)}}}for(let a=0,l=e.readInt(!0);a<l;a++){const c=e.readInt(!0)-1;for(let d=0,u=e.readInt(!0);d<u;d++){const m=e.readByte(),f=e.readInt(!0);if(m==fi){const p=new Ne(f,c);for(let b=0;b<f;b++)p.setFrame(b,e.readFloat());r.push(p);continue}const g=e.readInt(!0);switch(m){case ai:r.push(et(e,new Ee(f,g,c),1));break;case oi:r.push(et(e,new Xe(f,g,c),1));break;case li:r.push(et(e,new Be(f,g,c),1));break;case hi:r.push(et(e,new Re(f,g,c),1));break;case ci:r.push(et(e,new Le(f,g,c),1));break;case di:r.push(et(e,new Ve(f,g,c),1));break;case ui:r.push(et(e,new De(f,g,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){let c=s.skins[e.readInt(!0)];for(let d=0,u=e.readInt(!0);d<u;d++){let m=e.readInt(!0);for(let f=0,g=e.readInt(!0);f<g;f++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,p),x=e.readByte(),w=e.readInt(!0),y=w-1;switch(x){case ei:{let v=b,C=v.bones,S=v.vertices,A=C?S.length/3*2:S.length,T=e.readInt(!0),Y=new Te(w,T,m,v),M=e.readFloat();for(let P=0,E=0;;P++){let I,F=e.readInt(!0);if(F==0)I=C?B.newFloatArray(A):S;else{I=B.newFloatArray(A);let N=e.readInt(!0);if(F+=N,i==1)for(let V=N;V<F;V++)I[V]=e.readFloat();else for(let V=N;V<F;V++)I[V]=e.readFloat()*i;if(!C)for(let V=0,_=I.length;V<_;V++)I[V]+=S[V]}if(Y.setFrame(P,M,I),P==y)break;let L=e.readFloat();switch(e.readByte()){case dt:Y.setStepped(P);break;case ut:q(e,Y,E++,P,0,M,L,0,1,1)}M=L}r.push(Y);break}case si:{let v=new _e(w,m,b);for(let C=0;C<w;C++){let S=e.readFloat(),A=e.readInt32();v.setFrame(C,S,Ms[A&15],A>>4,e.readFloat())}r.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let a=new kt(h),l=s.slots.length;for(let c=0;c<h;c++){let d=e.readFloat(),u=e.readInt(!0),m=B.newArray(l,0);for(let b=l-1;b>=0;b--)m[b]=-1;let f=B.newArray(l-u,0),g=0,p=0;for(let b=0;b<u;b++){let x=e.readInt(!0);for(;g!=x;)f[p++]=g++;m[g+e.readInt(!0)]=g++}for(;g<l;)f[p++]=g++;for(let b=l-1;b>=0;b--)m[b]==-1&&(m[b]=f[--p]);a.setFrame(c,d,m)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=new Wt(o);for(let l=0;l<o;l++){let c=e.readFloat(),d=s.events[e.readInt(!0)],u=new Je(c,d);u.intValue=e.readInt(!1),u.floatValue=e.readFloat(),u.stringValue=e.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=e.readFloat(),u.balance=e.readFloat()),a.setFrame(l,u)}r.push(a)}let n=0;for(let a=0,l=r.length;a<l;a++)n=Math.max(n,r[a].getDuration());return new Ut(t,r,n)}},Ks=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=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 r=0;r<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(i),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Lr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},Vr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function et(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let h=0,o=0,n=t.getFrameCount()-1;t.setFrame(h,r,i),h!=n;h++){let a=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(h);break;case ut:q(e,t,o++,h,0,r,a,i,l,s)}r=a,i=l}return t}function hs(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,h),o!=a;o++){let l=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(o);break;case ut:q(e,t,n++,o,0,r,l,i,c,s),q(e,t,n++,o,1,r,l,h,d,s)}r=l,i=c,h=d}return t}function q(e,t,s,r,i,h,o,n,a,l){t.setBezier(s,r,i,h,n,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,a)}var Dr=0,Nr=1,_r=2,Or=3,Ur=4,qr=5,Wr=6,zr=7,Gr=8,$r=9,Hr=10,Kr=0,jr=1,Jr=2,Qr=3,Zr=4,ti=5,ei=0,si=1,ri=0,ii=1,ni=2,ai=0,oi=1,li=2,hi=4,ci=5,di=6,ui=7,fi=8,dt=1,ut=2,js=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new St(()=>B.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=e.slots,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n<o;n++){let a=h[n];if(!a.bone.active)continue;let l=a.getAttachment();if(l instanceof ze){let c=l;s.push(c);let d=i.obtain();d.length!=c.worldVerticesLength&&(d=B.newFloatArray(c.worldVerticesLength)),r.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,o=i.length;h<o;h++){let n=i[h],a=n;for(let l=0,c=n.length;l<c;l+=2){let d=a[l],u=a[l+1];e=Math.min(e,d),t=Math.min(t,u),s=Math.max(s,d),r=Math.max(r,u)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let i=this.minX,h=this.minY,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=h&&r<=h||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),l=a*(i-e)+t;if(l>h&&l<n||(l=a*(o-e)+t,l>h&&l<n))return!0;let c=(h-t)/a+e;return c>i&&c<o||(c=(n-t)/a+e,c>i&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,i=e.length,h=i-2,o=!1;for(let n=0;n<i;n+=2){let a=r[n+1],l=r[h+1];if(a<s&&l>=s||l<s&&a>=s){let c=r[n];c+(s-a)/(l-a)*(r[h]-c)<t&&(o=!o)}h=n}return o}intersectsSegment(e,t,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;h++)if(this.intersectsSegmentPolygon(i[h],e,t,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,r,i){let h=e,o=e.length,n=t-r,a=s-i,l=t*i-s*r,c=h[o-2],d=h[o-1];for(let u=0;u<o;u+=2){let m=h[u],f=h[u+1],g=c*f-d*m,p=c-m,b=d-f,x=n*b-a*p,w=(l*p-n*g)/x;if((w>=c&&w<=m||w>=m&&w<=c)&&(w>=t&&w<=r||w>=r&&w<=t)){let y=(l*b-a*g)/x;if((y>=d&&y<=f||y>=f&&y<=d)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,d=f}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}},Js=class rt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new St(()=>new Array);polygonIndicesPool=new St(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n<r;n++)i[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=r;n<a;++n)h[n]=rt.isConcave(n,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let n=r-1,a=0,l=1;for(;;){t:if(!h[a]){let u=i[n]<<1,m=i[a]<<1,f=i[l]<<1,g=s[u],p=s[u+1],b=s[m],x=s[m+1],w=s[f],y=s[f+1];for(let v=(l+1)%r;v!=n;v=(v+1)%r){if(!h[v])continue;let C=i[v]<<1,S=s[C],A=s[C+1];if(rt.positiveArea(w,y,g,p,S,A)&&rt.positiveArea(g,p,b,x,S,A)&&rt.positiveArea(b,x,w,y,S,A))break t}break}if(l==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=l,l=(l+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),h.splice(a,1),r--;let c=(r+a-1)%r,d=a==r?0:a;h[c]=rt.isConcave(c,r,s,i),h[d]=rt.isConcave(d,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(t,s){let r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,l=0;for(let c=0,d=s.length;c<d;c+=3){let u=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,g=r[u],p=r[u+1],b=r[m],x=r[m+1],w=r[f],y=r[f+1],v=!1;if(a==u){let C=n.length-4,S=rt.winding(n[C],n[C+1],n[C+2],n[C+3],w,y),A=rt.winding(w,y,n[0],n[1],n[2],n[3]);S==l&&A==l&&(n.push(w),n.push(y),o.push(f),v=!0)}v||(n.length>0?(i.push(n),h.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(p),n.push(b),n.push(x),n.push(w),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(u),o.push(m),o.push(f),l=rt.winding(g,p,b,x,w,y),a=u)}n.length>0&&(i.push(n),h.push(o));for(let c=0,d=i.length;c<d;c++){if(o=h[c],o.length==0)continue;let u=o[0],m=o[o.length-1];n=i[c];let f=n.length-4,g=n[f],p=n[f+1],b=n[f+2],x=n[f+3],w=n[0],y=n[1],v=n[2],C=n[3],S=rt.winding(g,p,b,x,w,y);for(let A=0;A<d;A++){if(A==c)continue;let T=h[A];if(T.length!=3)continue;let Y=T[0],M=T[1],P=T[2],E=i[A],I=E[E.length-2],F=E[E.length-1];if(Y!=u||M!=m)continue;let L=rt.winding(g,p,b,x,I,F),N=rt.winding(I,F,w,y,v,C);L==S&&N==S&&(E.length=0,T.length=0,n.push(I),n.push(F),o.push(P),g=b,p=x,b=I,x=F,A=0)}}for(let c=i.length-1;c>=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let h=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,h,o){return t*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(t,s,r,i,h,o){let n=r-t,a=i-s;return h*a-o*n+n*s-t*a>=0?1:-1}},jt=class bs{triangulator=new Js;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 r=s.worldVerticesLength,i=B.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let h=this.clippingPolygon;bs.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=o.length;n<a;n++){let l=o[n];bs.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,s,r,i,h,o,n,a){let l,c,d,u,m,f;typeof s=="number"?(l=r,c=i,d=h,u=o,m=n,f=a):(l=s,c=r,d=i,u=h,m=o,f=n),d&&u&&m&&typeof f=="boolean"?this.clipTrianglesRender(t,l,c,d,u,m,f):this.clipTrianglesNoRender(t,l,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,l=0;h.length=0,o.length=0;for(let c=0;c<r;c+=3){let d=s[c]<<1,u=t[d],m=t[d+1];d=s[c+1]<<1;let f=t[d],g=t[d+1];d=s[c+2]<<1;let p=t[d],b=t[d+1];for(let x=0;x<a;x++){let w=h.length;if(this.clip(u,m,f,g,p,b,n[x],i)){let y=i.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,S=B.setArraySize(h,w+v*2);for(let T=0;T<y;T+=2,w+=2){let Y=C[T],M=C[T+1];S[w]=Y,S[w+1]=M}w=o.length;let A=B.setArraySize(o,w+3*(v-2));v--;for(let T=1;T<v;T++,w+=3)A[w]=l,A[w+1]=l+T,A[w+2]=l+T+1;l+=v+1}else{let y=B.setArraySize(h,w+6);y[w]=u,y[w+1]=m,y[w+2]=f,y[w+3]=g,y[w+4]=p,y[w+5]=b,w=o.length;let v=B.setArraySize(o,w+3);v[w]=l,v[w+1]=l+1,v[w+2]=l+2,l+=3;break}}}}clipTrianglesRender(t,s,r,i,h,o,n){let a=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=n?12:8,f=0;l.length=0,c.length=0;for(let g=0;g<r;g+=3){let p=s[g]<<1,b=t[p],x=t[p+1],w=i[p],y=i[p+1];p=s[g+1]<<1;let v=t[p],C=t[p+1],S=i[p],A=i[p+1];p=s[g+2]<<1;let T=t[p],Y=t[p+1],M=i[p],P=i[p+1];for(let E=0;E<u;E++){let I=l.length;if(this.clip(b,x,v,C,T,Y,d[E],a)){let F=a.length;if(F==0)continue;let L=C-Y,N=T-v,V=b-T,_=Y-x,$=1/(L*V+N*(x-Y)),W=F>>1,j=this.clipOutput,R=B.setArraySize(l,I+W*m);for(let G=0;G<F;G+=2,I+=m){let st=j[G],J=j[G+1];R[I]=st,R[I+1]=J,R[I+2]=h.r,R[I+3]=h.g,R[I+4]=h.b,R[I+5]=h.a;let Z=st-T,tt=J-Y,nt=(L*Z+N*tt)*$,vt=(_*Z+V*tt)*$,Yt=1-nt-vt;R[I+6]=w*nt+S*vt+M*Yt,R[I+7]=y*nt+A*vt+P*Yt,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=B.setArraySize(c,I+3*(W-2));W--;for(let G=1;G<W;G++,I+=3)U[I]=f,U[I+1]=f+G,U[I+2]=f+G+1;f+=W+1}else{let F=B.setArraySize(l,I+3*m);F[I]=b,F[I+1]=x,F[I+2]=h.r,F[I+3]=h.g,F[I+4]=h.b,F[I+5]=h.a,n?(F[I+6]=w,F[I+7]=y,F[I+8]=o.r,F[I+9]=o.g,F[I+10]=o.b,F[I+11]=o.a,F[I+12]=v,F[I+13]=C,F[I+14]=h.r,F[I+15]=h.g,F[I+16]=h.b,F[I+17]=h.a,F[I+18]=S,F[I+19]=A,F[I+20]=o.r,F[I+21]=o.g,F[I+22]=o.b,F[I+23]=o.a,F[I+24]=T,F[I+25]=Y,F[I+26]=h.r,F[I+27]=h.g,F[I+28]=h.b,F[I+29]=h.a,F[I+30]=M,F[I+31]=P,F[I+32]=o.r,F[I+33]=o.g,F[I+34]=o.b,F[I+35]=o.a):(F[I+6]=w,F[I+7]=y,F[I+8]=v,F[I+9]=C,F[I+10]=h.r,F[I+11]=h.g,F[I+12]=h.b,F[I+13]=h.a,F[I+14]=S,F[I+15]=A,F[I+16]=T,F[I+17]=Y,F[I+18]=h.r,F[I+19]=h.g,F[I+20]=h.b,F[I+21]=h.a,F[I+22]=M,F[I+23]=P),I=c.length;let L=B.setArraySize(c,I+3);L[I]=f,L[I+1]=f+1,L[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(t,s,r,i){let h=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,l=this.clippingPolygons,c=l.length,d=0;o.length=0,n.length=0,a.length=0;for(let u=0;u<r;u+=3){let m=s[u]<<1,f=t[m],g=t[m+1],p=i[m],b=i[m+1];m=s[u+1]<<1;let x=t[m],w=t[m+1],y=i[m],v=i[m+1];m=s[u+2]<<1;let C=t[m],S=t[m+1],A=i[m],T=i[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(f,g,x,w,C,S,l[Y],h)){let P=h.length;if(P==0)continue;let E=w-S,I=C-x,F=f-C,L=S-g,N=1/(E*F+I*(g-S)),V=P>>1,_=this.clipOutput,$=B.setArraySize(o,M+V*2),W=B.setArraySize(n,M+V*2);for(let R=0;R<P;R+=2,M+=2){let U=_[R],G=_[R+1];$[M]=U,$[M+1]=G;let st=U-C,J=G-S,Z=(E*st+I*J)*N,tt=(L*st+F*J)*N,nt=1-Z-tt;W[M]=p*Z+y*tt+A*nt,W[M+1]=b*Z+v*tt+T*nt}M=a.length;let j=B.setArraySize(a,M+3*(V-2));V--;for(let R=1;R<V;R++,M+=3)j[M]=d,j[M+1]=d+R,j[M+2]=d+R+1;d+=V+1}else{let P=B.setArraySize(o,M+6);P[M]=f,P[M+1]=g,P[M+2]=x,P[M+3]=w,P[M+4]=C,P[M+5]=S;let E=B.setArraySize(n,M+3*2);E[M]=p,E[M+1]=b,E[M+2]=y,E[M+3]=v,E[M+4]=A,E[M+5]=T,M=a.length;let I=B.setArraySize(a,M+3);I[M]=d,I[M+1]=d+1,I[M+2]=d+2,d+=3;break}}}}clip(t,s,r,i,h,o,n,a){let l=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(t),d.push(s),d.push(r),d.push(i),d.push(h),d.push(o),d.push(t),d.push(s),a.length=0;let u=n.length-4,m=n;for(let f=0;;f+=2){let g=m[f],p=m[f+1],b=g-m[f+2],x=p-m[f+3],w=a.length,y=d;for(let C=0,S=d.length-2;C<S;){let A=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],P=x*(g-Y)>b*(p-M),E=x*(g-A)-b*(p-T);if(E>0){if(P){a.push(Y),a.push(M);continue}let I=Y-A,F=M-T,L=E/(I*x-F*b);if(L>=0&&L<=1)a.push(A+I*L),a.push(T+F*L);else{a.push(Y),a.push(M);continue}}else if(P){let I=Y-A,F=M-T,L=E/(I*x-F*b);if(L>=0&&L<=1)a.push(A+I*L),a.push(T+F*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(w==a.length)return l.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==u)break;let v=a;a=d,a.length=0,d=v}if(l!=a){l.length=0;for(let f=0,g=a.length-2;f<g;f++)l[f]=a[f]}else l.length=l.length-2;return c}static makeClockwise(t){let s=t,r=t.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,o=0,n=0,a=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],n=s[l+2],a=s[l+3],i+=h*a-n*o;if(!(i<0))for(let l=0,c=r-2,d=r>>1;l<d;l+=2){let u=s[l],m=s[l+1],f=c-l;s[l]=s[f],s[l+1]=s[f+1],s[f]=u,s[f+1]=m}}},cs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Rt,r=typeof e=="string"?JSON.parse(e):e,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=k(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let o=r.bones[h],n=null,a=k(o,"parent",null);a&&(n=s.findBone(a));let l=new Ke(s.bones.length,o.name,n);l.length=k(o,"length",0)*t,l.x=k(o,"x",0)*t,l.y=k(o,"y",0)*t,l.rotation=k(o,"rotation",0),l.scaleX=k(o,"scaleX",1),l.scaleY=k(o,"scaleY",1),l.shearX=k(o,"shearX",0),l.shearY=k(o,"shearY",0),l.inherit=B.enumValue(Kt,k(o,"inherit","Normal")),l.skinRequired=k(o,"skin",!1);let c=k(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(r.slots)for(let h=0;h<r.slots.length;h++){let o=r.slots[h],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let l=new ns(s.slots.length,n,a),c=k(o,"color",null);c&&l.color.setFromString(c);let d=k(o,"dark",null);d&&(l.darkColor=D.fromString(d)),l.attachmentName=k(o,"attachment",null),l.blendMode=B.enumValue(as,k(o,"blend","normal")),l.visible=k(o,"visible",!0),s.slots.push(l)}if(r.ik)for(let h=0;h<r.ik.length;h++){let o=r.ik[h],n=new Ze(o.name);n.order=k(o,"order",0),n.skinRequired=k(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);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=k(o,"mix",1),n.softness=k(o,"softness",0)*t,n.bendDirection=k(o,"bendPositive",!0)?1:-1,n.compress=k(o,"compress",!1),n.stretch=k(o,"stretch",!1),n.uniform=k(o,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],n=new os(o.name);n.order=k(o,"order",0),n.skinRequired=k(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);n.bones.push(u)}let a=o.target,l=s.findBone(a);if(!l)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=l,n.local=k(o,"local",!1),n.relative=k(o,"relative",!1),n.offsetRotation=k(o,"rotation",0),n.offsetX=k(o,"x",0)*t,n.offsetY=k(o,"y",0)*t,n.offsetScaleX=k(o,"scaleX",0),n.offsetScaleY=k(o,"scaleY",0),n.offsetShearY=k(o,"shearY",0),n.mixRotate=k(o,"mixRotate",1),n.mixX=k(o,"mixX",1),n.mixY=k(o,"mixY",n.mixX),n.mixScaleX=k(o,"mixScaleX",1),n.mixScaleY=k(o,"mixScaleY",n.mixScaleX),n.mixShearY=k(o,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],n=new ts(o.name);n.order=k(o,"order",0),n.skinRequired=k(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);n.bones.push(u)}let a=o.target,l=s.findSlot(a);if(!l)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=l,n.positionMode=B.enumValue(es,k(o,"positionMode","Percent")),n.spacingMode=B.enumValue(ss,k(o,"spacingMode","Length")),n.rotateMode=B.enumValue(rs,k(o,"rotateMode","Tangent")),n.offsetRotation=k(o,"rotation",0),n.position=k(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=k(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=k(o,"mixRotate",1),n.mixX=k(o,"mixX",1),n.mixY=k(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],n=new Hs(o.name);n.order=k(o,"order",0),n.skinRequired=k(o,"skin",!1);const a=o.bone,l=s.findBone(a);if(l==null)throw new Error("Physics bone not found: "+a);n.bone=l,n.x=k(o,"x",0),n.y=k(o,"y",0),n.rotate=k(o,"rotate",0),n.scaleX=k(o,"scaleX",0),n.shearX=k(o,"shearX",0),n.limit=k(o,"limit",5e3)*t,n.step=1/k(o,"fps",60),n.inertia=k(o,"inertia",1),n.strength=k(o,"strength",100),n.damping=k(o,"damping",1),n.massInverse=1/k(o,"mass",1),n.wind=k(o,"wind",0),n.gravity=k(o,"gravity",0),n.mix=k(o,"mix",1),n.inertiaGlobal=k(o,"inertiaGlobal",!1),n.strengthGlobal=k(o,"strengthGlobal",!1),n.dampingGlobal=k(o,"dampingGlobal",!1),n.massGlobal=k(o,"massGlobal",!1),n.windGlobal=k(o,"windGlobal",!1),n.gravityGlobal=k(o,"gravityGlobal",!1),n.mixGlobal=k(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],n=new Lt(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let l=o.bones[a],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let l=o.ik[a],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let l=o.transform[a],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let l=o.path[a],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let l=o.physics[a],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let l=s.findSlot(a);if(!l)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let d in c){let u=this.readAttachment(c[d],n,l.index,d,s);u&&n.setAttachment(l.index,d,u)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let l=a.getAttachment(n.slotIndex,n.parent);if(!l)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?l:n.mesh,n.mesh.setParentMesh(l),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],n=new Qe(h);n.intValue=k(o,"int",0),n.floatValue=k(o,"float",0),n.stringValue=k(o,"string",""),n.audioPath=k(o,"audio",null),n.audioPath&&(n.volume=k(o,"volume",1),n.balance=k(o,"balance",0)),s.events.push(n)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,r,i){let h=this.scale;switch(r=k(e,"name",r),k(e,"type","region")){case"region":{let o=k(e,"path",r),n=this.readSequence(k(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,r,o,n);if(!a)return null;a.path=o,a.x=k(e,"x",0)*h,a.y=k(e,"y",0)*h,a.scaleX=k(e,"scaleX",1),a.scaleY=k(e,"scaleY",1),a.rotation=k(e,"rotation",0),a.width=e.width*h,a.height=e.height*h,a.sequence=n;let l=k(e,"color",null);return l&&a.color.setFromString(l),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=k(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=k(e,"path",r),n=this.readSequence(k(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,r,o,n);if(!a)return null;a.path=o;let l=k(e,"color",null);l&&a.color.setFromString(l),a.width=k(e,"width",0)*h,a.height=k(e,"height",0)*h,a.sequence=n;let c=k(e,"parent",null);if(c)return this.linkedMeshes.push(new mi(a,k(e,"skin",null),s,c,k(e,"timelines",!0))),a;let d=e.uvs;return this.readVertices(e,a,d.length),a.triangles=e.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=k(e,"edges",null),a.hullLength=k(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=k(e,"closed",!1),o.constantSpeed=k(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=B.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*h;o.lengths=a;let l=k(e,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=k(e,"x",0)*h,o.y=k(e,"y",0)*h,o.rotation=k(e,"rotation",0);let n=k(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let n=k(e,"end",null);n&&(o.endSlot=i.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let l=k(e,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(e){if(e==null)return null;let t=new Ts(k(e,"count",0));return t.start=k(e,"start",1),t.digits=k(e,"digits",0),t.setupIndex=k(e,"setup",0),t}readVertices(e,t,s){let r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let n=B.toFloatArray(i);if(r!=1)for(let a=0,l=i.length;a<l;a++)n[a]*=r;t.vertices=n;return}let h=new Array,o=new Array;for(let n=0,a=i.length;n<a;){let l=i[n++];o.push(l);for(let c=n+l*4;n<c;n+=4)o.push(i[n]),h.push(i[n+1]*r),h.push(i[n+2]*r),h.push(i[n+3])}t.bones=o,t.vertices=B.toFloatArray(h)}readAnimation(e,t,s){let r=this.scale,i=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 l=a.index;for(let c in n){let d=n[c];if(!d)continue;let u=d.length;if(c=="attachment"){let m=new xt(u,l);for(let f=0;f<u;f++){let g=d[f];m.setFrame(f,k(g,"time",0),k(g,"name",null))}i.push(m)}else if(c=="rgba"){let m=new ve(u,u<<2,l),f=d[0],g=k(f,"time",0),p=D.fromString(f.color);for(let b=0,x=0;;b++){m.setFrame(b,g,p.r,p.g,p.b,p.a);let w=d[b+1];if(!w){m.shrink(x);break}let y=k(w,"time",0),v=D.fromString(w.color),C=f.curve;C&&(x=z(C,m,x,b,0,g,y,p.r,v.r,1),x=z(C,m,x,b,1,g,y,p.g,v.g,1),x=z(C,m,x,b,2,g,y,p.b,v.b,1),x=z(C,m,x,b,3,g,y,p.a,v.a,1)),g=y,p=v,f=w}i.push(m)}else if(c=="rgb"){let m=new Ce(u,u*3,l),f=d[0],g=k(f,"time",0),p=D.fromString(f.color);for(let b=0,x=0;;b++){m.setFrame(b,g,p.r,p.g,p.b);let w=d[b+1];if(!w){m.shrink(x);break}let y=k(w,"time",0),v=D.fromString(w.color),C=f.curve;C&&(x=z(C,m,x,b,0,g,y,p.r,v.r,1),x=z(C,m,x,b,1,g,y,p.g,v.g,1),x=z(C,m,x,b,2,g,y,p.b,v.b,1)),g=y,p=v,f=w}i.push(m)}else if(c=="alpha")i.push(ot(d,new Se(u,u,l),0,1));else if(c=="rgba2"){let m=new ke(u,u*7,l),f=d[0],g=k(f,"time",0),p=D.fromString(f.light),b=D.fromString(f.dark);for(let x=0,w=0;;x++){m.setFrame(x,g,p.r,p.g,p.b,p.a,b.r,b.g,b.b);let y=d[x+1];if(!y){m.shrink(w);break}let v=k(y,"time",0),C=D.fromString(y.light),S=D.fromString(y.dark),A=f.curve;A&&(w=z(A,m,w,x,0,g,v,p.r,C.r,1),w=z(A,m,w,x,1,g,v,p.g,C.g,1),w=z(A,m,w,x,2,g,v,p.b,C.b,1),w=z(A,m,w,x,3,g,v,p.a,C.a,1),w=z(A,m,w,x,4,g,v,b.r,S.r,1),w=z(A,m,w,x,5,g,v,b.g,S.g,1),w=z(A,m,w,x,6,g,v,b.b,S.b,1)),g=v,p=C,b=S,f=y}i.push(m)}else if(c=="rgb2"){let m=new Ae(u,u*6,l),f=d[0],g=k(f,"time",0),p=D.fromString(f.light),b=D.fromString(f.dark);for(let x=0,w=0;;x++){m.setFrame(x,g,p.r,p.g,p.b,b.r,b.g,b.b);let y=d[x+1];if(!y){m.shrink(w);break}let v=k(y,"time",0),C=D.fromString(y.light),S=D.fromString(y.dark),A=f.curve;A&&(w=z(A,m,w,x,0,g,v,p.r,C.r,1),w=z(A,m,w,x,1,g,v,p.g,C.g,1),w=z(A,m,w,x,2,g,v,p.b,C.b,1),w=z(A,m,w,x,3,g,v,b.r,S.r,1),w=z(A,m,w,x,4,g,v,b.g,S.g,1),w=z(A,m,w,x,5,g,v,b.b,S.b,1)),g=v,p=C,b=S,f=y}i.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 l=a.index;for(let c in n){let d=n[c],u=d.length;if(u!=0){if(c==="rotate")i.push(ot(d,new Et(u,u,l),0,1));else if(c==="translate"){let m=new de(u,u<<1,l);i.push(ds(d,m,"x","y",0,r))}else if(c==="translatex"){let m=new ue(u,u,l);i.push(ot(d,m,0,r))}else if(c==="translatey"){let m=new fe(u,u,l);i.push(ot(d,m,0,r))}else if(c==="scale"){let m=new me(u,u<<1,l);i.push(ds(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new ge(u,u,l);i.push(ot(d,m,1,1))}else if(c==="scaley"){let m=new xe(u,u,l);i.push(ot(d,m,1,1))}else if(c==="shear"){let m=new pe(u,u<<1,l);i.push(ds(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new we(u,u,l);i.push(ot(d,m,0,1))}else if(c==="sheary"){let m=new be(u,u,l);i.push(ot(d,m,0,1))}else if(c==="inherit"){let m=new ye(u,a.index);for(let f=0;f<d.length;f++){let g=d[f];m.setFrame(f,k(g,"time",0),B.enumValue(Kt,k(g,"inherit","Normal")))}i.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),d=new Ie(n.length,n.length<<1,c),u=k(a,"time",0),m=k(a,"mix",1),f=k(a,"softness",0)*r;for(let g=0,p=0;;g++){d.setFrame(g,u,m,f,k(a,"bendPositive",!0)?1:-1,k(a,"compress",!1),k(a,"stretch",!1));let b=n[g+1];if(!b){d.shrink(p);break}let x=k(b,"time",0),w=k(b,"mix",1),y=k(b,"softness",0)*r,v=a.curve;v&&(p=z(v,d,p,g,0,u,x,m,w,1),p=z(v,d,p,g,1,u,x,f,y,r)),u=x,m=w,f=y,a=b}i.push(d)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),d=new Me(n.length,n.length*6,c),u=k(a,"time",0),m=k(a,"mixRotate",1),f=k(a,"mixX",1),g=k(a,"mixY",f),p=k(a,"mixScaleX",1),b=k(a,"mixScaleY",p),x=k(a,"mixShearY",1);for(let w=0,y=0;;w++){d.setFrame(w,u,m,f,g,p,b,x);let v=n[w+1];if(!v){d.shrink(y);break}let C=k(v,"time",0),S=k(v,"mixRotate",1),A=k(v,"mixX",1),T=k(v,"mixY",A),Y=k(v,"mixScaleX",1),M=k(v,"mixScaleY",Y),P=k(v,"mixShearY",1),E=a.curve;E&&(y=z(E,d,y,w,0,u,C,m,S,1),y=z(E,d,y,w,1,u,C,f,A,1),y=z(E,d,y,w,2,u,C,g,T,1),y=z(E,d,y,w,3,u,C,p,Y,1),y=z(E,d,y,w,4,u,C,b,M,1),y=z(E,d,y,w,5,u,C,x,P,1)),u=C,m=S,f=A,g=T,p=Y,b=M,p=Y,a=v}i.push(d)}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 l=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],u=d[0];if(!u)continue;let m=d.length;if(c==="position"){let f=new Ye(m,m,l);i.push(ot(d,f,0,a.positionMode==0?r:1))}else if(c==="spacing"){let f=new Fe(m,m,l);i.push(ot(d,f,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(c==="mix"){let f=new Pe(m,m*3,l),g=k(u,"time",0),p=k(u,"mixRotate",1),b=k(u,"mixX",1),x=k(u,"mixY",b);for(let w=0,y=0;;w++){f.setFrame(w,g,p,b,x);let v=d[w+1];if(!v){f.shrink(y);break}let C=k(v,"time",0),S=k(v,"mixRotate",1),A=k(v,"mixX",1),T=k(v,"mixY",A),Y=u.curve;Y&&(y=z(Y,f,y,w,0,g,C,p,S,1),y=z(Y,f,y,w,1,g,C,b,A,1),y=z(Y,f,y,w,2,g,C,x,T,1)),g=C,p=S,b=A,x=T,u=v}i.push(f)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(l)}for(let l in n){let c=n[l],d=c[0];if(!d)continue;let u=c.length;if(l=="reset"){const f=new Ne(u,a);for(let g=0;d!=null;d=c[g+1],g++)f.setFrame(g,k(d,"time",0));i.push(f);continue}let m;if(l=="inertia")m=new Ee(u,u,a);else if(l=="strength")m=new Xe(u,u,a);else if(l=="damping")m=new Be(u,u,a);else if(l=="mass")m=new Re(u,u,a);else if(l=="wind")m=new Le(u,u,a);else if(l=="gravity")m=new Ve(u,u,a);else if(l=="mix")m=new De(u,u,a);else continue;i.push(ot(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 l in n){let c=n[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let u=d.index;for(let m in c){let f=c[m],g=a.getAttachment(u,m);for(let p in f){let b=f[p],x=b[0];if(x){if(p=="deform"){let w=g.bones,y=g.vertices,v=w?y.length/3*2:y.length,C=new Te(b.length,b.length,u,g),S=k(x,"time",0);for(let A=0,T=0;;A++){let Y,M=k(x,"vertices",null);if(!M)Y=w?B.newFloatArray(v):y;else{Y=B.newFloatArray(v);let F=k(x,"offset",0);if(B.arrayCopy(M,0,Y,F,M.length),r!=1)for(let L=F,N=L+M.length;L<N;L++)Y[L]*=r;if(!w)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(A,S,Y);let P=b[A+1];if(!P){C.shrink(T);break}let E=k(P,"time",0),I=x.curve;I&&(T=z(I,C,T,A,0,S,E,0,1,1)),S=E,x=P}i.push(C)}else if(p=="sequence"){let w=new _e(b.length,u,g),y=0;for(let v=0;v<b.length;v++){let C=k(x,"delay",y),S=k(x,"time",0),A=Is[k(x,"mode","hold")],T=k(x,"index",0);w.setFrame(v,S,A,T,C),y=C,x=b[v+1]}i.push(w)}}}}}}if(e.drawOrder){let o=new kt(e.drawOrder.length),n=s.slots.length,a=0;for(let l=0;l<e.drawOrder.length;l++,a++){let c=e.drawOrder[l],d=null,u=k(c,"offsets",null);if(u){d=B.newArray(n,-1);let m=B.newArray(n-u.length,0),f=0,g=0;for(let p=0;p<u.length;p++){let b=u[p],x=s.findSlot(b.slot);if(!x)throw new Error("Slot not found: "+x);let w=x.index;for(;f!=w;)m[g++]=f++;d[f+b.offset]=f++}for(;f<n;)m[g++]=f++;for(let p=n-1;p>=0;p--)d[p]==-1&&(d[p]=m[--g])}o.setFrame(a,k(c,"time",0),d)}i.push(o)}if(e.events){let o=new Wt(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let l=e.events[a],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Je(B.toSinglePrecision(k(l,"time",0)),c);d.intValue=k(l,"int",c.intValue),d.floatValue=k(l,"float",c.floatValue),d.stringValue=k(l,"string",c.stringValue),d.data.audioPath&&(d.volume=k(l,"volume",1),d.balance=k(l,"balance",0)),o.setFrame(n,d)}i.push(o)}let h=0;for(let o=0,n=i.length;o<n;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new Ut(t,i,h))}},mi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function ot(e,t,s,r){let i=e[0],h=k(i,"time",0),o=k(i,"value",s)*r,n=0;for(let a=0;;a++){t.setFrame(a,h,o);let l=e[a+1];if(!l)return t.shrink(n),t;let c=k(l,"time",0),d=k(l,"value",s)*r;i.curve&&(n=z(i.curve,t,n,a,0,h,c,o,d,r)),h=c,o=d,i=l}}function ds(e,t,s,r,i,h){let o=e[0],n=k(o,"time",0),a=k(o,s,i)*h,l=k(o,r,i)*h,c=0;for(let d=0;;d++){t.setFrame(d,n,a,l);let u=e[d+1];if(!u)return t.shrink(c),t;let m=k(u,"time",0),f=k(u,s,i)*h,g=k(u,r,i)*h,p=o.curve;p&&(c=z(p,t,c,d,0,n,m,a,f,h),c=z(p,t,c,d,1,n,m,l,g,h)),n=m,a=f,l=g,o=u}}function z(e,t,s,r,i,h,o,n,a,l){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,d=e[c],u=e[c+1]*l,m=e[c+2],f=e[c+3]*l;return t.setBezier(s,r,i,h,n,d,u,m,f,o,a),s+1}function k(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{Texture as gi,SCALE_MODES as Qs,MIPMAP_MODES as Zs,WRAP_MODES as us,BLEND_MODES as Jt}from"@pixi/core";var Vt=class bt extends Ge{static textureMap=new Map;static from(t){return bt.textureMap.has(t)?bt.textureMap.get(t):new bt(t)}texture;constructor(t){super(t.resource.source),this.texture=gi.from(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=bt.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=bt.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=bt.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return Qs.NEAREST;case 9729:case 9987:case 9985:return Qs.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case 9728:case 9729:return Zs.OFF;case 9986:case 9984:case 9987:case 9985:return Zs.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return us.CLAMP;case 33648:return us.MIRRORED_REPEAT;case 10497:return us.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return Jt.NORMAL;case 1:return Jt.ADD;case 2:return Jt.MULTIPLY;case 3:return Jt.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};import{Mesh as xi,MeshGeometry as pi,MeshMaterial as wi}from"@pixi/mesh";import{Texture as bi}from"@pixi/core";var tr=class yt extends xi{name="";static auxColor=[0,0,0,0];warnedTwoTint=!1;constructor(){const t=new pi;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const s=new wi(bi.EMPTY);super(t,s)}updateFromSpineData(t,s,r,i,h,o,n,a){this.texture=t.texture;const l=h/(a?12:8)*2,c=this.geometry.getBuffer("aTextureCoord");c.data?.length!==l&&(c.data=new Float32Array(l));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==l&&(d.data=new Float32Array(l));let u=0,m=c.data,f=d.data;for(let p=0;p<h;p+=a?12:8){let b=p;f[u]=i[b++],f[u+1]=i[b++],b+=4,m[u]=i[b++],m[u+1]=i[b++],u+=2}a&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),yt.auxColor[0]=i[2],yt.auxColor[1]=i[3],yt.auxColor[2]=i[4],yt.auxColor[3]=i[5],this.tint=yt.auxColor,this.alpha=yt.auxColor[3],this.blendMode=Vt.toPixiBlending(s);const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const p=g.data;for(let b=0;b<n;b++)p[b]=o[b]}this.name=r,c.update(),d.update(),g.update()}};import{Mesh as yi}from"@pixi/mesh";import{Geometry as vi,Buffer as fs,TYPES as er}from"@pixi/core";var sr=class extends vi{constructor(e=!1){super();const t=new fs(void 0),s=new fs(void 0,!0),r=new fs(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,er.FLOAT),this.addAttribute("aTextureCoord",s,2,!1,er.FLOAT),this.addIndex(r)}};import{Shader as Ci,TextureMatrix as Si,Color as Qt,Texture as ki,Matrix as Ai,Program as Ti}from"@pixi/core";var Ii=`
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTextureMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
}
`,Mi=`
varying vec2 vTextureCoord;
uniform vec4 uColor;
uniform vec4 uDarkColor;
uniform sampler2D uSampler;
void main(void)
{
vec4 texColor = texture2D(uSampler, vTextureCoord);
gl_FragColor.a = texColor.a * uColor.a;
gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb;
}
`,rr=class extends Ci{uvMatrix;batchable;pluginName;_tintRGB;_darkTintRGB;_colorDirty;_alpha;_tintColor;_darkTintColor;constructor(e){const t={uSampler:e??ki.EMPTY,alpha:1,uTextureMatrix:Ai.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},s={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(Ti.from(Ii,Mi),t),this._colorDirty=!1,this.uvMatrix=new Si(t.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new Qt(s.tint),this._darkTintColor=new Qt(s.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=s.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(e){e!==this.darkTint&&(this._darkTintColor.setValue(e),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,Qt.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),Qt.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}},ir=class extends yi{_darkTintRGB=0;constructor(e){super(new sr,new rr(e),void 0,void 0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(e){this.shader.darkTint=e}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(e){const t=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=s._tintRGB,this._darkTintRGB=s._darkTintRGB,this._texture=s.texture;const r=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[r]),e.plugins[r].render(this)}},Zt=class Q extends ir{name="";static auxColor=[0,0,0,0];constructor(){super()}updateFromSpineData(t,s,r,i,h,o,n,a){this.texture=t.texture;const l=h/(a?12:8)*2,c=this.geometry.getBuffer("aTextureCoord");c.data?.length!==l&&(c.data=new Float32Array(l));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==l&&(d.data=new Float32Array(l));let u=0,m=c.data,f=d.data;for(let p=0;p<h;p+=a?12:8){let b=p;f[u]=i[b++],f[u+1]=i[b++],b+=4,m[u]=i[b++],m[u+1]=i[b++],u+=2}a?(Q.auxColor[0]=i[8],Q.auxColor[1]=i[9],Q.auxColor[2]=i[10],Q.auxColor[3]=i[11],this.darkTint=Q.auxColor,Q.auxColor[0]=i[2],Q.auxColor[1]=i[3],Q.auxColor[2]=i[4],Q.auxColor[3]=i[5],this.tint=Q.auxColor):(Q.auxColor[0]=i[2],Q.auxColor[1]=i[3],Q.auxColor[2]=i[4],Q.auxColor[3]=i[5],this.tint=Q.auxColor),this.blendMode=Vt.toPixiBlending(s),this.alpha=Q.auxColor[3];const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const p=g.data;for(let b=0;b<n;b++)p[b]=o[b]}this.name=r,c.update(),d.update(),g.update()}};import{Assets as te}from"@pixi/assets";import{Point as Yi}from"@pixi/core";import{Ticker as nr}from"@pixi/core";import{Bounds as Fi,Container as Pi}from"@pixi/display";import{Graphics as Ei}from"@pixi/graphics";import"@pixi/events";var Xi=class{constructor(e,t,s,r){this.x=e,this.y=t,this.width=s,this.height=r}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Bi=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new It(e.skeleton.data);t.setToSetupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new jt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Ri=class{constructor(e,t=[],s=.05,r=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=r}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new Oe(e.state.data),s=new It(e.skeleton.data),r=this.clipping?new jt:void 0,i=s.data;if(this.skins.length>0){let o=new Lt("custom-skin");for(const n of this.skins){const a=i.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const h=this.animation!=null?i.findAnimation(this.animation):null;if(h==null){s.updateWorldTransform(2);const o=s.getBoundsRect(r);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,l=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimationWith(0,h,!1);const c=Math.max(h.duration/this.timeStep,1);for(let u=0;u<c;u++){const m=u>0?this.timeStep:0;t.update(m),t.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(r);o=Math.min(o,f.x),n=Math.min(n,f.y),a=Math.max(a,f.x+f.width),l=Math.max(l,f.y+f.height)}const d={x:o,y:n,width:a-o,height:l-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},Li=class K extends Pi{skeleton;state;darkTint=!1;hasNeverUpdated=!0;_debug=void 0;get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}slotMeshFactory=()=>new tr;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};_autoUpdate=!1;_ticker=nr.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??nr.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}meshesCache=new Map;static vectorAux=new Pt;static clipper=new jt;static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;static DARK_VERTEX_SIZE=12;lightColor=new D;darkColor=new D;_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}_boundsPoint=new Yi;_boundsSpineID=-1;_boundsSpineDirty=!0;constructor(t,s){if(t instanceof Rt)t={...s,skeletonData:t};else if(s)throw new Error("You cannot use options and oldOptions together.");super();const r=t instanceof Rt?t:t.skeletonData;this.skeleton=new It(r);const i=new Ls(r);this.state=new Oe(i),t?.darkTint!==void 0||s?.slotMeshFactory===void 0?(this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(h=>!!h.data.darkColor):t?.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new Zt)):this.initializeMeshFactory(s?.slotMeshFactory),t?.ticker&&(this._ticker=t.ticker),this.autoUpdate=t?.autoUpdate??!0,this.boundsProvider=t.boundsProvider}initializeMeshFactory(t){if(t){this.slotMeshFactory=t;const s=this.slotMeshFactory();s instanceof Zt&&(this.darkTint=!0),s.destroy()}else for(let s=0;s<this.skeleton.slots.length;s++)if(this.skeleton.slots[s].data.darkColor){this.slotMeshFactory=()=>new Zt,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const r=s??this._ticker.deltaMS/1e3;this.state.update(r),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(r),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}updateTransform(){this.renderMeshes(),this.sortChildren(),this.debug?.renderDebug(this),super.updateTransform()}destroy(t){this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,s]of this.meshesCache)s?.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(let s in this.clippingSlotToPixiMasks)this.clippingSlotToPixiMasks[s].mask?.destroy(),delete this.clippingSlotToPixiMasks[s];super.destroy(t)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){if(this.hasMeshForSlot(t)){let s=this.meshesCache.get(t);return s.visible=!0,s}else{let s=this.slotMeshFactory();return this.addChild(s),this.meshesCache.set(t,s),s}}slotsObject=new Map;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}addSlotObject(t,s,r){let i=this.getSlotFromRef(t);const h=this.slotsObject.get(i)?.container;if(!(h&&h===s)){for(const[o,{container:n}]of this.slotsObject)if(o!==i&&n===s){this.removeSlotObject(o,s);break}h&&this.removeChild(h),this.slotsObject.set(i,{container:s,followAttachmentTimeline:r?.followAttachmentTimeline||!1,followSlotColor:r?.followSlotColor||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){let r=this.getSlotFromRef(t),i=this.slotsObject.get(r)?.container;i&&(s&&s!==i||(this.removeChild(i),this.slotsObject.delete(r)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}verticesCache=B.newFloatArray(1024);clippingSlotToPixiMasks={};updateSlotObject(t,s,r){const{container:i,followAttachmentTimeline:h}=t,o=h?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&o,i.visible){let n=s.bone;const a=i.localTransform;a.a=n.a,a.b=n.c,a.c=-n.b,a.d=-n.d,a.tx=n.worldX,a.ty=n.worldY,i.transform.setFromMatrix(a),i.zIndex=r,i.alpha=this.skeleton.color.a*s.color.a,t.followSlotColor&&this.setSlotObjectTint(i,255*this.skeleton.color.r*s.color.r<<16|255*this.skeleton.color.g*s.color.g<<8|255*this.skeleton.color.b*s.color.b)}}setSlotObjectTint(t,s){const r=t;"tint"in r&&(r.tint=s);for(const i of r.children??[])this.setSlotObjectTint(i,s)}currentClippingSlot;updateAndSetPixiMask(t,s){const r=t.attachment;if(r&&r instanceof pt){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let i=this.currentClippingSlot;const h=this.slotsObject.get(t);if(i&&h){let o=i.mask;if(o||(o=ar.obtain(),i.mask=o,this.addChild(o)),!i.maskComputed){let n=i.slot,a=n.attachment;i.maskComputed=!0;const l=a.worldVerticesLength,c=i.vertices;a.computeWorldVertices(n,0,l,c,0,2),o.clear().lineStyle(0).beginFill(0).drawPolygon(c).endFill()}h.container.mask=o}else h?.container.mask&&(h.container.mask=null);if(i&&i.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 pt)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),ar.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){this.resetMeshes();let t=null,s=null;const r=this.skeleton.drawOrder;for(let i=0,h=r.length,o=0;i<h;i++){const n=r[i];let a=this.slotsObject.get(n),l=i+o;a&&(this.updateSlotObject(a,n,l+1),o++),this.updateAndSetPixiMask(n,i===r.length-1);const c=n.darkColor!=null,d=K.clipper.isClipping()?2:c?K.DARK_VERTEX_SIZE:K.VERTEX_SIZE;if(!n.bone.active){K.clipper.clipEndWithSlot(n);continue}const u=n.getAttachment();let m,f,g=0;if(u instanceof Xt){const p=u;m=p.color,g=d*4,p.computeWorldVertices(n,this.verticesCache,0,d),t=K.QUAD_TRIANGLES,s=p.uvs,f=p.region?.texture}else if(u instanceof At){const p=u;m=p.color,g=(p.worldVerticesLength>>1)*d,g>this.verticesCache.length&&(this.verticesCache=B.newFloatArray(g)),p.computeWorldVertices(n,0,p.worldVerticesLength,this.verticesCache,0,d),t=p.triangles,s=p.uvs,f=p.region?.texture}else if(u instanceof pt){K.clipper.clipStart(n,u);continue}else{this.hasMeshForSlot(n)&&(this.getMeshForSlot(n).visible=!1),K.clipper.clipEndWithSlot(n);continue}if(f!=null){const b=n.bone.skeleton.color,x=n.color,w=b.a*x.a*m.a;this.lightColor.set(b.r*x.r*m.r,b.g*x.g*m.g,b.b*x.b*m.b,w),n.darkColor!=null?this.darkColor.set(n.darkColor.r,n.darkColor.g,n.darkColor.b,1):this.darkColor.set(0,0,0,1);let y,v,C,S;if(K.clipper.isClipping())K.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,c),y=K.clipper.clippedVertices,v=y.length,C=K.clipper.clippedTriangles,S=C.length;else{const T=this.verticesCache;for(let Y=2,M=0,P=g;Y<P;Y+=d,M+=2){let E=Y;T[E++]=this.lightColor.r,T[E++]=this.lightColor.g,T[E++]=this.lightColor.b,T[E++]=this.lightColor.a,T[E++]=s[M],T[E++]=s[M+1],c&&(T[E++]=this.darkColor.r,T[E++]=this.darkColor.g,T[E++]=this.darkColor.b,T[E++]=this.darkColor.a)}y=this.verticesCache,v=g,C=t,S=t.length}if(v==0||S==0){K.clipper.clipEndWithSlot(n);continue}const A=this.getMeshForSlot(n);A.renderable=!0,A.zIndex=l,A.updateFromSpineData(f,n.data.blendMode,n.data.name,y,v,C,S,c)}K.clipper.clipEndWithSlot(n)}K.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const t=this.transform;if(this._boundsSpineID===t._worldID)return;this.updateBounds();const s=this._localBounds,r=this._boundsPoint;r.set(s.minX,s.minY),t.worldTransform.apply(r,r),this._bounds.minX=r.x,this._bounds.minY=r.y,r.set(s.maxX,s.maxY),t.worldTransform.apply(r,r),this._bounds.maxX=r.x,this._bounds.maxY=r.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new Fi);const t=this._boundsProvider.calculateBounds(this),s=this._localBounds;s.clear(),s.minX=t.x,s.minY=t.y,s.maxX=t.x+t.width,s.maxY=t.y+t.height,this.hitArea=this._localBounds.getRectangle()}setBonePosition(t,s){const r=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cannot set bone position, bone ${String(r)} not found`);if(K.vectorAux.set(s.x,s.y),t.parent){const i=t.parent.worldToLocal(K.vectorAux);t.x=i.x,t.y=i.y}else t.x=K.vectorAux.x,t.y=K.vectorAux.y}getBonePosition(t,s){const r=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(`Cannot get bone position! Bone ${String(r)} not found`),s)}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 skeletonCache=Object.create(null);static from(t,s,r){if(typeof t=="string")return K.oldFrom(t,s,r);const{skeleton:i,atlas:h,scale:o=1,darkTint:n,autoUpdate:a,boundsProvider:l,ticker:c}=t,d=`${i}-${h}-${o}`;let u=K.skeletonCache[d];if(!u){const m=te.get(i),f=te.get(h),g=new He(f);let p=m instanceof Uint8Array?new ls(g):new cs(g);p.scale=o,u=p.readSkeletonData(m),K.skeletonCache[d]=u}return new K({skeletonData:u,darkTint:n,autoUpdate:a,boundsProvider:l,ticker:c})}static oldFrom(t,s,r){const i=`${t}-${s}-${r?.scale??1}`;let h=K.skeletonCache[i];if(h)return new K(h,r);const o=te.get(t),n=te.get(s),a=new He(n);let l=o instanceof Uint8Array?new ls(a):new cs(a);return l.scale=r?.scale??1,h=l.readSkeletonData(o),K.skeletonCache[i]=h,new this(h,r)}get tint(){return this.skeleton.color.toRgb888()}set tint(t){D.rgb888ToColor(this.skeleton.color,t)}},ar=new St(()=>new Ei);It.yDown=!0;import{Container as ms}from"@pixi/display";import{Graphics as lt}from"@pixi/graphics";import{Text as Vi}from"@pixi/text";var Di=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 ms,bones:new ms,skeletonXY:new lt,regionAttachmentsShape:new lt,meshTrianglesLine:new lt,meshHullLine:new lt,clippingPolygon:new lt,boundingBoxesRect:new lt,boundingBoxesCircle:new lt,boundingBoxesPolygon:new lt,pathsCurve:new lt,pathsLine:new lt,eventText:new ms,eventCallback:{event:(s,r)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),h=new Vi(r.data.name,{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"});h.scale.x=Math.sign(e.scale.x),h.anchor.set(.5),t.eventText.addChild(h),setTimeout(()=>{h.destroyed||h.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 i=t.bones.children.length;i>0;i--)t.bones.children[i-1].destroy({children:!0,texture:!0,baseTexture:!0});const s=Math.abs(e.scale.x||e.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,r,s),this.drawPaths&&this.drawPathsFunc(e,t,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,r),this.drawClipping&&this.drawClippingFunc(e,t,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,r),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,r){const i=e.skeleton,h=i.x,o=i.y,n=i.bones;t.skeletonXY.lineStyle(s,this.skeletonXYColor,1);for(let l=0,c=n.length;l<c;l++){const d=n[l],u=d.data.length,m=h+d.worldX,f=o+d.worldY,g=h+u*d.a+d.worldX,p=o+u*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const b=Math.abs(m-g),x=Math.abs(f-p),w=Math.pow(b,2),y=x,v=Math.pow(x,2),C=Math.sqrt(w+v),S=Math.pow(C,2),A=Math.PI/180,T=Math.acos((S+v-w)/(2*y*C))||0;if(C===0)continue;const Y=new lt;t.bones.addChild(Y);const M=C/50/r;Y.beginFill(this.bonesColor,1),Y.drawPolygon(0,0,0-M,C-M*3,0,C-M,0+M,C-M*3),Y.endFill(),Y.x=m,Y.y=f,Y.pivot.y=C;let P=0;m<g&&f<p?P=-T+180*A:m>g&&f<p?P=180*A+T:m>g&&f>p?P=-T:m<g&&f>p?P=T:f===p&&m<g?P=90*A:f===p&&m>g?P=-90*A:m===g&&f<p?P=180*A:m===g&&f>p&&(P=0),Y.rotation=P,Y.lineStyle(s+M/2.4,this.bonesColor,1),Y.beginFill(0,.6),Y.drawCircle(0,C,M*1.2),Y.endFill()}const a=s*3;t.skeletonXY.moveTo(h-a,o-a),t.skeletonXY.lineTo(h+a,o+a),t.skeletonXY.moveTo(h+a,o-a),t.skeletonXY.lineTo(h-a,o+a)}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;t.regionAttachmentsShape.lineStyle(s,this.regionAttachmentsColor,1);for(let h=0,o=i.length;h<o;h++){const n=i[h],a=n.getAttachment();if(a==null||!(a instanceof Xt))continue;const l=a,c=new Float32Array(8);l.computeWorldVertices(n,c,0,2),t.regionAttachmentsShape.drawPolygon(Array.from(c.slice(0,8)))}}drawMeshHullAndMeshTriangles(e,t,s){const i=e.skeleton.slots;t.meshHullLine.lineStyle(s,this.meshHullColor,1),t.meshTrianglesLine.lineStyle(s,this.meshTrianglesColor,1);for(let h=0,o=i.length;h<o;h++){const n=i[h];if(!n.bone.active)continue;const a=n.getAttachment();if(a==null||!(a instanceof At))continue;const l=a,c=new Float32Array(l.worldVerticesLength),d=l.triangles;let u=l.hullLength;if(l.computeWorldVertices(n,0,l.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,f=d.length;m<f;m+=3){const g=d[m]*2,p=d[m+1]*2,b=d[m+2]*2;t.meshTrianglesLine.moveTo(c[g],c[g+1]),t.meshTrianglesLine.lineTo(c[p],c[p+1]),t.meshTrianglesLine.lineTo(c[b],c[b+1])}if(this.drawMeshHull&&u>0){u=(u>>1)*2;let m=c[u-2],f=c[u-1];for(let g=0,p=u;g<p;g+=2){const b=c[g],x=c[g+1];t.meshHullLine.moveTo(b,x),t.meshHullLine.lineTo(m,f),m=b,f=x}}}}drawClippingFunc(e,t,s){const i=e.skeleton.slots;t.clippingPolygon.lineStyle(s,this.clippingPolygonColor,1);for(let h=0,o=i.length;h<o;h++){const n=i[h];if(!n.bone.active)continue;const a=n.getAttachment();if(a==null||!(a instanceof pt))continue;const l=a,c=l.worldVerticesLength,d=new Float32Array(c);l.computeWorldVertices(n,0,c,d,0,2),t.clippingPolygon.drawPolygon(Array.from(d))}}drawBoundingBoxesFunc(e,t,s){t.boundingBoxesRect.lineStyle(s,this.boundingBoxesRectColor,5);const r=new js;r.update(e.skeleton,!0),r.minX!==1/0&&t.boundingBoxesRect.drawRect(r.minX,r.minY,r.getWidth(),r.getHeight());const i=r.polygons,h=(o,n,a)=>{if(t.boundingBoxesPolygon.lineStyle(s,this.boundingBoxesPolygonColor,1),t.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),a<3)throw new Error("Polygon must contain at least 3 vertices");const l=[],c=s*2;for(let d=0,u=o.length;d<u;d+=2){const m=o[d],f=o[d+1];t.boundingBoxesCircle.lineStyle(0),t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(m,f,c),t.boundingBoxesCircle.endFill(),l.push(m,f)}t.boundingBoxesPolygon.drawPolygon(l),t.boundingBoxesPolygon.endFill()};for(let o=0,n=i.length;o<n;o++){const a=i[o];h(a,0,a.length)}}drawPathsFunc(e,t,s){const i=e.skeleton.slots;t.pathsCurve.lineStyle(s,this.pathsCurveColor,1),t.pathsLine.lineStyle(s,this.pathsLineColor,1);for(let h=0,o=i.length;h<o;h++){const n=i[h];if(!n.bone.active)continue;const a=n.getAttachment();if(a==null||!(a instanceof Tt))continue;const l=a;let c=l.worldVerticesLength;const d=new Float32Array(c);l.computeWorldVertices(n,0,c,d,0,2);let u=d[2],m=d[3],f=0,g=0;if(l.closed){const p=d[0],b=d[1],x=d[c-2],w=d[c-1];f=d[c-4],g=d[c-3],t.pathsCurve.moveTo(u,m),t.pathsCurve.bezierCurveTo(p,b,x,w,f,g),t.pathsLine.moveTo(u,m),t.pathsLine.lineTo(p,b),t.pathsLine.moveTo(f,g),t.pathsLine.lineTo(x,w)}c-=4;for(let p=4;p<c;p+=6){const b=d[p],x=d[p+1],w=d[p+2],y=d[p+3];f=d[p+4],g=d[p+5],t.pathsCurve.moveTo(u,m),t.pathsCurve.bezierCurveTo(b,x,w,y,f,g),t.pathsLine.moveTo(u,m),t.pathsLine.lineTo(b,x),t.pathsLine.moveTo(f,g),t.pathsLine.lineTo(w,y),u=f,m=g}}}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({baseTexture:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};import{Assets as or,copySearchParams as Ni}from"@pixi/assets";import{LoaderParserPriority as _i,checkExtension as gs}from"@pixi/assets";import{ALPHA_MODES as lr,ExtensionType as hr,settings as cr,utils as ee,BaseTexture as dr,extensions as Oi}from"@pixi/core";var se="spineTextureAtlasLoader",Ui={extension:hr.Asset,resolver:{test:e=>gs(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(cr.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:se,extension:{type:hr.LoadParser,priority:_i.Normal,name:se},test(e){return gs(e,".atlas")},async load(e){const t=await cr.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${se}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return await t.text()},testParse(e,t){const s=gs(t.src,".atlas"),r=typeof e=="string",i=t.loadParser===se;return Promise.resolve((s||i)&&r)},unload(e){e.dispose()},async parse(e,t,s){const r=t.data||{};let i=ee.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const h=new Ht(e);if(r.images instanceof dr||typeof r.images=="string"){const a=r.images;r.images={},r.images[h.pages[0].name]=a}const o=[];let n=!0;for(const a of s.parsers)if(a.name=="loadTextures"){n=a.config?.preferCreateImageBitmap;break}or.setPreferences({preferCreateImageBitmap:!1});for(const a of h.pages){const l=a.name,c=r?.images?r.images[l]:void 0;if(c instanceof dr)a.setTexture(Vt.from(c));else{const d=c??ee.path.normalize([...i.split(ee.path.sep),l].join(ee.path.sep)),u={src:Ni(d,t.src),data:{...r.imageMetadata,alphaMode:a.pma?lr.PMA:lr.UNPACK}},m=s.load(u).then(f=>{a.setTexture(Vt.from(f.baseTexture))});o.push(m)}}return await Promise.all(o),or.setPreferences({preferCreateImageBitmap:n}),h}}};Oi.add(Ui);import{LoaderParserPriority as qi,checkExtension as xs}from"@pixi/assets";import{ExtensionType as ur,settings as Wi,extensions as zi}from"@pixi/core";var re="spineSkeletonLoader";function Gi(e){return e.hasOwnProperty("bones")}function $i(e){return e instanceof Uint8Array}var Hi={extension:ur.Asset,loader:{name:re,extension:{type:ur.LoadParser,priority:qi.Normal,name:re},test(e){return xs(e,".skel")},async load(e){const t=await Wi.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${re}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=xs(t.src,".json")&&Gi(e),r=xs(t.src,".skel")&&$i(e),i=t.loadParser===re;return Promise.resolve(s||r||i)}}};zi.add(Hi);import{Geometry as Ki,Buffer as fr,TYPES as Dt}from"@pixi/core";var mr=class extends Ki{_buffer;_indexBuffer;constructor(e=!1){super(),this._buffer=new fr(void 0,e,!1),this._indexBuffer=new fr(void 0,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Dt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Dt.FLOAT).addAttribute("aColor",this._buffer,4,!0,Dt.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,Dt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Dt.FLOAT).addIndex(this._indexBuffer)}};import{extensions as ji,BatchRenderer as Ji,ExtensionType as Qi,BatchShaderGenerator as Zi,Color as gr}from"@pixi/core";var tn=`
precision highp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aColor;
attribute vec4 aDarkColor;
attribute float aTextureId;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform vec4 tint;
varying vec2 vTextureCoord;
varying vec4 vColor;
varying vec4 vDarkColor;
varying float vTextureId;
void main(void){
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vTextureId = aTextureId;
vColor = aColor * tint;
vDarkColor = aDarkColor * tint;
}
`,en=`
varying vec2 vTextureCoord;
varying vec4 vColor;
varying vec4 vDarkColor;
varying float vTextureId;
uniform sampler2D uSamplers[%count%];
void main(void){
vec4 color;
%forloop%
gl_FragColor.a = color.a * vColor.a;
gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb;
}
`,xr=class extends Ji{static extension={name:"darkTintBatch",type:Qi.RendererPlugin};constructor(e){super(e),this.shaderGenerator=new Zi(tn,en),this.geometryClass=mr,this.vertexSize=7}packInterleavedGeometry(e,t,s,r,i){const{uint32View:h,float32View:o}=t,n=r/this.vertexSize,a=e.uvs,l=e.indices,c=e.vertexData,d=e._texture.baseTexture._batchLocation,u=Math.min(e.worldAlpha,1),m=gr.shared.setValue(e._tintRGB).toPremultiplied(u,!0),f=gr.shared.setValue(e._darkTintRGB).premultiply(u,!0).toPremultiplied(1,!1);for(let g=0;g<c.length;g+=2)o[r++]=c[g],o[r++]=c[g+1],o[r++]=a[g],o[r++]=a[g+1],h[r++]=m,h[r++]=f,o[r++]=d;for(let g=0;g<l.length;g++)s[i++]=n+l[g]}};ji.add(xr);export{Xi as AABBRectangleBoundsProvider,Se as AlphaTimeline,Ut as Animation,Oe as AnimationState,Pr as AnimationStateAdapter,Ls as AnimationStateData,Os as AssetCache,Br as AssetManagerBase,He as AtlasAttachmentLoader,ce as Attachment,xt as AttachmentTimeline,Ks as BinaryInput,as as BlendMode,je as Bone,Ke as BoneData,ze as BoundingBoxAttachment,Rs as CURRENT,pt as ClippingAttachment,D as Color,Bt as ConstraintData,at as CurveTimeline,it as CurveTimeline1,qt as CurveTimeline2,Zt as DarkSlotMesh,mr as DarkTintBatchGeometry,sr as DarkTintGeometry,rr as DarkTintMaterial,ir as DarkTintMesh,xr as DarkTintRenderer,Mr as DebugUtils,Te as DeformTimeline,Us as Downloader,kt as DrawOrderTimeline,Je as Event,Qe as EventData,Es as EventQueue,Wt as EventTimeline,Xs as EventType,Ue as FIRST,Er as FakeTexture,Gt as HOLD_FIRST,Bs as HOLD_MIX,qe as HOLD_SUBSEQUENT,qs as IkConstraint,Ze as IkConstraintData,Ie as IkConstraintTimeline,Kt as Inherit,ye as InheritTimeline,Tr as IntSet,ks as Interpolation,X as MathUtils,At as MeshAttachment,Ys as MixBlend,Fs as MixDirection,Tt as PathAttachment,Ws as PathConstraint,ts as PathConstraintData,Pe as PathConstraintMixTimeline,Ye as PathConstraintPositionTimeline,Fe as PathConstraintSpacingTimeline,$s as Physics,Be as PhysicsConstraintDampingTimeline,Ve as PhysicsConstraintGravityTimeline,Ee as PhysicsConstraintInertiaTimeline,Re as PhysicsConstraintMassTimeline,De as PhysicsConstraintMixTimeline,Ne as PhysicsConstraintResetTimeline,Xe as PhysicsConstraintStrengthTimeline,ft as PhysicsConstraintTimeline,Le as PhysicsConstraintWindTimeline,_s as PointAttachment,St as Pool,es as PositionMode,As as Pow,Ir as PowOut,Ae as RGB2Timeline,ke as RGBA2Timeline,ve as RGBATimeline,Ce as RGBTimeline,Xt as RegionAttachment,rs as RotateMode,Et as RotateTimeline,We as SETUP,zt as SUBSEQUENT,me as ScaleTimeline,ge as ScaleXTimeline,xe as ScaleYTimeline,_e as SequenceTimeline,Bi as SetupPoseBoundsProvider,pe as ShearTimeline,we as ShearXTimeline,be as ShearYTimeline,It as Skeleton,ls as SkeletonBinary,js as SkeletonBounds,jt as SkeletonClipping,Rt as SkeletonData,cs as SkeletonJson,Lt as Skin,is as SkinEntry,Ri as SkinsAndAnimationBoundsProvider,zs as Slot,ns as SlotData,tr as SlotMesh,ss as SpacingMode,Li as Spine,Di as SpineDebugRenderer,Vt as SpineTexture,he as StringSet,Ge as Texture,Ht as TextureAtlas,Ns as TextureAtlasPage,$e as TextureAtlasRegion,$t as TextureFilter,Ds as TextureRegion,Vs as TextureWrap,Yr as TimeKeeper,H as Timeline,Ps as TrackEntry,Gs as TransformConstraint,os as TransformConstraintData,Me as TransformConstraintTimeline,de as TranslateTimeline,ue as TranslateXTimeline,fe as TranslateYTimeline,Js as Triangulator,B as Utils,Pt as Vector2,ct as VertexAttachment,Fr as WindowedMean};