@esotericsoftware/spine-core 4.2.33 → 4.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var spine=(()=>{var Re=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Fs=Object.getOwnPropertyNames,Es=Object.prototype.hasOwnProperty,Rs=(e,t,s)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ps=(e,t)=>{for(var s in t)Re(e,s,{get:t[s],enumerable:!0})},Bs=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fs(t))!Es.call(e,a)&&a!==s&&Re(e,a,{get:()=>t[a],enumerable:!(i=Xs(t,a))||i.enumerable});return e},Vs=e=>Bs(Re({},"__esModule",{value:!0}),e),B=(e,t,s)=>(Rs(e,typeof t!="symbol"?t+"":t,s),s),qt={};Ps(qt,{AlphaTimeline:()=>dt,Animation:()=>Ve,AnimationState:()=>ns,AnimationStateAdapter:()=>qs,AnimationStateData:()=>Us,AssetManagerBase:()=>Gs,AtlasAttachmentLoader:()=>Hs,Attachment:()=>Qe,AttachmentTimeline:()=>we,BinaryInput:()=>Is,BlendMode:()=>$e,Bone:()=>Yt,BoneData:()=>Tt,BoundingBoxAttachment:()=>_e,CURRENT:()=>cs,ClippingAttachment:()=>It,Color:()=>N,ConstraintData:()=>Fe,CurveTimeline:()=>le,CurveTimeline1:()=>se,CurveTimeline2:()=>Le,DebugUtils:()=>Ns,DeformTimeline:()=>mt,Downloader:()=>bs,DrawOrderTimeline:()=>pe,Event:()=>Mt,EventData:()=>Xt,EventQueue:()=>os,EventTimeline:()=>Xe,EventType:()=>ee,FIRST:()=>vt,FakeTexture:()=>Ws,HOLD_FIRST:()=>Oe,HOLD_MIX:()=>hs,HOLD_SUBSEQUENT:()=>St,IkConstraint:()=>ws,IkConstraintData:()=>Ft,IkConstraintTimeline:()=>gt,IntSet:()=>Ls,Interpolation:()=>Ut,MathUtils:()=>X,MeshAttachment:()=>Se,MixBlend:()=>$t,MixDirection:()=>jt,PathAttachment:()=>Ae,PathConstraint:()=>Ie,PathConstraintData:()=>Et,PathConstraintMixTimeline:()=>pt,PathConstraintPositionTimeline:()=>bt,PathConstraintSpacingTimeline:()=>wt,Physics:()=>As,PhysicsConstraintDampingTimeline:()=>es,PhysicsConstraintGravityTimeline:()=>rs,PhysicsConstraintInertiaTimeline:()=>Qt,PhysicsConstraintMassTimeline:()=>ts,PhysicsConstraintMixTimeline:()=>is,PhysicsConstraintResetTimeline:()=>yt,PhysicsConstraintStrengthTimeline:()=>Zt,PhysicsConstraintTimeline:()=>fe,PhysicsConstraintWindTimeline:()=>ss,PointAttachment:()=>kt,Pool:()=>Ye,PositionMode:()=>We,Pow:()=>Wt,PowOut:()=>Ds,RGB2Timeline:()=>ut,RGBA2Timeline:()=>ft,RGBATimeline:()=>ht,RGBTimeline:()=>ct,RegionAttachment:()=>W,RotateMode:()=>He,RotateTimeline:()=>Me,SETUP:()=>At,SUBSEQUENT:()=>Ne,ScaleTimeline:()=>rt,ScaleXTimeline:()=>it,ScaleYTimeline:()=>at,SequenceTimeline:()=>ve,ShearTimeline:()=>nt,ShearXTimeline:()=>lt,ShearYTimeline:()=>ot,Skeleton:()=>Ss,SkeletonBinary:()=>Js,SkeletonBounds:()=>Yr,SkeletonClipping:()=>Dt,SkeletonData:()=>Rt,SkeletonJson:()=>Mr,Skin:()=>Ge,SkinEntry:()=>Pt,Slot:()=>ps,SlotData:()=>Bt,SpacingMode:()=>ze,StringSet:()=>Ke,Texture:()=>ds,TextureAtlas:()=>ms,TextureAtlasPage:()=>gs,TextureAtlasRegion:()=>Ct,TextureFilter:()=>qe,TextureRegion:()=>us,TextureWrap:()=>fs,TimeKeeper:()=>Os,Timeline:()=>J,TrackEntry:()=>ls,TransformConstraint:()=>ys,TransformConstraintData:()=>Vt,TransformConstraintTimeline:()=>xt,TransformMode:()=>Ue,TranslateTimeline:()=>et,TranslateXTimeline:()=>tt,TranslateYTimeline:()=>st,Triangulator:()=>te,Utils:()=>R,Vector2:()=>Pe,VertexAttachment:()=>ne,WindowedMean:()=>_s});var Ls=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}},Ke=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new be().setFromString(e)}},N=be;B(N,"WHITE",new be(1,1,1,1)),B(N,"RED",new be(1,0,0,1)),B(N,"GREEN",new be(0,1,0,1)),B(N,"BLUE",new be(0,0,1,1)),B(N,"MAGENTA",new be(1,0,1,1));var ae=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ae.degRad)}static sinDeg(e){return Math.sin(e*ae.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ae.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ae.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},X=ae;B(X,"PI",3.1415927),B(X,"PI2",ae.PI*2),B(X,"invPI2",1/ae.PI2),B(X,"radiansToDegrees",180/ae.PI),B(X,"radDeg",ae.radiansToDegrees),B(X,"degreesToRadians",ae.PI/180),B(X,"degRad",ae.degreesToRadians);var Ut=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},Wt=class extends Ut{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}},Ds=class extends Wt{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},ye=class{static arrayCopy(e,t,s,i,a){for(let h=t,o=i;h<t+a;h++,o++)s[o]=e[h]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:ye.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(ye.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(ye.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return ye.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return ye.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=ye;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ns=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)}}},Ye=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}},Pe=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}},Os=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)}},_s=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}},Qe=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},zt=class extends Qe{id=zt.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,h){s=a+(s>>1)*h;let o=e.bone.skeleton,r=e.deform,l=this.vertices,n=this.bones;if(!n){r.length>0&&(l=r);let u=e.bone,m=u.worldX,x=u.worldY,p=u.a,w=u.b,g=u.c,b=u.d;for(let v=t,y=a;y<s;v+=2,y+=h){let S=l[v],A=l[v+1];i[y]=S*p+A*w+m,i[y+1]=S*g+A*b+x}return}let c=0,f=0;for(let u=0;u<t;u+=2){let m=n[c];c+=m+1,f+=m}let d=o.bones;if(r.length==0)for(let u=a,m=f*3;u<s;u+=h){let x=0,p=0,w=n[c++];for(w+=c;c<w;c++,m+=3){let g=d[n[c]],b=l[m],v=l[m+1],y=l[m+2];x+=(b*g.a+v*g.b+g.worldX)*y,p+=(b*g.c+v*g.d+g.worldY)*y}i[u]=x,i[u+1]=p}else{let u=r;for(let m=a,x=f*3,p=f<<1;m<s;m+=h){let w=0,g=0,b=n[c++];for(b+=c;c<b;c++,x+=3,p+=2){let v=d[n[c]],y=l[x]+u[p],S=l[x+1]+u[p+1],A=l[x+2];w+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}i[m]=w,i[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ne=zt;B(ne,"nextID",0);var Be=class{id=Be.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Be(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Be._nextID++}},Ze=Be;B(Ze,"_nextID",0);var Ht=(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))(Ht||{}),Gt=[0,1,2,3,4,5,6],Ve=class{name;timelines=[];timelineIds=new Ke;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,a,h,o,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let n=0,c=l.length;n<c;n++)l[n].apply(e,t,s,a,h,o,r)}},$t=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))($t||{}),jt=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(jt||{}),O={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,physicsConstraintInertia:19,physicsConstraintStrength:20,physicsConstraintDamping:21,physicsConstraintMass:22,physicsConstraintWind:23,physicsConstraintGravity:24,physicsConstraintMix:25,physicsConstraintReset:26,sequence:27},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},le=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,h,o,r,l,n,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-h*2+r)*.03,m=(a-o*2+l)*.03,x=((h-r)*3-i+n)*.006,p=((o-l)*3-a+c)*.006,w=u*2+x,g=m*2+p,b=(h-i)*.3+u+x*.16666667,v=(o-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let A=d+18;d<A;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let l=this.frames[t],n=this.frames[t+s];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}let h=i+18;for(i+=2;i<h;i+=2)if(a[i]>=e){let l=a[i-2],n=a[i-1];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}t+=this.getFrameEntries();let o=a[h-2],r=a[h-1];return r+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-r)}},se=class extends le{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 a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],h=t[s+1];return h+(e-a)/(t[s+2]-a)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return a+h*t;case 1:case 2:h+=a-i}return i+h*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let h=this.getCurveValue(e);return s==0?a+(h-a)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,a,h){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(h-a)*t:i+(h-i)*t}getScaleValue(e,t,s,i,a,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return a+(h-a)*t}return a}let r=this.getCurveValue(e)*h;if(t==1)return s==3?a+r-h:r;if(i==1)switch(s){case 0:return h+(Math.abs(r)*X.signum(h)-h)*t;case 1:case 2:return a+(Math.abs(r)*X.signum(a)-a)*t}else{let l=0;switch(s){case 0:return l=Math.abs(h)*X.signum(r),l+(r-l)*t;case 1:case 2:return l=Math.abs(a)*X.signum(r),l+(r-l)*t}}return a+(r-h)*t}},Le=class extends le{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Me=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,h,r.rotation,r.data.rotation))}},et=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,c=0,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,c+=(l[f+3+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:r.x=r.data.x+n*a,r.y=r.data.y+c*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+c-r.y)*a;break;case 3:r.x+=n*a,r.y+=c*a}}},tt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,h,r.x,r.data.x))}},st=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,h,r.y,r.data.y))}},rt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,c,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,c+=(l[f+3+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(n*=r.data.scaleX,c*=r.data.scaleY,a==1)h==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=n,r.scaleY=c);else{let u=0,m=0;if(o==1)switch(h){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*a;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(c-r.data.scaleY)*a}else switch(h){case 0:u=Math.abs(r.data.scaleX)*X.signum(n),m=Math.abs(r.data.scaleY)*X.signum(c),r.scaleX=u+(n-u)*a,r.scaleY=m+(c-m)*a;break;case 1:case 2:u=Math.abs(r.scaleX)*X.signum(n),m=Math.abs(r.scaleY)*X.signum(c),r.scaleX=u+(n-u)*a,r.scaleY=m+(c-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(c-r.data.scaleY)*a}}}},it=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,h,o,r.scaleX,r.data.scaleX))}},at=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,h,o,r.scaleX,r.data.scaleY))}},nt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,c=0,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,c+=(l[f+3+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+c*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+c-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=c*a}}},lt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,h,r.shearX,r.data.shearX))}},ot=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,h,r.shearX,r.data.shearY))}},ht=class extends le{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,i,a,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let p=r.data.color;switch(h){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let c=0,f=0,d=0,u=0,m=J.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let p=l[m];c=l[m+1],f=l[m+2],d=l[m+3],u=l[m+4];let w=(s-p)/(l[m+5]-p);c+=(l[m+5+1]-c)*w,f+=(l[m+5+2]-f)*w,d+=(l[m+5+3]-d)*w,u+=(l[m+5+4]-u)*w;break;case 1:c=l[m+1],f=l[m+2],d=l[m+3],u=l[m+4];break;default:c=this.getBezierValue(s,m,1,x-2),f=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),u=this.getBezierValue(s,m,4,x+18*3-2)}a==1?n.set(c,f,d,u):(h==0&&n.setFromColor(r.data.color),n.add((c-n.r)*a,(f-n.g)*a,(d-n.b)*a,(u-n.a)*a))}},ct=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let x=r.data.color;switch(h){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*a,n.g+=(x.g-n.g)*a,n.b+=(x.b-n.b)*a}return}let c=0,f=0,d=0,u=J.search(l,s,4),m=this.curves[u>>2];switch(m){case 0:let x=l[u];c=l[u+1],f=l[u+2],d=l[u+3];let p=(s-x)/(l[u+4]-x);c+=(l[u+4+1]-c)*p,f+=(l[u+4+2]-f)*p,d+=(l[u+4+3]-d)*p;break;case 1:c=l[u+1],f=l[u+2],d=l[u+3];break;default:c=this.getBezierValue(s,u,1,m-2),f=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(a==1)n.r=c,n.g=f,n.b=d;else{if(h==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(c-n.r)*a,n.g+=(f-n.g)*a,n.b+=(d-n.b)*a}}},dt=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,O.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(s<this.frames[0]){let c=r.data.color;switch(h){case 0:l.a=c.a;return;case 1:l.a+=(c.a-l.a)*a}return}let n=this.getCurveValue(s);a==1?l.a=n:(h==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*a)}},ft=class extends le{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,i,a,h,o,r,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,c=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:n.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),c.r+=(y.r-c.r)*a,c.g+=(y.g-c.g)*a,c.b+=(y.b-c.b)*a}return}let f=0,d=0,u=0,m=0,x=0,p=0,w=0,g=J.search(l,s,8),b=this.curves[g>>3];switch(b){case 0:let v=l[g];f=l[g+1],d=l[g+2],u=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];let y=(s-v)/(l[g+8]-v);f+=(l[g+8+1]-f)*y,d+=(l[g+8+2]-d)*y,u+=(l[g+8+3]-u)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,p+=(l[g+8+6]-p)*y,w+=(l[g+8+7]-w)*y;break;case 1:f=l[g+1],d=l[g+2],u=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];break;default:f=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),m=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2),w=this.getBezierValue(s,g,7,b+18*6-2)}if(a==1)n.set(f,d,u,m),c.r=x,c.g=p,c.b=w;else{if(h==0){n.setFromColor(r.data.color);let v=r.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}n.add((f-n.r)*a,(d-n.g)*a,(u-n.b)*a,(m-n.a)*a),c.r+=(x-c.r)*a,c.g+=(p-c.g)*a,c.b+=(w-c.b)*a}}},ut=class extends le{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,i,a,h,o,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,c=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:n.r=v.r,n.g=v.g,n.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,c.r+=(y.r-c.r)*a,c.g+=(y.g-c.g)*a,c.b+=(y.b-c.b)*a}return}let f=0,d=0,u=0,m=0,x=0,p=0,w=0,g=J.search(l,s,7),b=this.curves[g/7];switch(b){case 0:let v=l[g];f=l[g+1],d=l[g+2],u=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];let y=(s-v)/(l[g+7]-v);f+=(l[g+7+1]-f)*y,d+=(l[g+7+2]-d)*y,u+=(l[g+7+3]-u)*y,x+=(l[g+7+4]-x)*y,p+=(l[g+7+5]-p)*y,w+=(l[g+7+6]-w)*y;break;case 1:f=l[g+1],d=l[g+2],u=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];break;default:f=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),p=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2)}if(a==1)n.r=f,n.g=d,n.b=u,c.r=x,c.g=p,c.b=w;else{if(h==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}n.r+=(f-n.r)*a,n.g+=(d-n.g)*a,n.b+=(u-n.b)*a,c.r+=(x-c.r)*a,c.g+=(p-c.g)*a,c.b+=(w-c.b)*a}}},we=class extends J{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,i,a,h,o){let r=e.slots[this.slotIndex];if(r.bone.active){if(o==1){h==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},mt=class extends le{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[O.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,h,o,r,l,n,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-h*2+r)*.03,m=l*.03-o*.06,x=((h-r)*3-i+n)*.006,p=(o-l+.33333333)*.018,w=u*2+x,g=m*2+p,b=(h-i)*.3+u+x*.16666667,v=o*.3+m+p*.16666667,y=i+b,S=v;for(let A=d+18;d<A;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],l=s[i-1];return l+(e-r)/(s[i]-r)*(s[i+1]-l)}let h=s[a-2],o=s[a-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof ne)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=f;let g=l;if(g.bones){a=1-a;for(var u=0;u<f;u++)n[u]*=a}else{let b=g.vertices;for(var u=0;u<f;u++)n[u]+=(b[u]-n[u])*a}}return}if(n.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(a==1)if(h==3){let b=l;if(b.bones)for(let v=0;v<f;v++)n[v]+=g[v];else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,n,0,f);else switch(h){case 0:{let v=l;if(v.bones)for(let y=0;y<f;y++)n[y]=g[y]*a;else{let y=v.vertices;for(let S=0;S<f;S++){let A=y[S];n[S]=A+(g[S]-A)*a}}break}case 1:case 2:for(let v=0;v<f;v++)n[v]+=(g[v]-n[v])*a;break;case 3:let b=l;if(b.bones)for(let v=0;v<f;v++)n[v]+=g[v]*a;else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=(g[y]-v[y])*a}}return}let m=J.search1(d,s),x=this.getCurvePercent(s,m),p=c[m],w=c[m+1];if(a==1)if(h==3){let g=l;if(g.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=v+(w[b]-v)*x}else{let b=g.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=y+(w[v]-y)*x-b[v]}}}else for(let g=0;g<f;g++){let b=p[g];n[g]=b+(w[g]-b)*x}else switch(h){case 0:{let b=l;if(b.bones)for(let v=0;v<f;v++){let y=p[v];n[v]=(y+(w[v]-y)*x)*a}else{let v=b.vertices;for(let y=0;y<f;y++){let S=p[y],A=v[y];n[y]=A+(S+(w[y]-S)*x-A)*a}}break}case 1:case 2:for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x-n[b])*a}break;case 3:let g=l;if(g.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x)*a}else{let b=g.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=(y+(w[v]-y)*x-b[v])*a}}}}},Jt=class extends J{events;constructor(e){super(e,Jt.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,h,o){if(!i)return;let r=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,h,o),t=-1;else if(t>=r[l-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let c=r[n];for(;n>0&&r[n-1]==c;)n--}for(;n<l&&s>=r[n];n++)i.push(this.events[n])}},Xe=Jt;B(Xe,"propertyIds",[""+O.event]);var Kt=class extends J{drawOrders;constructor(e){super(e,Kt.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,h,o){if(o==1){h==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(h==0||h==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),l=this.drawOrders[r];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,c=e.slots;for(let f=0,d=l.length;f<d;f++)n[f]=c[l[f]]}}},pe=Kt;B(pe,"propertyIds",[""+O.drawOrder]);var gt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,a,h,o){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,c=0,f=J.search(l,s,6),d=this.curves[f/6];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+6]-u);n+=(l[f+6+1]-n)*m,c+=(l[f+6+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(c-r.data.softness)*a,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[f+3],r.compress=l[f+4]!=0,r.stretch=l[f+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(c-r.softness)*a,o==0&&(r.bendDirection=l[f+3],r.compress=l[f+4]!=0,r.stretch=l[f+5]!=0))}},xt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,h,o,r){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=a,l[e+4]=h,l[e+5]=o,l[e+6]=r}apply(e,t,s,i,a,h,o){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){let w=r.data;switch(h){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,c,f,d,u,m,x=J.search(l,s,7),p=this.curves[x/7];switch(p){case 0:let w=l[x];n=l[x+1],c=l[x+2],f=l[x+3],d=l[x+4],u=l[x+5],m=l[x+6];let g=(s-w)/(l[x+7]-w);n+=(l[x+7+1]-n)*g,c+=(l[x+7+2]-c)*g,f+=(l[x+7+3]-f)*g,d+=(l[x+7+4]-d)*g,u+=(l[x+7+5]-u)*g,m+=(l[x+7+6]-m)*g;break;case 1:n=l[x+1],c=l[x+2],f=l[x+3],d=l[x+4],u=l[x+5],m=l[x+6];break;default:n=this.getBezierValue(s,x,1,p-2),c=this.getBezierValue(s,x,2,p+18-2),f=this.getBezierValue(s,x,3,p+18*2-2),d=this.getBezierValue(s,x,4,p+18*3-2),u=this.getBezierValue(s,x,5,p+18*4-2),m=this.getBezierValue(s,x,6,p+18*5-2)}if(h==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(c-w.mixX)*a,r.mixY=w.mixY+(f-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(u-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(c-r.mixX)*a,r.mixY+=(f-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(u-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},bt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,h,r.position,r.data.position))}},wt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,h,r.spacing,r.data.spacing))}},pt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=a}apply(e,t,s,i,a,h,o){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,c,f,d=J.search(l,s,4),u=this.curves[d>>2];switch(u){case 0:let m=l[d];n=l[d+1],c=l[d+2],f=l[d+3];let x=(s-m)/(l[d+4]-m);n+=(l[d+4+1]-n)*x,c+=(l[d+4+2]-c)*x,f+=(l[d+4+3]-f)*x;break;case 1:n=l[d+1],c=l[d+2],f=l[d+3];break;default:n=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2),f=this.getBezierValue(s,d,3,u+18*2-2)}if(h==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(c-m.mixX)*a,r.mixY=m.mixY+(f-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(c-r.mixX)*a,r.mixY+=(f-r.mixY)*a}},fe=class extends se{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,o){let r;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,h,this.get(n),this.setup(n),l))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,h,this.get(r),this.setup(r)))}},Qt=class extends fe{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}},Zt=class extends fe{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}},es=class extends fe{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}},ts=class extends fe{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}},ss=class extends fe{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}},rs=class extends fe{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}},is=class extends fe{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}},as=class extends J{constraintIndex;constructor(e,t){super(e,as.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,h,o){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,h,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},yt=as;B(yt,"propertyIds",[O.physicsConstraintReset.toString()]);var ue=class extends J{slotIndex;attachment;constructor(e,t,s){super(e,[O.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return ue.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,i,a){let h=this.frames;e*=ue.ENTRIES,h[e]=t,h[e+ue.MODE]=s|i<<4,h[e+ue.DELAY]=a}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof ne)||l.timelineAttachment!=n))return;let c=this.frames;if(s<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let f=J.search(c,s,ue.ENTRIES),d=c[f],u=c[f+ue.MODE],m=c[f+ue.DELAY];if(!this.attachment.sequence)return;let x=u>>4,p=this.attachment.sequence.regions.length,w=Gt[u&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(p-1,x);break;case 2:x%=p;break;case 3:{let g=(p<<1)-2;x=g==0?0:x%g,x>=p&&(x=g-x);break}case 4:x=Math.max(p-1-x,0);break;case 5:x=p-1-x%p;break;case 6:{let g=(p<<1)-2;x=g==0?0:(x+p-1)%g,x>=p&&(x=g-x)}}r.sequenceIndex=x}},ve=ue;B(ve,"ENTRIES",3),B(ve,"MODE",1),B(ve,"DELAY",2);var De=class{static emptyAnimation(){return De._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new os(this);propertyIDs=new Ke;animationsChanged=!1;trackEntryPool=new Ye(()=>new ls);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let h=e*a.timeScale;if(a.delay>0){if(a.delay-=h,a.delay>0)continue;h=-a.delay,a.delay=0}let o=a.next;if(o){let r=a.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*o.timeScale,a.trackTime+=h,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let f=0,d=s.length;f<d;f++){let u=s[f];if(!u||u.delay>0)continue;i=!0;let m=f==0?1:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let p=x>=u.alphaAttachmentThreshold,w=u.animationLast,g=u.getAnimationTime(),b=g,v=t;u.reverse&&(b=u.animation.duration-b,v=null);let y=u.animation.timelines,S=y.length;if(f==0&&x==1||m==3){f==0&&(p=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(x,m);var a=y[A];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,x,m,0)}}else{let A=u.timelineMode,k=u.shortestRotation,T=!k&&u.timelinesRotation.length!=S<<1;T&&(u.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let E=y[Y],F=A[Y]==Ne?m:0;!k&&E instanceof Me?this.applyRotateTimeline(E,e,b,x,F,u.timelinesRotation,Y<<1,T):E instanceof we?this.applyAttachmentTimeline(E,e,b,m,p):(R.webkit602BugfixHelper(x,m),E.apply(e,w,b,v,x,F,0))}}this.queueEvents(u,g),t.length=0,u.nextAnimationLast=g,u.nextTrackLast=u.trackTime}for(var h=this.unkeyedState+At,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==h){var c=n.data.attachmentName;n.setAttachment(c?e.getAttachment(n.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let h=a<i.mixAttachmentThreshold,o=a<i.mixDrawOrderThreshold,r=i.animation.timelines,l=r.length,n=i.alpha*e.interruptAlpha,c=n*(1-a),f=i.animationLast,d=i.getAnimationTime(),u=d,m=null;if(i.reverse?u=i.animation.duration-u:a<i.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)r[x].apply(t,f,u,m,c,s,1);else{let x=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,g=!w&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let b=0;b<l;b++){let v=r[b],y=1,S,A=0;switch(x[b]){case Ne:if(!o&&v instanceof pe)continue;S=s,A=c;break;case vt:S=0,A=c;break;case St:S=s,A=n;break;case Oe:S=0,A=n;break;default:S=0;let k=p[b];A=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=A,!w&&v instanceof Me?this.applyRotateTimeline(v,t,u,A,S,i.timelinesRotation,b<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,u,S,h&&A>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof pe&&S==0&&(y=0),v.apply(t,f,u,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var h=t.slots[e.slotIndex];h.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,h,h.data.attachmentName,a):this.setAttachment(t,h,e.attachmentNames[J.search1(e.frames,s)],a),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+At))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+cs)}applyRotateTimeline(e,t,s,i,a,h,o,r){if(r&&(h[o]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let n=e.frames,c=0,f=0;if(s<n[0])switch(a){case 0:l.rotation=l.data.rotation;default:return;case 1:c=l.rotation,f=l.data.rotation}else c=a==0?l.data.rotation:l.rotation,f=l.data.rotation+e.getCurveValue(s);let d=0,u=f-c;if(u-=Math.ceil(u/360-.5)*360,u==0)d=h[o];else{let m=0,x=0;r?(m=0,x=u):(m=h[o],x=h[o+1]);let p=m-m%360;d=u+p;let w=u>=0,g=m>=0;Math.abs(x)<=90&&X.signum(x)!=X.signum(u)&&(Math.abs(m-p)>180?(d+=360*X.signum(m),g=w):p!=0?d-=360*X.signum(m):g=w),g!=w&&(d+=360*X.signum(m)),h[o]=d}h[o+1]=u,l.rotation=c+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,h=e.trackLast%a,o=this.events,r=0,l=o.length;for(;r<l;r++){let c=o[r];if(c.time<h)break;c.time>i||this.queue.event(e,c)}let n=!1;for(e.loop?n=a==0||h>e.trackTime%a:n=t>=i&&e.animationLast<i,n&&this.queue.complete(e);r<l;r++){let c=o[r];c.time<s||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let h=this.trackEntry(e,t,s,a);return this.setCurrent(e,h,i),this.queue.drain(),h}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let h=this.trackEntry(e,t,s,a);return a?(a.next=h,h.previous=a,i<=0&&(i+=a.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=i,h}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,De.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,De.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-t),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let h=e.timelineHoldMix;h.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=o.addAll(s[r].getPropertyIds())?Oe:St;return}e:for(let r=0;r<i;r++){let l=s[r],n=l.getPropertyIds();if(!o.addAll(n))a[r]=Ne;else if(!t||l instanceof we||l instanceof pe||l instanceof Xe||!t.animation.hasTimeline(n))a[r]=vt;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=hs,h[r]=c;continue e}break}a[r]=Oe}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},ns=De;B(ns,"_emptyAnimation",new Ve("<empty>",[],0));var ls=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,this.previous!=null&&this.delay<=0&&(this.delay+=this.previous.getTrackComplete()-e),this.delay=this.delay}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}},os=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ee.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ee.interrupt),this.objects.push(e)}end(e){this.objects.push(ee.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ee.dispose),this.objects.push(e)}complete(e){this.objects.push(ee.complete),this.objects.push(e)}event(e,t){this.objects.push(ee.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case ee.start:a.listener&&a.listener.start&&a.listener.start(a);for(let o=0;o<t.length;o++){let r=t[o];r.start&&r.start(a)}break;case ee.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let o=0;o<t.length;o++){let r=t[o];r.interrupt&&r.interrupt(a)}break;case ee.end:a.listener&&a.listener.end&&a.listener.end(a);for(let o=0;o<t.length;o++){let r=t[o];r.end&&r.end(a)}case ee.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let o=0;o<t.length;o++){let r=t[o];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case ee.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let o=0;o<t.length;o++){let r=t[o];r.complete&&r.complete(a)}break;case ee.event:let h=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,h);for(let o=0;o<t.length;o++){let r=t[o];r.event&&r.event(a,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ee=(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))(ee||{}),qs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Ne=0,vt=1,St=2,Oe=3,hs=4,At=1,cs=2,Us=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},_e=class extends ne{color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new _e(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},It=class extends ne{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new It(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},ds=class{_image;constructor(e){this._image=e}getImage(){return this._image}},qe=(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))(qe||{}),fs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(fs||{}),us=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ws=class extends ds{setFilters(e,t){}setWraps(e,t){}dispose(){}},ms=class{pages=new Array;regions=new Array;constructor(e){let t=new zs(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(qe,s[1]),n.magFilter=R.enumValue(qe,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let c=s[1];c=="true"?n.degrees=90:c!="false"&&(n.degrees=parseInt(c))},a.index=n=>{n.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,r=null,l=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let n=new Ct(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let f=a[s[0]];if(f)f(n);else{r||(r=[]),l||(l=[]),r.push(s[0]);let d=[];for(let u=0;u<c;u++)d.push(parseInt(s[u+1]));l.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&l&&l.length>0&&(n.names=r,n.values=l,r=null,l=null),n.u=n.x/o.width,n.v=n.y/o.height,n.degrees==90?(n.u2=(n.x+n.height)/o.width,n.v2=(n.y+n.width)/o.height):(n.u2=(n.x+n.width)/o.width,n.v2=(n.y+n.height)/o.height),this.regions.push(n)}else{for(o=new gs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let n=i[s[0]];n&&n(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()}},zs=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let h=t.indexOf(",",a);if(h==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,h-a).trim(),a=h+1,i==4)return 4}}},gs=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Ct=class extends us{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)}},Se=class extends ne{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,h=0,o=0;if(this.region instanceof Ct){let r=this.region,l=r.page,n=l.width,c=l.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/n,o=r.originalWidth/c;for(let f=0;f<s;f+=2)t[f]=i+e[f+1]*h,t[f+1]=a+(1-e[f])*o;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/c,h=r.originalWidth/n,o=r.originalHeight/c;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f])*h,t[f+1]=a+(1-e[f+1])*o;return;case 270:i-=r.offsetY/n,a-=r.offsetX/c,h=r.originalHeight/n,o=r.originalWidth/c;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f+1])*h,t[f+1]=a+e[f]*o;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/n,o=r.originalHeight/c}else this.region?(h=this.region.u2-i,o=this.region.v2-a):(i=a=0,h=o=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*h,t[r+1]=a+e[r+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new Se(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,h)}newLinkedMesh(){let e=new Se(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ae=class extends ne{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ae(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},kt=class extends ne{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*X.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,h=s*e.c+i*e.d;return X.atan2Deg(h,a)}copy(){let e=new kt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},xs=class extends Qe{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*i,o=a+this.region.width*s,r=h+this.region.height*i,l=this.rotation*X.degRad,n=Math.cos(l),c=Math.sin(l),f=this.x,d=this.y,u=a*n+f,m=a*c,x=h*n+d,p=h*c,w=o*n+f,g=o*c,b=r*n+d,v=r*c,y=this.offset;y[0]=u-p,y[1]=x+m,y[2]=u-v,y[3]=b+m,y[4]=w-v,y[5]=b+g,y[6]=w-p,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,h=this.offset,o=a.worldX,r=a.worldY,l=a.a,n=a.b,c=a.c,f=a.d,d=0,u=0;d=h[0],u=h[1],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r,s+=i,d=h[2],u=h[3],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r,s+=i,d=h[4],u=h[5],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r,s+=i,d=h[6],u=h[7],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r}copy(){let e=new xs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},W=xs;B(W,"X1",0),B(W,"Y1",1),B(W,"C1R",2),B(W,"C1G",3),B(W,"C1B",4),B(W,"C1A",5),B(W,"U1",6),B(W,"V1",7),B(W,"X2",8),B(W,"Y2",9),B(W,"C2R",10),B(W,"C2G",11),B(W,"C2B",12),B(W,"C2A",13),B(W,"U2",14),B(W,"V2",15),B(W,"X3",16),B(W,"Y3",17),B(W,"C3R",18),B(W,"C3G",19),B(W,"C3B",20),B(W,"C3A",21),B(W,"U3",22),B(W,"V3",23),B(W,"X4",24),B(W,"Y4",25),B(W,"C4R",26),B(W,"C4G",27),B(W,"C4B",28),B(W,"C4A",29),B(W,"U4",30),B(W,"V4",31);var Hs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,h=i.length;a<h;a++){let o=s.getPath(t,a),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new W(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=h}return a}newMeshAttachment(e,t,s,i){let a=new Se(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=h}return a}newBoundingBoxAttachment(e,t){return new _e(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new kt(t)}newClippingAttachment(e,t){return new It(t)}},Tt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;transformMode=Ue.Normal;skinRequired=!1;color=new N;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}},Ue=(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))(Ue||{}),Yt=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;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=h,this.ashearY=o;let r=this.parent;if(!r){let d=this.skeleton;const u=d.scaleX,m=d.scaleY,x=(s+h)*X.degRad,p=(s+90+o)*X.degRad;this.a=Math.cos(x)*i*u,this.b=Math.cos(p)*a*u,this.c=Math.sin(x)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*u+d.x,this.worldY=t*m+d.y;return}let l=r.a,n=r.b,c=r.c,f=r.d;switch(this.worldX=l*e+n*t+r.worldX,this.worldY=c*e+f*t+r.worldY,this.data.transformMode){case 0:{const d=(s+h)*X.degRad,u=(s+90+o)*X.degRad,m=Math.cos(d)*i,x=Math.cos(u)*a,p=Math.sin(d)*i,w=Math.sin(u)*a;this.a=l*m+n*p,this.b=l*x+n*w,this.c=c*m+f*p,this.d=c*x+f*w;return}case 1:{const d=(s+h)*X.degRad,u=(s+90+o)*X.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(u)*a,this.c=Math.sin(d)*i,this.d=Math.sin(u)*a;break}case 2:{let d=l*l+c*c,u=0;d>1e-4?(d=Math.abs(l*f-n*c)/d,l/=this.skeleton.scaleX,c/=this.skeleton.scaleY,n=c*d,f=l*d,u=Math.atan2(c,l)*X.radDeg):(l=0,c=0,u=90-Math.atan2(f,n)*X.radDeg);const m=(s+h-u)*X.degRad,x=(s+o-u+90)*X.degRad,p=Math.cos(m)*i,w=Math.cos(x)*a,g=Math.sin(m)*i,b=Math.sin(x)*a;this.a=l*p-n*g,this.b=l*w-n*b,this.c=c*p+f*g,this.d=c*w+f*b;break}case 3:case 4:{s*=X.degRad;const d=Math.cos(s),u=Math.sin(s);let m=(l*d+n*u)/this.skeleton.scaleX,x=(c*d+f*u)/this.skeleton.scaleY,p=Math.sqrt(m*m+x*x);p>1e-5&&(p=1/p),m*=p,x*=p,p=Math.sqrt(m*m+x*x),this.data.transformMode==3&&l*f-n*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*p,g=Math.sin(s)*p;h*=X.degRad,o=(90+o)*X.degRad;const b=Math.cos(h)*i,v=Math.cos(o)*a,y=Math.sin(h)*i,S=Math.sin(o)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=x*b+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY}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,i=e.c,a=e.d,h=1/(t*a-s*i),o=a*h,r=s*h,l=i*h,n=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*o-f*r,this.ay=f*n-c*l;let d,u,m,x;if(this.data.transformMode==1)d=this.a,u=this.b,m=this.c,x=this.d;else{switch(this.data.transformMode){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i),y=t/this.skeleton.scaleX;s=-(i/this.skeleton.scaleY)*v*this.skeleton.scaleX,a=y*v*this.skeleton.scaleY,h=1/(t*a-s*i),o=a*h,r=s*h;break}case 3:case 4:let p=X.cosDeg(this.rotation),w=X.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.data.transformMode==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=X.PI/2+Math.atan2(i,t);s=Math.cos(b)*g,a=Math.sin(b)*g,h=1/(t*a-s*i),o=a*h,r=s*h,l=i*h,n=t*h}d=o*this.a-r*this.c,u=o*this.b-r*this.d,m=n*this.c-l*this.a,x=n*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*x-u*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*u+m*x,p)*X.radDeg,this.arotation=Math.atan2(m,d)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*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,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=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),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Fe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},Gs=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new bs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),h=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new ms(o),l=r.pages.length,n=!1;for(let c of r.pages)this.loadTexture(i?i[c.name]:h+c.name,(f,d)=>{n||(c.setTexture(d),--l==0&&this.success(t,e,r))},(f,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${f}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
-
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},bs=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=t.charCodeAt(a);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let a=()=>{this.finish(e,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let a=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let a=t==200||t==0?[s]:[t,s];for(let h=a.length-1,o=i.length;h<o;h+=2)i[h].apply(null,a)}},Mt=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}},Xt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ws=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.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,a,h,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,c=r.c,f=r.d,d=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=(t-e.worldX)*X.signum(e.skeleton.scaleX),m=(s-e.worldY)*X.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(l*f-n*c)/Math.max(1e-4,l*l+c*c),g=l/e.skeleton.scaleX,b=c/e.skeleton.scaleY;n=-b*w*e.skeleton.scaleX,f=g*w*e.skeleton.scaleY,d+=Math.atan2(b,g)*X.radDeg;default:let v=t-r.worldX,y=s-r.worldY,S=l*f-n*c;Math.abs(S)<=1e-4?(u=0,m=0):(u=(v*f-y*n)/S-e.ax,m=(y*l-v*c)/S-e.ay)}d+=Math.atan2(m,u)*X.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,p=e.ascaleY;if(i||a){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=s-e.worldY}const w=e.data.length*x;if(w>1e-4){const g=u*u+m*m;if(i&&g<w*w||a&&g>w*w){const b=(Math.sqrt(g)/w-1)*o+1;x*=b,h&&(p*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,x,p,e.ashearX,e.ashearY)}apply2(e,t,s,i,a,h,o,r,l){let n=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,u=f,m=d,x=t.ascaleX,p=0,w=0,g=0;f<0?(f=-f,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),x<0?(x=-x,w=180):w=0;let b=t.ax,v=0,y=0,S=0,A=e.a,k=e.b,T=e.c,Y=e.d,E=Math.abs(f-d)<=1e-4;!E||h?(v=0,y=A*b+e.worldX,S=T*b+e.worldY):(v=t.ay,y=A*b+k*v+e.worldX,S=T*b+Y*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");A=F.a,k=F.b,T=F.c,Y=F.d;let P=A*Y-k*T,C=y-F.worldX,M=S-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let V=(C*Y-M*k)*P-n,q=(M*A-C*T)*P-c,L=Math.sqrt(V*V+q*q),H=t.data.length*x,j,$;if(L<1e-4){this.apply1(e,s,i,!1,h,!1,l),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}C=s-F.worldX,M=i-F.worldY;let _=(C*Y-M*k)*P-n,D=(M*A-C*T)*P-c,G=_*_+D*D;if(r!=0){r*=f*(x+1)*.5;let K=Math.sqrt(G),re=K-L-H*f+r;if(re>0){let ie=Math.min(1,re/(r*2))-1;ie=(re-r*(1-ie*ie))/K,_-=ie*_,D-=ie*D,G=_*_+D*D}}e:if(E){H*=f;let K=(G-L*L-H*H)/(2*L*H);K<-1?(K=-1,$=Math.PI*a):K>1?(K=1,$=0,h&&(A=(Math.sqrt(G)/(L+H)-1)*l+1,u*=A,o&&(m*=A))):$=Math.acos(K)*a,A=L+H*K,k=H*Math.sin($),j=Math.atan2(D*A-_*k,_*A+D*k)}else{A=f*H,k=d*H;let K=A*A,re=k*k,ie=Math.atan2(D,_);T=re*L*L+K*G-K*re;let xe=-2*re*L,Ce=re-K;if(Y=xe*xe-4*Ce*T,Y>=0){let ke=Math.sqrt(Y);xe<0&&(ke=-ke),ke=-(xe+ke)*.5;let Ys=ke/Ce,Ms=T/ke,Te=Math.abs(Ys)<Math.abs(Ms)?Ys:Ms;if(Te*Te<=G){M=Math.sqrt(G-Te*Te)*a,j=ie-Math.atan2(M,Te),$=Math.atan2(M/d,(Te-L)/f);break e}}let Ee=X.PI,je=L-A,Ot=je*je,Cs=0,ks=0,Je=L+A,_t=Je*Je,Ts=0;T=-A*L/(K-re),T>=-1&&T<=1&&(T=Math.acos(T),C=A*Math.cos(T)+L,M=k*Math.sin(T),Y=C*C+M*M,Y<Ot&&(Ee=T,Ot=Y,je=C,Cs=M),Y>_t&&(ks=T,_t=Y,Je=C,Ts=M)),G<=(Ot+_t)*.5?(j=ie-Math.atan2(Cs*a,je),$=Ee*a):(j=ie-Math.atan2(Ts*a,Je),$=ks*a)}let Z=Math.atan2(v,b)*g,ce=e.arotation;j=(j-Z)*X.radDeg+p-ce,j>180?j-=360:j<-180&&(j+=360),e.updateWorldTransformWith(n,c,ce+j*l,u,m,0,0),ce=t.arotation,$=(($+Z)*X.radDeg-t.ashearX)*g+w-ce,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(b,v,ce+$*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ft=class extends Fe{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},Et=class extends Fe{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=We.Fixed;spacingMode=ze.Fixed;rotateMode=He.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},We=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(We||{}),ze=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ze||{}),He=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(He||{}),me=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,a=e.bones.length;i<a;i++){let h=t.findBone(e.bones[i].name);if(!h)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(h)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ae))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(s==0&&i==0&&a==0)return;let h=this.data,o=h.rotateMode==0,r=h.rotateMode==2,l=this.bones,n=l.length,c=o?n:n+1,f=R.setArraySize(this.spaces,c),d=r?this.lengths=R.setArraySize(this.lengths,n):[],u=this.spacing;switch(h.spacingMode){case 2:if(r)for(let y=0,S=c-1;y<S;y++){let A=l[y],k=A.data.length,T=k*A.a,Y=k*A.c;d[y]=Math.sqrt(T*T+Y*Y)}R.arrayFill(f,1,c,u);break;case 3:let b=0;for(let y=0,S=c-1;y<S;){let A=l[y],k=A.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*A.a,Y=k*A.c,E=Math.sqrt(T*T+Y*Y);r&&(d[y]=E),f[++y]=E,b+=E}}if(b>0){b=c/b*u;for(let y=1;y<c;y++)f[y]*=b}break;default:let v=h.spacingMode==0;for(let y=0,S=c-1;y<S;){let A=l[y],k=A.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*A.a,Y=k*A.c,E=Math.sqrt(T*T+Y*Y);r&&(d[y]=E),f[++y]=(v?k+u:u)*E/k}}}let m=this.computeWorldPositions(t,c,o),x=m[0],p=m[1],w=h.offsetRotation,g=!1;if(w==0)g=h.rotateMode==1;else{g=!1;let b=this.target.bone;w*=b.a*b.d-b.b*b.c>0?X.degRad:-X.degRad}for(let b=0,v=3;b<n;b++,v+=3){let y=l[b];y.worldX+=(x-y.worldX)*i,y.worldY+=(p-y.worldY)*a;let S=m[v],A=m[v+1],k=S-x,T=A-p;if(r){let Y=d[b];if(Y!=0){let E=(Math.sqrt(k*k+T*T)/Y-1)*s+1;y.a*=E,y.c*=E}}if(x=S,p=A,s>0){let Y=y.a,E=y.b,F=y.c,P=y.d,C=0,M=0,V=0;if(o?C=m[v-1]:f[b+1]==0?C=m[v+2]:C=Math.atan2(T,k),C-=Math.atan2(F,Y),g){M=Math.cos(C),V=Math.sin(C);let q=y.data.length;x+=(q*(M*Y-V*F)-k)*s,p+=(q*(V*Y+M*F)-T)*s}else C+=w;C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C*=s,M=Math.cos(C),V=Math.sin(C),y.a=M*Y-V*F,y.b=M*E-V*P,y.c=V*Y+M*F,y.d=V*E+M*P}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,a=this.position,h=this.spaces,o=R.setArraySize(this.positions,t*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,c=n/6,f=me.NONE;if(!e.constantSpeed){let q=e.lengths;c-=l?1:2;let L=q[c];this.data.positionMode==1&&(a*=L);let H;switch(this.data.spacingMode){case 2:H=L;break;case 3:H=L/t;break;default:H=1}r=R.setArraySize(this.world,8);for(let j=0,$=0,_=0;j<t;j++,$+=3){let D=h[j]*H;a+=D;let G=a;if(l)G%=L,G<0&&(G+=L),_=0;else if(G<0){f!=me.BEFORE&&(f=me.BEFORE,e.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(G,r,0,o,$);continue}else if(G>L){f!=me.AFTER&&(f=me.AFTER,e.computeWorldVertices(i,n-6,4,r,0,2)),this.addAfterPosition(G-L,r,0,o,$);continue}for(;;_++){let Z=q[_];if(!(G>Z)){if(_==0)G/=Z;else{let ce=q[_-1];G=(G-ce)/(Z-ce)}break}}_!=f&&(f=_,l&&_==c?(e.computeWorldVertices(i,n-4,4,r,0,2),e.computeWorldVertices(i,0,4,r,4,2)):e.computeWorldVertices(i,_*6+2,8,r,0,2)),this.addCurvePosition(G,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],o,$,s||j>0&&D==0)}return o}l?(n+=2,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n-4,r,0,2),e.computeWorldVertices(i,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(c--,n-=4,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n,r,0,2));let d=R.setArraySize(this.curves,c),u=0,m=r[0],x=r[1],p=0,w=0,g=0,b=0,v=0,y=0,S=0,A=0,k=0,T=0,Y=0,E=0,F=0,P=0;for(let q=0,L=2;q<c;q++,L+=6)p=r[L],w=r[L+1],g=r[L+2],b=r[L+3],v=r[L+4],y=r[L+5],S=(m-p*2+g)*.1875,A=(x-w*2+b)*.1875,k=((p-g)*3-m+v)*.09375,T=((w-b)*3-x+y)*.09375,Y=S*2+k,E=A*2+T,F=(p-m)*.75+S+k*.16666667,P=(w-x)*.75+A+T*.16666667,u+=Math.sqrt(F*F+P*P),F+=Y,P+=E,Y+=k,E+=T,u+=Math.sqrt(F*F+P*P),F+=Y,P+=E,u+=Math.sqrt(F*F+P*P),F+=Y+k,P+=E+T,u+=Math.sqrt(F*F+P*P),d[q]=u,m=v,x=y;this.data.positionMode==1&&(a*=u);let C;switch(this.data.spacingMode){case 2:C=u;break;case 3:C=u/t;break;default:C=1}let M=this.segments,V=0;for(let q=0,L=0,H=0,j=0;q<t;q++,L+=3){let $=h[q]*C;a+=$;let _=a;if(l)_%=u,_<0&&(_+=u),H=0;else if(_<0){this.addBeforePosition(_,r,0,o,L);continue}else if(_>u){this.addAfterPosition(_-u,r,n-4,o,L);continue}for(;;H++){let D=d[H];if(!(_>D)){if(H==0)_/=D;else{let G=d[H-1];_=(_-G)/(D-G)}break}}if(H!=f){f=H;let D=H*6;for(m=r[D],x=r[D+1],p=r[D+2],w=r[D+3],g=r[D+4],b=r[D+5],v=r[D+6],y=r[D+7],S=(m-p*2+g)*.03,A=(x-w*2+b)*.03,k=((p-g)*3-m+v)*.006,T=((w-b)*3-x+y)*.006,Y=S*2+k,E=A*2+T,F=(p-m)*.3+S+k*.16666667,P=(w-x)*.3+A+T*.16666667,V=Math.sqrt(F*F+P*P),M[0]=V,D=1;D<8;D++)F+=Y,P+=E,Y+=k,E+=T,V+=Math.sqrt(F*F+P*P),M[D]=V;F+=Y,P+=E,V+=Math.sqrt(F*F+P*P),M[8]=V,F+=Y+k,P+=E+T,V+=Math.sqrt(F*F+P*P),M[9]=V,j=0}for(_*=V;;j++){let D=M[j];if(!(_>D)){if(j==0)_/=D;else{let G=M[j-1];_=j+(_-G)/(D-G)}break}}this.addCurvePosition(_*.1,m,x,p,w,g,b,v,y,o,L,s||q>0&&$==0)}return o}addBeforePosition(e,t,s,i,a){let h=t[s],o=t[s+1],r=t[s+2]-h,l=t[s+3]-o,n=Math.atan2(l,r);i[a]=h+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addAfterPosition(e,t,s,i,a){let h=t[s+2],o=t[s+3],r=h-t[s],l=o-t[s+1],n=Math.atan2(l,r);i[a]=h+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addCurvePosition(e,t,s,i,a,h,o,r,l,n,c,f){if(e==0||isNaN(e)){n[c]=t,n[c+1]=s,n[c+2]=Math.atan2(a-s,i-t);return}let d=e*e,u=d*e,m=1-e,x=m*m,p=x*m,w=m*e,g=w*3,b=m*g,v=g*e,y=t*p+i*b+h*v+r*u,S=s*p+a*b+o*v+l*u;n[c]=y,n[c+1]=S,f&&(e<.001?n[c+2]=Math.atan2(a-s,i-t):n[c+2]=Math.atan2(S-(s*x+a*w*2+o*d),y-(t*x+i*w*2+h*d)))}},Ie=me;B(Ie,"NONE",-1),B(Ie,"BEFORE",-2),B(Ie,"AFTER",-3),B(Ie,"epsilon",1e-5);var $s=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,r=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:this.remaining+=Math.max(this.skeleton.time-this.lastTime,0),this.lastTime=this.skeleton.time;const l=o.worldX,n=o.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=n;else{let c=this.remaining,f=this.inertia,d=this.data.step;if(s||i){if(s&&(this.xOffset+=(this.ux-l)*f,this.ux=l),i&&(this.yOffset+=(this.uy-n)*f,this.uy=n),c>=d){const u=this.massInverse*d,m=this.strength,x=this.wind*100,p=this.gravity*-100,w=Math.pow(this.damping,60*d);do s&&(this.xVelocity+=(x-this.xOffset*m)*u,this.xOffset+=this.xVelocity*d,this.xVelocity*=w),i&&(this.yVelocity+=(p-this.yOffset*m)*u,this.yOffset+=this.yVelocity*d,this.yVelocity*=w),c-=d;while(c>=d)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a||h){let u=Math.atan2(o.c,o.a),m=0,x=0,p=0;if(a){p=(this.data.rotate+this.data.shearX)*t;let w=this.cx-o.worldX,g=this.cy-o.worldY,b=Math.atan2(g+this.ty,w+this.tx)-u-this.rotateOffset*p;this.rotateOffset+=(b-Math.ceil(b*X.invPI2-.5)*X.PI2)*f,b=this.rotateOffset*p+u,m=Math.cos(b),x=Math.sin(b),h&&(b=r*o.getWorldScaleX(),b>0&&(this.scaleOffset+=(w*m+g*x)*f/b))}else{m=Math.cos(u),x=Math.sin(u);const w=r*o.getWorldScaleX();w>0&&(this.scaleOffset+=((this.cx-o.worldX)*m+(this.cy-o.worldY)*x)*f/w)}if(c=this.remaining,c>=d){const w=this.massInverse*d,g=this.strength,b=this.wind,v=this.gravity,y=Math.pow(this.damping,60*d);for(;;)if(c-=d,h&&(this.scaleVelocity+=(b*m-v*x-this.scaleOffset*g)*w,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=y),a){if(this.rotateVelocity+=(-.01*r*(b*x+v*m)-this.rotateOffset*g)*w,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=y,c<d)break;const S=this.rotateOffset*p+u;m=Math.cos(S),x=Math.sin(S)}else if(c<d)break}}this.remaining=c}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a){let l=this.rotateOffset*t,n=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,n=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-n*o.d,o.d=n*f+c*o.d),d+=l*this.data.shearX,n=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-n*o.c,o.c=n*f+c*o.c}else l*=this.data.rotate,n=Math.sin(l),c=Math.cos(l),f=o.a,o.a=c*f-n*o.c,o.c=n*f+c*o.c,f=o.b,o.b=c*f-n*o.d,o.d=n*f+c*o.d}if(h){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=r*o.a,this.ty=r*o.c),o.updateAppliedTransform()}},ps=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 N,this.darkColor=e.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ne)||!(this.attachment instanceof ne)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Pe;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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,c=r.c,f=r.d,d=l*f-n*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(c,l)-Math.atan2(y,b)+u;A>X.PI?A-=X.PI2:A<-X.PI&&(A+=X.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*t,g.worldY+=(b.y-g.worldY)*s}if(i!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(l*l+c*c)-b+this.data.offsetScaleX)*i)/b),g.a*=b,g.c*=b}if(a!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(n*n+f*f)-b+this.data.offsetScaleY)*a)/b),g.b*=b,g.d*=b}if(h>0){let b=g.b,v=g.d,y=Math.atan2(v,b),S=Math.atan2(f,n)-Math.atan2(c,l)-(y-Math.atan2(g.c,g.a));S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S=y+(S+m)*h;let A=Math.sqrt(b*b+v*v);g.b=Math.cos(S)*A,g.d=Math.sin(S)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,c=r.c,f=r.d,d=l*f-n*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(c,l)+u;A>X.PI?A-=X.PI2:A<-X.PI&&(A+=X.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*t,g.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=b,g.c*=b}if(a!=0){let b=(Math.sqrt(n*n+f*f)-1+this.data.offsetScaleY)*a+1;g.b*=b,g.d*=b}if(h>0){let b=Math.atan2(f,n)-Math.atan2(c,l);b>X.PI?b-=X.PI2:b<-X.PI&&(b+=X.PI2);let v=g.b,y=g.d;b=Math.atan2(y,v)+(b-X.PI/2+m)*h;let S=Math.sqrt(v*v+y*y);g.b=Math.cos(b)*S,g.d=Math.sin(b)*S}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let c=r[l],f=c.arotation;if(e!=0){let w=o.arotation-f+this.data.offsetRotation;w-=Math.ceil(w/360-.5)*360,f+=w*e}let d=c.ax,u=c.ay;d+=(o.ax-d+this.data.offsetX)*t,u+=(o.ay-u+this.data.offsetY)*s;let m=c.ascaleX,x=c.ascaleY;i!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*i)/m),a!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*a)/x);let p=c.ashearY;if(h!=0){let w=o.ashearY-p+this.data.offsetShearY;w-=Math.ceil(w/360-.5)*360,p+=w*h}c.updateWorldTransformWith(d,u,f,m,x,c.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let c=r[l],f=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,u=c.ay+(o.ay+this.data.offsetY)*s,m=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),x=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*a+1),p=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,u,f,m,x,c.ashearX,p)}}},vs=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return vs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Yt(s,this,null);else{let a=this.bones[s.parent.index];i=new Yt(s,this,a),a.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],a=new ps(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new ws(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new ys(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ie(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new $s(s,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,d=t.length;f<d;f++){let u=t[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,u=this.skin.bones.length;d<u;d++){let m=this.bones[f[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,a=this.pathConstraints,h=this.physicsConstraints,o=s.length,r=i.length,l=a.length,n=this.physicsConstraints.length,c=o+r+l+n;e:for(let f=0;f<c;f++){for(let d=0;d<o;d++){let u=s[d];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let d=0;d<r;d++){let u=i[d];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let d=0;d<l;d++){let u=a[d];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let d=0;d<n;d++){const u=h[d];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let a=s[s.length-1];this.sortBone(a),this._updateCache.push(e),this.sortReset(i.children),a.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let a=t.getAttachment();a instanceof Ae&&this.sortPathConstraintAttachmentWith(a,i);let h=e.bones,o=h.length;for(let r=0;r<o;r++)this.sortBone(h[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(h[r].children);for(let r=0;r<o;r++)h[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let a=t[i];this.sortBone(a.parent),this.sortBone(a)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let a in i)this.sortPathConstraintAttachmentWith(i[a],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ae))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let a=0,h=s.length;a<h;){let o=s[a++];for(o+=a;a<o;)this.sortBone(i[s[a++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(!e)throw new Error("physics is undefined");let t=this.bones;for(let i=0,a=t.length;i<a;i++){let h=t[i];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let s=this._updateCache;for(let i=0,a=s.length;i<a;i++)s[i].update(e)}updateWorldTransformWith(e,t){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=t.a,a=t.b,h=t.c,o=t.d;s.worldX=i*this.x+a*this.y+t.worldX,s.worldY=h*this.x+o*this.y+t.worldY;const r=(s.rotation+s.shearX)*X.degRad,l=(s.rotation+90+s.shearY)*X.degRad,n=Math.cos(r)*s.scaleX,c=Math.cos(l)*s.scaleY,f=Math.sin(r)*s.scaleX,d=Math.sin(l)*s.scaleY;s.a=(i*n+a*f)*this.scaleX,s.b=(i*c+a*d)*this.scaleX,s.c=(h*n+o*f)*this.scaleY,s.d=(h*c+o*d)*this.scaleY;let u=this._updateCache;for(let m=0,x=u.length;m<x;m++){let p=u[m];p!=s&&p.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s],h=a.data.attachmentName;if(h){let o=e.getAttachment(s,h);o&&a.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let h=s[i];if(h.data.name==e){let o=null;if(t&&(o=this.getAttachment(i,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);h.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(){let e=new Pe,t=new Pe;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,s=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let i=this.drawOrder,a=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l=0,n=i.length;l<n;l++){let c=i[l];if(!c.bone.active)continue;let f=0,d=null,u=c.getAttachment();if(u instanceof W)f=8,d=R.setArraySize(s,f,0),u.computeWorldVertices(c,d,0,2);else if(u instanceof Se){let m=u;f=m.worldVerticesLength,d=R.setArraySize(s,f,0),m.computeWorldVertices(c,0,f,d,0,2)}if(d)for(let m=0,x=d.length;m<x;m+=2){let p=d[m],w=d[m+1];a=Math.min(a,p),h=Math.min(h,w),o=Math.max(o,p),r=Math.max(r,w)}}e.set(a,h),t.set(o-a,r-h)}update(e){this.time+=e}},Ss=vs;B(Ss,"yDown",!1);var As=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(As||{}),js=class extends Fe{_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;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;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}},Pt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Ge=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){h=!0;break}h||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){h=!0;break}h||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){h=!0;break}h||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){h=!0;break}h||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof Se?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new Pt(t,i,a))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new Pt(e,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let a=e.slots[i],h=a.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let r in o){let l=o[r];if(h==l){let n=this.getAttachment(s,r);n&&a.setAttachment(n);break}}}s++}}},Bt=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=$e.Normal;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},$e=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))($e||{}),Vt=class extends Fe{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},Js=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Rt;s.name="";let i=new Is(e),a=i.readInt32(),h=i.readInt32();s.hash=h==0&&a==0?null:h.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let f=n==0?null:s.bones[i.readInt(!0)],d=new Tt(n,c,f);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.transformMode=i.readInt(!0),d.skinRequired=i.readBoolean(),o&&(N.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new Bt(n,c,f);N.rgba8888ToColor(d.color,i.readInt32());let u=i.readInt32();u!=-1&&N.rgb888ToColor(d.darkColor=new N,u),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Ft(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)],d.mix=i.readFloat(),d.softness=i.readFloat()*t;let u=i.readByte();d.skinRequired=(u&1)!=0,d.bendDirection=u&2?1:-1,d.compress=(u&4)!=0,d.stretch=(u&8)!=0,d.uniform=(u&16)!=0,s.ikConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Vt(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];const u=i.readByte();d.skinRequired=(u&1)!=0,d.local=(u&2)!=0,d.relative=(u&4)!=0,d.offsetRotation=i.readFloat(),d.offsetX=i.readFloat()*t,d.offsetY=i.readFloat()*t,d.offsetScaleX=i.readFloat(),d.offsetScaleY=i.readFloat(),d.offsetShearY=i.readFloat(),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),d.mixScaleX=i.readFloat(),d.mixScaleY=i.readFloat(),d.mixShearY=i.readFloat(),s.transformConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Et(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)],d.positionMode=i.readInt(!0),d.spacingMode=i.readInt(!0),d.rotateMode=i.readInt(!0),d.offsetRotation=i.readFloat(),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new js(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let u=i.readByte();d.skinRequired=(u&1)!=0,u&2&&(d.x=i.readFloat()),u&4&&(d.y=i.readFloat()),u&8&&(d.rotate=i.readFloat()),u&16&&(d.scaleX=i.readFloat()),u&32&&(d.shearX=i.readFloat()),d.step=1/i.readByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=i.readFloat(),d.wind=i.readFloat(),d.gravity=i.readFloat(),d.mix=i.readFloat(),u=i.readByte(),u&1&&(d.inertiaGlobal=!0),u&2&&(d.strengthGlobal=!0),u&4&&(d.dampingGlobal=!0),u&8&&(d.massGlobal=!0),u&16&&(d.windGlobal=!0),u&32&&(d.gravityGlobal=!0),u&64&&(d.mixGlobal=!0),s.physicsConstraints.push(d)}let l=this.readSkin(i,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let n=s.skins.length;for(R.setArraySize(s.skins,r=n+i.readInt(!0));n<r;n++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[n]=c}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let c=this.linkedMeshes[n];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let f=new Xt(c);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let a=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;a=new Ge("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");a=new Ge(o),i&&N.rgba8888ToColor(a.color,e.readInt32()),a.bones.length=e.readInt(!0);for(let r=0,l=a.bones.length;r<l;r++)a.bones[r]=t.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,a,r,c,i);f&&a.setAttachment(r,c,f)}}return a}readAttachment(e,t,s,i,a,h){let o=this.scale,r=e.readByte();const l=r&8?e.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(r&7){case ge.Region:{let n=r&16?e.readStringRef():null;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null;let d=e.readFloat(),u=e.readFloat(),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat();n||(n=l);let b=this.attachmentLoader.newRegionAttachment(s,l,n,f);return b?(b.path=n,b.x=u*o,b.y=m*o,b.scaleX=x,b.scaleY=p,b.rotation=d,b.width=w*o,b.height=g*o,N.rgba8888ToColor(b.color,c),b.sequence=f,f==null&&b.updateRegion(),b):null}case ge.BoundingBox:{let n=this.readVertices(e,(r&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,l);return f?(f.worldVerticesLength=n.length,f.vertices=n.vertices,f.bones=n.bones,h&&N.rgba8888ToColor(f.color,c),f):null}case ge.Mesh:{let n=r&16?e.readStringRef():l;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=e.readInt(!0),u=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,u.length,1),x=this.readShortArray(e,(u.length-d-2)*3);let p=[],w=0,g=0;h&&(p=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),n||(n=l);let b=this.attachmentLoader.newMeshAttachment(s,l,n,f);return b?(b.path=n,N.rgba8888ToColor(b.color,c),b.bones=u.bones,b.vertices=u.vertices,b.worldVerticesLength=u.length,b.triangles=x,b.regionUVs=m,f==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=f,h&&(b.edges=p,b.width=w*o,b.height=g*o),b):null}case ge.LinkedMesh:{const n=r&16?e.readStringRef():l;if(n==null)throw new Error("Path of linked mesh must not be null");const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=(r&128)!=0,u=e.readInt(!0),m=e.readStringRef();let x=0,p=0;h&&(x=e.readFloat(),p=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,l,n,f);return w?(w.path=n,N.rgba8888ToColor(w.color,c),w.sequence=f,h&&(w.width=x*o,w.height=p*o),this.linkedMeshes.push(new Ks(w,u,i,m,d)),w):null}case ge.Path:{const n=(r&16)!=0,c=(r&32)!=0,f=this.readVertices(e,(r&64)!=0),d=R.newArray(f.length/6,0);for(let x=0,p=d.length;x<p;x++)d[x]=e.readFloat()*o;const u=h?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=n,m.constantSpeed=c,m.worldVerticesLength=f.length,m.vertices=f.vertices,m.bones=f.bones,m.lengths=d,h&&N.rgba8888ToColor(m.color,u),m):null}case ge.Point:{const n=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,l);return u?(u.x=c*o,u.y=f*o,u.rotation=n,h&&N.rgba8888ToColor(u.color,d),u):null}case ge.Clipping:{const n=e.readInt(!0),c=this.readVertices(e,(r&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[n],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&N.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new Ze(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),a=new Qs;if(a.length=i<<1,!t)return a.vertices=this.readFloatArray(e,a.length,s),a;let h=new Array,o=new Array;for(let r=0;r<i;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return a.vertices=R.toFloatArray(h),a.bones=o,a}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let a=0;a<t;a++)i[a]=e.readFloat();else for(let a=0;a<t;a++)i[a]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,a=this.scale;for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),x=m-1;switch(u){case hr:{let p=new we(m,c);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readStringRef());i.push(p);break}case cr:{let p=e.readInt(!0),w=new ht(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,b,v,y,S),A!=x;A++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(A);break;case he:U(e,w,k++,A,0,g,T,b,Y,1),U(e,w,k++,A,1,g,T,v,E,1),U(e,w,k++,A,2,g,T,y,F,1),U(e,w,k++,A,3,g,T,S,P,1)}g=T,b=Y,v=E,y=F,S=P}i.push(w);break}case dr:{let p=e.readInt(!0),w=new ct(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,A=0;w.setFrame(S,g,b,v,y),S!=x;S++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(S);break;case he:U(e,w,A++,S,0,g,k,b,T,1),U(e,w,A++,S,1,g,k,v,Y,1),U(e,w,A++,S,2,g,k,y,E,1)}g=k,b=T,v=Y,y=E}i.push(w);break}case fr:{let p=e.readInt(!0),w=new ft(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,E=0;w.setFrame(Y,g,b,v,y,S,A,k,T),Y!=x;Y++){let F=e.readFloat(),P=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,H=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(Y);break;case he:U(e,w,E++,Y,0,g,F,b,P,1),U(e,w,E++,Y,1,g,F,v,C,1),U(e,w,E++,Y,2,g,F,y,M,1),U(e,w,E++,Y,3,g,F,S,V,1),U(e,w,E++,Y,4,g,F,A,q,1),U(e,w,E++,Y,5,g,F,k,L,1),U(e,w,E++,Y,6,g,F,T,H,1)}g=F,b=P,v=C,y=M,S=V,A=q,k=L,T=H}i.push(w);break}case ur:{let p=e.readInt(!0),w=new ut(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,b,v,y,S,A,k),T!=x;T++){let E=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(T);break;case he:U(e,w,Y++,T,0,g,E,b,F,1),U(e,w,Y++,T,1,g,E,v,P,1),U(e,w,Y++,T,2,g,E,y,C,1),U(e,w,Y++,T,3,g,E,S,M,1),U(e,w,Y++,T,4,g,E,A,V,1),U(e,w,Y++,T,5,g,E,k,q,1)}g=E,b=F,v=P,y=C,S=M,A=V,k=q}i.push(w);break}case mr:{let p=new dt(m,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,v=0;p.setFrame(b,w,g),b!=x;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(b);break;case he:U(e,p,v++,b,0,w,y,g,S,1)}w=y,g=S}i.push(p)}}}}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),x=e.readInt(!0);switch(u){case Zs:i.push(Q(e,new Me(m,x,c),1));break;case er:i.push(Lt(e,new et(m,x,c),a));break;case tr:i.push(Q(e,new tt(m,x,c),a));break;case sr:i.push(Q(e,new st(m,x,c),a));break;case rr:i.push(Lt(e,new rt(m,x,c),1));break;case ir:i.push(Q(e,new it(m,x,c),1));break;case ar:i.push(Q(e,new at(m,x,c),1));break;case nr:i.push(Lt(e,new nt(m,x,c),1));break;case lr:i.push(Q(e,new lt(m,x,c),1));break;case or:i.push(Q(e,new ot(m,x,c),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new gt(f,e.readInt(!0),c),m=e.readFloat(),x=e.readFloat(),p=e.readFloat()*a;for(let w=0,g=0;;w++){const b=e.readByte();if(u.setFrame(w,m,x,p,e.readByte(),(b&1)!=0,(b&2)!=0),w==d)break;let v=e.readFloat(),y=e.readFloat(),S=e.readFloat()*a;switch(e.readByte()){case oe:u.setStepped(w);break;case he:U(e,u,g++,w,0,m,v,x,y,1),U(e,u,g++,w,1,m,v,p,S,a)}m=v,x=y,p=S}i.push(u)}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new xt(f,e.readInt(!0),c),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;u.setFrame(y,m,x,p,w,g,b,v),y!=d;y++){let A=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),E=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case oe:u.setStepped(y);break;case he:U(e,u,S++,y,0,m,A,x,k,1),U(e,u,S++,y,1,m,A,p,T,1),U(e,u,S++,y,2,m,A,w,Y,1),U(e,u,S++,y,3,m,A,g,E,1),U(e,u,S++,y,4,m,A,b,F,1),U(e,u,S++,y,5,m,A,v,P,1)}m=A,x=k,p=T,w=Y,g=E,b=F,v=P}i.push(u)}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0),f=s.pathConstraints[c];for(let d=0,u=e.readInt(!0);d<u;d++){const m=e.readByte(),x=e.readInt(!0),p=e.readInt(!0);switch(m){case br:i.push(Q(e,new bt(x,p,c),f.positionMode==0?a:1));break;case wr:i.push(Q(e,new wt(x,p,c),f.spacingMode==0||f.spacingMode==1?a:1));break;case pr:let w=new pt(x,p,c),g=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,A=0,k=w.getFrameCount()-1;w.setFrame(S,g,b,v,y),S!=k;S++){let T=e.readFloat(),Y=e.readFloat(),E=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:w.setStepped(S);break;case he:U(e,w,A++,S,0,g,T,b,Y,1),U(e,w,A++,S,1,g,T,v,E,1),U(e,w,A++,S,2,g,T,y,F,1)}g=T,b=Y,v=E,y=F}i.push(w)}}}for(let l=0,n=e.readInt(!0);l<n;l++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const u=e.readByte(),m=e.readInt(!0);if(u==Tr){const p=new yt(m,c);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat());i.push(p);continue}const x=e.readInt(!0);switch(u){case yr:i.push(Q(e,new Qt(m,x,c),1));break;case vr:i.push(Q(e,new Zt(m,x,c),1));break;case Sr:i.push(Q(e,new es(m,x,c),1));break;case Ar:i.push(Q(e,new ts(m,x,c),1));break;case Ir:i.push(Q(e,new ss(m,x,c),1));break;case Cr:i.push(Q(e,new rs(m,x,c),1));break;case kr:i.push(Q(e,new is(m,x,c),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let c=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readInt(!0);for(let m=0,x=e.readInt(!0);m<x;m++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let w=c.getAttachment(u,p),g=e.readByte(),b=e.readInt(!0),v=b-1;switch(g){case gr:{let y=w,S=y.bones,A=y.vertices,k=S?A.length/3*2:A.length,T=e.readInt(!0),Y=new mt(b,T,u,y),E=e.readFloat();for(let F=0,P=0;;F++){let C,M=e.readInt(!0);if(M==0)C=S?R.newFloatArray(k):A;else{C=R.newFloatArray(k);let q=e.readInt(!0);if(M+=q,a==1)for(let L=q;L<M;L++)C[L]=e.readFloat();else for(let L=q;L<M;L++)C[L]=e.readFloat()*a;if(!S)for(let L=0,H=C.length;L<H;L++)C[L]+=A[L]}if(Y.setFrame(F,E,C),F==v)break;let V=e.readFloat();switch(e.readByte()){case oe:Y.setStepped(F);break;case he:U(e,Y,P++,F,0,E,V,0,1,1)}E=V}i.push(Y);break}case xr:{let y=new ve(b,u,w);for(let S=0;S<b;S++){let A=e.readFloat(),k=e.readInt32();y.setFrame(S,A,Gt[k&15],k>>4,e.readFloat())}i.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let l=new pe(h),n=s.slots.length;for(let c=0;c<h;c++){let f=e.readFloat(),d=e.readInt(!0),u=R.newArray(n,0);for(let w=n-1;w>=0;w--)u[w]=-1;let m=R.newArray(n-d,0),x=0,p=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;x!=g;)m[p++]=x++;u[x+e.readInt(!0)]=x++}for(;x<n;)m[p++]=x++;for(let w=n-1;w>=0;w--)u[w]==-1&&(u[w]=m[--p]);l.setFrame(c,f,u)}i.push(l)}let o=e.readInt(!0);if(o>0){let l=new Xe(o);for(let n=0;n<o;n++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new Mt(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(n,d)}i.push(l)}let r=0;for(let l=0,n=i.length;l<n;l++)r=Math.max(r,i[l].getDuration());return new Ve(t,i,r)}},Is=class{constructor(e,t=new Array,s=0,i=new DataView(e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let a=this.readUnsignedByte();switch(a>>4){case 12:case 13:t+=String.fromCharCode((a&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((a&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(a),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ks=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}},Qs=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}},ge=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(ge||{});function Q(e,t,s){let i=e.readFloat(),a=e.readFloat()*s;for(let h=0,o=0,r=t.getFrameCount()-1;t.setFrame(h,i,a),h!=r;h++){let l=e.readFloat(),n=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(h);break;case he:U(e,t,o++,h,0,i,l,a,n,s)}i=l,a=n}return t}function Lt(e,t,s){let i=e.readFloat(),a=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,r=0,l=t.getFrameCount()-1;t.setFrame(o,i,a,h),o!=l;o++){let n=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(o);break;case he:U(e,t,r++,o,0,i,n,a,c,s),U(e,t,r++,o,1,i,n,h,f,s)}i=n,a=c,h=f}return t}function U(e,t,s,i,a,h,o,r,l,n){t.setBezier(s,i,a,h,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var Zs=0,er=1,tr=2,sr=3,rr=4,ir=5,ar=6,nr=7,lr=8,or=9,hr=0,cr=1,dr=2,fr=3,ur=4,mr=5,gr=0,xr=1,br=0,wr=1,pr=2,yr=0,vr=1,Sr=2,Ar=4,Ir=5,Cr=6,kr=7,Tr=8,oe=1,he=2,Yr=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ye(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,h=e.slots,o=h.length;s.length=0,a.freeAll(i),i.length=0;for(let r=0;r<o;r++){let l=h[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof _e){let c=n;s.push(c);let f=a.obtain();f.length!=c.worldVerticesLength&&(f=R.newFloatArray(c.worldVerticesLength)),i.push(f),c.computeWorldVertices(l,0,c.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let h=0,o=a.length;h<o;h++){let r=a[h],l=r;for(let n=0,c=r.length;n<c;n+=2){let f=l[n],d=l[n+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let a=this.minX,h=this.minY,o=this.maxX,r=this.maxY;if(e<=a&&s<=a||t<=h&&i<=h||e>=o&&s>=o||t>=r&&i>=r)return!1;let l=(i-t)/(s-e),n=l*(a-e)+t;if(n>h&&n<r||(n=l*(o-e)+t,n>h&&n<r))return!0;let c=(h-t)/l+e;return c>a&&c<o||(c=(r-t)/l+e,c>a&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,a=e.length,h=a-2,o=!1;for(let r=0;r<a;r+=2){let l=i[r+1],n=i[h+1];if(l<s&&n>=s||n<s&&l>=s){let c=i[r];c+(s-l)/(n-l)*(i[h]-c)<t&&(o=!o)}h=r}return o}intersectsSegment(e,t,s,i){let a=this.polygons;for(let h=0,o=a.length;h<o;h++)if(this.intersectsSegmentPolygon(a[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,a){let h=e,o=e.length,r=t-i,l=s-a,n=t*a-s*i,c=h[o-2],f=h[o-1];for(let d=0;d<o;d+=2){let u=h[d],m=h[d+1],x=c*m-f*u,p=c-u,w=f-m,g=r*w-l*p,b=(n*p-r*x)/g;if((b>=c&&b<=u||b>=u&&b<=c)&&(b>=t&&b<=i||b>=i&&b<=t)){let v=(n*w-l*x)/g;if((v>=f&&v<=m||v>=m&&v<=f)&&(v>=s&&v<=a||v>=a&&v<=s))return!0}c=u,f=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},te=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ye(()=>new Array);polygonIndicesPool=new Ye(()=>new Array);triangulate(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let o=0;o<s;o++)i[o]=o;let a=this.isConcaveArray;a.length=0;for(let o=0,r=s;o<r;++o)a[o]=te.isConcave(o,s,t,i);let h=this.triangles;for(h.length=0;s>3;){let o=s-1,r=0,l=1;for(;;){e:if(!a[r]){let f=i[o]<<1,d=i[r]<<1,u=i[l]<<1,m=t[f],x=t[f+1],p=t[d],w=t[d+1],g=t[u],b=t[u+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!a[v])continue;let y=i[v]<<1,S=t[y],A=t[y+1];if(te.positiveArea(g,b,m,x,S,A)&&te.positiveArea(m,x,p,w,S,A)&&te.positiveArea(p,w,g,b,S,A))break e}break}if(l==0){do{if(!a[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%s}h.push(i[(s+r-1)%s]),h.push(i[r]),h.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let n=(s+r-1)%s,c=r==s?0:r;a[n]=te.isConcave(n,s,t,i),a[c]=te.isConcave(c,s,t,i)}return s==3&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,c=t.length;n<c;n+=3){let f=t[n]<<1,d=t[n+1]<<1,u=t[n+2]<<1,m=s[f],x=s[f+1],p=s[d],w=s[d+1],g=s[u],b=s[u+1],v=!1;if(r==f){let y=o.length-4,S=te.winding(o[y],o[y+1],o[y+2],o[y+3],g,b),A=te.winding(g,b,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(g),o.push(b),h.push(u),v=!0)}v||(o.length>0?(i.push(o),a.push(h)):(this.polygonPool.free(o),this.polygonIndicesPool.free(h)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(x),o.push(p),o.push(w),o.push(g),o.push(b),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(f),h.push(d),h.push(u),l=te.winding(m,x,p,w,g,b),r=f)}o.length>0&&(i.push(o),a.push(h));for(let n=0,c=i.length;n<c;n++){if(h=a[n],h.length==0)continue;let f=h[0],d=h[h.length-1];o=i[n];let u=o.length-4,m=o[u],x=o[u+1],p=o[u+2],w=o[u+3],g=o[0],b=o[1],v=o[2],y=o[3],S=te.winding(m,x,p,w,g,b);for(let A=0;A<c;A++){if(A==n)continue;let k=a[A];if(k.length!=3)continue;let T=k[0],Y=k[1],E=k[2],F=i[A],P=F[F.length-2],C=F[F.length-1];if(T!=f||Y!=d)continue;let M=te.winding(m,x,p,w,P,C),V=te.winding(P,C,g,b,v,y);M==S&&V==S&&(F.length=0,k.length=0,o.push(P),o.push(C),h.push(E),m=p,x=w,p=P,w=C,A=0)}}for(let n=i.length-1;n>=0;n--)o=i[n],o.length==0&&(i.splice(n,1),this.polygonPool.free(o),h=a[n],a.splice(n,1),this.polygonIndicesPool.free(h));return i}static isConcave(e,t,s,i){let a=i[(t+e-1)%t]<<1,h=i[e]<<1,o=i[(e+1)%t]<<1;return!this.positiveArea(s[a],s[a+1],s[h],s[h+1],s[o],s[o+1])}static positiveArea(e,t,s,i,a,h){return e*(h-i)+s*(t-h)+a*(i-t)>=0}static winding(e,t,s,i,a,h){let o=s-e,r=i-t;return a*r-h*o+o*t-e*r>=0?1:-1}},Dt=class{triangulator=new te;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let a=this.clippingPolygon;Dt.makeClockwise(a);let h=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let o=0,r=h.length;o<r;o++){let l=h[o];Dt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return h.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,a,h,o,r){let l=this.clipOutput,n=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,u=r?12:8,m=0;n.length=0,c.length=0;e:for(let x=0;x<i;x+=3){let p=s[x]<<1,w=e[p],g=e[p+1],b=a[p],v=a[p+1];p=s[x+1]<<1;let y=e[p],S=e[p+1],A=a[p],k=a[p+1];p=s[x+2]<<1;let T=e[p],Y=e[p+1],E=a[p],F=a[p+1];for(let P=0;P<d;P++){let C=n.length;if(this.clip(w,g,y,S,T,Y,f[P],l)){let M=l.length;if(M==0)continue;let V=S-Y,q=T-y,L=w-T,H=Y-g,j=1/(V*L+q*(g-Y)),$=M>>1,_=this.clipOutput,D=R.setArraySize(n,C+$*u);for(let Z=0;Z<M;Z+=2){let ce=_[Z],K=_[Z+1];D[C]=ce,D[C+1]=K,D[C+2]=h.r,D[C+3]=h.g,D[C+4]=h.b,D[C+5]=h.a;let re=ce-T,ie=K-Y,xe=(V*re+q*ie)*j,Ce=(H*re+L*ie)*j,Ee=1-xe-Ce;D[C+6]=b*xe+A*Ce+E*Ee,D[C+7]=v*xe+k*Ce+F*Ee,r&&(D[C+8]=o.r,D[C+9]=o.g,D[C+10]=o.b,D[C+11]=o.a),C+=u}C=c.length;let G=R.setArraySize(c,C+3*($-2));$--;for(let Z=1;Z<$;Z++)G[C]=m,G[C+1]=m+Z,G[C+2]=m+Z+1,C+=3;m+=$+1}else{let M=R.setArraySize(n,C+3*u);M[C]=w,M[C+1]=g,M[C+2]=h.r,M[C+3]=h.g,M[C+4]=h.b,M[C+5]=h.a,r?(M[C+6]=b,M[C+7]=v,M[C+8]=o.r,M[C+9]=o.g,M[C+10]=o.b,M[C+11]=o.a,M[C+12]=y,M[C+13]=S,M[C+14]=h.r,M[C+15]=h.g,M[C+16]=h.b,M[C+17]=h.a,M[C+18]=A,M[C+19]=k,M[C+20]=o.r,M[C+21]=o.g,M[C+22]=o.b,M[C+23]=o.a,M[C+24]=T,M[C+25]=Y,M[C+26]=h.r,M[C+27]=h.g,M[C+28]=h.b,M[C+29]=h.a,M[C+30]=E,M[C+31]=F,M[C+32]=o.r,M[C+33]=o.g,M[C+34]=o.b,M[C+35]=o.a):(M[C+6]=b,M[C+7]=v,M[C+8]=y,M[C+9]=S,M[C+10]=h.r,M[C+11]=h.g,M[C+12]=h.b,M[C+13]=h.a,M[C+14]=A,M[C+15]=k,M[C+16]=T,M[C+17]=Y,M[C+18]=h.r,M[C+19]=h.g,M[C+20]=h.b,M[C+21]=h.a,M[C+22]=E,M[C+23]=F),C=c.length;let V=R.setArraySize(c,C+3);V[C]=m,V[C+1]=m+1,V[C+2]=m+2,m+=3;continue e}}}}clip(e,t,s,i,a,h,o,r){let l=r,n=!1,c;o.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(e),c.push(t),c.push(s),c.push(i),c.push(a),c.push(h),c.push(e),c.push(t),r.length=0;let f=o,d=o.length-4;for(let u=0;;u+=2){let m=f[u],x=f[u+1],p=f[u+2],w=f[u+3],g=m-p,b=x-w,v=c,y=c.length-2,S=r.length;for(let k=0;k<y;k+=2){let T=v[k],Y=v[k+1],E=v[k+2],F=v[k+3],P=g*(F-w)-b*(E-p)>0;if(g*(Y-w)-b*(T-p)>0){if(P){r.push(E),r.push(F);continue}let C=F-Y,M=E-T,V=C*(p-m)-M*(w-x);if(Math.abs(V)>1e-6){let q=(M*(x-Y)-C*(m-T))/V;r.push(m+(p-m)*q),r.push(x+(w-x)*q)}else r.push(m),r.push(x)}else if(P){let C=F-Y,M=E-T,V=C*(p-m)-M*(w-x);if(Math.abs(V)>1e-6){let q=(M*(x-Y)-C*(m-T))/V;r.push(m+(p-m)*q),r.push(x+(w-x)*q)}else r.push(m),r.push(x);r.push(E),r.push(F)}n=!0}if(S==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==d)break;let A=r;r=c,r.length=0,c=A}if(l!=r){l.length=0;for(let u=0,m=r.length-2;u<m;u++)l[u]=r[u]}else l.length=l.length-2;return n}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],a=0,h=0,o=0,r=0;for(let l=0,n=s-3;l<n;l+=2)a=t[l],h=t[l+1],o=t[l+2],r=t[l+3],i+=a*r-o*h;if(!(i<0))for(let l=0,n=s-2,c=s>>1;l<c;l+=2){let f=t[l],d=t[l+1],u=n-l;t[l]=t[u],t[l+1]=t[u+1],t[u]=f,t[u+1]=d}}},Mr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Rt,i=typeof e=="string"?JSON.parse(e):e,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.fps=a.fps,s.imagesPath=a.images),i.bones)for(let h=0;h<i.bones.length;h++){let o=i.bones[h],r=null,l=I(o,"parent",null);l&&(r=s.findBone(l));let n=new Tt(s.bones.length,o.name,r);n.length=I(o,"length",0)*t,n.x=I(o,"x",0)*t,n.y=I(o,"y",0)*t,n.rotation=I(o,"rotation",0),n.scaleX=I(o,"scaleX",1),n.scaleY=I(o,"scaleY",1),n.shearX=I(o,"shearX",0),n.shearY=I(o,"shearY",0),n.transformMode=R.enumValue(Ue,I(o,"transform","Normal")),n.skinRequired=I(o,"skin",!1);let c=I(o,"color",null);c&&n.color.setFromString(c),s.bones.push(n)}if(i.slots)for(let h=0;h<i.slots.length;h++){let o=i.slots[h],r=s.findBone(o.bone);if(!r)throw new Error(`Couldn't find bone ${o.bone} for slot ${o.name}`);let l=new Bt(s.slots.length,o.name,r),n=I(o,"color",null);n&&l.color.setFromString(n);let c=I(o,"dark",null);c&&(l.darkColor=N.fromString(c)),l.attachmentName=I(o,"attachment",null),l.blendMode=R.enumValue($e,I(o,"blend","normal")),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let o=i.ik[h],r=new Ft(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let c=s.findBone(o.bones[n]);if(!c)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(c)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);r.target=l,r.mix=I(o,"mix",1),r.softness=I(o,"softness",0)*t,r.bendDirection=I(o,"bendPositive",!0)?1:-1,r.compress=I(o,"compress",!1),r.stretch=I(o,"stretch",!1),r.uniform=I(o,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let h=0;h<i.transform.length;h++){let o=i.transform[h],r=new Vt(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=I(o,"local",!1),r.relative=I(o,"relative",!1),r.offsetRotation=I(o,"rotation",0),r.offsetX=I(o,"x",0)*t,r.offsetY=I(o,"y",0)*t,r.offsetScaleX=I(o,"scaleX",0),r.offsetScaleY=I(o,"scaleY",0),r.offsetShearY=I(o,"shearY",0),r.mixRotate=I(o,"mixRotate",1),r.mixX=I(o,"mixX",1),r.mixY=I(o,"mixY",r.mixX),r.mixScaleX=I(o,"mixScaleX",1),r.mixScaleY=I(o,"mixScaleY",r.mixScaleX),r.mixShearY=I(o,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let h=0;h<i.path.length;h++){let o=i.path[h],r=new Et(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=R.enumValue(We,I(o,"positionMode","Percent")),r.spacingMode=R.enumValue(ze,I(o,"spacingMode","Length")),r.rotateMode=R.enumValue(He,I(o,"rotateMode","Tangent")),r.offsetRotation=I(o,"rotation",0),r.position=I(o,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=I(o,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=I(o,"mixRotate",1),r.mixX=I(o,"mixX",1),r.mixY=I(o,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.skins)for(let h=0;h<i.skins.length;h++){let o=i.skins[h],r=new Ge(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],c=s.findBone(n);if(!c)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(c)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],c=s.findIkConstraint(n);if(!c)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(c)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],c=s.findTransformConstraint(n);if(!c)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(c)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],c=s.findPathConstraint(n);if(!c)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(c)}for(let l in o.attachments){let n=s.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let c=o.attachments[l];for(let f in c){let d=this.readAttachment(c[f],r,n.index,f,s);d&&r.setAttachment(n.index,f,d)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let r=this.linkedMeshes[h],l=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${r.skin}`);let n=l.getAttachment(r.slotIndex,r.parent);if(!n)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let o=i.events[h],r=new Xt(h);r.intValue=I(o,"int",0),r.floatValue=I(o,"float",0),r.stringValue=I(o,"string",""),r.audioPath=I(o,"audio",null),r.audioPath&&(r.volume=I(o,"volume",1),r.balance=I(o,"balance",0)),s.events.push(r)}if(i.animations)for(let h in i.animations){let o=i.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,i,a){let h=this.scale;switch(i=I(e,"name",i),I(e,"type","region")){case"region":{let o=I(e,"path",i),r=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,i,o,r);if(!l)return null;l.path=o,l.x=I(e,"x",0)*h,l.y=I(e,"y",0)*h,l.scaleX=I(e,"scaleX",1),l.scaleY=I(e,"scaleY",1),l.rotation=I(e,"rotation",0),l.width=e.width*h,l.height=e.height*h,l.sequence=r;let n=I(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=I(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=I(e,"path",i),r=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,i,o,r);if(!l)return null;l.path=o;let n=I(e,"color",null);n&&l.color.setFromString(n),l.width=I(e,"width",0)*h,l.height=I(e,"height",0)*h,l.sequence=r;let c=I(e,"parent",null);if(c)return this.linkedMeshes.push(new Xr(l,I(e,"skin",null),s,c,I(e,"timelines",!0))),l;let f=e.uvs;return this.readVertices(e,l,f.length),l.triangles=e.triangles,l.regionUVs=f,l.region!=null&&l.updateRegion(),l.edges=I(e,"edges",null),l.hullLength=I(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=I(e,"closed",!1),o.constantSpeed=I(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=R.newArray(r/3,0);for(let c=0;c<e.lengths.length;c++)l[c]=e.lengths[c]*h;o.lengths=l;let n=I(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=I(e,"x",0)*h,o.y=I(e,"y",0)*h,o.rotation=I(e,"rotation",0);let r=I(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let r=I(e,"end",null);r&&(o.endSlot=a.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=I(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let t=new Ze(I(e,"count",0));return t.start=I(e,"start",1),t.digits=I(e,"digits",0),t.setupIndex=I(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let a=e.vertices;if(s==a.length){let r=R.toFloatArray(a);if(i!=1)for(let l=0,n=a.length;l<n;l++)r[l]*=i;t.vertices=r;return}let h=new Array,o=new Array;for(let r=0,l=a.length;r<l;){let n=a[r++];o.push(n);for(let c=r+n*4;r<c;r+=4)o.push(a[r]),h.push(a[r+1]*i),h.push(a[r+2]*i),h.push(a[r+3])}t.bones=o,t.vertices=R.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,a=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let c in r){let f=r[c];if(!f)continue;let d=f.length;if(c=="attachment"){let u=new we(d,n);for(let m=0;m<d;m++){let x=f[m];u.setFrame(m,I(x,"time",0),I(x,"name",null))}a.push(u)}else if(c=="rgba"){let u=new ht(d,d<<2,n),m=f[0],x=I(m,"time",0),p=N.fromString(m.color);for(let w=0,g=0;;w++){u.setFrame(w,x,p.r,p.g,p.b,p.a);let b=f[w+1];if(!b){u.shrink(g);break}let v=I(b,"time",0),y=N.fromString(b.color),S=m.curve;S&&(g=z(S,u,g,w,0,x,v,p.r,y.r,1),g=z(S,u,g,w,1,x,v,p.g,y.g,1),g=z(S,u,g,w,2,x,v,p.b,y.b,1),g=z(S,u,g,w,3,x,v,p.a,y.a,1)),x=v,p=y,m=b}a.push(u)}else if(c=="rgb"){let u=new ct(d,d*3,n),m=f[0],x=I(m,"time",0),p=N.fromString(m.color);for(let w=0,g=0;;w++){u.setFrame(w,x,p.r,p.g,p.b);let b=f[w+1];if(!b){u.shrink(g);break}let v=I(b,"time",0),y=N.fromString(b.color),S=m.curve;S&&(g=z(S,u,g,w,0,x,v,p.r,y.r,1),g=z(S,u,g,w,1,x,v,p.g,y.g,1),g=z(S,u,g,w,2,x,v,p.b,y.b,1)),x=v,p=y,m=b}a.push(u)}else if(c=="alpha")a.push(de(f,new dt(d,d,n),0,1));else if(c=="rgba2"){let u=new ft(d,d*7,n),m=f[0],x=I(m,"time",0),p=N.fromString(m.light),w=N.fromString(m.dark);for(let g=0,b=0;;g++){u.setFrame(g,x,p.r,p.g,p.b,p.a,w.r,w.g,w.b);let v=f[g+1];if(!v){u.shrink(b);break}let y=I(v,"time",0),S=N.fromString(v.light),A=N.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,g,0,x,y,p.r,S.r,1),b=z(k,u,b,g,1,x,y,p.g,S.g,1),b=z(k,u,b,g,2,x,y,p.b,S.b,1),b=z(k,u,b,g,3,x,y,p.a,S.a,1),b=z(k,u,b,g,4,x,y,w.r,A.r,1),b=z(k,u,b,g,5,x,y,w.g,A.g,1),b=z(k,u,b,g,6,x,y,w.b,A.b,1)),x=y,p=S,w=A,m=v}a.push(u)}else if(c=="rgb2"){let u=new ut(d,d*6,n),m=f[0],x=I(m,"time",0),p=N.fromString(m.light),w=N.fromString(m.dark);for(let g=0,b=0;;g++){u.setFrame(g,x,p.r,p.g,p.b,w.r,w.g,w.b);let v=f[g+1];if(!v){u.shrink(b);break}let y=I(v,"time",0),S=N.fromString(v.light),A=N.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,g,0,x,y,p.r,S.r,1),b=z(k,u,b,g,1,x,y,p.g,S.g,1),b=z(k,u,b,g,2,x,y,p.b,S.b,1),b=z(k,u,b,g,3,x,y,w.r,A.r,1),b=z(k,u,b,g,4,x,y,w.g,A.g,1),b=z(k,u,b,g,5,x,y,w.b,A.b,1)),x=y,p=S,w=A,m=v}a.push(u)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let c in r){let f=r[c],d=f.length;if(d!=0){if(c==="rotate")a.push(de(f,new Me(d,d,n),0,1));else if(c==="translate"){let u=new et(d,d<<1,n);a.push(Nt(f,u,"x","y",0,i))}else if(c==="translatex"){let u=new tt(d,d,n);a.push(de(f,u,0,i))}else if(c==="translatey"){let u=new st(d,d,n);a.push(de(f,u,0,i))}else if(c==="scale"){let u=new rt(d,d<<1,n);a.push(Nt(f,u,"x","y",1,1))}else if(c==="scalex"){let u=new it(d,d,n);a.push(de(f,u,1,1))}else if(c==="scaley"){let u=new at(d,d,n);a.push(de(f,u,1,1))}else if(c==="shear"){let u=new nt(d,d<<1,n);a.push(Nt(f,u,"x","y",0,1))}else if(c==="shearx"){let u=new lt(d,d,n);a.push(de(f,u,0,1))}else if(c==="sheary"){let u=new ot(d,d,n);a.push(de(f,u,0,1))}}}}if(e.ik)for(let o in e.ik){let r=e.ik[o],l=r[0];if(!l)continue;let n=s.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(n),f=new gt(r.length,r.length<<1,c),d=I(l,"time",0),u=I(l,"mix",1),m=I(l,"softness",0)*i;for(let x=0,p=0;;x++){f.setFrame(x,d,u,m,I(l,"bendPositive",!0)?1:-1,I(l,"compress",!1),I(l,"stretch",!1));let w=r[x+1];if(!w){f.shrink(p);break}let g=I(w,"time",0),b=I(w,"mix",1),v=I(w,"softness",0)*i,y=l.curve;y&&(p=z(y,f,p,x,0,d,g,u,b,1),p=z(y,f,p,x,1,d,g,m,v,i)),d=g,u=b,m=v,l=w}a.push(f)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=s.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(n),f=new xt(r.length,r.length*6,c),d=I(l,"time",0),u=I(l,"mixRotate",1),m=I(l,"mixX",1),x=I(l,"mixY",m),p=I(l,"mixScaleX",1),w=I(l,"mixScaleY",p),g=I(l,"mixShearY",1);for(let b=0,v=0;;b++){f.setFrame(b,d,u,m,x,p,w,g);let y=r[b+1];if(!y){f.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),T=I(y,"mixY",k),Y=I(y,"mixScaleX",1),E=I(y,"mixScaleY",Y),F=I(y,"mixShearY",1),P=l.curve;P&&(v=z(P,f,v,b,0,d,S,u,A,1),v=z(P,f,v,b,1,d,S,m,k,1),v=z(P,f,v,b,2,d,S,x,T,1),v=z(P,f,v,b,3,d,S,p,Y,1),v=z(P,f,v,b,4,d,S,w,E,1),v=z(P,f,v,b,5,d,S,g,F,1)),d=S,u=A,m=k,x=T,p=Y,w=E,p=Y,l=y}a.push(f)}if(e.path)for(let o in e.path){let r=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=s.pathConstraints.indexOf(l);for(let c in r){let f=r[c],d=f[0];if(!d)continue;let u=f.length;if(c==="position"){let m=new bt(u,u,n);a.push(de(f,m,0,l.positionMode==0?i:1))}else if(c==="spacing"){let m=new wt(u,u,n);a.push(de(f,m,0,l.spacingMode==0||l.spacingMode==1?i:1))}else if(c==="mix"){let m=new pt(u,u*3,n),x=I(d,"time",0),p=I(d,"mixRotate",1),w=I(d,"mixX",1),g=I(d,"mixY",w);for(let b=0,v=0;;b++){m.setFrame(b,x,p,w,g);let y=f[b+1];if(!y){m.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),T=I(y,"mixY",k),Y=d.curve;Y&&(v=z(Y,m,v,b,0,x,S,p,A,1),v=z(Y,m,v,b,1,x,S,w,k,1),v=z(Y,m,v,b,2,x,S,g,T,1)),x=S,p=A,w=k,g=T,d=y}a.push(m)}}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let c=r[n],f=s.findSlot(n);if(!f)throw new Error("Slot not found: "+n);let d=f.index;for(let u in c){let m=c[u],x=l.getAttachment(d,u);for(let p in m){let w=m[p],g=w[0];if(g){if(p=="deform"){let b=x.bones,v=x.vertices,y=b?v.length/3*2:v.length,S=new mt(w.length,w.length,d,x),A=I(g,"time",0);for(let k=0,T=0;;k++){let Y,E=I(g,"vertices",null);if(!E)Y=b?R.newFloatArray(y):v;else{Y=R.newFloatArray(y);let M=I(g,"offset",0);if(R.arrayCopy(E,0,Y,M,E.length),i!=1)for(let V=M,q=V+E.length;V<q;V++)Y[V]*=i;if(!b)for(let V=0;V<y;V++)Y[V]+=v[V]}S.setFrame(k,A,Y);let F=w[k+1];if(!F){S.shrink(T);break}let P=I(F,"time",0),C=g.curve;C&&(T=z(C,S,T,k,0,A,P,0,1,1)),A=P,g=F}a.push(S)}else if(p=="sequence"){let b=new ve(w.length,d,x),v=0;for(let y=0;y<w.length;y++){let S=I(g,"delay",v),A=I(g,"time",0),k=Ht[I(g,"mode","hold")],T=I(g,"index",0);b.setFrame(y,A,k,T,S),v=S,g=w[y+1]}a.push(b)}}}}}}if(e.drawOrder){let o=new pe(e.drawOrder.length),r=s.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let c=e.drawOrder[n],f=null,d=I(c,"offsets",null);if(d){f=R.newArray(r,-1);let u=R.newArray(r-d.length,0),m=0,x=0;for(let p=0;p<d.length;p++){let w=d[p],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;m!=b;)u[x++]=m++;f[m+w.offset]=m++}for(;m<r;)u[x++]=m++;for(let p=r-1;p>=0;p--)f[p]==-1&&(f[p]=u[--x])}o.setFrame(l,I(c,"time",0),f)}a.push(o)}if(e.events){let o=new Xe(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],c=s.findEvent(n.name);if(!c)throw new Error("Event not found: "+n.name);let f=new Mt(R.toSinglePrecision(I(n,"time",0)),c);f.intValue=I(n,"int",c.intValue),f.floatValue=I(n,"float",c.floatValue),f.stringValue=I(n,"string",c.stringValue),f.data.audioPath&&(f.volume=I(n,"volume",1),f.balance=I(n,"balance",0)),o.setFrame(r,f)}a.push(o)}let h=0;for(let o=0,r=a.length;o<r;o++)h=Math.max(h,a[o].getDuration());s.animations.push(new Ve(t,a,h))}},Xr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}};function de(e,t,s,i){let a=e[0],h=I(a,"time",0),o=I(a,"value",s)*i,r=0;for(let l=0;;l++){t.setFrame(l,h,o);let n=e[l+1];if(!n)return t.shrink(r),t;let c=I(n,"time",0),f=I(n,"value",s)*i;a.curve&&(r=z(a.curve,t,r,l,0,h,c,o,f,i)),h=c,o=f,a=n}}function Nt(e,t,s,i,a,h){let o=e[0],r=I(o,"time",0),l=I(o,s,a)*h,n=I(o,i,a)*h,c=0;for(let f=0;;f++){t.setFrame(f,r,l,n);let d=e[f+1];if(!d)return t.shrink(c),t;let u=I(d,"time",0),m=I(d,s,a)*h,x=I(d,i,a)*h,p=o.curve;p&&(c=z(p,t,c,f,0,r,u,l,m,h),c=z(p,t,c,f,1,r,u,n,x,h)),r=u,l=m,n=x,o=d}}function z(e,t,s,i,a,h,o,r,l,n){if(e=="stepped")return t.setStepped(i),s;let c=a<<2,f=e[c],d=e[c+1]*n,u=e[c+2],m=e[c+3]*n;return t.setBezier(s,i,a,h,r,f,d,u,m,o,l),s+1}function I(e,t,s){return e[t]!==void 0?e[t]:s}return typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1))),Vs(qt)})();
|
|
1
|
+
"use strict";var spine=(()=>{var Re=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,Es=Object.getOwnPropertyNames,Rs=Object.prototype.hasOwnProperty,Ps=(e,t,s)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Bs=(e,t)=>{for(var s in t)Re(e,s,{get:t[s],enumerable:!0})},Vs=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Es(t))!Rs.call(e,a)&&a!==s&&Re(e,a,{get:()=>t[a],enumerable:!(i=Fs(t,a))||i.enumerable});return e},Ls=e=>Vs(Re({},"__esModule",{value:!0}),e),B=(e,t,s)=>(Ps(e,typeof t!="symbol"?t+"":t,s),s),jt={};Bs(jt,{AlphaTimeline:()=>ft,Animation:()=>Ve,AnimationState:()=>ns,AnimationStateAdapter:()=>Us,AnimationStateData:()=>Ws,AssetManagerBase:()=>$s,AtlasAttachmentLoader:()=>Hs,Attachment:()=>Ze,AttachmentTimeline:()=>we,BinaryInput:()=>Cs,BlendMode:()=>je,Bone:()=>Bt,BoneData:()=>Pt,BoundingBoxAttachment:()=>qe,CURRENT:()=>cs,ClippingAttachment:()=>Ft,Color:()=>N,ConstraintData:()=>Fe,CurveTimeline:()=>le,CurveTimeline1:()=>se,CurveTimeline2:()=>Le,DebugUtils:()=>Os,DeformTimeline:()=>gt,Downloader:()=>bs,DrawOrderTimeline:()=>pe,Event:()=>Vt,EventData:()=>Lt,EventQueue:()=>os,EventTimeline:()=>Xe,EventType:()=>ee,FIRST:()=>Yt,FakeTexture:()=>zs,HOLD_FIRST:()=>_e,HOLD_MIX:()=>hs,HOLD_SUBSEQUENT:()=>Mt,IkConstraint:()=>ws,IkConstraintData:()=>Dt,IkConstraintTimeline:()=>xt,IntSet:()=>Ds,Interpolation:()=>Jt,MathUtils:()=>X,MeshAttachment:()=>Se,MixBlend:()=>ts,MixDirection:()=>ss,PathAttachment:()=>Ae,PathConstraint:()=>Ie,PathConstraintData:()=>Nt,PathConstraintMixTimeline:()=>yt,PathConstraintPositionTimeline:()=>wt,PathConstraintSpacingTimeline:()=>pt,Physics:()=>As,PhysicsConstraintDampingTimeline:()=>At,PhysicsConstraintGravityTimeline:()=>kt,PhysicsConstraintInertiaTimeline:()=>vt,PhysicsConstraintMassTimeline:()=>It,PhysicsConstraintMixTimeline:()=>Tt,PhysicsConstraintResetTimeline:()=>De,PhysicsConstraintStrengthTimeline:()=>St,PhysicsConstraintTimeline:()=>fe,PhysicsConstraintWindTimeline:()=>Ct,PointAttachment:()=>Rt,Pool:()=>Ye,PositionMode:()=>ze,Pow:()=>Kt,PowOut:()=>Ns,RGB2Timeline:()=>mt,RGBA2Timeline:()=>ut,RGBATimeline:()=>ct,RGBTimeline:()=>dt,RegionAttachment:()=>W,RotateMode:()=>He,RotateTimeline:()=>Me,SETUP:()=>Xt,SUBSEQUENT:()=>Oe,ScaleTimeline:()=>it,ScaleXTimeline:()=>at,ScaleYTimeline:()=>nt,SequenceTimeline:()=>ve,ShearTimeline:()=>lt,ShearXTimeline:()=>ot,ShearYTimeline:()=>ht,Skeleton:()=>Ss,SkeletonBinary:()=>Js,SkeletonBounds:()=>Yr,SkeletonClipping:()=>zt,SkeletonData:()=>Ot,SkeletonJson:()=>Mr,Skin:()=>$e,SkinEntry:()=>_t,Slot:()=>ps,SlotData:()=>qt,SpacingMode:()=>Ge,StringSet:()=>Qe,Texture:()=>ds,TextureAtlas:()=>ms,TextureAtlasPage:()=>gs,TextureAtlasRegion:()=>Et,TextureFilter:()=>Ue,TextureRegion:()=>us,TextureWrap:()=>fs,TimeKeeper:()=>_s,Timeline:()=>J,TrackEntry:()=>ls,TransformConstraint:()=>ys,TransformConstraintData:()=>Ut,TransformConstraintTimeline:()=>bt,TransformMode:()=>We,TranslateTimeline:()=>tt,TranslateXTimeline:()=>st,TranslateYTimeline:()=>rt,Triangulator:()=>te,Utils:()=>R,Vector2:()=>Pe,VertexAttachment:()=>ne,WindowedMean:()=>qs});var Ds=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}},Qe=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new be().setFromString(e)}},N=be;B(N,"WHITE",new be(1,1,1,1)),B(N,"RED",new be(1,0,0,1)),B(N,"GREEN",new be(0,1,0,1)),B(N,"BLUE",new be(0,0,1,1)),B(N,"MAGENTA",new be(1,0,1,1));var ae=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ae.degRad)}static sinDeg(e){return Math.sin(e*ae.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ae.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ae.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},X=ae;B(X,"PI",3.1415927),B(X,"PI2",ae.PI*2),B(X,"invPI2",1/ae.PI2),B(X,"radiansToDegrees",180/ae.PI),B(X,"radDeg",ae.radiansToDegrees),B(X,"degreesToRadians",ae.PI/180),B(X,"degRad",ae.degreesToRadians);var Jt=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},Kt=class extends Jt{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}},Ns=class extends Kt{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},ye=class{static arrayCopy(e,t,s,i,a){for(let h=t,l=i;h<t+a;h++,l++)s[l]=e[h]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:ye.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(ye.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(ye.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return ye.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return ye.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=ye;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Os=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)}}},Ye=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}},Pe=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}},_s=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)}},qs=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}},Ze=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Qt=class extends Ze{id=Qt.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,h){s=a+(s>>1)*h;let l=e.bone.skeleton,r=e.deform,o=this.vertices,n=this.bones;if(!n){r.length>0&&(o=r);let u=e.bone,m=u.worldX,x=u.worldY,p=u.a,w=u.b,g=u.c,b=u.d;for(let v=t,y=a;y<s;v+=2,y+=h){let S=o[v],I=o[v+1];i[y]=S*p+I*w+m,i[y+1]=S*g+I*b+x}return}let c=0,f=0;for(let u=0;u<t;u+=2){let m=n[c];c+=m+1,f+=m}let d=l.bones;if(r.length==0)for(let u=a,m=f*3;u<s;u+=h){let x=0,p=0,w=n[c++];for(w+=c;c<w;c++,m+=3){let g=d[n[c]],b=o[m],v=o[m+1],y=o[m+2];x+=(b*g.a+v*g.b+g.worldX)*y,p+=(b*g.c+v*g.d+g.worldY)*y}i[u]=x,i[u+1]=p}else{let u=r;for(let m=a,x=f*3,p=f<<1;m<s;m+=h){let w=0,g=0,b=n[c++];for(b+=c;c<b;c++,x+=3,p+=2){let v=d[n[c]],y=o[x]+u[p],S=o[x+1]+u[p+1],I=o[x+2];w+=(y*v.a+S*v.b+v.worldX)*I,g+=(y*v.c+S*v.d+v.worldY)*I}i[m]=w,i[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ne=Qt;B(ne,"nextID",0);var Be=class{id=Be.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Be(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Be._nextID++}},et=Be;B(et,"_nextID",0);var Zt=(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))(Zt||{}),es=[0,1,2,3,4,5,6],Ve=class{name;timelines=[];timelineIds=new Qe;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,a,h,l,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let o=this.timelines;for(let n=0,c=o.length;n<c;n++)o[n].apply(e,t,s,a,h,l,r)}},ts=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(ts||{}),ss=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ss||{}),O={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,physicsConstraintInertia:19,physicsConstraintStrength:20,physicsConstraintDamping:21,physicsConstraintMass:22,physicsConstraintWind:23,physicsConstraintGravity:24,physicsConstraintMix:25,physicsConstraintReset:26,sequence:27},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},le=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,h,l,r,o,n,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-h*2+r)*.03,m=(a-l*2+o)*.03,x=((h-r)*3-i+n)*.006,p=((l-o)*3-a+c)*.006,w=u*2+x,g=m*2+p,b=(h-i)*.3+u+x*.16666667,v=(l-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let I=d+18;d<I;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let o=this.frames[t],n=this.frames[t+s];return n+(e-o)/(a[i]-o)*(a[i+1]-n)}let h=i+18;for(i+=2;i<h;i+=2)if(a[i]>=e){let o=a[i-2],n=a[i-1];return n+(e-o)/(a[i]-o)*(a[i+1]-n)}t+=this.getFrameEntries();let l=a[h-2],r=a[h-1];return r+(e-l)/(this.frames[t]-l)*(this.frames[t+s]-r)}},se=class extends le{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 a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],h=t[s+1];return h+(e-a)/(t[s+2]-a)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return a+h*t;case 1:case 2:h+=a-i}return i+h*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let h=this.getCurveValue(e);return s==0?a+(h-a)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,a,h){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(h-a)*t:i+(h-i)*t}getScaleValue(e,t,s,i,a,h){const l=this.frames;if(e<l[0]){switch(s){case 0:return h;case 1:return a+(h-a)*t}return a}let r=this.getCurveValue(e)*h;if(t==1)return s==3?a+r-h:r;if(i==1)switch(s){case 0:return h+(Math.abs(r)*X.signum(h)-h)*t;case 1:case 2:return a+(Math.abs(r)*X.signum(a)-a)*t}else{let o=0;switch(s){case 0:return o=Math.abs(h)*X.signum(r),o+(r-o)*t;case 1:case 2:return o=Math.abs(a)*X.signum(r),o+(r-o)*t}}return a+(r-h)*t}},Le=class extends le{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Me=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,h,r.rotation,r.data.rotation))}},tt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,c=0,f=J.search(o,s,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];n=o[f+1],c=o[f+2];let m=(s-u)/(o[f+3]-u);n+=(o[f+3+1]-n)*m,c+=(o[f+3+2]-c)*m;break;case 1:n=o[f+1],c=o[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:r.x=r.data.x+n*a,r.y=r.data.y+c*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+c-r.y)*a;break;case 3:r.x+=n*a,r.y+=c*a}}},st=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,h,r.x,r.data.x))}},rt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,h,r.y,r.data.y))}},it=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,c,f=J.search(o,s,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];n=o[f+1],c=o[f+2];let m=(s-u)/(o[f+3]-u);n+=(o[f+3+1]-n)*m,c+=(o[f+3+2]-c)*m;break;case 1:n=o[f+1],c=o[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(n*=r.data.scaleX,c*=r.data.scaleY,a==1)h==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=n,r.scaleY=c);else{let u=0,m=0;if(l==1)switch(h){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*a;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(c-r.data.scaleY)*a}else switch(h){case 0:u=Math.abs(r.data.scaleX)*X.signum(n),m=Math.abs(r.data.scaleY)*X.signum(c),r.scaleX=u+(n-u)*a,r.scaleY=m+(c-m)*a;break;case 1:case 2:u=Math.abs(r.scaleX)*X.signum(n),m=Math.abs(r.scaleY)*X.signum(c),r.scaleX=u+(n-u)*a,r.scaleY=m+(c-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(c-r.data.scaleY)*a}}}},at=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,h,l,r.scaleX,r.data.scaleX))}},nt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,h,l,r.scaleX,r.data.scaleY))}},lt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,c=0,f=J.search(o,s,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];n=o[f+1],c=o[f+2];let m=(s-u)/(o[f+3]-u);n+=(o[f+3+1]-n)*m,c+=(o[f+3+2]-c)*m;break;case 1:n=o[f+1],c=o[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+c*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+c-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=c*a}}},ot=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,h,r.shearX,r.data.shearX))}},ht=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,O.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,l){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,h,r.shearX,r.data.shearY))}},ct=class extends le{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,i,a,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,n=r.color;if(s<o[0]){let p=r.data.color;switch(h){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let c=0,f=0,d=0,u=0,m=J.search(o,s,5),x=this.curves[m/5];switch(x){case 0:let p=o[m];c=o[m+1],f=o[m+2],d=o[m+3],u=o[m+4];let w=(s-p)/(o[m+5]-p);c+=(o[m+5+1]-c)*w,f+=(o[m+5+2]-f)*w,d+=(o[m+5+3]-d)*w,u+=(o[m+5+4]-u)*w;break;case 1:c=o[m+1],f=o[m+2],d=o[m+3],u=o[m+4];break;default:c=this.getBezierValue(s,m,1,x-2),f=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),u=this.getBezierValue(s,m,4,x+18*3-2)}a==1?n.set(c,f,d,u):(h==0&&n.setFromColor(r.data.color),n.add((c-n.r)*a,(f-n.g)*a,(d-n.b)*a,(u-n.a)*a))}},dt=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,n=r.color;if(s<o[0]){let x=r.data.color;switch(h){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*a,n.g+=(x.g-n.g)*a,n.b+=(x.b-n.b)*a}return}let c=0,f=0,d=0,u=J.search(o,s,4),m=this.curves[u>>2];switch(m){case 0:let x=o[u];c=o[u+1],f=o[u+2],d=o[u+3];let p=(s-x)/(o[u+4]-x);c+=(o[u+4+1]-c)*p,f+=(o[u+4+2]-f)*p,d+=(o[u+4+3]-d)*p;break;case 1:c=o[u+1],f=o[u+2],d=o[u+3];break;default:c=this.getBezierValue(s,u,1,m-2),f=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(a==1)n.r=c,n.g=f,n.b=d;else{if(h==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(c-n.r)*a,n.g+=(f-n.g)*a,n.b+=(d-n.b)*a}}},ft=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,O.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(s<this.frames[0]){let c=r.data.color;switch(h){case 0:o.a=c.a;return;case 1:o.a+=(c.a-o.a)*a}return}let n=this.getCurveValue(s);a==1?o.a=n:(h==0&&(o.a=r.data.color.a),o.a+=(n-o.a)*a)}},ut=class extends le{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,i,a,h,l,r,o){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=r,this.frames[e+7]=o}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,n=r.color,c=r.darkColor;if(s<o[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:n.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),c.r+=(y.r-c.r)*a,c.g+=(y.g-c.g)*a,c.b+=(y.b-c.b)*a}return}let f=0,d=0,u=0,m=0,x=0,p=0,w=0,g=J.search(o,s,8),b=this.curves[g>>3];switch(b){case 0:let v=o[g];f=o[g+1],d=o[g+2],u=o[g+3],m=o[g+4],x=o[g+5],p=o[g+6],w=o[g+7];let y=(s-v)/(o[g+8]-v);f+=(o[g+8+1]-f)*y,d+=(o[g+8+2]-d)*y,u+=(o[g+8+3]-u)*y,m+=(o[g+8+4]-m)*y,x+=(o[g+8+5]-x)*y,p+=(o[g+8+6]-p)*y,w+=(o[g+8+7]-w)*y;break;case 1:f=o[g+1],d=o[g+2],u=o[g+3],m=o[g+4],x=o[g+5],p=o[g+6],w=o[g+7];break;default:f=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),m=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2),w=this.getBezierValue(s,g,7,b+18*6-2)}if(a==1)n.set(f,d,u,m),c.r=x,c.g=p,c.b=w;else{if(h==0){n.setFromColor(r.data.color);let v=r.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}n.add((f-n.r)*a,(d-n.g)*a,(u-n.b)*a,(m-n.a)*a),c.r+=(x-c.r)*a,c.g+=(p-c.g)*a,c.b+=(w-c.b)*a}}},mt=class extends le{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,i,a,h,l,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=r}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,n=r.color,c=r.darkColor;if(s<o[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:n.r=v.r,n.g=v.g,n.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,c.r+=(y.r-c.r)*a,c.g+=(y.g-c.g)*a,c.b+=(y.b-c.b)*a}return}let f=0,d=0,u=0,m=0,x=0,p=0,w=0,g=J.search(o,s,7),b=this.curves[g/7];switch(b){case 0:let v=o[g];f=o[g+1],d=o[g+2],u=o[g+3],x=o[g+4],p=o[g+5],w=o[g+6];let y=(s-v)/(o[g+7]-v);f+=(o[g+7+1]-f)*y,d+=(o[g+7+2]-d)*y,u+=(o[g+7+3]-u)*y,x+=(o[g+7+4]-x)*y,p+=(o[g+7+5]-p)*y,w+=(o[g+7+6]-w)*y;break;case 1:f=o[g+1],d=o[g+2],u=o[g+3],x=o[g+4],p=o[g+5],w=o[g+6];break;default:f=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),p=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2)}if(a==1)n.r=f,n.g=d,n.b=u,c.r=x,c.g=p,c.b=w;else{if(h==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}n.r+=(f-n.r)*a,n.g+=(d-n.g)*a,n.b+=(u-n.b)*a,c.r+=(x-c.r)*a,c.g+=(p-c.g)*a,c.b+=(w-c.b)*a}}},we=class extends J{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,i,a,h,l){let r=e.slots[this.slotIndex];if(r.bone.active){if(l==1){h==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},gt=class extends le{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[O.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,h,l,r,o,n,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-h*2+r)*.03,m=o*.03-l*.06,x=((h-r)*3-i+n)*.006,p=(l-o+.33333333)*.018,w=u*2+x,g=m*2+p,b=(h-i)*.3+u+x*.16666667,v=l*.3+m+p*.16666667,y=i+b,S=v;for(let I=d+18;d<I;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],o=s[i-1];return o+(e-r)/(s[i]-r)*(s[i+1]-o)}let h=s[a-2],l=s[a-1];return l+(1-l)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof ne)||o.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=f;let g=o;if(g.bones){a=1-a;for(var u=0;u<f;u++)n[u]*=a}else{let b=g.vertices;for(var u=0;u<f;u++)n[u]+=(b[u]-n[u])*a}}return}if(n.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(a==1)if(h==3){let b=o;if(b.bones)for(let v=0;v<f;v++)n[v]+=g[v];else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,n,0,f);else switch(h){case 0:{let v=o;if(v.bones)for(let y=0;y<f;y++)n[y]=g[y]*a;else{let y=v.vertices;for(let S=0;S<f;S++){let I=y[S];n[S]=I+(g[S]-I)*a}}break}case 1:case 2:for(let v=0;v<f;v++)n[v]+=(g[v]-n[v])*a;break;case 3:let b=o;if(b.bones)for(let v=0;v<f;v++)n[v]+=g[v]*a;else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=(g[y]-v[y])*a}}return}let m=J.search1(d,s),x=this.getCurvePercent(s,m),p=c[m],w=c[m+1];if(a==1)if(h==3){let g=o;if(g.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=v+(w[b]-v)*x}else{let b=g.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=y+(w[v]-y)*x-b[v]}}}else for(let g=0;g<f;g++){let b=p[g];n[g]=b+(w[g]-b)*x}else switch(h){case 0:{let b=o;if(b.bones)for(let v=0;v<f;v++){let y=p[v];n[v]=(y+(w[v]-y)*x)*a}else{let v=b.vertices;for(let y=0;y<f;y++){let S=p[y],I=v[y];n[y]=I+(S+(w[y]-S)*x-I)*a}}break}case 1:case 2:for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x-n[b])*a}break;case 3:let g=o;if(g.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x)*a}else{let b=g.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=(y+(w[v]-y)*x-b[v])*a}}}}},rs=class extends J{events;constructor(e){super(e,rs.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,h,l){if(!i)return;let r=this.frames,o=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,h,l),t=-1;else if(t>=r[o-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let c=r[n];for(;n>0&&r[n-1]==c;)n--}for(;n<o&&s>=r[n];n++)i.push(this.events[n])}},Xe=rs;B(Xe,"propertyIds",[""+O.event]);var is=class extends J{drawOrders;constructor(e){super(e,is.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,h,l){if(l==1){h==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(h==0||h==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),o=this.drawOrders[r];if(!o)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,c=e.slots;for(let f=0,d=o.length;f<d;f++)n[f]=c[o[f]]}}},pe=is;B(pe,"propertyIds",[""+O.drawOrder]);var xt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,h,l){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h?1:0,this.frames[e+5]=l?1:0}apply(e,t,s,i,a,h,l){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,c=0,f=J.search(o,s,6),d=this.curves[f/6];switch(d){case 0:let u=o[f];n=o[f+1],c=o[f+2];let m=(s-u)/(o[f+6]-u);n+=(o[f+6+1]-n)*m,c+=(o[f+6+2]-c)*m;break;case 1:n=o[f+1],c=o[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(c-r.data.softness)*a,l==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[f+3],r.compress=o[f+4]!=0,r.stretch=o[f+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(c-r.softness)*a,l==0&&(r.bendDirection=o[f+3],r.compress=o[f+4]!=0,r.stretch=o[f+5]!=0))}},bt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,h,l,r){let o=this.frames;e*=7,o[e]=t,o[e+1]=s,o[e+2]=i,o[e+3]=a,o[e+4]=h,o[e+5]=l,o[e+6]=r}apply(e,t,s,i,a,h,l){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){let w=r.data;switch(h){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,c,f,d,u,m,x=J.search(o,s,7),p=this.curves[x/7];switch(p){case 0:let w=o[x];n=o[x+1],c=o[x+2],f=o[x+3],d=o[x+4],u=o[x+5],m=o[x+6];let g=(s-w)/(o[x+7]-w);n+=(o[x+7+1]-n)*g,c+=(o[x+7+2]-c)*g,f+=(o[x+7+3]-f)*g,d+=(o[x+7+4]-d)*g,u+=(o[x+7+5]-u)*g,m+=(o[x+7+6]-m)*g;break;case 1:n=o[x+1],c=o[x+2],f=o[x+3],d=o[x+4],u=o[x+5],m=o[x+6];break;default:n=this.getBezierValue(s,x,1,p-2),c=this.getBezierValue(s,x,2,p+18-2),f=this.getBezierValue(s,x,3,p+18*2-2),d=this.getBezierValue(s,x,4,p+18*3-2),u=this.getBezierValue(s,x,5,p+18*4-2),m=this.getBezierValue(s,x,6,p+18*5-2)}if(h==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(c-w.mixX)*a,r.mixY=w.mixY+(f-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(u-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(c-r.mixX)*a,r.mixY+=(f-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(u-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},wt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,l){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,h,r.position,r.data.position))}},pt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,l){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,h,r.spacing,r.data.spacing))}},yt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=a}apply(e,t,s,i,a,h,l){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,c,f,d=J.search(o,s,4),u=this.curves[d>>2];switch(u){case 0:let m=o[d];n=o[d+1],c=o[d+2],f=o[d+3];let x=(s-m)/(o[d+4]-m);n+=(o[d+4+1]-n)*x,c+=(o[d+4+2]-c)*x,f+=(o[d+4+3]-f)*x;break;case 1:n=o[d+1],c=o[d+2],f=o[d+3];break;default:n=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2),f=this.getBezierValue(s,d,3,u+18*2-2)}if(h==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(c-m.mixX)*a,r.mixY=m.mixY+(f-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(c-r.mixX)*a,r.mixY+=(f-r.mixY)*a}},fe=class extends se{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,l){let r;if(this.constraintIndex==-1){const o=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,h,this.get(n),this.setup(n),o))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,h,this.get(r),this.setup(r)))}},vt=class extends fe{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}},St=class extends fe{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}},At=class extends fe{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}},It=class extends fe{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}},Ct=class extends fe{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}},kt=class extends fe{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}},Tt=class extends fe{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}},as=class extends J{constraintIndex;constructor(e,t){super(e,as.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,h,l){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,h,l),t=-1;else if(t>=o[o.length-1])return;if(!(s<o[0])&&(t<o[0]||s>=o[J.search1(o,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},De=as;B(De,"propertyIds",[O.physicsConstraintReset.toString()]);var ue=class extends J{slotIndex;attachment;constructor(e,t,s){super(e,[O.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return ue.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,i,a){let h=this.frames;e*=ue.ENTRIES,h[e]=t,h[e+ue.MODE]=s|i<<4,h[e+ue.DELAY]=a}apply(e,t,s,i,a,h,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,n=this.attachment;if(o!=n&&(!(o instanceof ne)||o.timelineAttachment!=n))return;let c=this.frames;if(s<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let f=J.search(c,s,ue.ENTRIES),d=c[f],u=c[f+ue.MODE],m=c[f+ue.DELAY];if(!this.attachment.sequence)return;let x=u>>4,p=this.attachment.sequence.regions.length,w=es[u&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(p-1,x);break;case 2:x%=p;break;case 3:{let g=(p<<1)-2;x=g==0?0:x%g,x>=p&&(x=g-x);break}case 4:x=Math.max(p-1-x,0);break;case 5:x=p-1-x%p;break;case 6:{let g=(p<<1)-2;x=g==0?0:(x+p-1)%g,x>=p&&(x=g-x)}}r.sequenceIndex=x}},ve=ue;B(ve,"ENTRIES",3),B(ve,"MODE",1),B(ve,"DELAY",2);var Ne=class{static emptyAnimation(){return Ne._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new os(this);propertyIDs=new Qe;animationsChanged=!1;trackEntryPool=new Ye(()=>new ls);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let h=e*a.timeScale;if(a.delay>0){if(a.delay-=h,a.delay>0)continue;h=-a.delay,a.delay=0}let l=a.next;if(l){let r=a.trackLast-l.delay;if(r>=0){for(l.delay=0,l.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*l.timeScale,a.trackTime+=h,this.setCurrent(s,l,!0);l.mixingFrom;)l.mixTime+=e,l=l.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let f=0,d=s.length;f<d;f++){let u=s[f];if(!u||u.delay>0)continue;i=!0;let m=f==0?1:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let p=x>=u.alphaAttachmentThreshold,w=u.animationLast,g=u.getAnimationTime(),b=g,v=t;u.reverse&&(b=u.animation.duration-b,v=null);let y=u.animation.timelines,S=y.length;if(f==0&&x==1||m==3){f==0&&(p=!0);for(let I=0;I<S;I++){R.webkit602BugfixHelper(x,m);var a=y[I];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,x,m,0)}}else{let I=u.timelineMode,k=u.shortestRotation,T=!k&&u.timelinesRotation.length!=S<<1;T&&(u.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let E=y[Y],F=I[Y]==Oe?m:0;!k&&E instanceof Me?this.applyRotateTimeline(E,e,b,x,F,u.timelinesRotation,Y<<1,T):E instanceof we?this.applyAttachmentTimeline(E,e,b,m,p):(R.webkit602BugfixHelper(x,m),E.apply(e,w,b,v,x,F,0))}}this.queueEvents(u,g),t.length=0,u.nextAnimationLast=g,u.nextTrackLast=u.trackTime}for(var h=this.unkeyedState+Xt,l=e.slots,r=0,o=e.slots.length;r<o;r++){var n=l[r];if(n.attachmentState==h){var c=n.data.attachmentName;n.setAttachment(c?e.getAttachment(n.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let h=a<i.mixAttachmentThreshold,l=a<i.mixDrawOrderThreshold,r=i.animation.timelines,o=r.length,n=i.alpha*e.interruptAlpha,c=n*(1-a),f=i.animationLast,d=i.getAnimationTime(),u=d,m=null;if(i.reverse?u=i.animation.duration-u:a<i.eventThreshold&&(m=this.events),s==3)for(let x=0;x<o;x++)r[x].apply(t,f,u,m,c,s,1);else{let x=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,g=!w&&i.timelinesRotation.length!=o<<1;g&&(i.timelinesRotation.length=o<<1),i.totalAlpha=0;for(let b=0;b<o;b++){let v=r[b],y=1,S,I=0;switch(x[b]){case Oe:if(!l&&v instanceof pe)continue;S=s,I=c;break;case Yt:S=0,I=c;break;case Mt:S=s,I=n;break;case _e:S=0,I=n;break;default:S=0;let k=p[b];I=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=I,!w&&v instanceof Me?this.applyRotateTimeline(v,t,u,I,S,i.timelinesRotation,b<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,u,S,h&&I>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(I,s),l&&v instanceof pe&&S==0&&(y=0),v.apply(t,f,u,m,I,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var h=t.slots[e.slotIndex];h.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,h,h.data.attachmentName,a):this.setAttachment(t,h,e.attachmentNames[J.search1(e.frames,s)],a),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Xt))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+cs)}applyRotateTimeline(e,t,s,i,a,h,l,r){if(r&&(h[l]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let o=t.bones[e.boneIndex];if(!o.active)return;let n=e.frames,c=0,f=0;if(s<n[0])switch(a){case 0:o.rotation=o.data.rotation;default:return;case 1:c=o.rotation,f=o.data.rotation}else c=a==0?o.data.rotation:o.rotation,f=o.data.rotation+e.getCurveValue(s);let d=0,u=f-c;if(u-=Math.ceil(u/360-.5)*360,u==0)d=h[l];else{let m=0,x=0;r?(m=0,x=u):(m=h[l],x=h[l+1]);let p=m-m%360;d=u+p;let w=u>=0,g=m>=0;Math.abs(x)<=90&&X.signum(x)!=X.signum(u)&&(Math.abs(m-p)>180?(d+=360*X.signum(m),g=w):p!=0?d-=360*X.signum(m):g=w),g!=w&&(d+=360*X.signum(m)),h[l]=d}h[l+1]=u,o.rotation=c+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,h=e.trackLast%a,l=this.events,r=0,o=l.length;for(;r<o;r++){let c=l[r];if(c.time<h)break;c.time>i||this.queue.event(e,c)}let n=!1;for(e.loop?n=a==0||h>e.trackTime%a:n=t>=i&&e.animationLast<i,n&&this.queue.complete(e);r<o;r++){let c=l[r];c.time<s||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let h=this.trackEntry(e,t,s,a);return this.setCurrent(e,h,i),this.queue.drain(),h}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let h=this.trackEntry(e,t,s,a);return a?(a.next=h,h.previous=a,i<=0&&(i+=a.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=i,h}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,Ne.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,Ne.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-t),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let h=e.timelineHoldMix;h.length=0;let l=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=l.addAll(s[r].getPropertyIds())?_e:Mt;return}e:for(let r=0;r<i;r++){let o=s[r],n=o.getPropertyIds();if(!l.addAll(n))a[r]=Oe;else if(!t||o instanceof we||o instanceof pe||o instanceof Xe||!t.animation.hasTimeline(n))a[r]=Yt;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=hs,h[r]=c;continue e}break}a[r]=_e}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},ns=Ne;B(ns,"_emptyAnimation",new Ve("<empty>",[],0));var ls=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,this.previous!=null&&this.delay<=0&&(this.delay+=this.previous.getTrackComplete()-e),this.delay=this.delay}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}},os=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ee.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ee.interrupt),this.objects.push(e)}end(e){this.objects.push(ee.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ee.dispose),this.objects.push(e)}complete(e){this.objects.push(ee.complete),this.objects.push(e)}event(e,t){this.objects.push(ee.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case ee.start:a.listener&&a.listener.start&&a.listener.start(a);for(let l=0;l<t.length;l++){let r=t[l];r.start&&r.start(a)}break;case ee.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let l=0;l<t.length;l++){let r=t[l];r.interrupt&&r.interrupt(a)}break;case ee.end:a.listener&&a.listener.end&&a.listener.end(a);for(let l=0;l<t.length;l++){let r=t[l];r.end&&r.end(a)}case ee.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let l=0;l<t.length;l++){let r=t[l];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case ee.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let l=0;l<t.length;l++){let r=t[l];r.complete&&r.complete(a)}break;case ee.event:let h=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,h);for(let l=0;l<t.length;l++){let r=t[l];r.event&&r.event(a,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ee=(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))(ee||{}),Us=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Oe=0,Yt=1,Mt=2,_e=3,hs=4,Xt=1,cs=2,Ws=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},qe=class extends ne{color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new qe(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ft=class extends ne{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Ft(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},ds=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ue=(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))(Ue||{}),fs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(fs||{}),us=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},zs=class extends ds{setFilters(e,t){}setWraps(e,t){}dispose(){}},ms=class{pages=new Array;regions=new Array;constructor(e){let t=new Gs(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(Ue,s[1]),n.magFilter=R.enumValue(Ue,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let c=s[1];c=="true"?n.degrees=90:c!="false"&&(n.degrees=parseInt(c))},a.index=n=>{n.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 l=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)l=null,h=t.readLine();else if(l){let n=new Et(l,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let f=a[s[0]];if(f)f(n);else{r||(r=[]),o||(o=[]),r.push(s[0]);let d=[];for(let u=0;u<c;u++)d.push(parseInt(s[u+1]));o.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&o&&o.length>0&&(n.names=r,n.values=o,r=null,o=null),n.u=n.x/l.width,n.v=n.y/l.height,n.degrees==90?(n.u2=(n.x+n.height)/l.width,n.v2=(n.y+n.width)/l.height):(n.u2=(n.x+n.width)/l.width,n.v2=(n.y+n.height)/l.height),this.regions.push(n)}else{for(l=new gs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let n=i[s[0]];n&&n(l)}this.pages.push(l)}}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()}},Gs=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let h=t.indexOf(",",a);if(h==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,h-a).trim(),a=h+1,i==4)return 4}}},gs=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Et=class extends us{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)}},Se=class extends ne{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,h=0,l=0;if(this.region instanceof Et){let r=this.region,o=r.page,n=o.width,c=o.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/n,l=r.originalWidth/c;for(let f=0;f<s;f+=2)t[f]=i+e[f+1]*h,t[f+1]=a+(1-e[f])*l;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/c,h=r.originalWidth/n,l=r.originalHeight/c;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f])*h,t[f+1]=a+(1-e[f+1])*l;return;case 270:i-=r.offsetY/n,a-=r.offsetX/c,h=r.originalHeight/n,l=r.originalWidth/c;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f+1])*h,t[f+1]=a+e[f]*l;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/n,l=r.originalHeight/c}else this.region?(h=this.region.u2-i,l=this.region.v2-a):(i=a=0,h=l=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*h,t[r+1]=a+e[r+1]*l}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new Se(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,h)}newLinkedMesh(){let e=new Se(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ae=class extends ne{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ae(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Rt=class extends ne{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*X.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,h=s*e.c+i*e.d;return X.atan2Deg(h,a)}copy(){let e=new Rt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},xs=class extends Ze{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*i,l=a+this.region.width*s,r=h+this.region.height*i,o=this.rotation*X.degRad,n=Math.cos(o),c=Math.sin(o),f=this.x,d=this.y,u=a*n+f,m=a*c,x=h*n+d,p=h*c,w=l*n+f,g=l*c,b=r*n+d,v=r*c,y=this.offset;y[0]=u-p,y[1]=x+m,y[2]=u-v,y[3]=b+m,y[4]=w-v,y[5]=b+g,y[6]=w-p,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,h=this.offset,l=a.worldX,r=a.worldY,o=a.a,n=a.b,c=a.c,f=a.d,d=0,u=0;d=h[0],u=h[1],t[s]=d*o+u*n+l,t[s+1]=d*c+u*f+r,s+=i,d=h[2],u=h[3],t[s]=d*o+u*n+l,t[s+1]=d*c+u*f+r,s+=i,d=h[4],u=h[5],t[s]=d*o+u*n+l,t[s+1]=d*c+u*f+r,s+=i,d=h[6],u=h[7],t[s]=d*o+u*n+l,t[s+1]=d*c+u*f+r}copy(){let e=new xs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},W=xs;B(W,"X1",0),B(W,"Y1",1),B(W,"C1R",2),B(W,"C1G",3),B(W,"C1B",4),B(W,"C1A",5),B(W,"U1",6),B(W,"V1",7),B(W,"X2",8),B(W,"Y2",9),B(W,"C2R",10),B(W,"C2G",11),B(W,"C2B",12),B(W,"C2A",13),B(W,"U2",14),B(W,"V2",15),B(W,"X3",16),B(W,"Y3",17),B(W,"C3R",18),B(W,"C3G",19),B(W,"C3B",20),B(W,"C3A",21),B(W,"U3",22),B(W,"V3",23),B(W,"X4",24),B(W,"Y4",25),B(W,"C4R",26),B(W,"C4G",27),B(W,"C4B",28),B(W,"C4A",29),B(W,"U4",30),B(W,"V4",31);var Hs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,h=i.length;a<h;a++){let l=s.getPath(t,a),r=this.atlas.findRegion(l);if(r==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new W(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=h}return a}newMeshAttachment(e,t,s,i){let a=new Se(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=h}return a}newBoundingBoxAttachment(e,t){return new qe(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new Rt(t)}newClippingAttachment(e,t){return new Ft(t)}},Pt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;transformMode=We.Normal;skinRequired=!1;color=new N;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}},We=(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))(We||{}),Bt=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;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,h,l){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=h,this.ashearY=l;let r=this.parent;if(!r){let d=this.skeleton;const u=d.scaleX,m=d.scaleY,x=(s+h)*X.degRad,p=(s+90+l)*X.degRad;this.a=Math.cos(x)*i*u,this.b=Math.cos(p)*a*u,this.c=Math.sin(x)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*u+d.x,this.worldY=t*m+d.y;return}let o=r.a,n=r.b,c=r.c,f=r.d;switch(this.worldX=o*e+n*t+r.worldX,this.worldY=c*e+f*t+r.worldY,this.data.transformMode){case 0:{const d=(s+h)*X.degRad,u=(s+90+l)*X.degRad,m=Math.cos(d)*i,x=Math.cos(u)*a,p=Math.sin(d)*i,w=Math.sin(u)*a;this.a=o*m+n*p,this.b=o*x+n*w,this.c=c*m+f*p,this.d=c*x+f*w;return}case 1:{const d=(s+h)*X.degRad,u=(s+90+l)*X.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(u)*a,this.c=Math.sin(d)*i,this.d=Math.sin(u)*a;break}case 2:{let d=o*o+c*c,u=0;d>1e-4?(d=Math.abs(o*f-n*c)/d,o/=this.skeleton.scaleX,c/=this.skeleton.scaleY,n=c*d,f=o*d,u=Math.atan2(c,o)*X.radDeg):(o=0,c=0,u=90-Math.atan2(f,n)*X.radDeg);const m=(s+h-u)*X.degRad,x=(s+l-u+90)*X.degRad,p=Math.cos(m)*i,w=Math.cos(x)*a,g=Math.sin(m)*i,b=Math.sin(x)*a;this.a=o*p-n*g,this.b=o*w-n*b,this.c=c*p+f*g,this.d=c*w+f*b;break}case 3:case 4:{s*=X.degRad;const d=Math.cos(s),u=Math.sin(s);let m=(o*d+n*u)/this.skeleton.scaleX,x=(c*d+f*u)/this.skeleton.scaleY,p=Math.sqrt(m*m+x*x);p>1e-5&&(p=1/p),m*=p,x*=p,p=Math.sqrt(m*m+x*x),this.data.transformMode==3&&o*f-n*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*p,g=Math.sin(s)*p;h*=X.degRad,l=(90+l)*X.degRad;const b=Math.cos(h)*i,v=Math.cos(l)*a,y=Math.sin(h)*i,S=Math.sin(l)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=x*b+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY}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,i=e.c,a=e.d,h=1/(t*a-s*i),l=a*h,r=s*h,o=i*h,n=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*l-f*r,this.ay=f*n-c*o;let d,u,m,x;if(this.data.transformMode==1)d=this.a,u=this.b,m=this.c,x=this.d;else{switch(this.data.transformMode){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i),y=t/this.skeleton.scaleX;s=-(i/this.skeleton.scaleY)*v*this.skeleton.scaleX,a=y*v*this.skeleton.scaleY,h=1/(t*a-s*i),l=a*h,r=s*h;break}case 3:case 4:let p=X.cosDeg(this.rotation),w=X.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.data.transformMode==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=X.PI/2+Math.atan2(i,t);s=Math.cos(b)*g,a=Math.sin(b)*g,h=1/(t*a-s*i),l=a*h,r=s*h,o=i*h,n=t*h}d=l*this.a-r*this.c,u=l*this.b-r*this.d,m=n*this.c-o*this.a,x=n*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*x-u*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*u+m*x,p)*X.radDeg,this.arotation=Math.atan2(m,d)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*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,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=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),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Fe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},$s=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new bs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),h=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,l=>{try{let r=new ms(l),o=r.pages.length,n=!1;for(let c of r.pages)this.loadTexture(i?i[c.name]:h+c.name,(f,d)=>{n||(c.setTexture(d),--o==0&&this.success(t,e,r))},(f,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${f}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(l,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${l}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
+
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},bs=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=t.charCodeAt(a);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let a=()=>{this.finish(e,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let a=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let a=t==200||t==0?[s]:[t,s];for(let h=a.length-1,l=i.length;h<l;h+=2)i[h].apply(null,a)}},Vt=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}},Lt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ws=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.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,a,h,l){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,n=r.b,c=r.c,f=r.d,d=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=(t-e.worldX)*X.signum(e.skeleton.scaleX),m=(s-e.worldY)*X.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(o*f-n*c)/Math.max(1e-4,o*o+c*c),g=o/e.skeleton.scaleX,b=c/e.skeleton.scaleY;n=-b*w*e.skeleton.scaleX,f=g*w*e.skeleton.scaleY,d+=Math.atan2(b,g)*X.radDeg;default:let v=t-r.worldX,y=s-r.worldY,S=o*f-n*c;Math.abs(S)<=1e-4?(u=0,m=0):(u=(v*f-y*n)/S-e.ax,m=(y*o-v*c)/S-e.ay)}d+=Math.atan2(m,u)*X.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,p=e.ascaleY;if(i||a){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=s-e.worldY}const w=e.data.length*x;if(w>1e-4){const g=u*u+m*m;if(i&&g<w*w||a&&g>w*w){const b=(Math.sqrt(g)/w-1)*l+1;x*=b,h&&(p*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*l,x,p,e.ashearX,e.ashearY)}apply2(e,t,s,i,a,h,l,r,o){let n=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,u=f,m=d,x=t.ascaleX,p=0,w=0,g=0;f<0?(f=-f,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),x<0?(x=-x,w=180):w=0;let b=t.ax,v=0,y=0,S=0,I=e.a,k=e.b,T=e.c,Y=e.d,E=Math.abs(f-d)<=1e-4;!E||h?(v=0,y=I*b+e.worldX,S=T*b+e.worldY):(v=t.ay,y=I*b+k*v+e.worldX,S=T*b+Y*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");I=F.a,k=F.b,T=F.c,Y=F.d;let P=I*Y-k*T,C=y-F.worldX,M=S-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let V=(C*Y-M*k)*P-n,q=(M*I-C*T)*P-c,L=Math.sqrt(V*V+q*q),G=t.data.length*x,j,$;if(L<1e-4){this.apply1(e,s,i,!1,h,!1,o),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}C=s-F.worldX,M=i-F.worldY;let _=(C*Y-M*k)*P-n,D=(M*I-C*T)*P-c,H=_*_+D*D;if(r!=0){r*=f*(x+1)*.5;let K=Math.sqrt(H),re=K-L-G*f+r;if(re>0){let ie=Math.min(1,re/(r*2))-1;ie=(re-r*(1-ie*ie))/K,_-=ie*_,D-=ie*D,H=_*_+D*D}}e:if(E){G*=f;let K=(H-L*L-G*G)/(2*L*G);K<-1?(K=-1,$=Math.PI*a):K>1?(K=1,$=0,h&&(I=(Math.sqrt(H)/(L+G)-1)*o+1,u*=I,l&&(m*=I))):$=Math.acos(K)*a,I=L+G*K,k=G*Math.sin($),j=Math.atan2(D*I-_*k,_*I+D*k)}else{I=f*G,k=d*G;let K=I*I,re=k*k,ie=Math.atan2(D,_);T=re*L*L+K*H-K*re;let xe=-2*re*L,Ce=re-K;if(Y=xe*xe-4*Ce*T,Y>=0){let ke=Math.sqrt(Y);xe<0&&(ke=-ke),ke=-(xe+ke)*.5;let Ms=ke/Ce,Xs=T/ke,Te=Math.abs(Ms)<Math.abs(Xs)?Ms:Xs;if(Te*Te<=H){M=Math.sqrt(H-Te*Te)*a,j=ie-Math.atan2(M,Te),$=Math.atan2(M/d,(Te-L)/f);break e}}let Ee=X.PI,Je=L-I,Ht=Je*Je,ks=0,Ts=0,Ke=L+I,$t=Ke*Ke,Ys=0;T=-I*L/(K-re),T>=-1&&T<=1&&(T=Math.acos(T),C=I*Math.cos(T)+L,M=k*Math.sin(T),Y=C*C+M*M,Y<Ht&&(Ee=T,Ht=Y,Je=C,ks=M),Y>$t&&(Ts=T,$t=Y,Ke=C,Ys=M)),H<=(Ht+$t)*.5?(j=ie-Math.atan2(ks*a,Je),$=Ee*a):(j=ie-Math.atan2(Ys*a,Ke),$=Ts*a)}let Z=Math.atan2(v,b)*g,de=e.arotation;j=(j-Z)*X.radDeg+p-de,j>180?j-=360:j<-180&&(j+=360),e.updateWorldTransformWith(n,c,de+j*o,u,m,0,0),de=t.arotation,$=(($+Z)*X.radDeg-t.ashearX)*g+w-de,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(b,v,de+$*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Dt=class extends Fe{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},Nt=class extends Fe{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=ze.Fixed;spacingMode=Ge.Fixed;rotateMode=He.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},ze=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(ze||{}),Ge=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Ge||{}),He=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(He||{}),me=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,a=e.bones.length;i<a;i++){let h=t.findBone(e.bones[i].name);if(!h)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(h)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ae))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(s==0&&i==0&&a==0)return;let h=this.data,l=h.rotateMode==0,r=h.rotateMode==2,o=this.bones,n=o.length,c=l?n:n+1,f=R.setArraySize(this.spaces,c),d=r?this.lengths=R.setArraySize(this.lengths,n):[],u=this.spacing;switch(h.spacingMode){case 2:if(r)for(let y=0,S=c-1;y<S;y++){let I=o[y],k=I.data.length,T=k*I.a,Y=k*I.c;d[y]=Math.sqrt(T*T+Y*Y)}R.arrayFill(f,1,c,u);break;case 3:let b=0;for(let y=0,S=c-1;y<S;){let I=o[y],k=I.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*I.a,Y=k*I.c,E=Math.sqrt(T*T+Y*Y);r&&(d[y]=E),f[++y]=E,b+=E}}if(b>0){b=c/b*u;for(let y=1;y<c;y++)f[y]*=b}break;default:let v=h.spacingMode==0;for(let y=0,S=c-1;y<S;){let I=o[y],k=I.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*I.a,Y=k*I.c,E=Math.sqrt(T*T+Y*Y);r&&(d[y]=E),f[++y]=(v?k+u:u)*E/k}}}let m=this.computeWorldPositions(t,c,l),x=m[0],p=m[1],w=h.offsetRotation,g=!1;if(w==0)g=h.rotateMode==1;else{g=!1;let b=this.target.bone;w*=b.a*b.d-b.b*b.c>0?X.degRad:-X.degRad}for(let b=0,v=3;b<n;b++,v+=3){let y=o[b];y.worldX+=(x-y.worldX)*i,y.worldY+=(p-y.worldY)*a;let S=m[v],I=m[v+1],k=S-x,T=I-p;if(r){let Y=d[b];if(Y!=0){let E=(Math.sqrt(k*k+T*T)/Y-1)*s+1;y.a*=E,y.c*=E}}if(x=S,p=I,s>0){let Y=y.a,E=y.b,F=y.c,P=y.d,C=0,M=0,V=0;if(l?C=m[v-1]:f[b+1]==0?C=m[v+2]:C=Math.atan2(T,k),C-=Math.atan2(F,Y),g){M=Math.cos(C),V=Math.sin(C);let q=y.data.length;x+=(q*(M*Y-V*F)-k)*s,p+=(q*(V*Y+M*F)-T)*s}else C+=w;C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C*=s,M=Math.cos(C),V=Math.sin(C),y.a=M*Y-V*F,y.b=M*E-V*P,y.c=V*Y+M*F,y.d=V*E+M*P}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,a=this.position,h=this.spaces,l=R.setArraySize(this.positions,t*3+2),r=this.world,o=e.closed,n=e.worldVerticesLength,c=n/6,f=me.NONE;if(!e.constantSpeed){let q=e.lengths;c-=o?1:2;let L=q[c];this.data.positionMode==1&&(a*=L);let G;switch(this.data.spacingMode){case 2:G=L;break;case 3:G=L/t;break;default:G=1}r=R.setArraySize(this.world,8);for(let j=0,$=0,_=0;j<t;j++,$+=3){let D=h[j]*G;a+=D;let H=a;if(o)H%=L,H<0&&(H+=L),_=0;else if(H<0){f!=me.BEFORE&&(f=me.BEFORE,e.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(H,r,0,l,$);continue}else if(H>L){f!=me.AFTER&&(f=me.AFTER,e.computeWorldVertices(i,n-6,4,r,0,2)),this.addAfterPosition(H-L,r,0,l,$);continue}for(;;_++){let Z=q[_];if(!(H>Z)){if(_==0)H/=Z;else{let de=q[_-1];H=(H-de)/(Z-de)}break}}_!=f&&(f=_,o&&_==c?(e.computeWorldVertices(i,n-4,4,r,0,2),e.computeWorldVertices(i,0,4,r,4,2)):e.computeWorldVertices(i,_*6+2,8,r,0,2)),this.addCurvePosition(H,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],l,$,s||j>0&&D==0)}return l}o?(n+=2,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n-4,r,0,2),e.computeWorldVertices(i,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(c--,n-=4,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n,r,0,2));let d=R.setArraySize(this.curves,c),u=0,m=r[0],x=r[1],p=0,w=0,g=0,b=0,v=0,y=0,S=0,I=0,k=0,T=0,Y=0,E=0,F=0,P=0;for(let q=0,L=2;q<c;q++,L+=6)p=r[L],w=r[L+1],g=r[L+2],b=r[L+3],v=r[L+4],y=r[L+5],S=(m-p*2+g)*.1875,I=(x-w*2+b)*.1875,k=((p-g)*3-m+v)*.09375,T=((w-b)*3-x+y)*.09375,Y=S*2+k,E=I*2+T,F=(p-m)*.75+S+k*.16666667,P=(w-x)*.75+I+T*.16666667,u+=Math.sqrt(F*F+P*P),F+=Y,P+=E,Y+=k,E+=T,u+=Math.sqrt(F*F+P*P),F+=Y,P+=E,u+=Math.sqrt(F*F+P*P),F+=Y+k,P+=E+T,u+=Math.sqrt(F*F+P*P),d[q]=u,m=v,x=y;this.data.positionMode==1&&(a*=u);let C;switch(this.data.spacingMode){case 2:C=u;break;case 3:C=u/t;break;default:C=1}let M=this.segments,V=0;for(let q=0,L=0,G=0,j=0;q<t;q++,L+=3){let $=h[q]*C;a+=$;let _=a;if(o)_%=u,_<0&&(_+=u),G=0;else if(_<0){this.addBeforePosition(_,r,0,l,L);continue}else if(_>u){this.addAfterPosition(_-u,r,n-4,l,L);continue}for(;;G++){let D=d[G];if(!(_>D)){if(G==0)_/=D;else{let H=d[G-1];_=(_-H)/(D-H)}break}}if(G!=f){f=G;let D=G*6;for(m=r[D],x=r[D+1],p=r[D+2],w=r[D+3],g=r[D+4],b=r[D+5],v=r[D+6],y=r[D+7],S=(m-p*2+g)*.03,I=(x-w*2+b)*.03,k=((p-g)*3-m+v)*.006,T=((w-b)*3-x+y)*.006,Y=S*2+k,E=I*2+T,F=(p-m)*.3+S+k*.16666667,P=(w-x)*.3+I+T*.16666667,V=Math.sqrt(F*F+P*P),M[0]=V,D=1;D<8;D++)F+=Y,P+=E,Y+=k,E+=T,V+=Math.sqrt(F*F+P*P),M[D]=V;F+=Y,P+=E,V+=Math.sqrt(F*F+P*P),M[8]=V,F+=Y+k,P+=E+T,V+=Math.sqrt(F*F+P*P),M[9]=V,j=0}for(_*=V;;j++){let D=M[j];if(!(_>D)){if(j==0)_/=D;else{let H=M[j-1];_=j+(_-H)/(D-H)}break}}this.addCurvePosition(_*.1,m,x,p,w,g,b,v,y,l,L,s||q>0&&$==0)}return l}addBeforePosition(e,t,s,i,a){let h=t[s],l=t[s+1],r=t[s+2]-h,o=t[s+3]-l,n=Math.atan2(o,r);i[a]=h+e*Math.cos(n),i[a+1]=l+e*Math.sin(n),i[a+2]=n}addAfterPosition(e,t,s,i,a){let h=t[s+2],l=t[s+3],r=h-t[s],o=l-t[s+1],n=Math.atan2(o,r);i[a]=h+e*Math.cos(n),i[a+1]=l+e*Math.sin(n),i[a+2]=n}addCurvePosition(e,t,s,i,a,h,l,r,o,n,c,f){if(e==0||isNaN(e)){n[c]=t,n[c+1]=s,n[c+2]=Math.atan2(a-s,i-t);return}let d=e*e,u=d*e,m=1-e,x=m*m,p=x*m,w=m*e,g=w*3,b=m*g,v=g*e,y=t*p+i*b+h*v+r*u,S=s*p+a*b+l*v+o*u;n[c]=y,n[c+1]=S,f&&(e<.001?n[c+2]=Math.atan2(a-s,i-t):n[c+2]=Math.atan2(S-(s*x+a*w*2+l*d),y-(t*x+i*w*2+h*d)))}},Ie=me;B(Ie,"NONE",-1),B(Ie,"BEFORE",-2),B(Ie,"AFTER",-3),B(Ie,"epsilon",1e-5);var js=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,r=l.data.length;switch(e){case 0:return;case 1:this.reset();case 2:this.remaining+=Math.max(this.skeleton.time-this.lastTime,0),this.lastTime=this.skeleton.time;const o=l.worldX,n=l.worldY;if(this._reset)this._reset=!1,this.ux=o,this.uy=n;else{let c=this.remaining,f=this.inertia,d=this.data.step;if(s||i){if(s&&(this.xOffset+=(this.ux-o)*f,this.ux=o),i&&(this.yOffset+=(this.uy-n)*f,this.uy=n),c>=d){const u=this.massInverse*d,m=this.strength,x=this.wind*100,p=this.gravity*-100,w=Math.pow(this.damping,60*d);do s&&(this.xVelocity+=(x-this.xOffset*m)*u,this.xOffset+=this.xVelocity*d,this.xVelocity*=w),i&&(this.yVelocity+=(p-this.yOffset*m)*u,this.yOffset+=this.yVelocity*d,this.yVelocity*=w),c-=d;while(c>=d)}s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(a||h){let u=Math.atan2(l.c,l.a),m=0,x=0,p=0;if(a){p=(this.data.rotate+this.data.shearX)*t;let w=this.cx-l.worldX,g=this.cy-l.worldY,b=Math.atan2(g+this.ty,w+this.tx)-u-this.rotateOffset*p;this.rotateOffset+=(b-Math.ceil(b*X.invPI2-.5)*X.PI2)*f,b=this.rotateOffset*p+u,m=Math.cos(b),x=Math.sin(b),h&&(b=r*l.getWorldScaleX(),b>0&&(this.scaleOffset+=(w*m+g*x)*f/b))}else{m=Math.cos(u),x=Math.sin(u);const w=r*l.getWorldScaleX();w>0&&(this.scaleOffset+=((this.cx-l.worldX)*m+(this.cy-l.worldY)*x)*f/w)}if(c=this.remaining,c>=d){const w=this.massInverse*d,g=this.strength,b=this.wind,v=this.gravity,y=Math.pow(this.damping,60*d);for(;;)if(c-=d,h&&(this.scaleVelocity+=(b*m-v*x-this.scaleOffset*g)*w,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=y),a){if(this.rotateVelocity+=(-.01*r*(b*x+v*m)-this.rotateOffset*g)*w,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=y,c<d)break;const S=this.rotateOffset*p+u;m=Math.cos(S),x=Math.sin(S)}else if(c<d)break}}this.remaining=c}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(a){let o=this.rotateOffset*t,n=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=o*this.data.rotate,n=Math.sin(d),c=Math.cos(d),f=l.b,l.b=c*f-n*l.d,l.d=n*f+c*l.d),d+=o*this.data.shearX,n=Math.sin(d),c=Math.cos(d),f=l.a,l.a=c*f-n*l.c,l.c=n*f+c*l.c}else o*=this.data.rotate,n=Math.sin(o),c=Math.cos(o),f=l.a,l.a=c*f-n*l.c,l.c=n*f+c*l.c,f=l.b,l.b=c*f-n*l.d,l.d=n*f+c*l.d}if(h){const o=1+this.scaleOffset*t*this.data.scaleX;l.a*=o,l.c*=o}e!=3&&(this.tx=r*l.a,this.ty=r*l.c),l.updateAppliedTransform()}},ps=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 N,this.darkColor=e.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ne)||!(this.attachment instanceof ne)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Pe;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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,r=this.target,o=r.a,n=r.b,c=r.c,f=r.d,d=o*f-n*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,I=Math.atan2(c,o)-Math.atan2(y,b)+u;I>X.PI?I-=X.PI2:I<-X.PI&&(I+=X.PI2),I*=e;let k=Math.cos(I),T=Math.sin(I);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(l){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*t,g.worldY+=(b.y-g.worldY)*s}if(i!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(o*o+c*c)-b+this.data.offsetScaleX)*i)/b),g.a*=b,g.c*=b}if(a!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(n*n+f*f)-b+this.data.offsetScaleY)*a)/b),g.b*=b,g.d*=b}if(h>0){let b=g.b,v=g.d,y=Math.atan2(v,b),S=Math.atan2(f,n)-Math.atan2(c,o)-(y-Math.atan2(g.c,g.a));S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S=y+(S+m)*h;let I=Math.sqrt(b*b+v*v);g.b=Math.cos(S)*I,g.d=Math.sin(S)*I}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,r=this.target,o=r.a,n=r.b,c=r.c,f=r.d,d=o*f-n*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,I=Math.atan2(c,o)+u;I>X.PI?I-=X.PI2:I<-X.PI&&(I+=X.PI2),I*=e;let k=Math.cos(I),T=Math.sin(I);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(l){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*t,g.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(o*o+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=b,g.c*=b}if(a!=0){let b=(Math.sqrt(n*n+f*f)-1+this.data.offsetScaleY)*a+1;g.b*=b,g.d*=b}if(h>0){let b=Math.atan2(f,n)-Math.atan2(c,o);b>X.PI?b-=X.PI2:b<-X.PI&&(b+=X.PI2);let v=g.b,y=g.d;b=Math.atan2(y,v)+(b-X.PI/2+m)*h;let S=Math.sqrt(v*v+y*y);g.b=Math.cos(b)*S,g.d=Math.sin(b)*S}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,l=this.target,r=this.bones;for(let o=0,n=r.length;o<n;o++){let c=r[o],f=c.arotation;if(e!=0){let w=l.arotation-f+this.data.offsetRotation;w-=Math.ceil(w/360-.5)*360,f+=w*e}let d=c.ax,u=c.ay;d+=(l.ax-d+this.data.offsetX)*t,u+=(l.ay-u+this.data.offsetY)*s;let m=c.ascaleX,x=c.ascaleY;i!=0&&m!=0&&(m=(m+(l.ascaleX-m+this.data.offsetScaleX)*i)/m),a!=0&&x!=0&&(x=(x+(l.ascaleY-x+this.data.offsetScaleY)*a)/x);let p=c.ashearY;if(h!=0){let w=l.ashearY-p+this.data.offsetShearY;w-=Math.ceil(w/360-.5)*360,p+=w*h}c.updateWorldTransformWith(d,u,f,m,x,c.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,l=this.target,r=this.bones;for(let o=0,n=r.length;o<n;o++){let c=r[o],f=c.arotation+(l.arotation+this.data.offsetRotation)*e,d=c.ax+(l.ax+this.data.offsetX)*t,u=c.ay+(l.ay+this.data.offsetY)*s,m=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*i+1),x=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*a+1),p=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,u,f,m,x,c.ashearX,p)}}},vs=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return vs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Bt(s,this,null);else{let a=this.bones[s.parent.index];i=new Bt(s,this,a),a.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],a=new ps(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new ws(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new ys(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ie(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new js(s,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,d=t.length;f<d;f++){let u=t[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,u=this.skin.bones.length;d<u;d++){let m=this.bones[f[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,a=this.pathConstraints,h=this.physicsConstraints,l=s.length,r=i.length,o=a.length,n=this.physicsConstraints.length,c=l+r+o+n;e:for(let f=0;f<c;f++){for(let d=0;d<l;d++){let u=s[d];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let d=0;d<r;d++){let u=i[d];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let d=0;d<o;d++){let u=a[d];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let d=0;d<n;d++){const u=h[d];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let a=s[s.length-1];this.sortBone(a),this._updateCache.push(e),this.sortReset(i.children),a.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,o=this.data.skins.length;r<o;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let a=t.getAttachment();a instanceof Ae&&this.sortPathConstraintAttachmentWith(a,i);let h=e.bones,l=h.length;for(let r=0;r<l;r++)this.sortBone(h[r]);this._updateCache.push(e);for(let r=0;r<l;r++)this.sortReset(h[r].children);for(let r=0;r<l;r++)h[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let a=t[i];this.sortBone(a.parent),this.sortBone(a)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let a in i)this.sortPathConstraintAttachmentWith(i[a],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ae))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let a=0,h=s.length;a<h;){let l=s[a++];for(l+=a;a<l;)this.sortBone(i[s[a++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(!e)throw new Error("physics is undefined");let t=this.bones;for(let i=0,a=t.length;i<a;i++){let h=t[i];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let s=this._updateCache;for(let i=0,a=s.length;i<a;i++)s[i].update(e)}updateWorldTransformWith(e,t){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=t.a,a=t.b,h=t.c,l=t.d;s.worldX=i*this.x+a*this.y+t.worldX,s.worldY=h*this.x+l*this.y+t.worldY;const r=(s.rotation+s.shearX)*X.degRad,o=(s.rotation+90+s.shearY)*X.degRad,n=Math.cos(r)*s.scaleX,c=Math.cos(o)*s.scaleY,f=Math.sin(r)*s.scaleX,d=Math.sin(o)*s.scaleY;s.a=(i*n+a*f)*this.scaleX,s.b=(i*c+a*d)*this.scaleX,s.c=(h*n+l*f)*this.scaleY,s.d=(h*c+l*d)*this.scaleY;let u=this._updateCache;for(let m=0,x=u.length;m<x;m++){let p=u[m];p!=s&&p.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s],h=a.data.attachmentName;if(h){let l=e.getAttachment(s,h);l&&a.setAttachment(l)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let h=s[i];if(h.data.name==e){let l=null;if(t&&(l=this.getAttachment(i,t),!l))throw new Error("Attachment not found: "+t+", for slot: "+e);h.setAttachment(l);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(){let e=new Pe,t=new Pe;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,s=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let i=this.drawOrder,a=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let o=0,n=i.length;o<n;o++){let c=i[o];if(!c.bone.active)continue;let f=0,d=null,u=c.getAttachment();if(u instanceof W)f=8,d=R.setArraySize(s,f,0),u.computeWorldVertices(c,d,0,2);else if(u instanceof Se){let m=u;f=m.worldVerticesLength,d=R.setArraySize(s,f,0),m.computeWorldVertices(c,0,f,d,0,2)}if(d)for(let m=0,x=d.length;m<x;m+=2){let p=d[m],w=d[m+1];a=Math.min(a,p),h=Math.min(h,w),l=Math.max(l,p),r=Math.max(r,w)}}e.set(a,h),t.set(l-a,r-h)}update(e){this.time+=e}},Ss=vs;B(Ss,"yDown",!1);var As=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(As||{}),Is=class extends Fe{_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;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)}},Ot=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;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}},_t=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},$e=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==a){h=!0;break}h||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==a){h=!0;break}h||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==a){h=!0;break}h||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==a){h=!0;break}h||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof Se?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new _t(t,i,a))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new _t(e,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let a=e.slots[i],h=a.getAttachment();if(h&&s<t.attachments.length){let l=t.attachments[s];for(let r in l){let o=l[r];if(h==o){let n=this.getAttachment(s,r);n&&a.setAttachment(n);break}}}s++}}},qt=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=je.Normal;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},je=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(je||{}),Ut=class extends Fe{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},Js=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ot;s.name="";let i=new Cs(e),a=i.readInt32(),h=i.readInt32();s.hash=h==0&&a==0?null:h.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();let l=i.readBoolean();l&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let f=n==0?null:s.bones[i.readInt(!0)],d=new Pt(n,c,f);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.transformMode=i.readInt(!0),d.skinRequired=i.readBoolean(),l&&(N.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new qt(n,c,f);N.rgba8888ToColor(d.color,i.readInt32());let u=i.readInt32();u!=-1&&N.rgb888ToColor(d.darkColor=new N,u),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),l&&(d.visible=i.readBoolean()),s.slots.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Dt(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)],d.mix=i.readFloat(),d.softness=i.readFloat()*t;let u=i.readByte();d.skinRequired=(u&1)!=0,d.bendDirection=u&2?1:-1,d.compress=(u&4)!=0,d.stretch=(u&8)!=0,d.uniform=(u&16)!=0,s.ikConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Ut(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];const u=i.readByte();d.skinRequired=(u&1)!=0,d.local=(u&2)!=0,d.relative=(u&4)!=0,d.offsetRotation=i.readFloat(),d.offsetX=i.readFloat()*t,d.offsetY=i.readFloat()*t,d.offsetScaleX=i.readFloat(),d.offsetScaleY=i.readFloat(),d.offsetShearY=i.readFloat(),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),d.mixScaleX=i.readFloat(),d.mixScaleY=i.readFloat(),d.mixShearY=i.readFloat(),s.transformConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Nt(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)],d.positionMode=i.readInt(!0),d.spacingMode=i.readInt(!0),d.rotateMode=i.readInt(!0),d.offsetRotation=i.readFloat(),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Is(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let u=i.readByte();d.skinRequired=(u&1)!=0,u&2&&(d.x=i.readFloat()),u&4&&(d.y=i.readFloat()),u&8&&(d.rotate=i.readFloat()),u&16&&(d.scaleX=i.readFloat()),u&32&&(d.shearX=i.readFloat()),d.step=1/i.readByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=i.readFloat(),d.wind=i.readFloat()*t,d.gravity=i.readFloat()*t,d.mix=i.readFloat(),u=i.readByte(),u&1&&(d.inertiaGlobal=!0),u&2&&(d.strengthGlobal=!0),u&4&&(d.dampingGlobal=!0),u&8&&(d.massGlobal=!0),u&16&&(d.windGlobal=!0),u&32&&(d.gravityGlobal=!0),u&64&&(d.mixGlobal=!0),s.physicsConstraints.push(d)}let o=this.readSkin(i,s,!0,l);o&&(s.defaultSkin=o,s.skins.push(o));{let n=s.skins.length;for(R.setArraySize(s.skins,r=n+i.readInt(!0));n<r;n++){let c=this.readSkin(i,s,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[n]=c}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let c=this.linkedMeshes[n];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let f=new Lt(c);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let a=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;a=new $e("default")}else{let l=e.readString();if(!l)throw new Error("Skin name must not be null.");a=new $e(l),i&&N.rgba8888ToColor(a.color,e.readInt32()),a.bones.length=e.readInt(!0);for(let r=0,o=a.bones.length;r<o;r++)a.bones[r]=t.bones[e.readInt(!0)];for(let r=0,o=e.readInt(!0);r<o;r++)a.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)a.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)a.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)a.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let l=0;l<h;l++){let r=e.readInt(!0);for(let o=0,n=e.readInt(!0);o<n;o++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,a,r,c,i);f&&a.setAttachment(r,c,f)}}return a}readAttachment(e,t,s,i,a,h){let l=this.scale,r=e.readByte();const o=r&8?e.readStringRef():a;if(!o)throw new Error("Attachment name must not be null");switch(r&7){case ge.Region:{let n=r&16?e.readStringRef():null;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null;let d=e.readFloat(),u=e.readFloat(),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat();n||(n=o);let b=this.attachmentLoader.newRegionAttachment(s,o,n,f);return b?(b.path=n,b.x=u*l,b.y=m*l,b.scaleX=x,b.scaleY=p,b.rotation=d,b.width=w*l,b.height=g*l,N.rgba8888ToColor(b.color,c),b.sequence=f,f==null&&b.updateRegion(),b):null}case ge.BoundingBox:{let n=this.readVertices(e,(r&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,o);return f?(f.worldVerticesLength=n.length,f.vertices=n.vertices,f.bones=n.bones,h&&N.rgba8888ToColor(f.color,c),f):null}case ge.Mesh:{let n=r&16?e.readStringRef():o;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=e.readInt(!0),u=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,u.length,1),x=this.readShortArray(e,(u.length-d-2)*3);let p=[],w=0,g=0;h&&(p=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),n||(n=o);let b=this.attachmentLoader.newMeshAttachment(s,o,n,f);return b?(b.path=n,N.rgba8888ToColor(b.color,c),b.bones=u.bones,b.vertices=u.vertices,b.worldVerticesLength=u.length,b.triangles=x,b.regionUVs=m,f==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=f,h&&(b.edges=p,b.width=w*l,b.height=g*l),b):null}case ge.LinkedMesh:{const n=r&16?e.readStringRef():o;if(n==null)throw new Error("Path of linked mesh must not be null");const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=(r&128)!=0,u=e.readInt(!0),m=e.readStringRef();let x=0,p=0;h&&(x=e.readFloat(),p=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,o,n,f);return w?(w.path=n,N.rgba8888ToColor(w.color,c),w.sequence=f,h&&(w.width=x*l,w.height=p*l),this.linkedMeshes.push(new Ks(w,u,i,m,d)),w):null}case ge.Path:{const n=(r&16)!=0,c=(r&32)!=0,f=this.readVertices(e,(r&64)!=0),d=R.newArray(f.length/6,0);for(let x=0,p=d.length;x<p;x++)d[x]=e.readFloat()*l;const u=h?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=n,m.constantSpeed=c,m.worldVerticesLength=f.length,m.vertices=f.vertices,m.bones=f.bones,m.lengths=d,h&&N.rgba8888ToColor(m.color,u),m):null}case ge.Point:{const n=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,o);return u?(u.x=c*l,u.y=f*l,u.rotation=n,h&&N.rgba8888ToColor(u.color,d),u):null}case ge.Clipping:{const n=e.readInt(!0),c=this.readVertices(e,(r&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,o);return d?(d.endSlot=t.slots[n],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&N.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new et(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),a=new Qs;if(a.length=i<<1,!t)return a.vertices=this.readFloatArray(e,a.length,s),a;let h=new Array,l=new Array;for(let r=0;r<i;r++){let o=e.readInt(!0);l.push(o);for(let n=0;n<o;n++)l.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return a.vertices=R.toFloatArray(h),a.bones=l,a}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let a=0;a<t;a++)i[a]=e.readFloat();else for(let a=0;a<t;a++)i[a]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,a=this.scale;for(let o=0,n=e.readInt(!0);o<n;o++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),x=m-1;switch(u){case hr:{let p=new we(m,c);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readStringRef());i.push(p);break}case cr:{let p=e.readInt(!0),w=new ct(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let I=0,k=0;w.setFrame(I,g,b,v,y,S),I!=x;I++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(I);break;case he:U(e,w,k++,I,0,g,T,b,Y,1),U(e,w,k++,I,1,g,T,v,E,1),U(e,w,k++,I,2,g,T,y,F,1),U(e,w,k++,I,3,g,T,S,P,1)}g=T,b=Y,v=E,y=F,S=P}i.push(w);break}case dr:{let p=e.readInt(!0),w=new dt(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,I=0;w.setFrame(S,g,b,v,y),S!=x;S++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(S);break;case he:U(e,w,I++,S,0,g,k,b,T,1),U(e,w,I++,S,1,g,k,v,Y,1),U(e,w,I++,S,2,g,k,y,E,1)}g=k,b=T,v=Y,y=E}i.push(w);break}case fr:{let p=e.readInt(!0),w=new ut(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,E=0;w.setFrame(Y,g,b,v,y,S,I,k,T),Y!=x;Y++){let F=e.readFloat(),P=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(Y);break;case he:U(e,w,E++,Y,0,g,F,b,P,1),U(e,w,E++,Y,1,g,F,v,C,1),U(e,w,E++,Y,2,g,F,y,M,1),U(e,w,E++,Y,3,g,F,S,V,1),U(e,w,E++,Y,4,g,F,I,q,1),U(e,w,E++,Y,5,g,F,k,L,1),U(e,w,E++,Y,6,g,F,T,G,1)}g=F,b=P,v=C,y=M,S=V,I=q,k=L,T=G}i.push(w);break}case ur:{let p=e.readInt(!0),w=new mt(m,p,c),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,b,v,y,S,I,k),T!=x;T++){let E=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(T);break;case he:U(e,w,Y++,T,0,g,E,b,F,1),U(e,w,Y++,T,1,g,E,v,P,1),U(e,w,Y++,T,2,g,E,y,C,1),U(e,w,Y++,T,3,g,E,S,M,1),U(e,w,Y++,T,4,g,E,I,V,1),U(e,w,Y++,T,5,g,E,k,q,1)}g=E,b=F,v=P,y=C,S=M,I=V,k=q}i.push(w);break}case mr:{let p=new ft(m,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,v=0;p.setFrame(b,w,g),b!=x;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(b);break;case he:U(e,p,v++,b,0,w,y,g,S,1)}w=y,g=S}i.push(p)}}}}for(let o=0,n=e.readInt(!0);o<n;o++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),x=e.readInt(!0);switch(u){case Zs:i.push(Q(e,new Me(m,x,c),1));break;case er:i.push(Wt(e,new tt(m,x,c),a));break;case tr:i.push(Q(e,new st(m,x,c),a));break;case sr:i.push(Q(e,new rt(m,x,c),a));break;case rr:i.push(Wt(e,new it(m,x,c),1));break;case ir:i.push(Q(e,new at(m,x,c),1));break;case ar:i.push(Q(e,new nt(m,x,c),1));break;case nr:i.push(Wt(e,new lt(m,x,c),1));break;case lr:i.push(Q(e,new ot(m,x,c),1));break;case or:i.push(Q(e,new ht(m,x,c),1))}}}for(let o=0,n=e.readInt(!0);o<n;o++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new xt(f,e.readInt(!0),c),m=e.readFloat(),x=e.readFloat(),p=e.readFloat()*a;for(let w=0,g=0;;w++){const b=e.readByte();if(u.setFrame(w,m,x,p,e.readByte(),(b&1)!=0,(b&2)!=0),w==d)break;let v=e.readFloat(),y=e.readFloat(),S=e.readFloat()*a;switch(e.readByte()){case oe:u.setStepped(w);break;case he:U(e,u,g++,w,0,m,v,x,y,1),U(e,u,g++,w,1,m,v,p,S,a)}m=v,x=y,p=S}i.push(u)}for(let o=0,n=e.readInt(!0);o<n;o++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new bt(f,e.readInt(!0),c),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;u.setFrame(y,m,x,p,w,g,b,v),y!=d;y++){let I=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),E=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case oe:u.setStepped(y);break;case he:U(e,u,S++,y,0,m,I,x,k,1),U(e,u,S++,y,1,m,I,p,T,1),U(e,u,S++,y,2,m,I,w,Y,1),U(e,u,S++,y,3,m,I,g,E,1),U(e,u,S++,y,4,m,I,b,F,1),U(e,u,S++,y,5,m,I,v,P,1)}m=I,x=k,p=T,w=Y,g=E,b=F,v=P}i.push(u)}for(let o=0,n=e.readInt(!0);o<n;o++){let c=e.readInt(!0),f=s.pathConstraints[c];for(let d=0,u=e.readInt(!0);d<u;d++){const m=e.readByte(),x=e.readInt(!0),p=e.readInt(!0);switch(m){case br:i.push(Q(e,new wt(x,p,c),f.positionMode==0?a:1));break;case wr:i.push(Q(e,new pt(x,p,c),f.spacingMode==0||f.spacingMode==1?a:1));break;case pr:let w=new yt(x,p,c),g=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,I=0,k=w.getFrameCount()-1;w.setFrame(S,g,b,v,y),S!=k;S++){let T=e.readFloat(),Y=e.readFloat(),E=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:w.setStepped(S);break;case he:U(e,w,I++,S,0,g,T,b,Y,1),U(e,w,I++,S,1,g,T,v,E,1),U(e,w,I++,S,2,g,T,y,F,1)}g=T,b=Y,v=E,y=F}i.push(w)}}}for(let o=0,n=e.readInt(!0);o<n;o++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const u=e.readByte(),m=e.readInt(!0);if(u==Tr){const p=new De(m,c);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat());i.push(p);continue}const x=e.readInt(!0);switch(u){case yr:i.push(Q(e,new vt(m,x,c),1));break;case vr:i.push(Q(e,new St(m,x,c),1));break;case Sr:i.push(Q(e,new At(m,x,c),1));break;case Ar:i.push(Q(e,new It(m,x,c),1));break;case Ir:i.push(Q(e,new Ct(m,x,c),a));break;case Cr:i.push(Q(e,new kt(m,x,c),a));break;case kr:i.push(Q(e,new Tt(m,x,c),1))}}}for(let o=0,n=e.readInt(!0);o<n;o++){let c=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readInt(!0);for(let m=0,x=e.readInt(!0);m<x;m++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let w=c.getAttachment(u,p),g=e.readByte(),b=e.readInt(!0),v=b-1;switch(g){case gr:{let y=w,S=y.bones,I=y.vertices,k=S?I.length/3*2:I.length,T=e.readInt(!0),Y=new gt(b,T,u,y),E=e.readFloat();for(let F=0,P=0;;F++){let C,M=e.readInt(!0);if(M==0)C=S?R.newFloatArray(k):I;else{C=R.newFloatArray(k);let q=e.readInt(!0);if(M+=q,a==1)for(let L=q;L<M;L++)C[L]=e.readFloat();else for(let L=q;L<M;L++)C[L]=e.readFloat()*a;if(!S)for(let L=0,G=C.length;L<G;L++)C[L]+=I[L]}if(Y.setFrame(F,E,C),F==v)break;let V=e.readFloat();switch(e.readByte()){case oe:Y.setStepped(F);break;case he:U(e,Y,P++,F,0,E,V,0,1,1)}E=V}i.push(Y);break}case xr:{let y=new ve(b,u,w);for(let S=0;S<b;S++){let I=e.readFloat(),k=e.readInt32();y.setFrame(S,I,es[k&15],k>>4,e.readFloat())}i.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let o=new pe(h),n=s.slots.length;for(let c=0;c<h;c++){let f=e.readFloat(),d=e.readInt(!0),u=R.newArray(n,0);for(let w=n-1;w>=0;w--)u[w]=-1;let m=R.newArray(n-d,0),x=0,p=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;x!=g;)m[p++]=x++;u[x+e.readInt(!0)]=x++}for(;x<n;)m[p++]=x++;for(let w=n-1;w>=0;w--)u[w]==-1&&(u[w]=m[--p]);o.setFrame(c,f,u)}i.push(o)}let l=e.readInt(!0);if(l>0){let o=new Xe(l);for(let n=0;n<l;n++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new Vt(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),o.setFrame(n,d)}i.push(o)}let r=0;for(let o=0,n=i.length;o<n;o++)r=Math.max(r,i[o].getDuration());return new Ve(t,i,r)}},Cs=class{constructor(e,t=new Array,s=0,i=new DataView(e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let a=this.readUnsignedByte();switch(a>>4){case 12:case 13:t+=String.fromCharCode((a&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((a&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(a),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ks=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}},Qs=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}},ge=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(ge||{});function Q(e,t,s){let i=e.readFloat(),a=e.readFloat()*s;for(let h=0,l=0,r=t.getFrameCount()-1;t.setFrame(h,i,a),h!=r;h++){let o=e.readFloat(),n=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(h);break;case he:U(e,t,l++,h,0,i,o,a,n,s)}i=o,a=n}return t}function Wt(e,t,s){let i=e.readFloat(),a=e.readFloat()*s,h=e.readFloat()*s;for(let l=0,r=0,o=t.getFrameCount()-1;t.setFrame(l,i,a,h),l!=o;l++){let n=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(l);break;case he:U(e,t,r++,l,0,i,n,a,c,s),U(e,t,r++,l,1,i,n,h,f,s)}i=n,a=c,h=f}return t}function U(e,t,s,i,a,h,l,r,o,n){t.setBezier(s,i,a,h,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,l,o)}var Zs=0,er=1,tr=2,sr=3,rr=4,ir=5,ar=6,nr=7,lr=8,or=9,hr=0,cr=1,dr=2,fr=3,ur=4,mr=5,gr=0,xr=1,br=0,wr=1,pr=2,yr=0,vr=1,Sr=2,Ar=4,Ir=5,Cr=6,kr=7,Tr=8,oe=1,he=2,Yr=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ye(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,h=e.slots,l=h.length;s.length=0,a.freeAll(i),i.length=0;for(let r=0;r<l;r++){let o=h[r];if(!o.bone.active)continue;let n=o.getAttachment();if(n instanceof qe){let c=n;s.push(c);let f=a.obtain();f.length!=c.worldVerticesLength&&(f=R.newFloatArray(c.worldVerticesLength)),i.push(f),c.computeWorldVertices(o,0,c.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let h=0,l=a.length;h<l;h++){let r=a[h],o=r;for(let n=0,c=r.length;n<c;n+=2){let f=o[n],d=o[n+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let a=this.minX,h=this.minY,l=this.maxX,r=this.maxY;if(e<=a&&s<=a||t<=h&&i<=h||e>=l&&s>=l||t>=r&&i>=r)return!1;let o=(i-t)/(s-e),n=o*(a-e)+t;if(n>h&&n<r||(n=o*(l-e)+t,n>h&&n<r))return!0;let c=(h-t)/o+e;return c>a&&c<l||(c=(r-t)/o+e,c>a&&c<l)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,a=e.length,h=a-2,l=!1;for(let r=0;r<a;r+=2){let o=i[r+1],n=i[h+1];if(o<s&&n>=s||n<s&&o>=s){let c=i[r];c+(s-o)/(n-o)*(i[h]-c)<t&&(l=!l)}h=r}return l}intersectsSegment(e,t,s,i){let a=this.polygons;for(let h=0,l=a.length;h<l;h++)if(this.intersectsSegmentPolygon(a[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,a){let h=e,l=e.length,r=t-i,o=s-a,n=t*a-s*i,c=h[l-2],f=h[l-1];for(let d=0;d<l;d+=2){let u=h[d],m=h[d+1],x=c*m-f*u,p=c-u,w=f-m,g=r*w-o*p,b=(n*p-r*x)/g;if((b>=c&&b<=u||b>=u&&b<=c)&&(b>=t&&b<=i||b>=i&&b<=t)){let v=(n*w-o*x)/g;if((v>=f&&v<=m||v>=m&&v<=f)&&(v>=s&&v<=a||v>=a&&v<=s))return!0}c=u,f=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},te=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ye(()=>new Array);polygonIndicesPool=new Ye(()=>new Array);triangulate(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let l=0;l<s;l++)i[l]=l;let a=this.isConcaveArray;a.length=0;for(let l=0,r=s;l<r;++l)a[l]=te.isConcave(l,s,t,i);let h=this.triangles;for(h.length=0;s>3;){let l=s-1,r=0,o=1;for(;;){e:if(!a[r]){let f=i[l]<<1,d=i[r]<<1,u=i[o]<<1,m=t[f],x=t[f+1],p=t[d],w=t[d+1],g=t[u],b=t[u+1];for(let v=(o+1)%s;v!=l;v=(v+1)%s){if(!a[v])continue;let y=i[v]<<1,S=t[y],I=t[y+1];if(te.positiveArea(g,b,m,x,S,I)&&te.positiveArea(m,x,p,w,S,I)&&te.positiveArea(p,w,g,b,S,I))break e}break}if(o==0){do{if(!a[r])break;r--}while(r>0);break}l=r,r=o,o=(o+1)%s}h.push(i[(s+r-1)%s]),h.push(i[r]),h.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let n=(s+r-1)%s,c=r==s?0:r;a[n]=te.isConcave(n,s,t,i),a[c]=te.isConcave(c,s,t,i)}return s==3&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let l=this.polygonPool.obtain();l.length=0;let r=-1,o=0;for(let n=0,c=t.length;n<c;n+=3){let f=t[n]<<1,d=t[n+1]<<1,u=t[n+2]<<1,m=s[f],x=s[f+1],p=s[d],w=s[d+1],g=s[u],b=s[u+1],v=!1;if(r==f){let y=l.length-4,S=te.winding(l[y],l[y+1],l[y+2],l[y+3],g,b),I=te.winding(g,b,l[0],l[1],l[2],l[3]);S==o&&I==o&&(l.push(g),l.push(b),h.push(u),v=!0)}v||(l.length>0?(i.push(l),a.push(h)):(this.polygonPool.free(l),this.polygonIndicesPool.free(h)),l=this.polygonPool.obtain(),l.length=0,l.push(m),l.push(x),l.push(p),l.push(w),l.push(g),l.push(b),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(f),h.push(d),h.push(u),o=te.winding(m,x,p,w,g,b),r=f)}l.length>0&&(i.push(l),a.push(h));for(let n=0,c=i.length;n<c;n++){if(h=a[n],h.length==0)continue;let f=h[0],d=h[h.length-1];l=i[n];let u=l.length-4,m=l[u],x=l[u+1],p=l[u+2],w=l[u+3],g=l[0],b=l[1],v=l[2],y=l[3],S=te.winding(m,x,p,w,g,b);for(let I=0;I<c;I++){if(I==n)continue;let k=a[I];if(k.length!=3)continue;let T=k[0],Y=k[1],E=k[2],F=i[I],P=F[F.length-2],C=F[F.length-1];if(T!=f||Y!=d)continue;let M=te.winding(m,x,p,w,P,C),V=te.winding(P,C,g,b,v,y);M==S&&V==S&&(F.length=0,k.length=0,l.push(P),l.push(C),h.push(E),m=p,x=w,p=P,w=C,I=0)}}for(let n=i.length-1;n>=0;n--)l=i[n],l.length==0&&(i.splice(n,1),this.polygonPool.free(l),h=a[n],a.splice(n,1),this.polygonIndicesPool.free(h));return i}static isConcave(e,t,s,i){let a=i[(t+e-1)%t]<<1,h=i[e]<<1,l=i[(e+1)%t]<<1;return!this.positiveArea(s[a],s[a+1],s[h],s[h+1],s[l],s[l+1])}static positiveArea(e,t,s,i,a,h){return e*(h-i)+s*(t-h)+a*(i-t)>=0}static winding(e,t,s,i,a,h){let l=s-e,r=i-t;return a*r-h*l+l*t-e*r>=0?1:-1}},zt=class{triangulator=new te;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let a=this.clippingPolygon;zt.makeClockwise(a);let h=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let l=0,r=h.length;l<r;l++){let o=h[l];zt.makeClockwise(o),o.push(o[0]),o.push(o[1])}return h.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,a,h,l,r){let o=this.clipOutput,n=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,u=r?12:8,m=0;n.length=0,c.length=0;e:for(let x=0;x<i;x+=3){let p=s[x]<<1,w=e[p],g=e[p+1],b=a[p],v=a[p+1];p=s[x+1]<<1;let y=e[p],S=e[p+1],I=a[p],k=a[p+1];p=s[x+2]<<1;let T=e[p],Y=e[p+1],E=a[p],F=a[p+1];for(let P=0;P<d;P++){let C=n.length;if(this.clip(w,g,y,S,T,Y,f[P],o)){let M=o.length;if(M==0)continue;let V=S-Y,q=T-y,L=w-T,G=Y-g,j=1/(V*L+q*(g-Y)),$=M>>1,_=this.clipOutput,D=R.setArraySize(n,C+$*u);for(let Z=0;Z<M;Z+=2){let de=_[Z],K=_[Z+1];D[C]=de,D[C+1]=K,D[C+2]=h.r,D[C+3]=h.g,D[C+4]=h.b,D[C+5]=h.a;let re=de-T,ie=K-Y,xe=(V*re+q*ie)*j,Ce=(G*re+L*ie)*j,Ee=1-xe-Ce;D[C+6]=b*xe+I*Ce+E*Ee,D[C+7]=v*xe+k*Ce+F*Ee,r&&(D[C+8]=l.r,D[C+9]=l.g,D[C+10]=l.b,D[C+11]=l.a),C+=u}C=c.length;let H=R.setArraySize(c,C+3*($-2));$--;for(let Z=1;Z<$;Z++)H[C]=m,H[C+1]=m+Z,H[C+2]=m+Z+1,C+=3;m+=$+1}else{let M=R.setArraySize(n,C+3*u);M[C]=w,M[C+1]=g,M[C+2]=h.r,M[C+3]=h.g,M[C+4]=h.b,M[C+5]=h.a,r?(M[C+6]=b,M[C+7]=v,M[C+8]=l.r,M[C+9]=l.g,M[C+10]=l.b,M[C+11]=l.a,M[C+12]=y,M[C+13]=S,M[C+14]=h.r,M[C+15]=h.g,M[C+16]=h.b,M[C+17]=h.a,M[C+18]=I,M[C+19]=k,M[C+20]=l.r,M[C+21]=l.g,M[C+22]=l.b,M[C+23]=l.a,M[C+24]=T,M[C+25]=Y,M[C+26]=h.r,M[C+27]=h.g,M[C+28]=h.b,M[C+29]=h.a,M[C+30]=E,M[C+31]=F,M[C+32]=l.r,M[C+33]=l.g,M[C+34]=l.b,M[C+35]=l.a):(M[C+6]=b,M[C+7]=v,M[C+8]=y,M[C+9]=S,M[C+10]=h.r,M[C+11]=h.g,M[C+12]=h.b,M[C+13]=h.a,M[C+14]=I,M[C+15]=k,M[C+16]=T,M[C+17]=Y,M[C+18]=h.r,M[C+19]=h.g,M[C+20]=h.b,M[C+21]=h.a,M[C+22]=E,M[C+23]=F),C=c.length;let V=R.setArraySize(c,C+3);V[C]=m,V[C+1]=m+1,V[C+2]=m+2,m+=3;continue e}}}}clip(e,t,s,i,a,h,l,r){let o=r,n=!1,c;l.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(e),c.push(t),c.push(s),c.push(i),c.push(a),c.push(h),c.push(e),c.push(t),r.length=0;let f=l,d=l.length-4;for(let u=0;;u+=2){let m=f[u],x=f[u+1],p=f[u+2],w=f[u+3],g=m-p,b=x-w,v=c,y=c.length-2,S=r.length;for(let k=0;k<y;k+=2){let T=v[k],Y=v[k+1],E=v[k+2],F=v[k+3],P=g*(F-w)-b*(E-p)>0;if(g*(Y-w)-b*(T-p)>0){if(P){r.push(E),r.push(F);continue}let C=F-Y,M=E-T,V=C*(p-m)-M*(w-x);if(Math.abs(V)>1e-6){let q=(M*(x-Y)-C*(m-T))/V;r.push(m+(p-m)*q),r.push(x+(w-x)*q)}else r.push(m),r.push(x)}else if(P){let C=F-Y,M=E-T,V=C*(p-m)-M*(w-x);if(Math.abs(V)>1e-6){let q=(M*(x-Y)-C*(m-T))/V;r.push(m+(p-m)*q),r.push(x+(w-x)*q)}else r.push(m),r.push(x);r.push(E),r.push(F)}n=!0}if(S==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==d)break;let I=r;r=c,r.length=0,c=I}if(o!=r){o.length=0;for(let u=0,m=r.length-2;u<m;u++)o[u]=r[u]}else o.length=o.length-2;return n}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],a=0,h=0,l=0,r=0;for(let o=0,n=s-3;o<n;o+=2)a=t[o],h=t[o+1],l=t[o+2],r=t[o+3],i+=a*r-l*h;if(!(i<0))for(let o=0,n=s-2,c=s>>1;o<c;o+=2){let f=t[o],d=t[o+1],u=n-o;t[o]=t[u],t[o+1]=t[u+1],t[u]=f,t[u+1]=d}}},Mr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ot,i=typeof e=="string"?JSON.parse(e):e,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.fps=a.fps,s.imagesPath=a.images),i.bones)for(let h=0;h<i.bones.length;h++){let l=i.bones[h],r=null,o=A(l,"parent",null);o&&(r=s.findBone(o));let n=new Pt(s.bones.length,l.name,r);n.length=A(l,"length",0)*t,n.x=A(l,"x",0)*t,n.y=A(l,"y",0)*t,n.rotation=A(l,"rotation",0),n.scaleX=A(l,"scaleX",1),n.scaleY=A(l,"scaleY",1),n.shearX=A(l,"shearX",0),n.shearY=A(l,"shearY",0),n.transformMode=R.enumValue(We,A(l,"transform","Normal")),n.skinRequired=A(l,"skin",!1);let c=A(l,"color",null);c&&n.color.setFromString(c),s.bones.push(n)}if(i.slots)for(let h=0;h<i.slots.length;h++){let l=i.slots[h],r=s.findBone(l.bone);if(!r)throw new Error(`Couldn't find bone ${l.bone} for slot ${l.name}`);let o=new qt(s.slots.length,l.name,r),n=A(l,"color",null);n&&o.color.setFromString(n);let c=A(l,"dark",null);c&&(o.darkColor=N.fromString(c)),o.attachmentName=A(l,"attachment",null),o.blendMode=R.enumValue(je,A(l,"blend","normal")),s.slots.push(o)}if(i.ik)for(let h=0;h<i.ik.length;h++){let l=i.ik[h],r=new Dt(l.name);r.order=A(l,"order",0),r.skinRequired=A(l,"skin",!1);for(let n=0;n<l.bones.length;n++){let c=s.findBone(l.bones[n]);if(!c)throw new Error(`Couldn't find bone ${l.bones[n]} for IK constraint ${l.name}.`);r.bones.push(c)}let o=s.findBone(l.target);if(!o)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);r.target=o,r.mix=A(l,"mix",1),r.softness=A(l,"softness",0)*t,r.bendDirection=A(l,"bendPositive",!0)?1:-1,r.compress=A(l,"compress",!1),r.stretch=A(l,"stretch",!1),r.uniform=A(l,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let h=0;h<i.transform.length;h++){let l=i.transform[h],r=new Ut(l.name);r.order=A(l,"order",0),r.skinRequired=A(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let f=l.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${l.name}.`);r.bones.push(d)}let o=l.target,n=s.findBone(o);if(!n)throw new Error(`Couldn't find target bone ${o} for transform constraint ${l.name}.`);r.target=n,r.local=A(l,"local",!1),r.relative=A(l,"relative",!1),r.offsetRotation=A(l,"rotation",0),r.offsetX=A(l,"x",0)*t,r.offsetY=A(l,"y",0)*t,r.offsetScaleX=A(l,"scaleX",0),r.offsetScaleY=A(l,"scaleY",0),r.offsetShearY=A(l,"shearY",0),r.mixRotate=A(l,"mixRotate",1),r.mixX=A(l,"mixX",1),r.mixY=A(l,"mixY",r.mixX),r.mixScaleX=A(l,"mixScaleX",1),r.mixScaleY=A(l,"mixScaleY",r.mixScaleX),r.mixShearY=A(l,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let h=0;h<i.path.length;h++){let l=i.path[h],r=new Nt(l.name);r.order=A(l,"order",0),r.skinRequired=A(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let f=l.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${l.name}.`);r.bones.push(d)}let o=l.target,n=s.findSlot(o);if(!n)throw new Error(`Couldn't find target slot ${o} for path constraint ${l.name}.`);r.target=n,r.positionMode=R.enumValue(ze,A(l,"positionMode","Percent")),r.spacingMode=R.enumValue(Ge,A(l,"spacingMode","Length")),r.rotateMode=R.enumValue(He,A(l,"rotateMode","Tangent")),r.offsetRotation=A(l,"rotation",0),r.position=A(l,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=A(l,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=A(l,"mixRotate",1),r.mixX=A(l,"mixX",1),r.mixY=A(l,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let h=0;h<i.physics.length;h++){const l=i.physics[h],r=new Is(l.name);r.order=A(l,"order",0),r.skinRequired=A(l,"skin",!1);const o=l.bone,n=s.findBone(o);if(n==null)throw new Error("Physics bone not found: "+o);r.bone=n,r.x=A(l,"x",0),r.y=A(l,"y",0),r.rotate=A(l,"rotate",0),r.scaleX=A(l,"scaleX",0),r.shearX=A(l,"shearX",0),r.step=1/A(l,"fps",60),r.inertia=A(l,"inertia",1),r.strength=A(l,"strength",100),r.damping=A(l,"damping",1),r.massInverse=1/A(l,"mass",1),r.wind=A(l,"wind",0)*t,r.gravity=A(l,"gravity",0)*t,r.mix=A(l,"mix",1),r.inertiaGlobal=A(l,"inertiaGlobal",!1),r.strengthGlobal=A(l,"strengthGlobal",!1),r.dampingGlobal=A(l,"dampingGlobal",!1),r.massGlobal=A(l,"massGlobal",!1),r.windGlobal=A(l,"windGlobal",!1),r.gravityGlobal=A(l,"gravityGlobal",!1),r.mixGlobal=A(l,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let h=0;h<i.skins.length;h++){let l=i.skins[h],r=new $e(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){let n=l.bones[o],c=s.findBone(n);if(!c)throw new Error(`Couldn't find bone ${n} for skin ${l.name}.`);r.bones.push(c)}if(l.ik)for(let o=0;o<l.ik.length;o++){let n=l.ik[o],c=s.findIkConstraint(n);if(!c)throw new Error(`Couldn't find IK constraint ${n} for skin ${l.name}.`);r.constraints.push(c)}if(l.transform)for(let o=0;o<l.transform.length;o++){let n=l.transform[o],c=s.findTransformConstraint(n);if(!c)throw new Error(`Couldn't find transform constraint ${n} for skin ${l.name}.`);r.constraints.push(c)}if(l.path)for(let o=0;o<l.path.length;o++){let n=l.path[o],c=s.findPathConstraint(n);if(!c)throw new Error(`Couldn't find path constraint ${n} for skin ${l.name}.`);r.constraints.push(c)}if(l.physics)for(let o=0;o<l.physics.length;o++){let n=l.physics[o],c=s.findPhysicsConstraint(n);if(!c)throw new Error(`Couldn't find physics constraint ${n} for skin ${l.name}.`);r.constraints.push(c)}for(let o in l.attachments){let n=s.findSlot(o);if(!n)throw new Error(`Couldn't find slot ${o} for skin ${l.name}.`);let c=l.attachments[o];for(let f in c){let d=this.readAttachment(c[f],r,n.index,f,s);d&&r.setAttachment(n.index,f,d)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let r=this.linkedMeshes[h],o=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let n=o.getAttachment(r.slotIndex,r.parent);if(!n)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let l=i.events[h],r=new Lt(h);r.intValue=A(l,"int",0),r.floatValue=A(l,"float",0),r.stringValue=A(l,"string",""),r.audioPath=A(l,"audio",null),r.audioPath&&(r.volume=A(l,"volume",1),r.balance=A(l,"balance",0)),s.events.push(r)}if(i.animations)for(let h in i.animations){let l=i.animations[h];this.readAnimation(l,h,s)}return s}readAttachment(e,t,s,i,a){let h=this.scale;switch(i=A(e,"name",i),A(e,"type","region")){case"region":{let l=A(e,"path",i),r=this.readSequence(A(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,i,l,r);if(!o)return null;o.path=l,o.x=A(e,"x",0)*h,o.y=A(e,"y",0)*h,o.scaleX=A(e,"scaleX",1),o.scaleY=A(e,"scaleY",1),o.rotation=A(e,"rotation",0),o.width=e.width*h,o.height=e.height*h,o.sequence=r;let n=A(e,"color",null);return n&&o.color.setFromString(n),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!l)return null;this.readVertices(e,l,e.vertexCount<<1);let r=A(e,"color",null);return r&&l.color.setFromString(r),l}case"mesh":case"linkedmesh":{let l=A(e,"path",i),r=this.readSequence(A(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,i,l,r);if(!o)return null;o.path=l;let n=A(e,"color",null);n&&o.color.setFromString(n),o.width=A(e,"width",0)*h,o.height=A(e,"height",0)*h,o.sequence=r;let c=A(e,"parent",null);if(c)return this.linkedMeshes.push(new Xr(o,A(e,"skin",null),s,c,A(e,"timelines",!0))),o;let f=e.uvs;return this.readVertices(e,o,f.length),o.triangles=e.triangles,o.regionUVs=f,o.region!=null&&o.updateRegion(),o.edges=A(e,"edges",null),o.hullLength=A(e,"hull",0)*2,o}case"path":{let l=this.attachmentLoader.newPathAttachment(t,i);if(!l)return null;l.closed=A(e,"closed",!1),l.constantSpeed=A(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,l,r<<1);let o=R.newArray(r/3,0);for(let c=0;c<e.lengths.length;c++)o[c]=e.lengths[c]*h;l.lengths=o;let n=A(e,"color",null);return n&&l.color.setFromString(n),l}case"point":{let l=this.attachmentLoader.newPointAttachment(t,i);if(!l)return null;l.x=A(e,"x",0)*h,l.y=A(e,"y",0)*h,l.rotation=A(e,"rotation",0);let r=A(e,"color",null);return r&&l.color.setFromString(r),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(t,i);if(!l)return null;let r=A(e,"end",null);r&&(l.endSlot=a.findSlot(r));let o=e.vertexCount;this.readVertices(e,l,o<<1);let n=A(e,"color",null);return n&&l.color.setFromString(n),l}}return null}readSequence(e){if(e==null)return null;let t=new et(A(e,"count",0));return t.start=A(e,"start",1),t.digits=A(e,"digits",0),t.setupIndex=A(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let a=e.vertices;if(s==a.length){let r=R.toFloatArray(a);if(i!=1)for(let o=0,n=a.length;o<n;o++)r[o]*=i;t.vertices=r;return}let h=new Array,l=new Array;for(let r=0,o=a.length;r<o;){let n=a[r++];l.push(n);for(let c=r+n*4;r<c;r+=4)l.push(a[r]),h.push(a[r+1]*i),h.push(a[r+2]*i),h.push(a[r+3])}t.bones=l,t.vertices=R.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,a=new Array;if(e.slots)for(let l in e.slots){let r=e.slots[l],o=s.findSlot(l);if(!o)throw new Error("Slot not found: "+l);let n=o.index;for(let c in r){let f=r[c];if(!f)continue;let d=f.length;if(c=="attachment"){let u=new we(d,n);for(let m=0;m<d;m++){let x=f[m];u.setFrame(m,A(x,"time",0),A(x,"name",null))}a.push(u)}else if(c=="rgba"){let u=new ct(d,d<<2,n),m=f[0],x=A(m,"time",0),p=N.fromString(m.color);for(let w=0,g=0;;w++){u.setFrame(w,x,p.r,p.g,p.b,p.a);let b=f[w+1];if(!b){u.shrink(g);break}let v=A(b,"time",0),y=N.fromString(b.color),S=m.curve;S&&(g=z(S,u,g,w,0,x,v,p.r,y.r,1),g=z(S,u,g,w,1,x,v,p.g,y.g,1),g=z(S,u,g,w,2,x,v,p.b,y.b,1),g=z(S,u,g,w,3,x,v,p.a,y.a,1)),x=v,p=y,m=b}a.push(u)}else if(c=="rgb"){let u=new dt(d,d*3,n),m=f[0],x=A(m,"time",0),p=N.fromString(m.color);for(let w=0,g=0;;w++){u.setFrame(w,x,p.r,p.g,p.b);let b=f[w+1];if(!b){u.shrink(g);break}let v=A(b,"time",0),y=N.fromString(b.color),S=m.curve;S&&(g=z(S,u,g,w,0,x,v,p.r,y.r,1),g=z(S,u,g,w,1,x,v,p.g,y.g,1),g=z(S,u,g,w,2,x,v,p.b,y.b,1)),x=v,p=y,m=b}a.push(u)}else if(c=="alpha")a.push(ce(f,new ft(d,d,n),0,1));else if(c=="rgba2"){let u=new ut(d,d*7,n),m=f[0],x=A(m,"time",0),p=N.fromString(m.light),w=N.fromString(m.dark);for(let g=0,b=0;;g++){u.setFrame(g,x,p.r,p.g,p.b,p.a,w.r,w.g,w.b);let v=f[g+1];if(!v){u.shrink(b);break}let y=A(v,"time",0),S=N.fromString(v.light),I=N.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,g,0,x,y,p.r,S.r,1),b=z(k,u,b,g,1,x,y,p.g,S.g,1),b=z(k,u,b,g,2,x,y,p.b,S.b,1),b=z(k,u,b,g,3,x,y,p.a,S.a,1),b=z(k,u,b,g,4,x,y,w.r,I.r,1),b=z(k,u,b,g,5,x,y,w.g,I.g,1),b=z(k,u,b,g,6,x,y,w.b,I.b,1)),x=y,p=S,w=I,m=v}a.push(u)}else if(c=="rgb2"){let u=new mt(d,d*6,n),m=f[0],x=A(m,"time",0),p=N.fromString(m.light),w=N.fromString(m.dark);for(let g=0,b=0;;g++){u.setFrame(g,x,p.r,p.g,p.b,w.r,w.g,w.b);let v=f[g+1];if(!v){u.shrink(b);break}let y=A(v,"time",0),S=N.fromString(v.light),I=N.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,g,0,x,y,p.r,S.r,1),b=z(k,u,b,g,1,x,y,p.g,S.g,1),b=z(k,u,b,g,2,x,y,p.b,S.b,1),b=z(k,u,b,g,3,x,y,w.r,I.r,1),b=z(k,u,b,g,4,x,y,w.g,I.g,1),b=z(k,u,b,g,5,x,y,w.b,I.b,1)),x=y,p=S,w=I,m=v}a.push(u)}}}if(e.bones)for(let l in e.bones){let r=e.bones[l],o=s.findBone(l);if(!o)throw new Error("Bone not found: "+l);let n=o.index;for(let c in r){let f=r[c],d=f.length;if(d!=0){if(c==="rotate")a.push(ce(f,new Me(d,d,n),0,1));else if(c==="translate"){let u=new tt(d,d<<1,n);a.push(Gt(f,u,"x","y",0,i))}else if(c==="translatex"){let u=new st(d,d,n);a.push(ce(f,u,0,i))}else if(c==="translatey"){let u=new rt(d,d,n);a.push(ce(f,u,0,i))}else if(c==="scale"){let u=new it(d,d<<1,n);a.push(Gt(f,u,"x","y",1,1))}else if(c==="scalex"){let u=new at(d,d,n);a.push(ce(f,u,1,1))}else if(c==="scaley"){let u=new nt(d,d,n);a.push(ce(f,u,1,1))}else if(c==="shear"){let u=new lt(d,d<<1,n);a.push(Gt(f,u,"x","y",0,1))}else if(c==="shearx"){let u=new ot(d,d,n);a.push(ce(f,u,0,1))}else if(c==="sheary"){let u=new ht(d,d,n);a.push(ce(f,u,0,1))}}}}if(e.ik)for(let l in e.ik){let r=e.ik[l],o=r[0];if(!o)continue;let n=s.findIkConstraint(l);if(!n)throw new Error("IK Constraint not found: "+l);let c=s.ikConstraints.indexOf(n),f=new xt(r.length,r.length<<1,c),d=A(o,"time",0),u=A(o,"mix",1),m=A(o,"softness",0)*i;for(let x=0,p=0;;x++){f.setFrame(x,d,u,m,A(o,"bendPositive",!0)?1:-1,A(o,"compress",!1),A(o,"stretch",!1));let w=r[x+1];if(!w){f.shrink(p);break}let g=A(w,"time",0),b=A(w,"mix",1),v=A(w,"softness",0)*i,y=o.curve;y&&(p=z(y,f,p,x,0,d,g,u,b,1),p=z(y,f,p,x,1,d,g,m,v,i)),d=g,u=b,m=v,o=w}a.push(f)}if(e.transform)for(let l in e.transform){let r=e.transform[l],o=r[0];if(!o)continue;let n=s.findTransformConstraint(l);if(!n)throw new Error("Transform constraint not found: "+l);let c=s.transformConstraints.indexOf(n),f=new bt(r.length,r.length*6,c),d=A(o,"time",0),u=A(o,"mixRotate",1),m=A(o,"mixX",1),x=A(o,"mixY",m),p=A(o,"mixScaleX",1),w=A(o,"mixScaleY",p),g=A(o,"mixShearY",1);for(let b=0,v=0;;b++){f.setFrame(b,d,u,m,x,p,w,g);let y=r[b+1];if(!y){f.shrink(v);break}let S=A(y,"time",0),I=A(y,"mixRotate",1),k=A(y,"mixX",1),T=A(y,"mixY",k),Y=A(y,"mixScaleX",1),E=A(y,"mixScaleY",Y),F=A(y,"mixShearY",1),P=o.curve;P&&(v=z(P,f,v,b,0,d,S,u,I,1),v=z(P,f,v,b,1,d,S,m,k,1),v=z(P,f,v,b,2,d,S,x,T,1),v=z(P,f,v,b,3,d,S,p,Y,1),v=z(P,f,v,b,4,d,S,w,E,1),v=z(P,f,v,b,5,d,S,g,F,1)),d=S,u=I,m=k,x=T,p=Y,w=E,p=Y,o=y}a.push(f)}if(e.path)for(let l in e.path){let r=e.path[l],o=s.findPathConstraint(l);if(!o)throw new Error("Path constraint not found: "+l);let n=s.pathConstraints.indexOf(o);for(let c in r){let f=r[c],d=f[0];if(!d)continue;let u=f.length;if(c==="position"){let m=new wt(u,u,n);a.push(ce(f,m,0,o.positionMode==0?i:1))}else if(c==="spacing"){let m=new pt(u,u,n);a.push(ce(f,m,0,o.spacingMode==0||o.spacingMode==1?i:1))}else if(c==="mix"){let m=new yt(u,u*3,n),x=A(d,"time",0),p=A(d,"mixRotate",1),w=A(d,"mixX",1),g=A(d,"mixY",w);for(let b=0,v=0;;b++){m.setFrame(b,x,p,w,g);let y=f[b+1];if(!y){m.shrink(v);break}let S=A(y,"time",0),I=A(y,"mixRotate",1),k=A(y,"mixX",1),T=A(y,"mixY",k),Y=d.curve;Y&&(v=z(Y,m,v,b,0,x,S,p,I,1),v=z(Y,m,v,b,1,x,S,w,k,1),v=z(Y,m,v,b,2,x,S,g,T,1)),x=S,p=I,w=k,g=T,d=y}a.push(m)}}}if(e.physics)for(let l in e.physics){let r=e.physics[l],o=-1;if(l.length>0){let n=s.findPhysicsConstraint(l);if(!n)throw new Error("Physics constraint not found: "+l);o=s.physicsConstraints.indexOf(n)}for(let n in r){let c=r[n],f=c[0];if(!f)continue;let d=c.length;if(n=="reset"){const x=new De(c.size,o);for(let p=0;f!=null;f=c[p+1],p++)x.setFrame(p,A(f,"time",0));a.push(x);continue}let u,m=1;if(n=="inertia")u=new vt(d,d,o);else if(n=="strength")u=new St(d,d,o);else if(n=="damping")u=new At(d,d,o);else if(n=="mass")u=new It(d,d,o);else if(n=="wind")u=new Ct(d,d,o),m=i;else if(n=="gravity")u=new kt(d,d,o),m=i;else if(n=="mix")u=new Tt(d,d,o);else continue;a.push(ce(c,u,0,m))}}if(e.attachments)for(let l in e.attachments){let r=e.attachments[l],o=s.findSkin(l);if(!o)throw new Error("Skin not found: "+l);for(let n in r){let c=r[n],f=s.findSlot(n);if(!f)throw new Error("Slot not found: "+n);let d=f.index;for(let u in c){let m=c[u],x=o.getAttachment(d,u);for(let p in m){let w=m[p],g=w[0];if(g){if(p=="deform"){let b=x.bones,v=x.vertices,y=b?v.length/3*2:v.length,S=new gt(w.length,w.length,d,x),I=A(g,"time",0);for(let k=0,T=0;;k++){let Y,E=A(g,"vertices",null);if(!E)Y=b?R.newFloatArray(y):v;else{Y=R.newFloatArray(y);let M=A(g,"offset",0);if(R.arrayCopy(E,0,Y,M,E.length),i!=1)for(let V=M,q=V+E.length;V<q;V++)Y[V]*=i;if(!b)for(let V=0;V<y;V++)Y[V]+=v[V]}S.setFrame(k,I,Y);let F=w[k+1];if(!F){S.shrink(T);break}let P=A(F,"time",0),C=g.curve;C&&(T=z(C,S,T,k,0,I,P,0,1,1)),I=P,g=F}a.push(S)}else if(p=="sequence"){let b=new ve(w.length,d,x),v=0;for(let y=0;y<w.length;y++){let S=A(g,"delay",v),I=A(g,"time",0),k=Zt[A(g,"mode","hold")],T=A(g,"index",0);b.setFrame(y,I,k,T,S),v=S,g=w[y+1]}a.push(b)}}}}}}if(e.drawOrder){let l=new pe(e.drawOrder.length),r=s.slots.length,o=0;for(let n=0;n<e.drawOrder.length;n++,o++){let c=e.drawOrder[n],f=null,d=A(c,"offsets",null);if(d){f=R.newArray(r,-1);let u=R.newArray(r-d.length,0),m=0,x=0;for(let p=0;p<d.length;p++){let w=d[p],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;m!=b;)u[x++]=m++;f[m+w.offset]=m++}for(;m<r;)u[x++]=m++;for(let p=r-1;p>=0;p--)f[p]==-1&&(f[p]=u[--x])}l.setFrame(o,A(c,"time",0),f)}a.push(l)}if(e.events){let l=new Xe(e.events.length),r=0;for(let o=0;o<e.events.length;o++,r++){let n=e.events[o],c=s.findEvent(n.name);if(!c)throw new Error("Event not found: "+n.name);let f=new Vt(R.toSinglePrecision(A(n,"time",0)),c);f.intValue=A(n,"int",c.intValue),f.floatValue=A(n,"float",c.floatValue),f.stringValue=A(n,"string",c.stringValue),f.data.audioPath&&(f.volume=A(n,"volume",1),f.balance=A(n,"balance",0)),l.setFrame(r,f)}a.push(l)}let h=0;for(let l=0,r=a.length;l<r;l++)h=Math.max(h,a[l].getDuration());s.animations.push(new Ve(t,a,h))}},Xr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}};function ce(e,t,s,i){let a=e[0],h=A(a,"time",0),l=A(a,"value",s)*i,r=0;for(let o=0;;o++){t.setFrame(o,h,l);let n=e[o+1];if(!n)return t.shrink(r),t;let c=A(n,"time",0),f=A(n,"value",s)*i;a.curve&&(r=z(a.curve,t,r,o,0,h,c,l,f,i)),h=c,l=f,a=n}}function Gt(e,t,s,i,a,h){let l=e[0],r=A(l,"time",0),o=A(l,s,a)*h,n=A(l,i,a)*h,c=0;for(let f=0;;f++){t.setFrame(f,r,o,n);let d=e[f+1];if(!d)return t.shrink(c),t;let u=A(d,"time",0),m=A(d,s,a)*h,x=A(d,i,a)*h,p=l.curve;p&&(c=z(p,t,c,f,0,r,u,o,m,h),c=z(p,t,c,f,1,r,u,n,x,h)),r=u,o=m,n=x,l=d}}function z(e,t,s,i,a,h,l,r,o,n){if(e=="stepped")return t.setStepped(i),s;let c=a<<2,f=e[c],d=e[c+1]*n,u=e[c+2],m=e[c+3]*n;return t.setBezier(s,i,a,h,r,f,d,u,m,l,o),s+1}function A(e,t,s){return e[t]!==void 0?e[t]:s}return typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1))),Ls(jt)})();
|