@esotericsoftware/spine-canvas 4.2.3 → 4.2.6

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
- var spine=(()=>{var $t=Object.defineProperty,ys=e=>$t(e,"__esModule",{value:!0}),vs=(e,s)=>{ys(e);for(var t in s)$t(e,t,{get:s[t],enumerable:!0})},Ht={};vs(Ht,{AlphaTimeline:()=>ut,Animation:()=>Ue,AnimationState:()=>es,AnimationStateAdapter:()=>Ys,AnimationStateData:()=>Ts,AssetManager:()=>nr,AssetManagerBase:()=>hs,AtlasAttachmentLoader:()=>Fs,Attachment:()=>et,AttachmentTimeline:()=>Ae,BinaryInput:()=>us,BlendMode:()=>De,Bone:()=>Mt,BoneData:()=>Xt,BoundingBoxAttachment:()=>He,CURRENT:()=>is,CanvasTexture:()=>ms,ClippingAttachment:()=>Ct,Color:()=>D,ConstraintData:()=>Ge,CurveTimeline:()=>ne,CurveTimeline1:()=>le,CurveTimeline2:()=>_e,DebugUtils:()=>ks,DeformTimeline:()=>xt,Downloader:()=>Ft,DrawOrderTimeline:()=>ke,Event:()=>Et,EventData:()=>Rt,EventQueue:()=>ss,EventTimeline:()=>Le,EventType:()=>ee,FIRST:()=>St,FakeTexture:()=>Xs,HOLD_FIRST:()=>$e,HOLD_MIX:()=>rs,HOLD_SUBSEQUENT:()=>At,IkConstraint:()=>cs,IkConstraintData:()=>Bt,IkConstraintTimeline:()=>wt,IntSet:()=>Ss,Interpolation:()=>Gt,MathUtils:()=>M,MeshAttachment:()=>Ye,MixBlend:()=>j,MixDirection:()=>ge,PathAttachment:()=>Me,PathConstraint:()=>Fe,PathConstraintData:()=>Pt,PathConstraintMixTimeline:()=>vt,PathConstraintPositionTimeline:()=>pt,PathConstraintSpacingTimeline:()=>yt,PointAttachment:()=>Tt,Pool:()=>Pe,PositionMode:()=>oe,Pow:()=>jt,PowOut:()=>As,RGB2Timeline:()=>gt,RGBA2Timeline:()=>mt,RGBATimeline:()=>dt,RGBTimeline:()=>ft,RegionAttachment:()=>P,RotateMode:()=>ye,RotateTimeline:()=>Ve,SETUP:()=>kt,SUBSEQUENT:()=>ze,ScaleTimeline:()=>at,ScaleXTimeline:()=>nt,ScaleYTimeline:()=>lt,SequenceTimeline:()=>Xe,ShearTimeline:()=>ot,ShearXTimeline:()=>ht,ShearYTimeline:()=>ct,Skeleton:()=>Es,SkeletonBinary:()=>Rs,SkeletonBounds:()=>rr,SkeletonClipping:()=>qt,SkeletonData:()=>Vt,SkeletonJson:()=>ir,SkeletonRenderer:()=>_t,Skin:()=>je,SkinEntry:()=>Lt,Slot:()=>ds,SlotData:()=>Dt,SpacingMode:()=>K,StringSet:()=>Ze,Texture:()=>It,TextureAtlas:()=>ns,TextureAtlasPage:()=>ls,TextureAtlasRegion:()=>Yt,TextureFilter:()=>Ce,TextureRegion:()=>as,TextureWrap:()=>Ie,TimeKeeper:()=>Cs,Timeline:()=>J,TrackEntry:()=>ts,TransformConstraint:()=>fs,TransformConstraintData:()=>Nt,TransformConstraintTimeline:()=>bt,TransformMode:()=>te,TranslateTimeline:()=>st,TranslateXTimeline:()=>rt,TranslateYTimeline:()=>it,Triangulator:()=>se,Utils:()=>B,Vector2:()=>Oe,VertexAttachment:()=>ae,WindowedMean:()=>Is});var Ss=class{constructor(){this.array=new Array}add(e){let s=this.contains(e);return this.array[e|0]=e|0,!s}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ze=class{constructor(){this.entries={},this.size=0}add(e){let s=this.entries[e];return this.entries[e]=!0,s?!1:(this.size++,!0)}addAll(e){let s=this.size;for(var t=0,a=e.length;t<a;t++)this.add(e[t]);return s!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},Se=class{constructor(e=0,s=0,t=0,a=0){this.r=e,this.g=s,this.b=t,this.a=a}set(e,s,t,a){return this.r=e,this.g=s,this.b=t,this.a=a,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,t,a){return this.r+=e,this.g+=s,this.b+=t,this.a+=a,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}static fromString(e){return new Se().setFromString(e)}},D=Se;D.WHITE=new Se(1,1,1,1),D.RED=new Se(1,0,0,1),D.GREEN=new Se(0,1,0,1),D.BLUE=new Se(0,0,1,1),D.MAGENTA=new Se(1,0,1,1);var me=class{static clamp(e,s,t){return e<s?s:e>t?t:e}static cosDeg(e){return Math.cos(e*me.degRad)}static sinDeg(e){return Math.sin(e*me.degRad)}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),1/3);return e<0?-s:s}static randomTriangular(e,s){return me.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,t){let a=Math.random(),i=s-e;return a<=(t-e)/i?e+Math.sqrt(a*i*(t-e)):s-Math.sqrt((1-a)*i*(s-t))}static isPowerOfTwo(e){return e&&(e&e-1)==0}},M=me;M.PI=3.1415927,M.PI2=me.PI*2,M.radiansToDegrees=180/me.PI,M.radDeg=me.radiansToDegrees,M.degreesToRadians=me.PI/180,M.degRad=me.degreesToRadians;var Gt=class{apply(e,s,t){return e+(s-e)*this.applyInternal(t)}},jt=class extends Gt{constructor(e){super();this.power=2,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}},As=class extends jt{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Te=class{static arrayCopy(e,s,t,a,i){for(let c=s,o=a;c<s+i;c++,o++)t[o]=e[c]}static arrayFill(e,s,t,a){for(let i=s;i<t;i++)e[i]=a}static setArraySize(e,s,t=0){let a=e.length;if(a==s)return e;if(e.length=s,a<s)for(let i=a;i<s;i++)e[i]=t;return e}static ensureArrayCapacity(e,s,t=0){return e.length>=s?e:Te.setArraySize(e,s,t)}static newArray(e,s){let t=new Array(e);for(let a=0;a<e;a++)t[a]=s;return t}static newFloatArray(e){if(Te.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let t=0;t<s.length;t++)s[t]=0;return s}}static newShortArray(e){if(Te.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let t=0;t<s.length;t++)s[t]=0;return s}}static toFloatArray(e){return Te.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Te.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,t=!0){for(var a=0;a<e.length;a++)if(e[a]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},B=Te;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array!="undefined";var ks=class{static logBones(e){for(let s=0;s<e.bones.length;s++){let t=e.bones[s];console.log(t.data.name+", "+t.a+", "+t.b+", "+t.c+", "+t.d+", "+t.worldX+", "+t.worldY)}}},Pe=class{constructor(e){this.items=new Array,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 s=0;s<e.length;s++)this.free(e[s])}clear(){this.items.length=0}},Oe=class{constructor(e=0,s=0){this.x=e,this.y=s}set(e,s){return this.x=e,this.y=s,this}length(){let e=this.x,s=this.y;return Math.sqrt(e*e+s*s)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},Cs=class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.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)}},Is=class{constructor(e=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,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 s=0;s<this.values.length;s++)e+=this.values[s];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},et=class{constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Jt=class extends et{constructor(e){super(e);this.id=Jt.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttahment=this}computeWorldVertices(e,s,t,a,i,c){t=i+(t>>1)*c;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,g=u.worldX,x=u.worldY,p=u.a,y=u.b,m=u.c,w=u.d;for(let b=s,v=i;v<t;b+=2,v+=c){let S=l[b],A=l[b+1];a[v]=S*p+A*y+g,a[v+1]=S*m+A*w+x}return}let h=0,d=0;for(let u=0;u<s;u+=2){let g=n[h];h+=g+1,d+=g}let f=o.bones;if(r.length==0)for(let u=i,g=d*3;u<t;u+=c){let x=0,p=0,y=n[h++];for(y+=h;h<y;h++,g+=3){let m=f[n[h]],w=l[g],b=l[g+1],v=l[g+2];x+=(w*m.a+b*m.b+m.worldX)*v,p+=(w*m.c+b*m.d+m.worldY)*v}a[u]=x,a[u+1]=p}else{let u=r;for(let g=i,x=d*3,p=d<<1;g<t;g+=c){let y=0,m=0,w=n[h++];for(w+=h;h<w;h++,x+=3,p+=2){let b=f[n[h]],v=l[x]+u[p],S=l[x+1]+u[p+1],A=l[x+2];y+=(v*b.a+S*b.b+b.worldX)*A,m+=(v*b.c+S*b.d+b.worldY)*A}a[g]=y,a[g+1]=m}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttahment=this.timelineAttahment}},ae=Jt;ae.nextID=0;var qe=class{constructor(e){this.id=qe.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(e)}copy(){let e=new qe(this.regions.length);return B.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let t=e.sequenceIndex;t==-1&&(t=this.setupIndex),t>=this.regions.length&&(t=this.regions.length-1);let a=this.regions[t];s.region!=a&&(s.region=a,s.updateRegion())}getPath(e,s){let t=e,a=(this.start+s).toString();for(let i=this.digits-a.length;i>0;i--)t+="0";return t+=a,t}static nextID(){return qe._nextID++}},tt=qe;tt._nextID=0;var fe;(function(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"})(fe||(fe={}));var Kt=[0,1,2,3,4,5,6],Ue=class{constructor(e,s,t){if(this.timelines=[],this.timelineIds=new Ze,!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(s),this.duration=t}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var s=0;s<e.length;s++)this.timelineIds.addAll(e[s].getPropertyIds())}hasTimeline(e){for(let s=0;s<e.length;s++)if(this.timelineIds.contains(e[s]))return!0;return!1}apply(e,s,t,a,i,c,o,r){if(!e)throw new Error("skeleton cannot be null.");a&&this.duration!=0&&(t%=this.duration,s>0&&(s%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(e,s,t,i,c,o,r)}},j;(function(e){e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add"})(j||(j={}));var ge;(function(e){e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut"})(ge||(ge={}));var H={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,sequence:19},J=class{constructor(e,s){this.propertyIds=s,this.frames=B.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,s){let t=e.length;for(let a=1;a<t;a++)if(e[a]>s)return a-1;return t-1}static search(e,s,t){let a=e.length;for(let i=t;i<a;i+=t)if(e[i]>s)return i-t;return a-t}},ne=class extends J{constructor(e,s,t){super(e,t);this.curves=B.newFloatArray(e+s*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let s=this.getFrameCount()+e*18;if(this.curves.length>s){let t=B.newFloatArray(s);B.arrayCopy(this.curves,0,t,0,s),this.curves=t}}setBezier(e,s,t,a,i,c,o,r,l,n,h){let d=this.curves,f=this.getFrameCount()+e*18;t==0&&(d[s]=2+f);let u=(a-c*2+r)*.03,g=(i-o*2+l)*.03,x=((c-r)*3-a+n)*.006,p=((o-l)*3-i+h)*.006,y=u*2+x,m=g*2+p,w=(c-a)*.3+u+x*.16666667,b=(o-i)*.3+g+p*.16666667,v=a+w,S=i+b;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=S,w+=y,b+=m,y+=x,m+=p,v+=w,S+=b}getBezierValue(e,s,t,a){let i=this.curves;if(i[a]>e){let l=this.frames[s],n=this.frames[s+t];return n+(e-l)/(i[a]-l)*(i[a+1]-n)}let c=a+18;for(a+=2;a<c;a+=2)if(i[a]>=e){let l=i[a-2],n=i[a-1];return n+(e-l)/(i[a]-l)*(i[a+1]-n)}s+=this.getFrameEntries();let o=i[c-2],r=i[c-1];return r+(e-o)/(this.frames[s]-o)*(this.frames[s+t]-r)}},le=class extends ne{constructor(e,s,t){super(e,s,[t])}getFrameEntries(){return 2}setFrame(e,s,t){e<<=1,this.frames[e]=s,this.frames[e+1]=t}getCurveValue(e){let s=this.frames,t=s.length-2;for(let i=2;i<=t;i+=2)if(s[i]>e){t=i-2;break}let a=this.curves[t>>1];switch(a){case 0:let i=s[t],c=s[t+1];return c+(e-i)/(s[t+2]-i)*(s[t+2+1]-c);case 1:return s[t+1]}return this.getBezierValue(e,t,1,a-2)}},_e=class extends ne{constructor(e,s,t,a){super(e,s,[t,a])}getFrameEntries(){return 3}setFrame(e,s,t,a){e*=3,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a}},Ve=class extends le{constructor(e,s,t){super(e,s,H.rotate+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.rotation=r.data.rotation;return;case 1:r.rotation+=(r.data.rotation-r.rotation)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.rotation=r.data.rotation+n*i;break;case 1:case 2:n+=r.data.rotation-r.rotation;case 3:r.rotation+=n*i}}},st=class extends _e{constructor(e,s,t){super(e,s,H.x+"|"+t,H.y+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*i,r.y+=(r.data.y-r.y)*i}return}let n=0,h=0,d=J.search(l,t,3),f=this.curves[d/3];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+3]-u);n+=(l[d+3+1]-n)*g,h+=(l[d+3+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}switch(c){case 0:r.x=r.data.x+n*i,r.y=r.data.y+h*i;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*i,r.y+=(r.data.y+h-r.y)*i;break;case 3:r.x+=n*i,r.y+=h*i}}},rt=class extends le{constructor(e,s,t){super(e,s,H.x+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.x=r.data.x;return;case 1:r.x+=(r.data.x-r.x)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.x=r.data.x+n*i;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*i;break;case 3:r.x+=n*i}}},it=class extends le{constructor(e,s,t){super(e,s,H.y+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.y=r.data.y;return;case 1:r.y+=(r.data.y-r.y)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.y=r.data.y+n*i;break;case 1:case 2:r.y+=(r.data.y+n-r.y)*i;break;case 3:r.y+=n*i}}},at=class extends _e{constructor(e,s,t){super(e,s,H.scaleX+"|"+t,H.scaleY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*i,r.scaleY+=(r.data.scaleY-r.scaleY)*i}return}let n,h,d=J.search(l,t,3),f=this.curves[d/3];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+3]-u);n+=(l[d+3+1]-n)*g,h+=(l[d+3+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}if(n*=r.data.scaleX,h*=r.data.scaleY,i==1)c==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=n,r.scaleY=h);else{let u=0,g=0;if(o==1)switch(c){case 0:u=r.data.scaleX,g=r.data.scaleY,r.scaleX=u+(Math.abs(n)*M.signum(u)-u)*i,r.scaleY=g+(Math.abs(h)*M.signum(g)-g)*i;break;case 1:case 2:u=r.scaleX,g=r.scaleY,r.scaleX=u+(Math.abs(n)*M.signum(u)-u)*i,r.scaleY=g+(Math.abs(h)*M.signum(g)-g)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i,r.scaleY+=(h-r.data.scaleY)*i}else switch(c){case 0:u=Math.abs(r.data.scaleX)*M.signum(n),g=Math.abs(r.data.scaleY)*M.signum(h),r.scaleX=u+(n-u)*i,r.scaleY=g+(h-g)*i;break;case 1:case 2:u=Math.abs(r.scaleX)*M.signum(n),g=Math.abs(r.scaleY)*M.signum(h),r.scaleX=u+(n-u)*i,r.scaleY=g+(h-g)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i,r.scaleY+=(h-r.data.scaleY)*i}}}},nt=class extends le{constructor(e,s,t){super(e,s,H.scaleX+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*i}return}let n=this.getCurveValue(t)*r.data.scaleX;if(i==1)c==3?r.scaleX+=n-r.data.scaleX:r.scaleX=n;else{let h=0;if(o==1)switch(c){case 0:h=r.data.scaleX,r.scaleX=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 1:case 2:h=r.scaleX,r.scaleX=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i}else switch(c){case 0:h=Math.abs(r.data.scaleX)*M.signum(n),r.scaleX=h+(n-h)*i;break;case 1:case 2:h=Math.abs(r.scaleX)*M.signum(n),r.scaleX=h+(n-h)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i}}}},lt=class extends le{constructor(e,s,t){super(e,s,H.scaleY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.scaleY=r.data.scaleY;return;case 1:r.scaleY+=(r.data.scaleY-r.scaleY)*i}return}let n=this.getCurveValue(t)*r.data.scaleY;if(i==1)c==3?r.scaleY+=n-r.data.scaleY:r.scaleY=n;else{let h=0;if(o==1)switch(c){case 0:h=r.data.scaleY,r.scaleY=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 1:case 2:h=r.scaleY,r.scaleY=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 3:r.scaleY+=(n-r.data.scaleY)*i}else switch(c){case 0:h=Math.abs(r.data.scaleY)*M.signum(n),r.scaleY=h+(n-h)*i;break;case 1:case 2:h=Math.abs(r.scaleY)*M.signum(n),r.scaleY=h+(n-h)*i;break;case 3:r.scaleY+=(n-r.data.scaleY)*i}}}},ot=class extends _e{constructor(e,s,t){super(e,s,H.shearX+"|"+t,H.shearY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*i,r.shearY+=(r.data.shearY-r.shearY)*i}return}let n=0,h=0,d=J.search(l,t,3),f=this.curves[d/3];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+3]-u);n+=(l[d+3+1]-n)*g,h+=(l[d+3+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}switch(c){case 0:r.shearX=r.data.shearX+n*i,r.shearY=r.data.shearY+h*i;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*i,r.shearY+=(r.data.shearY+h-r.shearY)*i;break;case 3:r.shearX+=n*i,r.shearY+=h*i}}},ht=class extends le{constructor(e,s,t){super(e,s,H.shearX+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.shearX=r.data.shearX;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.shearX=r.data.shearX+n*i;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*i;break;case 3:r.shearX+=n*i}}},ct=class extends le{constructor(e,s,t){super(e,s,H.shearY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.shearY=r.data.shearY;return;case 1:r.shearY+=(r.data.shearY-r.shearY)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.shearY=r.data.shearY+n*i;break;case 1:case 2:r.shearY+=(r.data.shearY+n-r.shearY)*i;break;case 3:r.shearY+=n*i}}},dt=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t,H.alpha+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 5}setFrame(e,s,t,a,i,c){e*=5,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(t<l[0]){let p=r.data.color;switch(c){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*i,(p.g-n.g)*i,(p.b-n.b)*i,(p.a-n.a)*i)}return}let h=0,d=0,f=0,u=0,g=J.search(l,t,5),x=this.curves[g/5];switch(x){case 0:let p=l[g];h=l[g+1],d=l[g+2],f=l[g+3],u=l[g+4];let y=(t-p)/(l[g+5]-p);h+=(l[g+5+1]-h)*y,d+=(l[g+5+2]-d)*y,f+=(l[g+5+3]-f)*y,u+=(l[g+5+4]-u)*y;break;case 1:h=l[g+1],d=l[g+2],f=l[g+3],u=l[g+4];break;default:h=this.getBezierValue(t,g,1,x-2),d=this.getBezierValue(t,g,2,x+18-2),f=this.getBezierValue(t,g,3,x+18*2-2),u=this.getBezierValue(t,g,4,x+18*3-2)}i==1?n.set(h,d,f,u):(c==0&&n.setFromColor(r.data.color),n.add((h-n.r)*i,(d-n.g)*i,(f-n.b)*i,(u-n.a)*i))}},ft=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 4}setFrame(e,s,t,a,i){e<<=2,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(t<l[0]){let x=r.data.color;switch(c){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*i,n.g+=(x.g-n.g)*i,n.b+=(x.b-n.b)*i}return}let h=0,d=0,f=0,u=J.search(l,t,4),g=this.curves[u>>2];switch(g){case 0:let x=l[u];h=l[u+1],d=l[u+2],f=l[u+3];let p=(t-x)/(l[u+4]-x);h+=(l[u+4+1]-h)*p,d+=(l[u+4+2]-d)*p,f+=(l[u+4+3]-f)*p;break;case 1:h=l[u+1],d=l[u+2],f=l[u+3];break;default:h=this.getBezierValue(t,u,1,g-2),d=this.getBezierValue(t,u,2,g+18-2),f=this.getBezierValue(t,u,3,g+18*2-2)}if(i==1)n.r=h,n.g=d,n.b=f;else{if(c==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(h-n.r)*i,n.g+=(d-n.g)*i,n.b+=(f-n.b)*i}}},ut=class extends le{constructor(e,s,t){super(e,s,H.alpha+"|"+t);this.slotIndex=0,this.slotIndex=t}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(t<this.frames[0]){let h=r.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*i}return}let n=this.getCurveValue(t);i==1?l.a=n:(c==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*i)}},mt=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t,H.alpha+"|"+t,H.rgb2+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 8}setFrame(e,s,t,a,i,c,o,r,l){e<<=3,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(t<l[0]){let b=r.data.color,v=r.data.darkColor;switch(c){case 0:n.setFromColor(b),h.r=v.r,h.g=v.g,h.b=v.b;return;case 1:n.add((b.r-n.r)*i,(b.g-n.g)*i,(b.b-n.b)*i,(b.a-n.a)*i),h.r+=(v.r-h.r)*i,h.g+=(v.g-h.g)*i,h.b+=(v.b-h.b)*i}return}let d=0,f=0,u=0,g=0,x=0,p=0,y=0,m=J.search(l,t,8),w=this.curves[m>>3];switch(w){case 0:let b=l[m];d=l[m+1],f=l[m+2],u=l[m+3],g=l[m+4],x=l[m+5],p=l[m+6],y=l[m+7];let v=(t-b)/(l[m+8]-b);d+=(l[m+8+1]-d)*v,f+=(l[m+8+2]-f)*v,u+=(l[m+8+3]-u)*v,g+=(l[m+8+4]-g)*v,x+=(l[m+8+5]-x)*v,p+=(l[m+8+6]-p)*v,y+=(l[m+8+7]-y)*v;break;case 1:d=l[m+1],f=l[m+2],u=l[m+3],g=l[m+4],x=l[m+5],p=l[m+6],y=l[m+7];break;default:d=this.getBezierValue(t,m,1,w-2),f=this.getBezierValue(t,m,2,w+18-2),u=this.getBezierValue(t,m,3,w+18*2-2),g=this.getBezierValue(t,m,4,w+18*3-2),x=this.getBezierValue(t,m,5,w+18*4-2),p=this.getBezierValue(t,m,6,w+18*5-2),y=this.getBezierValue(t,m,7,w+18*6-2)}if(i==1)n.set(d,f,u,g),h.r=x,h.g=p,h.b=y;else{if(c==0){n.setFromColor(r.data.color);let b=r.data.darkColor;h.r=b.r,h.g=b.g,h.b=b.b}n.add((d-n.r)*i,(f-n.g)*i,(u-n.b)*i,(g-n.a)*i),h.r+=(x-h.r)*i,h.g+=(p-h.g)*i,h.b+=(y-h.b)*i}}},gt=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t,H.rgb2+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 7}setFrame(e,s,t,a,i,c,o,r){e*=7,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(t<l[0]){let b=r.data.color,v=r.data.darkColor;switch(c){case 0:n.r=b.r,n.g=b.g,n.b=b.b,h.r=v.r,h.g=v.g,h.b=v.b;return;case 1:n.r+=(b.r-n.r)*i,n.g+=(b.g-n.g)*i,n.b+=(b.b-n.b)*i,h.r+=(v.r-h.r)*i,h.g+=(v.g-h.g)*i,h.b+=(v.b-h.b)*i}return}let d=0,f=0,u=0,g=0,x=0,p=0,y=0,m=J.search(l,t,7),w=this.curves[m/7];switch(w){case 0:let b=l[m];d=l[m+1],f=l[m+2],u=l[m+3],x=l[m+4],p=l[m+5],y=l[m+6];let v=(t-b)/(l[m+7]-b);d+=(l[m+7+1]-d)*v,f+=(l[m+7+2]-f)*v,u+=(l[m+7+3]-u)*v,x+=(l[m+7+4]-x)*v,p+=(l[m+7+5]-p)*v,y+=(l[m+7+6]-y)*v;break;case 1:d=l[m+1],f=l[m+2],u=l[m+3],x=l[m+4],p=l[m+5],y=l[m+6];break;default:d=this.getBezierValue(t,m,1,w-2),f=this.getBezierValue(t,m,2,w+18-2),u=this.getBezierValue(t,m,3,w+18*2-2),x=this.getBezierValue(t,m,4,w+18*3-2),p=this.getBezierValue(t,m,5,w+18*4-2),y=this.getBezierValue(t,m,6,w+18*5-2)}if(i==1)n.r=d,n.g=f,n.b=u,h.r=x,h.g=p,h.b=y;else{if(c==0){let b=r.data.color,v=r.data.darkColor;n.r=b.r,n.g=b.g,n.b=b.b,h.r=v.r,h.g=v.g,h.b=v.b}n.r+=(d-n.r)*i,n.g+=(f-n.g)*i,n.b+=(u-n.b)*i,h.r+=(x-h.r)*i,h.g+=(p-h.g)*i,h.b+=(y-h.b)*i}}},Ae=class extends J{constructor(e,s){super(e,[H.attachment+"|"+s]);this.slotIndex=0,this.slotIndex=s,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,t){this.frames[e]=s,this.attachmentNames[e]=t}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!!r.bone.active){if(o==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(t<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,t)])}}setAttachment(e,s,t){s.setAttachment(t?e.getAttachment(this.slotIndex,t):null)}},xt=class extends ne{constructor(e,s,t,a){super(e,s,[H.deform+"|"+t+"|"+a.id]);this.slotIndex=0,this.slotIndex=t,this.attachment=a,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,t){this.frames[e]=s,this.vertices[e]=t}setBezier(e,s,t,a,i,c,o,r,l,n,h){let d=this.curves,f=this.getFrameCount()+e*18;t==0&&(d[s]=2+f);let u=(a-c*2+r)*.03,g=l*.03-o*.06,x=((c-r)*3-a+n)*.006,p=(o-l+.33333333)*.018,y=u*2+x,m=g*2+p,w=(c-a)*.3+u+x*.16666667,b=o*.3+g+p*.16666667,v=a+w,S=b;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=S,w+=y,b+=m,y+=x,m+=p,v+=w,S+=b}getCurvePercent(e,s){let t=this.curves,a=t[s];switch(a){case 0:let r=this.frames[s];return(e-r)/(this.frames[s+this.getFrameEntries()]-r);case 1:return 0}if(a-=2,t[a]>e){let r=this.frames[s];return t[a+1]*(e-r)/(t[a]-r)}let i=a+18;for(a+=2;a<i;a+=2)if(t[a]>=e){let r=t[a-2],l=t[a-1];return l+(e-r)/(t[a]-r)*(t[a+1]-l)}let c=t[i-2],o=t[i-1];return o+(1-o)*(e-c)/(this.frames[s+this.getFrameEntries()]-c)}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof ae)||l.timelineAttahment!=this.attachment)return;let n=r.deform;n.length==0&&(c=0);let h=this.vertices,d=h[0].length,f=this.frames;if(t<f[0]){switch(c){case 0:n.length=0;return;case 1:if(i==1){n.length=0;return}n.length=d;let m=l;if(m.bones){i=1-i;for(var u=0;u<d;u++)n[u]*=i}else{let w=m.vertices;for(var u=0;u<d;u++)n[u]+=(w[u]-n[u])*i}}return}if(n.length=d,t>=f[f.length-1]){let m=h[f.length-1];if(i==1)if(c==3){let w=l;if(w.bones)for(let b=0;b<d;b++)n[b]+=m[b];else{let b=w.vertices;for(let v=0;v<d;v++)n[v]+=m[v]-b[v]}}else B.arrayCopy(m,0,n,0,d);else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<d;v++)n[v]=m[v]*i;else{let v=b.vertices;for(let S=0;S<d;S++){let A=v[S];n[S]=A+(m[S]-A)*i}}break}case 1:case 2:for(let b=0;b<d;b++)n[b]+=(m[b]-n[b])*i;break;case 3:let w=l;if(w.bones)for(let b=0;b<d;b++)n[b]+=m[b]*i;else{let b=w.vertices;for(let v=0;v<d;v++)n[v]+=(m[v]-b[v])*i}}return}let g=J.search1(f,t),x=this.getCurvePercent(t,g),p=h[g],y=h[g+1];if(i==1)if(c==3){let m=l;if(m.bones)for(let w=0;w<d;w++){let b=p[w];n[w]+=b+(y[w]-b)*x}else{let w=m.vertices;for(let b=0;b<d;b++){let v=p[b];n[b]+=v+(y[b]-v)*x-w[b]}}}else for(let m=0;m<d;m++){let w=p[m];n[m]=w+(y[m]-w)*x}else switch(c){case 0:{let w=l;if(w.bones)for(let b=0;b<d;b++){let v=p[b];n[b]=(v+(y[b]-v)*x)*i}else{let b=w.vertices;for(let v=0;v<d;v++){let S=p[v],A=b[v];n[v]=A+(S+(y[v]-S)*x-A)*i}}break}case 1:case 2:for(let w=0;w<d;w++){let b=p[w];n[w]+=(b+(y[w]-b)*x-n[w])*i}break;case 3:let m=l;if(m.bones)for(let w=0;w<d;w++){let b=p[w];n[w]+=(b+(y[w]-b)*x)*i}else{let w=m.vertices;for(let b=0;b<d;b++){let v=p[b];n[b]+=(v+(y[b]-v)*x-w[b])*i}}}}},Qt=class extends J{constructor(e){super(e,Qt.propertyIds);this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,t,a,i,c,o){if(!a)return;let r=this.frames,l=this.frames.length;if(s>t)this.apply(e,s,Number.MAX_VALUE,a,i,c,o),s=-1;else if(s>=r[l-1])return;if(t<r[0])return;let n=0;if(s<r[0])n=0;else{n=J.search1(r,s)+1;let h=r[n];for(;n>0&&r[n-1]==h;)n--}for(;n<l&&t>=r[n];n++)a.push(this.events[n])}},Le=Qt;Le.propertyIds=[""+H.event];var Zt=class extends J{constructor(e){super(e,Zt.propertyIds);this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,t){this.frames[e]=s,this.drawOrders[e]=t}apply(e,s,t,a,i,c,o){if(o==1){c==0&&B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(t<this.frames[0]){(c==0||c==1)&&B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,t),l=this.drawOrders[r];if(!l)B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,h=e.slots;for(let d=0,f=l.length;d<f;d++)n[d]=h[l[d]]}}},ke=Zt;ke.propertyIds=[""+H.drawOrder];var wt=class extends ne{constructor(e,s,t){super(e,s,[H.ikConstraint+"|"+t]);this.ikConstraintIndex=0,this.ikConstraintIndex=t}getFrameEntries(){return 6}setFrame(e,s,t,a,i,c,o){e*=6,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,s,t,a,i,c,o){let r=e.ikConstraints[this.ikConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){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)*i,r.softness+=(r.data.softness-r.softness)*i,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,h=0,d=J.search(l,t,6),f=this.curves[d/6];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+6]-u);n+=(l[d+6+1]-n)*g,h+=(l[d+6+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}c==0?(r.mix=r.data.mix+(n-r.data.mix)*i,r.softness=r.data.softness+(h-r.data.softness)*i,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[d+3],r.compress=l[d+4]!=0,r.stretch=l[d+5]!=0)):(r.mix+=(n-r.mix)*i,r.softness+=(h-r.softness)*i,o==0&&(r.bendDirection=l[d+3],r.compress=l[d+4]!=0,r.stretch=l[d+5]!=0))}},bt=class extends ne{constructor(e,s,t){super(e,s,[H.transformConstraint+"|"+t]);this.transformConstraintIndex=0,this.transformConstraintIndex=t}getFrameEntries(){return 7}setFrame(e,s,t,a,i,c,o,r){let l=this.frames;e*=7,l[e]=s,l[e+1]=t,l[e+2]=a,l[e+3]=i,l[e+4]=c,l[e+5]=o,l[e+6]=r}apply(e,s,t,a,i,c,o){let r=e.transformConstraints[this.transformConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){let y=r.data;switch(c){case 0:r.mixRotate=y.mixRotate,r.mixX=y.mixX,r.mixY=y.mixY,r.mixScaleX=y.mixScaleX,r.mixScaleY=y.mixScaleY,r.mixShearY=y.mixShearY;return;case 1:r.mixRotate+=(y.mixRotate-r.mixRotate)*i,r.mixX+=(y.mixX-r.mixX)*i,r.mixY+=(y.mixY-r.mixY)*i,r.mixScaleX+=(y.mixScaleX-r.mixScaleX)*i,r.mixScaleY+=(y.mixScaleY-r.mixScaleY)*i,r.mixShearY+=(y.mixShearY-r.mixShearY)*i}return}let n,h,d,f,u,g,x=J.search(l,t,7),p=this.curves[x/7];switch(p){case 0:let y=l[x];n=l[x+1],h=l[x+2],d=l[x+3],f=l[x+4],u=l[x+5],g=l[x+6];let m=(t-y)/(l[x+7]-y);n+=(l[x+7+1]-n)*m,h+=(l[x+7+2]-h)*m,d+=(l[x+7+3]-d)*m,f+=(l[x+7+4]-f)*m,u+=(l[x+7+5]-u)*m,g+=(l[x+7+6]-g)*m;break;case 1:n=l[x+1],h=l[x+2],d=l[x+3],f=l[x+4],u=l[x+5],g=l[x+6];break;default:n=this.getBezierValue(t,x,1,p-2),h=this.getBezierValue(t,x,2,p+18-2),d=this.getBezierValue(t,x,3,p+18*2-2),f=this.getBezierValue(t,x,4,p+18*3-2),u=this.getBezierValue(t,x,5,p+18*4-2),g=this.getBezierValue(t,x,6,p+18*5-2)}if(c==0){let y=r.data;r.mixRotate=y.mixRotate+(n-y.mixRotate)*i,r.mixX=y.mixX+(h-y.mixX)*i,r.mixY=y.mixY+(d-y.mixY)*i,r.mixScaleX=y.mixScaleX+(f-y.mixScaleX)*i,r.mixScaleY=y.mixScaleY+(u-y.mixScaleY)*i,r.mixShearY=y.mixShearY+(g-y.mixShearY)*i}else r.mixRotate+=(n-r.mixRotate)*i,r.mixX+=(h-r.mixX)*i,r.mixY+=(d-r.mixY)*i,r.mixScaleX+=(f-r.mixScaleX)*i,r.mixScaleY+=(u-r.mixScaleY)*i,r.mixShearY+=(g-r.mixShearY)*i}},pt=class extends le{constructor(e,s,t){super(e,s,H.pathConstraintPosition+"|"+t);this.pathConstraintIndex=0,this.pathConstraintIndex=t}apply(e,s,t,a,i,c,o){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.position=r.data.position;return;case 1:r.position+=(r.data.position-r.position)*i}return}let n=this.getCurveValue(t);c==0?r.position=r.data.position+(n-r.data.position)*i:r.position+=(n-r.position)*i}},yt=class extends le{constructor(e,s,t){super(e,s,H.pathConstraintSpacing+"|"+t);this.pathConstraintIndex=0,this.pathConstraintIndex=t}apply(e,s,t,a,i,c,o){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.spacing=r.data.spacing;return;case 1:r.spacing+=(r.data.spacing-r.spacing)*i}return}let n=this.getCurveValue(t);c==0?r.spacing=r.data.spacing+(n-r.data.spacing)*i:r.spacing+=(n-r.spacing)*i}},vt=class extends ne{constructor(e,s,t){super(e,s,[H.pathConstraintMix+"|"+t]);this.pathConstraintIndex=0,this.pathConstraintIndex=t}getFrameEntries(){return 4}setFrame(e,s,t,a,i){let c=this.frames;e<<=2,c[e]=s,c[e+1]=t,c[e+2]=a,c[e+3]=i}apply(e,s,t,a,i,c,o){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){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)*i,r.mixX+=(r.data.mixX-r.mixX)*i,r.mixY+=(r.data.mixY-r.mixY)*i}return}let n,h,d,f=J.search(l,t,4),u=this.curves[f>>2];switch(u){case 0:let g=l[f];n=l[f+1],h=l[f+2],d=l[f+3];let x=(t-g)/(l[f+4]-g);n+=(l[f+4+1]-n)*x,h+=(l[f+4+2]-h)*x,d+=(l[f+4+3]-d)*x;break;case 1:n=l[f+1],h=l[f+2],d=l[f+3];break;default:n=this.getBezierValue(t,f,1,u-2),h=this.getBezierValue(t,f,2,u+18-2),d=this.getBezierValue(t,f,3,u+18*2-2)}if(c==0){let g=r.data;r.mixRotate=g.mixRotate+(n-g.mixRotate)*i,r.mixX=g.mixX+(h-g.mixX)*i,r.mixY=g.mixY+(d-g.mixY)*i}else r.mixRotate+=(n-r.mixRotate)*i,r.mixX+=(h-r.mixX)*i,r.mixY+=(d-r.mixY)*i}},pe=class extends J{constructor(e,s,t){super(e,[H.sequence+"|"+s+"|"+t.sequence.id]);this.slotIndex=s,this.attachment=t}getFrameEntries(){return pe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,t,a,i){let c=this.frames;e*=pe.ENTRIES,c[e]=s,c[e+pe.MODE]=t|a<<4,c[e+pe.DELAY]=i}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof ae)||l.timelineAttahment!=n))return;let h=this.frames;if(t<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let d=J.search(h,t,pe.ENTRIES),f=h[d],u=h[d+pe.MODE],g=h[d+pe.DELAY],x=u>>4,p=this.attachment.sequence.regions.length,y=Kt[u&15];if(y!=fe.hold)switch(x+=(t-f)/g+1e-5|0,y){case fe.once:x=Math.min(p-1,x);break;case fe.loop:x%=p;break;case fe.pingpong:{let m=(p<<1)-2;x%=m,x>=p&&(x=m-x);break}case fe.onceReverse:x=Math.max(p-1-x,0);break;case fe.loopReverse:x=p-1-x%p;break;case fe.pingpongReverse:{let m=(p<<1)-2;x=(x+p-1)%m,x>=p&&(x=m-x)}}r.sequenceIndex=x}},Xe=pe;Xe.ENTRIES=3,Xe.MODE=1,Xe.DELAY=2;var We=class{constructor(e){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new ss(this),this.propertyIDs=new Ze,this.animationsChanged=!1,this.trackEntryPool=new Pe(()=>new ts),this.data=e}static emptyAnimation(){return We._emptyAnimation}update(e){e*=this.timeScale;let s=this.tracks;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let c=e*i.timeScale;if(i.delay>0){if(i.delay-=c,i.delay>0)continue;c=-i.delay,i.delay=0}let o=i.next;if(o){let r=i.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=i.timeScale==0?0:(r/i.timeScale+e)*o.timeScale,i.trackTime+=c,this.setCurrent(t,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){s[t]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,e)){let r=i.mixingFrom;for(i.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}i.trackTime+=c}this.queue.drain()}updateMixingFrom(e,s){let t=e.mixingFrom;if(!t)return!0;let a=this.updateMixingFrom(t,s);return t.animationLast=t.nextAnimationLast,t.trackLast=t.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((t.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=t.mixingFrom,t.mixingFrom&&(t.mixingFrom.mixingTo=e),e.interruptAlpha=t.interruptAlpha,this.queue.end(t)),a):(t.trackTime+=s*t.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,t=this.tracks,a=!1;for(let d=0,f=t.length;d<f;d++){let u=t[d];if(!u||u.delay>0)continue;a=!0;let g=d==0?j.first:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,e,g):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let p=u.animationLast,y=u.getAnimationTime(),m=y,w=s;u.reverse&&(m=u.animation.duration-m,w=null);let b=u.animation.timelines,v=b.length;if(d==0&&x==1||g==j.add)for(let S=0;S<v;S++){B.webkit602BugfixHelper(x,g);var i=b[S];i instanceof Ae?this.applyAttachmentTimeline(i,e,m,g,!0):i.apply(e,p,m,w,x,g,ge.mixIn)}else{let S=u.timelineMode,A=u.shortestRotation,C=!A&&u.timelinesRotation.length!=v<<1;C&&(u.timelinesRotation.length=v<<1);for(let Y=0;Y<v;Y++){let X=b[Y],R=S[Y]==ze?g:j.setup;!A&&X instanceof Ve?this.applyRotateTimeline(X,e,m,x,R,u.timelinesRotation,Y<<1,C):X instanceof Ae?this.applyAttachmentTimeline(X,e,m,g,!0):(B.webkit602BugfixHelper(x,g),X.apply(e,p,m,w,x,R,ge.mixIn))}}this.queueEvents(u,y),s.length=0,u.nextAnimationLast=y,u.nextTrackLast=u.trackTime}for(var c=this.unkeyedState+kt,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==c){var h=n.data.attachmentName;n.setAttachment(h?e.getAttachment(n.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),a}applyMixingFrom(e,s,t){let a=e.mixingFrom;a.mixingFrom&&this.applyMixingFrom(a,s,t);let i=0;e.mixDuration==0?(i=1,t==j.first&&(t=j.setup)):(i=e.mixTime/e.mixDuration,i>1&&(i=1),t!=j.first&&(t=a.mixBlend));let c=i<a.attachmentThreshold,o=i<a.drawOrderThreshold,r=a.animation.timelines,l=r.length,n=a.alpha*e.interruptAlpha,h=n*(1-i),d=a.animationLast,f=a.getAnimationTime(),u=f,g=null;if(a.reverse?u=a.animation.duration-u:i<a.eventThreshold&&(g=this.events),t==j.add)for(let x=0;x<l;x++)r[x].apply(s,d,u,g,h,t,ge.mixOut);else{let x=a.timelineMode,p=a.timelineHoldMix,y=a.shortestRotation,m=!y&&a.timelinesRotation.length!=l<<1;m&&(a.timelinesRotation.length=l<<1),a.totalAlpha=0;for(let w=0;w<l;w++){let b=r[w],v=ge.mixOut,S,A=0;switch(x[w]){case ze:if(!o&&b instanceof ke)continue;S=t,A=h;break;case St:S=j.setup,A=h;break;case At:S=t,A=n;break;case $e:S=j.setup,A=n;break;default:S=j.setup;let C=p[w];A=n*Math.max(0,1-C.mixTime/C.mixDuration);break}a.totalAlpha+=A,!y&&b instanceof Ve?this.applyRotateTimeline(b,s,u,A,S,a.timelinesRotation,w<<1,m):b instanceof Ae?this.applyAttachmentTimeline(b,s,u,S,c):(B.webkit602BugfixHelper(A,t),o&&b instanceof ke&&S==j.setup&&(v=ge.mixIn),b.apply(s,d,u,g,A,S,v))}}return e.mixDuration>0&&this.queueEvents(a,f),this.events.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime,i}applyAttachmentTimeline(e,s,t,a,i){var c=s.slots[e.slotIndex];!c.bone.active||(t<e.frames[0]?(a==j.setup||a==j.first)&&this.setAttachment(s,c,c.data.attachmentName,i):this.setAttachment(s,c,e.attachmentNames[J.search1(e.frames,t)],i),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+kt))}setAttachment(e,s,t,a){s.setAttachment(t?e.getAttachment(s.data.index,t):null),a&&(s.attachmentState=this.unkeyedState+is)}applyRotateTimeline(e,s,t,a,i,c,o,r){if(r&&(c[o]=0),a==1){e.apply(s,0,t,null,1,i,ge.mixIn);return}let l=s.bones[e.boneIndex];if(!l.active)return;let n=e.frames,h=0,d=0;if(t<n[0])switch(i){case j.setup:l.rotation=l.data.rotation;default:return;case j.first:h=l.rotation,d=l.data.rotation}else h=i==j.setup?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(t);let f=0,u=d-h;if(u-=(16384-(16384.499999999996-u/360|0))*360,u==0)f=c[o];else{let g=0,x=0;r?(g=0,x=u):(g=c[o],x=c[o+1]);let p=u>0,y=g>=0;M.signum(x)!=M.signum(u)&&Math.abs(x)<=90&&(Math.abs(g)>180&&(g+=360*M.signum(g)),y=p),f=u+g-g%360,y!=p&&(f+=360*M.signum(g)),c[o]=f}c[o+1]=u,l.rotation=h+f*a}queueEvents(e,s){let t=e.animationStart,a=e.animationEnd,i=a-t,c=e.trackLast%i,o=this.events,r=0,l=o.length;for(;r<l;r++){let h=o[r];if(h.time<c)break;h.time>a||this.queue.event(e,h)}let n=!1;for(e.loop?n=i==0||c>e.trackTime%i:n=s>=a&&e.animationLast<a,n&&this.queue.complete(e);r<l;r++){let h=o[r];h.time<t||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,t=this.tracks.length;s<t;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let t=s;for(;;){let a=t.mixingFrom;if(!a)break;this.queue.end(a),t.mixingFrom=null,t.mixingTo=null,t=a}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,t){let a=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,a&&(t&&this.queue.interrupt(a),s.mixingFrom=a,a.mixingTo=s,s.mixTime=0,a.mixingFrom&&a.mixDuration>0&&(s.interruptAlpha*=Math.min(1,a.mixTime/a.mixDuration)),a.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,t=!1){let a=this.data.skeletonData.findAnimation(s);if(!a)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,a,t)}setAnimationWith(e,s,t=!1){if(!s)throw new Error("animation cannot be null.");let a=!0,i=this.expandToIndex(e);i&&(i.nextTrackLast==-1?(this.tracks[e]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,a=!1):this.clearNext(i));let c=this.trackEntry(e,s,t,i);return this.setCurrent(e,c,a),this.queue.drain(),c}addAnimation(e,s,t=!1,a=0){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,i,t,a)}addAnimationWith(e,s,t=!1,a=0){if(!s)throw new Error("animation cannot be null.");let i=this.expandToIndex(e);if(i)for(;i.next;)i=i.next;let c=this.trackEntry(e,s,t,i);return i?(i.next=c,c.previous=i,a<=0&&(a+=i.getTrackComplete()-c.mixDuration)):(this.setCurrent(e,c,!0),this.queue.drain()),c.delay=a,c}setEmptyAnimation(e,s=0){let t=this.setAnimationWith(e,We.emptyAnimation(),!1);return t.mixDuration=s,t.trackEnd=s,t}addEmptyAnimation(e,s=0,t=0){let a=this.addAnimationWith(e,We.emptyAnimation(),!1,t);return t<=0&&(a.delay+=a.mixDuration-s),a.mixDuration=s,a.trackEnd=s,a}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,a=this.tracks.length;t<a;t++){let i=this.tracks[t];i&&this.setEmptyAnimation(i.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,t,a){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=e,i.animation=s,i.loop=t,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.attachmentThreshold=0,i.drawOrderThreshold=0,i.animationStart=0,i.animationEnd=s.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=a?this.data.getMix(a.animation,s):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=j.replace,i}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,t=e.length;s<t;s++){let a=e[s];if(!!a){for(;a.mixingFrom;)a=a.mixingFrom;do(!a.mixingTo||a.mixBlend!=j.add)&&this.computeHold(a),a=a.mixingTo;while(a)}}}computeHold(e){let s=e.mixingTo,t=e.animation.timelines,a=e.animation.timelines.length,i=e.timelineMode;i.length=a;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(s&&s.holdPrevious){for(let r=0;r<a;r++)i[r]=o.addAll(t[r].getPropertyIds())?$e:At;return}e:for(let r=0;r<a;r++){let l=t[r],n=l.getPropertyIds();if(!o.addAll(n))i[r]=ze;else if(!s||l instanceof Ae||l instanceof ke||l instanceof Le||!s.animation.hasTimeline(n))i[r]=St;else{for(let h=s.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(n)){if(e.mixDuration>0){i[r]=rs,c[r]=h;continue e}break}i[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 s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},es=We;es._emptyAnimation=new Ue("<empty>",[],0);var ts=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=j.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.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}},ss=class{constructor(e){this.objects=[],this.drainDisabled=!1,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,s){this.objects.push(ee.event),this.objects.push(e),this.objects.push(s)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,s=this.animState.listeners;for(let t=0;t<e.length;t+=2){let a=e[t],i=e[t+1];switch(a){case ee.start:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<s.length;o++){let r=s[o];r.start&&r.start(i)}break;case ee.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<s.length;o++){let r=s[o];r.interrupt&&r.interrupt(i)}break;case ee.end:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<s.length;o++){let r=s[o];r.end&&r.end(i)}case ee.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<s.length;o++){let r=s[o];r.dispose&&r.dispose(i)}this.animState.trackEntryPool.free(i);break;case ee.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<s.length;o++){let r=s[o];r.complete&&r.complete(i)}break;case ee.event:let c=e[t+++2];i.listener&&i.listener.event&&i.listener.event(i,c);for(let o=0;o<s.length;o++){let r=s[o];r.event&&r.event(i,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ee;(function(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"})(ee||(ee={}));var Ys=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,s){}},ze=0,St=1,At=2,$e=3,rs=4,kt=1,is=2,Ts=class{constructor(e){if(this.animationToMixTime={},this.defaultMix=0,!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,s,t){let a=this.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);this.setMixWith(a,i,t)}setMixWith(e,s,t){if(!e)throw new Error("from cannot be null.");if(!s)throw new Error("to cannot be null.");let a=e.name+"."+s.name;this.animationToMixTime[a]=t}getMix(e,s){let t=e.name+"."+s.name,a=this.animationToMixTime[t];return a===void 0?this.defaultMix:a}},He=class extends ae{constructor(e){super(e);this.color=new D(1,1,1,1)}copy(){let e=new He(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ct=class extends ae{constructor(e){super(e);this.endSlot=null,this.color=new D(.2275,.2275,.8078,1)}copy(){let e=new Ct(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},It=class{constructor(e){this._image=e}getImage(){return this._image}},Ce;(function(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"})(Ce||(Ce={}));var Ie;(function(e){e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat"})(Ie||(Ie={}));var as=class{constructor(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Xs=class extends It{setFilters(e,s){}setWraps(e,s){}dispose(){}},ns=class{constructor(e){this.pages=new Array,this.regions=new Array;let s=new Ms(e),t=new Array(4),a={};a.size=n=>{n.width=parseInt(t[1]),n.height=parseInt(t[2])},a.format=()=>{},a.filter=n=>{n.minFilter=B.enumValue(Ce,t[1]),n.magFilter=B.enumValue(Ce,t[2])},a.repeat=n=>{t[1].indexOf("x")!=-1&&(n.uWrap=Ie.Repeat),t[1].indexOf("y")!=-1&&(n.vWrap=Ie.Repeat)},a.pma=n=>{n.pma=t[1]=="true"};var i={};i.xy=n=>{n.x=parseInt(t[1]),n.y=parseInt(t[2])},i.size=n=>{n.width=parseInt(t[1]),n.height=parseInt(t[2])},i.bounds=n=>{n.x=parseInt(t[1]),n.y=parseInt(t[2]),n.width=parseInt(t[3]),n.height=parseInt(t[4])},i.offset=n=>{n.offsetX=parseInt(t[1]),n.offsetY=parseInt(t[2])},i.orig=n=>{n.originalWidth=parseInt(t[1]),n.originalHeight=parseInt(t[2])},i.offsets=n=>{n.offsetX=parseInt(t[1]),n.offsetY=parseInt(t[2]),n.originalWidth=parseInt(t[3]),n.originalHeight=parseInt(t[4])},i.rotate=n=>{let h=t[1];h=="true"?n.degrees=90:h!="false"&&(n.degrees=parseInt(h))},i.index=n=>{n.index=parseInt(t[1])};let c=s.readLine();for(;c&&c.trim().length==0;)c=s.readLine();for(;!(!c||c.trim().length==0||s.readEntry(t,c)==0);)c=s.readLine();let o=null,r=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=s.readLine();else if(o){let n=new Yt(o,c);for(;;){let h=s.readEntry(t,c=s.readLine());if(h==0)break;let d=i[t[0]];if(d)d(n);else{r||(r=[]),l||(l=[]),r.push(t[0]);let f=[];for(let u=0;u<h;u++)f.push(parseInt(t[u+1]));l.push(f)}}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 ls(c.trim());s.readEntry(t,c=s.readLine())!=0;){let n=a[t[0]];n&&n(o)}this.pages.push(o)}}findRegion(e){for(let s=0;s<this.regions.length;s++)if(this.regions[s].name==e)return this.regions[s];return null}setTextures(e,s=""){for(let t of this.pages)t.setTexture(e.get(s+t.name))}dispose(){var e;for(let s=0;s<this.pages.length;s++)(e=this.pages[s].texture)==null||e.dispose()}},Ms=class{constructor(e){this.index=0,this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,s){if(!s||(s=s.trim(),s.length==0))return 0;let t=s.indexOf(":");if(t==-1)return 0;e[0]=s.substr(0,t).trim();for(let a=1,i=t+1;;a++){let c=s.indexOf(",",i);if(c==-1)return e[a]=s.substr(i).trim(),a;if(e[a]=s.substr(i,c-i).trim(),i=c+1,a==4)return 4}}},ls=class{constructor(e){this.minFilter=Ce.Nearest,this.magFilter=Ce.Nearest,this.uWrap=Ie.ClampToEdge,this.vWrap=Ie.ClampToEdge,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap)}},Yt=class extends as{constructor(e,s){super();this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=e,this.name=s}},Ye=class extends ae{constructor(e,s){super(e);this.region=null,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new D(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new D(0,0,0,0),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=B.newFloatArray(e.length));let s=this.uvs,t=this.uvs.length,a=this.region.u,i=this.region.v,c=0,o=0;if(this.region instanceof Yt){let r=this.region,l=r.page.texture.getImage(),n=l.width,h=l.height;switch(r.degrees){case 90:a-=(r.originalHeight-r.offsetY-r.height)/n,i-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let d=0;d<t;d+=2)s[d]=a+e[d+1]*c,s[d+1]=i+(1-e[d])*o;return;case 180:a-=(r.originalWidth-r.offsetX-r.width)/n,i-=r.offsetY/h,c=r.originalWidth/n,o=r.originalHeight/h;for(let d=0;d<t;d+=2)s[d]=a+(1-e[d])*c,s[d+1]=i+(1-e[d+1])*o;return;case 270:a-=r.offsetY/n,i-=r.offsetX/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let d=0;d<t;d+=2)s[d]=a+(1-e[d+1])*c,s[d+1]=i+e[d]*o;return}a-=r.offsetX/n,i-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/n,o=r.originalHeight/h}else this.region?(c=this.region.u2-a,o=this.region.v2-i):(a=i=0,c=o=1);for(let r=0;r<t;r+=2)s[r]=a+e[r]*c,s[r+1]=i+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 Ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),B.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),B.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),B.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,t,a,i,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,t,a,i,c)}newLinkedMesh(){let e=new Ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttahment=this.timelineAttahment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Me=class extends ae{constructor(e){super(e);this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new D(1,1,1,1)}copy(){let e=new Me(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Tt=class extends ae{constructor(e){super(e);this.x=0,this.y=0,this.rotation=0,this.color=new D(.38,.94,0,1)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){let s=M.cosDeg(this.rotation),t=M.sinDeg(this.rotation),a=s*e.a+t*e.b,i=s*e.c+t*e.d;return Math.atan2(i,a)*M.radDeg}copy(){let e=new Tt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},os=class extends et{constructor(e,s){super(e);this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new D(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new D(1,1,1,1),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*t,c=a+this.region.width*s,o=i+this.region.height*t,r=this.rotation*Math.PI/180,l=Math.cos(r),n=Math.sin(r),h=this.x,d=this.y,f=a*l+h,u=a*n,g=i*l+d,x=i*n,p=c*l+h,y=c*n,m=o*l+d,w=o*n,b=this.offset;b[0]=f-x,b[1]=g+u,b[2]=f-w,b[3]=m+u,b[4]=p-w,b[5]=m+y,b[6]=p-x,b[7]=g+y;let v=this.uvs;e.degrees==90?(v[2]=e.u,v[3]=e.v2,v[4]=e.u,v[5]=e.v,v[6]=e.u2,v[7]=e.v,v[0]=e.u2,v[1]=e.v2):(v[0]=e.u,v[1]=e.v2,v[2]=e.u,v[3]=e.v,v[4]=e.u2,v[5]=e.v,v[6]=e.u2,v[7]=e.v2)}computeWorldVertices(e,s,t,a){this.sequence!=null&&this.sequence.apply(e,this);let i=e.bone,c=this.offset,o=i.worldX,r=i.worldY,l=i.a,n=i.b,h=i.c,d=i.d,f=0,u=0;f=c[0],u=c[1],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r,t+=a,f=c[2],u=c[3],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r,t+=a,f=c[4],u=c[5],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r,t+=a,f=c[6],u=c[7],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r}copy(){let e=new os(this.name,this.path);return e.region=this.region,e.rendererObject=this.rendererObject,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,B.arrayCopy(this.uvs,0,e.uvs,0,8),B.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},P=os;P.X1=0,P.Y1=1,P.C1R=2,P.C1G=3,P.C1B=4,P.C1A=5,P.U1=6,P.V1=7,P.X2=8,P.Y2=9,P.C2R=10,P.C2G=11,P.C2B=12,P.C2A=13,P.U2=14,P.V2=15,P.X3=16,P.Y3=17,P.C3R=18,P.C3G=19,P.C3B=20,P.C3A=21,P.U3=22,P.V3=23,P.X4=24,P.Y4=25,P.C4R=26,P.C4G=27,P.C4B=28,P.C4A=29,P.U4=30,P.V4=31;var Fs=class{constructor(e){this.atlas=e}loadSequence(e,s,t){let a=t.regions;for(let i=0,c=a.length;i<c;i++){let o=t.getPath(s,i),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");a[i]=r,a[i].renderObject=a[i]}}newRegionAttachment(e,s,t,a){let i=new P(s,t);if(a!=null)this.loadSequence(s,t,a);else{let c=this.atlas.findRegion(t);if(!c)throw new Error("Region not found in atlas: "+t+" (region attachment: "+s+")");c.renderObject=c,i.region=c}return i}newMeshAttachment(e,s,t,a){let i=new Ye(s,t);if(a!=null)this.loadSequence(s,t,a);else{let c=this.atlas.findRegion(t);if(!c)throw new Error("Region not found in atlas: "+t+" (mesh attachment: "+s+")");c.renderObject=c,i.region=c}return i}newBoundingBoxAttachment(e,s){return new He(s)}newPathAttachment(e,s){return new Me(s)}newPointAttachment(e,s){return new Tt(s)}newClippingAttachment(e,s){return new Ct(s)}},Xt=class{constructor(e,s,t){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=te.Normal,this.skinRequired=!1,this.color=new D,e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.name=s,this.parent=t}},te;(function(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"})(te||(te={}));var Mt=class{constructor(e,s,t){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=s,this.parent=t,this.setToSetupPose()}isActive(){return this.active}update(){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,s,t,a,i,c,o){this.ax=e,this.ay=s,this.arotation=t,this.ascaleX=a,this.ascaleY=i,this.ashearX=c,this.ashearY=o;let r=this.parent;if(!r){let f=this.skeleton,u=t+90+o,g=f.scaleX,x=f.scaleY;this.a=M.cosDeg(t+c)*a*g,this.b=M.cosDeg(u)*i*g,this.c=M.sinDeg(t+c)*a*x,this.d=M.sinDeg(u)*i*x,this.worldX=e*g+f.x,this.worldY=s*x+f.y;return}let l=r.a,n=r.b,h=r.c,d=r.d;switch(this.worldX=l*e+n*s+r.worldX,this.worldY=h*e+d*s+r.worldY,this.data.transformMode){case te.Normal:{let f=t+90+o,u=M.cosDeg(t+c)*a,g=M.cosDeg(f)*i,x=M.sinDeg(t+c)*a,p=M.sinDeg(f)*i;this.a=l*u+n*x,this.b=l*g+n*p,this.c=h*u+d*x,this.d=h*g+d*p;return}case te.OnlyTranslation:{let f=t+90+o;this.a=M.cosDeg(t+c)*a,this.b=M.cosDeg(f)*i,this.c=M.sinDeg(t+c)*a,this.d=M.sinDeg(f)*i;break}case te.NoRotationOrReflection:{let f=l*l+h*h,u=0;f>1e-4?(f=Math.abs(l*d-n*h)/f,l/=this.skeleton.scaleX,h/=this.skeleton.scaleY,n=h*f,d=l*f,u=Math.atan2(h,l)*M.radDeg):(l=0,h=0,u=90-Math.atan2(d,n)*M.radDeg);let g=t+c-u,x=t+o-u+90,p=M.cosDeg(g)*a,y=M.cosDeg(x)*i,m=M.sinDeg(g)*a,w=M.sinDeg(x)*i;this.a=l*p-n*m,this.b=l*y-n*w,this.c=h*p+d*m,this.d=h*y+d*w;break}case te.NoScale:case te.NoScaleOrReflection:{let f=M.cosDeg(t),u=M.sinDeg(t),g=(l*f+n*u)/this.skeleton.scaleX,x=(h*f+d*u)/this.skeleton.scaleY,p=Math.sqrt(g*g+x*x);p>1e-5&&(p=1/p),g*=p,x*=p,p=Math.sqrt(g*g+x*x),this.data.transformMode==te.NoScale&&l*d-n*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let y=Math.PI/2+Math.atan2(x,g),m=Math.cos(y)*p,w=Math.sin(y)*p,b=M.cosDeg(c)*a,v=M.cosDeg(90+o)*i,S=M.sinDeg(c)*a,A=M.sinDeg(90+o)*i;this.a=g*b+m*S,this.b=g*v+m*A,this.c=x*b+w*S,this.d=x*v+w*A;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}getWorldRotationX(){return Math.atan2(this.c,this.a)*M.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*M.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)}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)*M.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)*M.radDeg;return}let s=e.a,t=e.b,a=e.c,i=e.d,c=1/(s*i-t*a),o=this.worldX-e.worldX,r=this.worldY-e.worldY;this.ax=o*i*c-r*t*c,this.ay=r*s*c-o*a*c;let l=c*i,n=c*s,h=c*t,d=c*a,f=l*this.a-h*this.c,u=l*this.b-h*this.d,g=n*this.c-d*this.a,x=n*this.d-d*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+g*g),this.ascaleX>1e-4){let p=f*x-u*g;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(f*u+g*x,p)*M.radDeg,this.arotation=Math.atan2(g,f)*M.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*M.radDeg}worldToLocal(e){let s=1/(this.a*this.d-this.b*this.c),t=e.x-this.worldX,a=e.y-this.worldY;return e.x=t*this.d*s-a*this.b*s,e.y=a*this.a*s-t*this.c*s,e}localToWorld(e){let s=e.x,t=e.y;return e.x=s*this.a+t*this.b+this.worldX,e.y=s*this.c+t*this.d+this.worldY,e}worldToLocalRotation(e){let s=M.sinDeg(e),t=M.cosDeg(e);return Math.atan2(this.a*s-this.c*t,this.d*t-this.b*s)*M.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let s=M.sinDeg(e),t=M.cosDeg(e);return Math.atan2(t*this.c+s*this.d,t*this.a+s*this.b)*M.radDeg}rotateWorld(e){let s=this.a,t=this.b,a=this.c,i=this.d,c=M.cosDeg(e),o=M.sinDeg(e);this.a=c*s-o*a,this.b=c*t-o*i,this.c=o*s+c*a,this.d=o*t+c*i}},Ge=class{constructor(e,s,t){this.name=e,this.order=s,this.skinRequired=t}},hs=class{constructor(e,s="",t=new Ft){this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=e,this.pathPrefix=s,this.downloader=t}start(e){return this.toLoad++,this.pathPrefix+e}success(e,s,t){this.toLoad--,this.loaded++,this.assets[s]=t,e&&e(s,t)}error(e,s,t){this.toLoad--,this.loaded++,this.errors[s]=t,e&&e(s,t)}loadAll(){return new Promise((s,t)=>{let a=()=>{if(this.isLoadingComplete()){this.hasErrors()?t(this.errors):s(this);return}requestAnimationFrame(a)};requestAnimationFrame(a)})}setRawDataURI(e,s){this.downloader.rawDataUris[this.pathPrefix+e]=s}loadBinary(e,s=()=>{},t=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,a=>{this.success(s,e,a)},(a,i)=>{this.error(t,e,`Couldn't load binary ${e}: status ${a}, ${i}`)})}loadText(e,s=()=>{},t=()=>{}){e=this.start(e),this.downloader.downloadText(e,a=>{this.success(s,e,a)},(a,i)=>{this.error(t,e,`Couldn't load text ${e}: status ${a}, ${i}`)})}loadJson(e,s=()=>{},t=()=>{}){e=this.start(e),this.downloader.downloadJson(e,a=>{this.success(s,e,a)},(a,i)=>{this.error(t,e,`Couldn't load JSON ${e}: status ${a}, ${i}`)})}loadTexture(e,s=()=>{},t=()=>{}){if(e=this.start(e),!!!(typeof window!="undefined"&&typeof navigator!="undefined"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(t,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(s,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(s,e,this.textureLoader(c))},c.onerror=()=>{this.error(t,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,s=()=>{},t=()=>{},a){let i=e.lastIndexOf("/"),c=i>=0?e.substring(0,i+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new ns(o),l=r.pages.length,n=!1;for(let h of r.pages)this.loadTexture(a?a[h.name]:c+h.name,(d,f)=>{n||(h.setTexture(f),--l==0&&this.success(s,e,r))},(d,f)=>{n||this.error(t,e,`Couldn't load texture atlas ${e} page image: ${d}`),n=!0})}catch(r){this.error(t,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(t,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 s=this.assets[e];if(s)return s;let t=this.errors[e];throw Error("Asset not found: "+e+(t?`
2
- `+t:""))}remove(e){e=this.pathPrefix+e;let s=this.assets[e];return s.dispose&&s.dispose(),delete this.assets[e],s}removeAll(){for(let e in this.assets){let s=this.assets[e];s.dispose&&s.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}},Ft=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let s=e.indexOf("base64,");return s!=-1?(s+="base64,".length,atob(e.substr(s))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var s=window.atob(e),t=s.length,a=new Uint8Array(t),i=0;i<t;i++)a[i]=s.charCodeAt(i);return a}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let s=e.indexOf("base64,");if(s==-1)throw new Error("Not a binary data URI.");return s+="base64,".length,this.base64ToUint8Array(e.substr(s))}downloadText(e,s,t){if(this.start(e,s,t))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let a=new XMLHttpRequest;a.overrideMimeType("text/html"),a.open("GET",e,!0);let i=()=>{this.finish(e,a.status,a.responseText)};a.onload=i,a.onerror=i,a.send()}downloadJson(e,s,t){this.downloadText(e,a=>{s(JSON.parse(a))},t)}downloadBinary(e,s,t){if(this.start(e,s,t))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer";let i=()=>{this.finish(e,a.status,a.response)};a.onload=()=>{a.status==200||a.status==0?this.finish(e,200,new Uint8Array(a.response)):i()},a.onerror=i,a.send()}start(e,s,t){let a=this.callbacks[e];try{if(a)return!0;this.callbacks[e]=a=[]}finally{a.push(s,t)}}finish(e,s,t){let a=this.callbacks[e];delete this.callbacks[e];let i=s==200||s==0?[t]:[s,t];for(let c=i.length-1,o=a.length;c<o;c+=2)a[c].apply(null,i)}},Et=class{constructor(e,s){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!s)throw new Error("data cannot be null.");this.time=e,this.data=s}},Rt=class{constructor(e){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=e}},cs=class{constructor(e,s){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)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 a=0;a<e.bones.length;a++){let i=s.findBone(e.bones[a].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[a].name}`);this.bones.push(i)}let t=s.findBone(e.target.name);if(!t)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=t}isActive(){return this.active}update(){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,s,t,a,i,c,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,h=r.c,d=r.d,f=-e.ashearX-e.arotation,u=0,g=0;switch(e.data.transformMode){case te.OnlyTranslation:u=s-e.worldX,g=t-e.worldY;break;case te.NoRotationOrReflection:let y=Math.abs(l*d-n*h)/(l*l+h*h),m=l/e.skeleton.scaleX,w=h/e.skeleton.scaleY;n=-w*y*e.skeleton.scaleX,d=m*y*e.skeleton.scaleY,f+=Math.atan2(w,m)*M.radDeg;default:let b=s-r.worldX,v=t-r.worldY,S=l*d-n*h;u=(b*d-v*n)/S-e.ax,g=(v*l-b*h)/S-e.ay}f+=Math.atan2(g,u)*M.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=e.ascaleX,p=e.ascaleY;if(a||i){switch(e.data.transformMode){case te.NoScale:case te.NoScaleOrReflection:u=s-e.worldX,g=t-e.worldY}let y=e.data.length*x,m=Math.sqrt(u*u+g*g);if(a&&m<y||i&&m>y&&y>1e-4){let w=(m/y-1)*o+1;x*=w,c&&(p*=w)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,x,p,e.ashearX,e.ashearY)}apply2(e,s,t,a,i,c,o,r,l){let n=e.ax,h=e.ay,d=e.ascaleX,f=e.ascaleY,u=d,g=f,x=s.ascaleX,p=0,y=0,m=0;d<0?(d=-d,p=180,m=-1):(p=0,m=1),f<0&&(f=-f,m=-m),x<0?(x=-x,y=180):y=0;let w=s.ax,b=0,v=0,S=0,A=e.a,C=e.b,Y=e.c,X=e.d,R=Math.abs(d-f)<=1e-4;!R||c?(b=0,v=A*w+e.worldX,S=Y*w+e.worldY):(b=s.ay,v=A*w+C*b+e.worldX,S=Y*w+X*b+e.worldY);let E=e.parent;if(!E)throw new Error("IK parent must itself have a parent.");A=E.a,C=E.b,Y=E.c,X=E.d;let F=1/(A*X-C*Y),I=v-E.worldX,T=S-E.worldY,V=(I*X-T*C)*F-n,U=(T*A-I*Y)*F-h,L=Math.sqrt(V*V+U*U),W=s.data.length*x,O,$;if(L<1e-4){this.apply1(e,t,a,!1,c,!1,l),s.updateWorldTransformWith(w,b,0,s.ascaleX,s.ascaleY,s.ashearX,s.ashearY);return}I=t-E.worldX,T=a-E.worldY;let q=(I*X-T*C)*F-n,N=(T*A-I*Y)*F-h,G=q*q+N*N;if(r!=0){r*=d*(x+1)*.5;let Q=Math.sqrt(G),re=Q-L-W*d+r;if(re>0){let ie=Math.min(1,re/(r*2))-1;ie=(re-r*(1-ie*ie))/Q,q-=ie*q,N-=ie*N,G=q*q+N*N}}e:if(R){W*=d;let Q=(G-L*L-W*W)/(2*L*W);Q<-1?(Q=-1,$=Math.PI*i):Q>1?(Q=1,$=0,c&&(A=(Math.sqrt(G)/(L+W)-1)*l+1,u*=A,o&&(g*=A))):$=Math.acos(Q)*i,A=L+W*Q,C=W*Math.sin($),O=Math.atan2(N*A-q*C,q*A+N*C)}else{A=d*W,C=f*W;let Q=A*A,re=C*C,ie=Math.atan2(N,q);Y=re*L*L+Q*G-Q*re;let ve=-2*re*L,Ee=re-Q;if(X=ve*ve-4*Ee*Y,X>=0){let Re=Math.sqrt(X);ve<0&&(Re=-Re),Re=-(ve+Re)*.5;let bs=Re/Ee,ps=Y/Re,Be=Math.abs(bs)<Math.abs(ps)?bs:ps;if(Be*Be<=G){T=Math.sqrt(G-Be*Be)*i,O=ie-Math.atan2(T,Be),$=Math.atan2(T/f,(Be-L)/d);break e}}let Ne=M.PI,Ke=L-A,Wt=Ke*Ke,gs=0,xs=0,Qe=L+A,zt=Qe*Qe,ws=0;Y=-A*L/(Q-re),Y>=-1&&Y<=1&&(Y=Math.acos(Y),I=A*Math.cos(Y)+L,T=C*Math.sin(Y),X=I*I+T*T,X<Wt&&(Ne=Y,Wt=X,Ke=I,gs=T),X>zt&&(xs=Y,zt=X,Qe=I,ws=T)),G<=(Wt+zt)*.5?(O=ie-Math.atan2(gs*i,Ke),$=Ne*i):(O=ie-Math.atan2(ws*i,Qe),$=xs*i)}let Z=Math.atan2(b,w)*m,de=e.arotation;O=(O-Z)*M.radDeg+p-de,O>180?O-=360:O<-180&&(O+=360),e.updateWorldTransformWith(n,h,de+O*l,u,g,0,0),de=s.arotation,$=(($+Z)*M.radDeg-s.ashearX)*m+y-de,$>180?$-=360:$<-180&&($+=360),s.updateWorldTransformWith(w,b,de+$*l,s.ascaleX,s.ascaleY,s.ashearX,s.ashearY)}},Bt=class extends Ge{constructor(e){super(e,0,!1);this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Pt=class extends Ge{constructor(e){super(e,0,!1);this.bones=new Array,this._target=null,this.positionMode=oe.Fixed,this.spacingMode=K.Fixed,this.rotateMode=ye.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},oe;(function(e){e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent"})(oe||(oe={}));var K;(function(e){e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional"})(K||(K={}));var ye;(function(e){e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale"})(ye||(ye={}));var xe=class{constructor(e,s){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let a=0,i=e.bones.length;a<i;a++){let c=s.findBone(e.bones[a].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[a].name}.`);this.bones.push(c)}let t=s.findSlot(e.target.name);if(!t)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=t,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}update(){let e=this.target.getAttachment();if(!(e instanceof Me))return;let s=this.mixRotate,t=this.mixX,a=this.mixY;if(s==0&&t==0&&a==0)return;let i=this.data,c=i.rotateMode==ye.Tangent,o=i.rotateMode==ye.ChainScale,r=this.bones,l=r.length,n=c?l:l+1,h=B.setArraySize(this.spaces,n),d=o?this.lengths=B.setArraySize(this.lengths,l):[],f=this.spacing;switch(i.spacingMode){case K.Percent:if(o)for(let b=0,v=n-1;b<v;b++){let S=r[b],A=S.data.length;if(A<xe.epsilon)d[b]=0;else{let C=A*S.a,Y=A*S.c;d[b]=Math.sqrt(C*C+Y*Y)}}B.arrayFill(h,1,n,f);break;case K.Proportional:let m=0;for(let b=0,v=n-1;b<v;){let S=r[b],A=S.data.length;if(A<xe.epsilon)o&&(d[b]=0),h[++b]=f;else{let C=A*S.a,Y=A*S.c,X=Math.sqrt(C*C+Y*Y);o&&(d[b]=X),h[++b]=X,m+=X}}if(m>0){m=n/m*f;for(let b=1;b<n;b++)h[b]*=m}break;default:let w=i.spacingMode==K.Length;for(let b=0,v=n-1;b<v;){let S=r[b],A=S.data.length;if(A<xe.epsilon)o&&(d[b]=0),h[++b]=f;else{let C=A*S.a,Y=A*S.c,X=Math.sqrt(C*C+Y*Y);o&&(d[b]=X),h[++b]=(w?A+f:f)*X/A}}}let u=this.computeWorldPositions(e,n,c),g=u[0],x=u[1],p=i.offsetRotation,y=!1;if(p==0)y=i.rotateMode==ye.Chain;else{y=!1;let m=this.target.bone;p*=m.a*m.d-m.b*m.c>0?M.degRad:-M.degRad}for(let m=0,w=3;m<l;m++,w+=3){let b=r[m];b.worldX+=(g-b.worldX)*t,b.worldY+=(x-b.worldY)*a;let v=u[w],S=u[w+1],A=v-g,C=S-x;if(o){let Y=d[m];if(Y!=0){let X=(Math.sqrt(A*A+C*C)/Y-1)*s+1;b.a*=X,b.c*=X}}if(g=v,x=S,s>0){let Y=b.a,X=b.b,R=b.c,E=b.d,F=0,I=0,T=0;if(c?F=u[w-1]:h[m+1]==0?F=u[w+2]:F=Math.atan2(C,A),F-=Math.atan2(R,Y),y){I=Math.cos(F),T=Math.sin(F);let V=b.data.length;g+=(V*(I*Y-T*R)-A)*s,x+=(V*(T*Y+I*R)-C)*s}else F+=p;F>M.PI?F-=M.PI2:F<-M.PI&&(F+=M.PI2),F*=s,I=Math.cos(F),T=Math.sin(F),b.a=I*Y-T*R,b.b=I*X-T*E,b.c=T*Y+I*R,b.d=T*X+I*E}b.updateAppliedTransform()}}computeWorldPositions(e,s,t){let a=this.target,i=this.position,c=this.spaces,o=B.setArraySize(this.positions,s*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,h=n/6,d=xe.NONE;if(!e.constantSpeed){let U=e.lengths;h-=l?1:2;let L=U[h];this.data.positionMode==oe.Percent&&(i*=L);let W;switch(this.data.spacingMode){case K.Percent:W=L;break;case K.Proportional:W=L/s;break;default:W=1}r=B.setArraySize(this.world,8);for(let O=0,$=0,q=0;O<s;O++,$+=3){let N=c[O]*W;i+=N;let G=i;if(l)G%=L,G<0&&(G+=L),q=0;else if(G<0){d!=xe.BEFORE&&(d=xe.BEFORE,e.computeWorldVertices(a,2,4,r,0,2)),this.addBeforePosition(G,r,0,o,$);continue}else if(G>L){d!=xe.AFTER&&(d=xe.AFTER,e.computeWorldVertices(a,n-6,4,r,0,2)),this.addAfterPosition(G-L,r,0,o,$);continue}for(;;q++){let Z=U[q];if(!(G>Z)){if(q==0)G/=Z;else{let de=U[q-1];G=(G-de)/(Z-de)}break}}q!=d&&(d=q,l&&q==h?(e.computeWorldVertices(a,n-4,4,r,0,2),e.computeWorldVertices(a,0,4,r,4,2)):e.computeWorldVertices(a,q*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,$,t||O>0&&N==0)}return o}l?(n+=2,r=B.setArraySize(this.world,n),e.computeWorldVertices(a,2,n-4,r,0,2),e.computeWorldVertices(a,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(h--,n-=4,r=B.setArraySize(this.world,n),e.computeWorldVertices(a,2,n,r,0,2));let f=B.setArraySize(this.curves,h),u=0,g=r[0],x=r[1],p=0,y=0,m=0,w=0,b=0,v=0,S=0,A=0,C=0,Y=0,X=0,R=0,E=0,F=0;for(let U=0,L=2;U<h;U++,L+=6)p=r[L],y=r[L+1],m=r[L+2],w=r[L+3],b=r[L+4],v=r[L+5],S=(g-p*2+m)*.1875,A=(x-y*2+w)*.1875,C=((p-m)*3-g+b)*.09375,Y=((y-w)*3-x+v)*.09375,X=S*2+C,R=A*2+Y,E=(p-g)*.75+S+C*.16666667,F=(y-x)*.75+A+Y*.16666667,u+=Math.sqrt(E*E+F*F),E+=X,F+=R,X+=C,R+=Y,u+=Math.sqrt(E*E+F*F),E+=X,F+=R,u+=Math.sqrt(E*E+F*F),E+=X+C,F+=R+Y,u+=Math.sqrt(E*E+F*F),f[U]=u,g=b,x=v;this.data.positionMode==oe.Percent&&(i*=u);let I;switch(this.data.spacingMode){case K.Percent:I=u;break;case K.Proportional:I=u/s;break;default:I=1}let T=this.segments,V=0;for(let U=0,L=0,W=0,O=0;U<s;U++,L+=3){let $=c[U]*I;i+=$;let q=i;if(l)q%=u,q<0&&(q+=u),W=0;else if(q<0){this.addBeforePosition(q,r,0,o,L);continue}else if(q>u){this.addAfterPosition(q-u,r,n-4,o,L);continue}for(;;W++){let N=f[W];if(!(q>N)){if(W==0)q/=N;else{let G=f[W-1];q=(q-G)/(N-G)}break}}if(W!=d){d=W;let N=W*6;for(g=r[N],x=r[N+1],p=r[N+2],y=r[N+3],m=r[N+4],w=r[N+5],b=r[N+6],v=r[N+7],S=(g-p*2+m)*.03,A=(x-y*2+w)*.03,C=((p-m)*3-g+b)*.006,Y=((y-w)*3-x+v)*.006,X=S*2+C,R=A*2+Y,E=(p-g)*.3+S+C*.16666667,F=(y-x)*.3+A+Y*.16666667,V=Math.sqrt(E*E+F*F),T[0]=V,N=1;N<8;N++)E+=X,F+=R,X+=C,R+=Y,V+=Math.sqrt(E*E+F*F),T[N]=V;E+=X,F+=R,V+=Math.sqrt(E*E+F*F),T[8]=V,E+=X+C,F+=R+Y,V+=Math.sqrt(E*E+F*F),T[9]=V,O=0}for(q*=V;;O++){let N=T[O];if(!(q>N)){if(O==0)q/=N;else{let G=T[O-1];q=O+(q-G)/(N-G)}break}}this.addCurvePosition(q*.1,g,x,p,y,m,w,b,v,o,L,t||U>0&&$==0)}return o}addBeforePosition(e,s,t,a,i){let c=s[t],o=s[t+1],r=s[t+2]-c,l=s[t+3]-o,n=Math.atan2(l,r);a[i]=c+e*Math.cos(n),a[i+1]=o+e*Math.sin(n),a[i+2]=n}addAfterPosition(e,s,t,a,i){let c=s[t+2],o=s[t+3],r=c-s[t],l=o-s[t+1],n=Math.atan2(l,r);a[i]=c+e*Math.cos(n),a[i+1]=o+e*Math.sin(n),a[i+2]=n}addCurvePosition(e,s,t,a,i,c,o,r,l,n,h,d){if(e==0||isNaN(e)){n[h]=s,n[h+1]=t,n[h+2]=Math.atan2(i-t,a-s);return}let f=e*e,u=f*e,g=1-e,x=g*g,p=x*g,y=g*e,m=y*3,w=g*m,b=m*e,v=s*p+a*w+c*b+r*u,S=t*p+i*w+o*b+l*u;n[h]=v,n[h+1]=S,d&&(e<.001?n[h+2]=Math.atan2(i-t,a-s):n[h+2]=Math.atan2(S-(t*x+i*y*2+o*f),v-(s*x+a*y*2+c*f)))}},Fe=xe;Fe.NONE=-1,Fe.BEFORE=-2,Fe.AFTER=-3,Fe.epsilon=1e-5;var ds=class{constructor(e,s){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!e)throw new Error("data cannot be null.");if(!s)throw new Error("bone cannot be null.");this.data=e,this.bone=s,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ae)||!(this.attachment instanceof ae)||e.timelineAttahment!=this.attachment.timelineAttahment)&&(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}},fs=class{constructor(e,s){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new Oe,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)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 a=0;a<e.bones.length;a++){let i=s.findBone(e.bones[a].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[a].name}.`);this.bones.push(i)}let t=s.findBone(e.target.name);if(!t)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=t}isActive(){return this.active}update(){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleX==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,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=s!=0||t!=0,r=this.target,l=r.a,n=r.b,h=r.c,d=r.d,f=l*d-n*h>0?M.degRad:-M.degRad,u=this.data.offsetRotation*f,g=this.data.offsetShearY*f,x=this.bones;for(let p=0,y=x.length;p<y;p++){let m=x[p];if(e!=0){let w=m.a,b=m.b,v=m.c,S=m.d,A=Math.atan2(h,l)-Math.atan2(v,w)+u;A>M.PI?A-=M.PI2:A<-M.PI&&(A+=M.PI2),A*=e;let C=Math.cos(A),Y=Math.sin(A);m.a=C*w-Y*v,m.b=C*b-Y*S,m.c=Y*w+C*v,m.d=Y*b+C*S}if(o){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),m.worldX+=(w.x-m.worldX)*s,m.worldY+=(w.y-m.worldY)*t}if(a!=0){let w=Math.sqrt(m.a*m.a+m.c*m.c);w!=0&&(w=(w+(Math.sqrt(l*l+h*h)-w+this.data.offsetScaleX)*a)/w),m.a*=w,m.c*=w}if(i!=0){let w=Math.sqrt(m.b*m.b+m.d*m.d);w!=0&&(w=(w+(Math.sqrt(n*n+d*d)-w+this.data.offsetScaleY)*i)/w),m.b*=w,m.d*=w}if(c>0){let w=m.b,b=m.d,v=Math.atan2(b,w),S=Math.atan2(d,n)-Math.atan2(h,l)-(v-Math.atan2(m.c,m.a));S>M.PI?S-=M.PI2:S<-M.PI&&(S+=M.PI2),S=v+(S+g)*c;let A=Math.sqrt(w*w+b*b);m.b=Math.cos(S)*A,m.d=Math.sin(S)*A}m.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=s!=0||t!=0,r=this.target,l=r.a,n=r.b,h=r.c,d=r.d,f=l*d-n*h>0?M.degRad:-M.degRad,u=this.data.offsetRotation*f,g=this.data.offsetShearY*f,x=this.bones;for(let p=0,y=x.length;p<y;p++){let m=x[p];if(e!=0){let w=m.a,b=m.b,v=m.c,S=m.d,A=Math.atan2(h,l)+u;A>M.PI?A-=M.PI2:A<-M.PI&&(A+=M.PI2),A*=e;let C=Math.cos(A),Y=Math.sin(A);m.a=C*w-Y*v,m.b=C*b-Y*S,m.c=Y*w+C*v,m.d=Y*b+C*S}if(o){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),m.worldX+=w.x*s,m.worldY+=w.y*t}if(a!=0){let w=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*a+1;m.a*=w,m.c*=w}if(i!=0){let w=(Math.sqrt(n*n+d*d)-1+this.data.offsetScaleY)*i+1;m.b*=w,m.d*=w}if(c>0){let w=Math.atan2(d,n)-Math.atan2(h,l);w>M.PI?w-=M.PI2:w<-M.PI&&(w+=M.PI2);let b=m.b,v=m.d;w=Math.atan2(v,b)+(w-M.PI/2+g)*c;let S=Math.sqrt(b*b+v*v);m.b=Math.cos(w)*S,m.d=Math.sin(w)*S}m.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],d=h.arotation;if(e!=0){let y=o.arotation-d+this.data.offsetRotation;y-=(16384-(16384.499999999996-y/360|0))*360,d+=y*e}let f=h.ax,u=h.ay;f+=(o.ax-f+this.data.offsetX)*s,u+=(o.ay-u+this.data.offsetY)*t;let g=h.ascaleX,x=h.ascaleY;a!=0&&g!=0&&(g=(g+(o.ascaleX-g+this.data.offsetScaleX)*a)/g),i!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*i)/x);let p=h.ashearY;if(c!=0){let y=o.ashearY-p+this.data.offsetShearY;y-=(16384-(16384.499999999996-y/360|0))*360,p+=y*c}h.updateWorldTransformWith(f,u,d,g,x,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],d=h.arotation+(o.arotation+this.data.offsetRotation)*e,f=h.ax+(o.ax+this.data.offsetX)*s,u=h.ay+(o.ay+this.data.offsetY)*t,g=h.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*a+1),x=h.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),p=h.ashearY+(o.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(f,u,d,g,x,h.ashearX,p)}}},Es=class{constructor(e){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let t=e.bones[s],a;if(!t.parent)a=new Mt(t,this,null);else{let i=this.bones[t.parent.index];a=new Mt(t,this,i),i.children.push(a)}this.bones.push(a)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let t=e.slots[s],a=this.bones[t.boneData.index],i=new ds(t,a);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let t=e.ikConstraints[s];this.ikConstraints.push(new cs(t,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let t=e.transformConstraints[s];this.transformConstraints.push(new fs(t,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let t=e.pathConstraints[s];this.pathConstraints.push(new Fe(t,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let n=0,h=s.length;n<h;n++){let d=s[n];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let n=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let f=this.bones[n[h].index];do f.sorted=!1,f.active=!0,f=f.parent;while(f)}}let t=this.ikConstraints,a=this.transformConstraints,i=this.pathConstraints,c=t.length,o=a.length,r=i.length,l=c+o+r;e:for(let n=0;n<l;n++){for(let h=0;h<c;h++){let d=t[h];if(d.data.order==n){this.sortIkConstraint(d);continue e}}for(let h=0;h<o;h++){let d=a[h];if(d.data.order==n){this.sortTransformConstraint(d);continue e}}for(let h=0;h<r;h++){let d=i[h];if(d.data.order==n){this.sortPathConstraint(d);continue e}}}for(let n=0,h=s.length;n<h;n++)this.sortBone(s[n])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let t=e.bones,a=t[0];if(this.sortBone(a),t.length==1)this._updateCache.push(e),this.sortReset(a.children);else{let i=t[t.length-1];this.sortBone(i),this._updateCache.push(e),this.sortReset(a.children),i.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&B.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,t=s.data.index,a=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,t,a),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,t,a);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],t,a);let i=s.getAttachment();i instanceof Me&&this.sortPathConstraintAttachmentWith(i,a);let c=e.bones,o=c.length;for(let r=0;r<o;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(c[r].children);for(let r=0;r<o;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,t=s.length;if(e.data.local)for(let a=0;a<t;a++){let i=s[a];this.sortBone(i.parent),this.sortBone(i)}else for(let a=0;a<t;a++)this.sortBone(s[a]);this._updateCache.push(e);for(let a=0;a<t;a++)this.sortReset(s[a].children);for(let a=0;a<t;a++)s[a].sorted=!0}sortPathConstraintAttachment(e,s,t){let a=e.attachments[s];if(!!a)for(let i in a)this.sortPathConstraintAttachmentWith(a[i],t)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Me))return;let t=e.bones;if(!t)this.sortBone(s);else{let a=this.bones;for(let i=0,c=t.length;i<c;){let o=t[i++];for(o+=i;i<o;)this.sortBone(a[t[i++]])}}}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,t=e.length;s<t;s++){let a=e[s];!a.active||(a.sorted&&this.sortReset(a.children),a.sorted=!1)}}updateWorldTransform(){let e=this.bones;for(let t=0,a=e.length;t<a;t++){let i=e[t];i.ax=i.x,i.ay=i.y,i.arotation=i.rotation,i.ascaleX=i.scaleX,i.ascaleY=i.scaleY,i.ashearX=i.shearX,i.ashearY=i.shearY}let s=this._updateCache;for(let t=0,a=s.length;t<a;t++)s[t].update()}updateWorldTransformWith(e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let t=e.a,a=e.b,i=e.c,c=e.d;s.worldX=t*this.x+a*this.y+e.worldX,s.worldY=i*this.x+c*this.y+e.worldY;let o=s.rotation+90+s.shearY,r=M.cosDeg(s.rotation+s.shearX)*s.scaleX,l=M.cosDeg(o)*s.scaleY,n=M.sinDeg(s.rotation+s.shearX)*s.scaleX,h=M.sinDeg(o)*s.scaleY;s.a=(t*r+a*n)*this.scaleX,s.b=(t*l+a*h)*this.scaleX,s.c=(i*r+c*n)*this.scaleY,s.d=(i*l+c*h)*this.scaleY;let d=this._updateCache;for(let f=0,u=d.length;f<u;f++){let g=d[f];g!=s&&g.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let e=this.bones;for(let i=0,c=e.length;i<c;i++)e[i].setToSetupPose();let s=this.ikConstraints;for(let i=0,c=s.length;i<c;i++){let o=s[i];o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}let t=this.transformConstraints;for(let i=0,c=t.length;i<c;i++){let o=t[i],r=o.data;o.mixRotate=r.mixRotate,o.mixX=r.mixX,o.mixY=r.mixY,o.mixScaleX=r.mixScaleX,o.mixScaleY=r.mixScaleY,o.mixShearY=r.mixShearY}let a=this.pathConstraints;for(let i=0,c=a.length;i<c;i++){let o=a[i],r=o.data;o.position=r.position,o.spacing=r.spacing,o.mixRotate=r.mixRotate,o.mixX=r.mixX,o.mixY=r.mixY}}setSlotsToSetupPose(){let e=this.slots;B.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,t=e.length;s<t;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let t=0,a=s.length;t<a;t++){let i=s[t],c=i.data.attachmentName;if(c){let o=e.getAttachment(t,c);o&&i.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let t=this.data.findSlot(e);if(!t)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(t.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let t=this.skin.getAttachment(e,s);if(t)return t}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let a=0,i=t.length;a<i;a++){let c=t[a];if(c.data.name==e){let o=null;if(s&&(o=this.getAttachment(a,s),!o))throw new Error("Attachment not found: "+s+", for slot: "+e);c.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.ikConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.transformConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.pathConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}getBoundsRect(){let e=new Oe,s=new Oe;return this.getBounds(e,s),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(e,s,t=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let a=this.drawOrder,i=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l=0,n=a.length;l<n;l++){let h=a[l];if(!h.bone.active)continue;let d=0,f=null,u=h.getAttachment();if(u instanceof P)d=8,f=B.setArraySize(t,d,0),u.computeWorldVertices(h,f,0,2);else if(u instanceof Ye){let g=u;d=g.worldVerticesLength,f=B.setArraySize(t,d,0),g.computeWorldVertices(h,0,d,f,0,2)}if(f)for(let g=0,x=f.length;g<x;g+=2){let p=f[g],y=f[g+1];i=Math.min(i,p),c=Math.min(c,y),o=Math.max(o,p),r=Math.max(r,y)}}e.set(i,c),s.set(o-i,r-c)}},Vt=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let s=this.skins;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let s=this.events;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let s=this.animations;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.ikConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.transformConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.pathConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}},Lt=class{constructor(e=0,s,t){this.slotIndex=e,this.name=s,this.attachment=t}},je=class{constructor(e){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,s,t){if(!t)throw new Error("attachment cannot be null.");let a=this.attachments;e>=a.length&&(a.length=e+1),a[e]||(a[e]={}),a[e][s]=t}addSkin(e){for(let a=0;a<e.bones.length;a++){let i=e.bones[a],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){c=!0;break}c||this.bones.push(i)}for(let a=0;a<e.constraints.length;a++){let i=e.constraints[a],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){c=!0;break}c||this.constraints.push(i)}let s=e.getAttachments();for(let a=0;a<s.length;a++){var t=s[a];this.setAttachment(t.slotIndex,t.name,t.attachment)}}copySkin(e){for(let a=0;a<e.bones.length;a++){let i=e.bones[a],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){c=!0;break}c||this.bones.push(i)}for(let a=0;a<e.constraints.length;a++){let i=e.constraints[a],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){c=!0;break}c||this.constraints.push(i)}let s=e.getAttachments();for(let a=0;a<s.length;a++){var t=s[a];!t.attachment||(t.attachment instanceof Ye?(t.attachment=t.attachment.newLinkedMesh(),this.setAttachment(t.slotIndex,t.name,t.attachment)):(t.attachment=t.attachment.copy(),this.setAttachment(t.slotIndex,t.name,t.attachment)))}}getAttachment(e,s){let t=this.attachments[e];return t?t[s]:null}removeAttachment(e,s){let t=this.attachments[e];t&&delete t[s]}getAttachments(){let e=new Array;for(var s=0;s<this.attachments.length;s++){let t=this.attachments[s];if(t)for(let a in t){let i=t[a];i&&e.push(new Lt(s,a,i))}}return e}getAttachmentsForSlot(e,s){let t=this.attachments[e];if(t)for(let a in t){let i=t[a];i&&s.push(new Lt(e,a,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,s){let t=0;for(let a=0;a<e.slots.length;a++){let i=e.slots[a],c=i.getAttachment();if(c&&t<s.attachments.length){let o=s.attachments[t];for(let r in o){let l=o[r];if(c==l){let n=this.getAttachment(t,r);n&&i.setAttachment(n);break}}}t++}}},Dt=class{constructor(e,s,t){if(this.index=0,this.color=new D(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=De.Normal,e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");if(!t)throw new Error("boneData cannot be null.");this.index=e,this.name=s,this.boneData=t}},De;(function(e){e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"})(De||(De={}));var Nt=class extends Ge{constructor(e){super(e,0,!1);this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Rs=class{constructor(e){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=e}readSkeletonData(e){let s=this.scale,t=new Vt;t.name="";let a=new us(e),i=a.readInt32(),c=a.readInt32();t.hash=c==0&&i==0?null:c.toString(16)+i.toString(16),t.version=a.readString(),t.x=a.readFloat(),t.y=a.readFloat(),t.width=a.readFloat(),t.height=a.readFloat();let o=a.readBoolean();o&&(t.fps=a.readFloat(),t.imagesPath=a.readString(),t.audioPath=a.readString());let r=0;r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("String in string table must not be null.");a.strings.push(h)}r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("Bone name must not be null.");let d=n==0?null:t.bones[a.readInt(!0)],f=new Xt(n,h,d);f.rotation=a.readFloat(),f.x=a.readFloat()*s,f.y=a.readFloat()*s,f.scaleX=a.readFloat(),f.scaleY=a.readFloat(),f.shearX=a.readFloat(),f.shearY=a.readFloat(),f.length=a.readFloat()*s,f.transformMode=a.readInt(!0),f.skinRequired=a.readBoolean(),o&&D.rgba8888ToColor(f.color,a.readInt32()),t.bones.push(f)}r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("Slot name must not be null.");let d=t.bones[a.readInt(!0)],f=new Dt(n,h,d);D.rgba8888ToColor(f.color,a.readInt32());let u=a.readInt32();u!=-1&&D.rgb888ToColor(f.darkColor=new D,u),f.attachmentName=a.readStringRef(),f.blendMode=a.readInt(!0),t.slots.push(f)}r=a.readInt(!0);for(let n=0,h;n<r;n++){let d=a.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Bt(d);f.order=a.readInt(!0),f.skinRequired=a.readBoolean(),h=a.readInt(!0);for(let u=0;u<h;u++)f.bones.push(t.bones[a.readInt(!0)]);f.target=t.bones[a.readInt(!0)],f.mix=a.readFloat(),f.softness=a.readFloat()*s,f.bendDirection=a.readByte(),f.compress=a.readBoolean(),f.stretch=a.readBoolean(),f.uniform=a.readBoolean(),t.ikConstraints.push(f)}r=a.readInt(!0);for(let n=0,h;n<r;n++){let d=a.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Nt(d);f.order=a.readInt(!0),f.skinRequired=a.readBoolean(),h=a.readInt(!0);for(let u=0;u<h;u++)f.bones.push(t.bones[a.readInt(!0)]);f.target=t.bones[a.readInt(!0)],f.local=a.readBoolean(),f.relative=a.readBoolean(),f.offsetRotation=a.readFloat(),f.offsetX=a.readFloat()*s,f.offsetY=a.readFloat()*s,f.offsetScaleX=a.readFloat(),f.offsetScaleY=a.readFloat(),f.offsetShearY=a.readFloat(),f.mixRotate=a.readFloat(),f.mixX=a.readFloat(),f.mixY=a.readFloat(),f.mixScaleX=a.readFloat(),f.mixScaleY=a.readFloat(),f.mixShearY=a.readFloat(),t.transformConstraints.push(f)}r=a.readInt(!0);for(let n=0,h;n<r;n++){let d=a.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Pt(d);f.order=a.readInt(!0),f.skinRequired=a.readBoolean(),h=a.readInt(!0);for(let u=0;u<h;u++)f.bones.push(t.bones[a.readInt(!0)]);f.target=t.slots[a.readInt(!0)],f.positionMode=a.readInt(!0),f.spacingMode=a.readInt(!0),f.rotateMode=a.readInt(!0),f.offsetRotation=a.readFloat(),f.position=a.readFloat(),f.positionMode==oe.Fixed&&(f.position*=s),f.spacing=a.readFloat(),(f.spacingMode==K.Length||f.spacingMode==K.Fixed)&&(f.spacing*=s),f.mixRotate=a.readFloat(),f.mixX=a.readFloat(),f.mixY=a.readFloat(),t.pathConstraints.push(f)}let l=this.readSkin(a,t,!0,o);l&&(t.defaultSkin=l,t.skins.push(l));{let n=t.skins.length;for(B.setArraySize(t.skins,r=n+a.readInt(!0));n<r;n++){let h=this.readSkin(a,t,!1,o);if(!h)throw new Error("readSkin() should not have returned null.");t.skins[n]=h}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let h=this.linkedMeshes[n],d=h.skin?t.findSkin(h.skin):t.defaultSkin;if(!d)throw new Error("Not skin found for linked mesh.");if(!h.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(h.slotIndex,h.parent);if(!f)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttahment=h.inheritTimeline?f:h.mesh,h.mesh.setParentMesh(f),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readStringRef();if(!h)throw new Error;let d=new Rt(h);d.intValue=a.readInt(!1),d.floatValue=a.readFloat(),d.stringValue=a.readString(),d.audioPath=a.readString(),d.audioPath&&(d.volume=a.readFloat(),d.balance=a.readFloat()),t.events.push(d)}r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("Animatio name must not be null.");t.animations.push(this.readAnimation(a,h,t))}return t}readSkin(e,s,t,a){let i=null,c=0;if(t){if(c=e.readInt(!0),c==0)return null;i=new je("default")}else{let o=e.readStringRef();if(!o)throw new Error("Skin name must not be null.");i=new je(o),i.bones.length=e.readInt(!0);for(let r=0,l=i.bones.length;r<l;r++)i.bones[r]=s.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)i.constraints.push(s.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)i.constraints.push(s.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)i.constraints.push(s.pathConstraints[e.readInt(!0)]);c=e.readInt(!0)}for(let o=0;o<c;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,s,i,r,h,a);d&&i.setAttachment(r,h,d)}}return i}readAttachment(e,s,t,a,i,c){let o=this.scale,r=e.readStringRef();switch(r||(r=i),e.readByte()){case we.Region:{let l=e.readStringRef(),n=e.readFloat(),h=e.readFloat(),d=e.readFloat(),f=e.readFloat(),u=e.readFloat(),g=e.readFloat(),x=e.readFloat(),p=e.readInt32(),y=this.readSequence(e);l||(l=r);let m=this.attachmentLoader.newRegionAttachment(t,r,l,y);return m?(m.path=l,m.x=h*o,m.y=d*o,m.scaleX=f,m.scaleY=u,m.rotation=n,m.width=g*o,m.height=x*o,D.rgba8888ToColor(m.color,p),m.sequence=y,y==null&&m.updateRegion(),m):null}case we.BoundingBox:{let l=e.readInt(!0),n=this.readVertices(e,l),h=c?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(t,r);return d?(d.worldVerticesLength=l<<1,d.vertices=n.vertices,d.bones=n.bones,c&&D.rgba8888ToColor(d.color,h),d):null}case we.Mesh:{let l=e.readStringRef(),n=e.readInt32(),h=e.readInt(!0),d=this.readFloatArray(e,h<<1,1),f=this.readShortArray(e),u=this.readVertices(e,h),g=e.readInt(!0),x=this.readSequence(e),p=[],y=0,m=0;c&&(p=this.readShortArray(e),y=e.readFloat(),m=e.readFloat()),l||(l=r);let w=this.attachmentLoader.newMeshAttachment(t,r,l,x);return w?(w.path=l,D.rgba8888ToColor(w.color,n),w.bones=u.bones,w.vertices=u.vertices,w.worldVerticesLength=h<<1,w.triangles=f,w.regionUVs=d,x==null&&w.updateRegion(),w.hullLength=g<<1,w.sequence=x,c&&(w.edges=p,w.width=y*o,w.height=m*o),w):null}case we.LinkedMesh:{let l=e.readStringRef(),n=e.readInt32(),h=e.readStringRef(),d=e.readStringRef(),f=e.readBoolean(),u=this.readSequence(e),g=0,x=0;c&&(g=e.readFloat(),x=e.readFloat()),l||(l=r);let p=this.attachmentLoader.newMeshAttachment(t,r,l,u);return p?(p.path=l,D.rgba8888ToColor(p.color,n),p.sequence=u,c&&(p.width=g*o,p.height=x*o),this.linkedMeshes.push(new Bs(p,h,a,d,f)),p):null}case we.Path:{let l=e.readBoolean(),n=e.readBoolean(),h=e.readInt(!0),d=this.readVertices(e,h),f=B.newArray(h/3,0);for(let x=0,p=f.length;x<p;x++)f[x]=e.readFloat()*o;let u=c?e.readInt32():0,g=this.attachmentLoader.newPathAttachment(t,r);return g?(g.closed=l,g.constantSpeed=n,g.worldVerticesLength=h<<1,g.vertices=d.vertices,g.bones=d.bones,g.lengths=f,c&&D.rgba8888ToColor(g.color,u),g):null}case we.Point:{let l=e.readFloat(),n=e.readFloat(),h=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(t,r);return f?(f.x=n*o,f.y=h*o,f.rotation=l,c&&D.rgba8888ToColor(f.color,d),f):null}case we.Clipping:{let l=e.readInt(!0),n=e.readInt(!0),h=this.readVertices(e,n),d=c?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(t,r);return f?(f.endSlot=s.slots[l],f.worldVerticesLength=n<<1,f.vertices=h.vertices,f.bones=h.bones,c&&D.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){if(!e.readBoolean())return null;let s=new tt(e.readInt(!0));return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,s){let t=this.scale,a=s<<1,i=new Ps;if(!e.readBoolean())return i.vertices=this.readFloatArray(e,a,t),i;let c=new Array,o=new Array;for(let r=0;r<s;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),c.push(e.readFloat()*t),c.push(e.readFloat()*t),c.push(e.readFloat())}return i.vertices=B.toFloatArray(c),i.bones=o,i}readFloatArray(e,s,t){let a=new Array(s);if(t==1)for(let i=0;i<s;i++)a[i]=e.readFloat();else for(let i=0;i<s;i++)a[i]=e.readFloat()*t;return a}readShortArray(e){let s=e.readInt(!0),t=new Array(s);for(let a=0;a<s;a++)t[a]=e.readShort();return t}readAnimation(e,s,t){e.readInt(!0);let a=new Array,i=this.scale,c=new D,o=new D;for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,g=e.readInt(!0);u<g;u++){let x=e.readByte(),p=e.readInt(!0),y=p-1;switch(x){case $s:{let m=new Ae(p,f);for(let w=0;w<p;w++)m.setFrame(w,e.readFloat(),e.readStringRef());a.push(m);break}case Hs:{let m=e.readInt(!0),w=new dt(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let Y=0,X=0;w.setFrame(Y,b,v,S,A,C),Y!=y;Y++){let R=e.readFloat(),E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(Y);break;case ce:_(e,w,X++,Y,0,b,R,v,E,1),_(e,w,X++,Y,1,b,R,S,F,1),_(e,w,X++,Y,2,b,R,A,I,1),_(e,w,X++,Y,3,b,R,C,T,1)}b=R,v=E,S=F,A=I,C=T}a.push(w);break}case Gs:{let m=e.readInt(!0),w=new ft(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,Y=0;w.setFrame(C,b,v,S,A),C!=y;C++){let X=e.readFloat(),R=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(C);break;case ce:_(e,w,Y++,C,0,b,X,v,R,1),_(e,w,Y++,C,1,b,X,S,E,1),_(e,w,Y++,C,2,b,X,A,F,1)}b=X,v=R,S=E,A=F}a.push(w);break}case js:{let m=e.readInt(!0),w=new mt(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let E=0,F=0;w.setFrame(E,b,v,S,A,C,Y,X,R),E!=y;E++){let I=e.readFloat(),T=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,$=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(E);break;case ce:_(e,w,F++,E,0,b,I,v,T,1),_(e,w,F++,E,1,b,I,S,V,1),_(e,w,F++,E,2,b,I,A,U,1),_(e,w,F++,E,3,b,I,C,L,1),_(e,w,F++,E,4,b,I,Y,W,1),_(e,w,F++,E,5,b,I,X,O,1),_(e,w,F++,E,6,b,I,R,$,1)}b=I,v=T,S=V,A=U,C=L,Y=W,X=O,R=$}a.push(w);break}case Js:{let m=e.readInt(!0),w=new gt(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255;for(let R=0,E=0;w.setFrame(R,b,v,S,A,C,Y,X),R!=y;R++){let F=e.readFloat(),I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(R);break;case ce:_(e,w,E++,R,0,b,F,v,I,1),_(e,w,E++,R,1,b,F,S,T,1),_(e,w,E++,R,2,b,F,A,V,1),_(e,w,E++,R,3,b,F,C,U,1),_(e,w,E++,R,4,b,F,Y,L,1),_(e,w,E++,R,5,b,F,X,W,1)}b=F,v=I,S=T,A=V,C=U,Y=L,X=W}a.push(w);break}case Ks:{let m=new ut(p,e.readInt(!0),f),w=e.readFloat(),b=e.readUnsignedByte()/255;for(let v=0,S=0;m.setFrame(v,w,b),v!=y;v++){let A=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case he:m.setStepped(v);break;case ce:_(e,m,S++,v,0,w,A,b,C,1)}w=A,b=C}a.push(m)}}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,g=e.readInt(!0);u<g;u++){let x=e.readByte(),p=e.readInt(!0),y=e.readInt(!0);switch(x){case Vs:a.push(be(e,new Ve(p,y,f),1));break;case Ls:a.push(Ot(e,new st(p,y,f),i));break;case Ds:a.push(be(e,new rt(p,y,f),i));break;case Ns:a.push(be(e,new it(p,y,f),i));break;case Os:a.push(Ot(e,new at(p,y,f),1));break;case qs:a.push(be(e,new nt(p,y,f),1));break;case Us:a.push(be(e,new lt(p,y,f),1));break;case _s:a.push(Ot(e,new ot(p,y,f),1));break;case Ws:a.push(be(e,new ht(p,y,f),1));break;case zs:a.push(be(e,new ct(p,y,f),1))}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),g=u-1,x=new wt(u,e.readInt(!0),f),p=e.readFloat(),y=e.readFloat(),m=e.readFloat()*i;for(let w=0,b=0;x.setFrame(w,p,y,m,e.readByte(),e.readBoolean(),e.readBoolean()),w!=g;w++){let v=e.readFloat(),S=e.readFloat(),A=e.readFloat()*i;switch(e.readByte()){case he:x.setStepped(w);break;case ce:_(e,x,b++,w,0,p,v,y,S,1),_(e,x,b++,w,1,p,v,m,A,i)}p=v,y=S,m=A}a.push(x)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),g=u-1,x=new bt(u,e.readInt(!0),f),p=e.readFloat(),y=e.readFloat(),m=e.readFloat(),w=e.readFloat(),b=e.readFloat(),v=e.readFloat(),S=e.readFloat();for(let A=0,C=0;x.setFrame(A,p,y,m,w,b,v,S),A!=g;A++){let Y=e.readFloat(),X=e.readFloat(),R=e.readFloat(),E=e.readFloat(),F=e.readFloat(),I=e.readFloat(),T=e.readFloat();switch(e.readByte()){case he:x.setStepped(A);break;case ce:_(e,x,C++,A,0,p,Y,y,X,1),_(e,x,C++,A,1,p,Y,m,R,1),_(e,x,C++,A,2,p,Y,w,E,1),_(e,x,C++,A,3,p,Y,b,F,1),_(e,x,C++,A,4,p,Y,v,I,1),_(e,x,C++,A,5,p,Y,S,T,1)}p=Y,y=X,m=R,w=E,b=F,v=I,S=T}a.push(x)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=t.pathConstraints[f];for(let g=0,x=e.readInt(!0);g<x;g++)switch(e.readByte()){case er:a.push(be(e,new pt(e.readInt(!0),e.readInt(!0),f),u.positionMode==oe.Fixed?i:1));break;case tr:a.push(be(e,new yt(e.readInt(!0),e.readInt(!0),f),u.spacingMode==K.Length||u.spacingMode==K.Fixed?i:1));break;case sr:let p=new vt(e.readInt(!0),e.readInt(!0),f),y=e.readFloat(),m=e.readFloat(),w=e.readFloat(),b=e.readFloat();for(let v=0,S=0,A=p.getFrameCount()-1;p.setFrame(v,y,m,w,b),v!=A;v++){let C=e.readFloat(),Y=e.readFloat(),X=e.readFloat(),R=e.readFloat();switch(e.readByte()){case he:p.setStepped(v);break;case ce:_(e,p,S++,v,0,y,C,m,Y,1),_(e,p,S++,v,1,y,C,w,X,1),_(e,p,S++,v,2,y,C,b,R,1)}y=C,m=Y,w=X,b=R}a.push(p)}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=t.skins[e.readInt(!0)];for(let u=0,g=e.readInt(!0);u<g;u++){let x=e.readInt(!0);for(let p=0,y=e.readInt(!0);p<y;p++){let m=e.readStringRef();if(!m)throw new Error("attachmentName must not be null.");let w=f.getAttachment(x,m),b=e.readByte(),v=e.readInt(!0),S=v-1;switch(b){case Qs:{let A=w,C=A.bones,Y=A.vertices,X=C?Y.length/3*2:Y.length,R=e.readInt(!0),E=new xt(v,R,x,A),F=e.readFloat();for(let I=0,T=0;;I++){let V,U=e.readInt(!0);if(U==0)V=C?B.newFloatArray(X):Y;else{V=B.newFloatArray(X);let W=e.readInt(!0);if(U+=W,i==1)for(let O=W;O<U;O++)V[O]=e.readFloat();else for(let O=W;O<U;O++)V[O]=e.readFloat()*i;if(!C)for(let O=0,$=V.length;O<$;O++)V[O]+=Y[O]}if(E.setFrame(I,F,V),I==S)break;let L=e.readFloat();switch(e.readByte()){case he:E.setStepped(I);break;case ce:_(e,E,T++,I,0,F,L,0,1,1)}F=L}a.push(E);break}case Zs:{let A=new Xe(v,x,w);for(let C=0;C<v;C++){let Y=e.readFloat(),X=e.readInt32();A.setFrame(C,Y,Kt[X&15],X>>4,e.readFloat())}a.push(A);break}}}}}let r=e.readInt(!0);if(r>0){let h=new ke(r),d=t.slots.length;for(let f=0;f<r;f++){let u=e.readFloat(),g=e.readInt(!0),x=B.newArray(d,0);for(let w=d-1;w>=0;w--)x[w]=-1;let p=B.newArray(d-g,0),y=0,m=0;for(let w=0;w<g;w++){let b=e.readInt(!0);for(;y!=b;)p[m++]=y++;x[y+e.readInt(!0)]=y++}for(;y<d;)p[m++]=y++;for(let w=d-1;w>=0;w--)x[w]==-1&&(x[w]=p[--m]);h.setFrame(f,u,x)}a.push(h)}let l=e.readInt(!0);if(l>0){let h=new Le(l);for(let d=0;d<l;d++){let f=e.readFloat(),u=t.events[e.readInt(!0)],g=new Et(f,u);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readBoolean()?e.readString():u.stringValue,g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),h.setFrame(d,g)}a.push(h)}let n=0;for(let h=0,d=a.length;h<d;h++)n=Math.max(n,a[h].getDuration());return new Ue(s,a,n)}},us=class{constructor(e,s=new Array,t=0,a=new DataView(e.buffer)){this.strings=s,this.index=t,this.buffer=a}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 s=this.readByte(),t=s&127;return(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<7,(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<14,(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<21,(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<28)))),e?t:t>>>1^-(t&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 s="",t=0;for(let a=0;a<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:s+=String.fromCharCode((i&31)<<6|this.readByte()&63),a+=2;break;case 14:s+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),a+=3;break;default:s+=String.fromCharCode(i),a++}}return s}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Bs=class{constructor(e,s,t,a,i){this.mesh=e,this.skin=s,this.slotIndex=t,this.parent=a,this.inheritTimeline=i}},Ps=class{constructor(e=null,s=null){this.bones=e,this.vertices=s}},we;(function(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"})(we||(we={}));function be(e,s,t){let a=e.readFloat(),i=e.readFloat()*t;for(let c=0,o=0,r=s.getFrameCount()-1;s.setFrame(c,a,i),c!=r;c++){let l=e.readFloat(),n=e.readFloat()*t;switch(e.readByte()){case he:s.setStepped(c);break;case ce:_(e,s,o++,c,0,a,l,i,n,t)}a=l,i=n}return s}function Ot(e,s,t){let a=e.readFloat(),i=e.readFloat()*t,c=e.readFloat()*t;for(let o=0,r=0,l=s.getFrameCount()-1;s.setFrame(o,a,i,c),o!=l;o++){let n=e.readFloat(),h=e.readFloat()*t,d=e.readFloat()*t;switch(e.readByte()){case he:s.setStepped(o);break;case ce:_(e,s,r++,o,0,a,n,i,h,t),_(e,s,r++,o,1,a,n,c,d,t)}a=n,i=h,c=d}return s}function _(e,s,t,a,i,c,o,r,l,n){s.setBezier(t,a,i,c,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var Vs=0,Ls=1,Ds=2,Ns=3,Os=4,qs=5,Us=6,_s=7,Ws=8,zs=9,$s=0,Hs=1,Gs=2,js=3,Js=4,Ks=5,Qs=0,Zs=1,er=0,tr=1,sr=2,he=1,ce=2,rr=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new Pe(()=>B.newFloatArray(16))}update(e,s){if(!e)throw new Error("skeleton cannot be null.");let t=this.boundingBoxes,a=this.polygons,i=this.polygonPool,c=e.slots,o=c.length;t.length=0,i.freeAll(a),a.length=0;for(let r=0;r<o;r++){let l=c[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof He){let h=n;t.push(h);let d=i.obtain();d.length!=h.worldVerticesLength&&(d=B.newFloatArray(h.worldVerticesLength)),a.push(d),h.computeWorldVertices(l,0,h.worldVerticesLength,d,0,2)}}s?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,s=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=this.polygons;for(let c=0,o=i.length;c<o;c++){let r=i[c],l=r;for(let n=0,h=r.length;n<h;n+=2){let d=l[n],f=l[n+1];e=Math.min(e,d),s=Math.min(s,f),t=Math.max(t,d),a=Math.max(a,f)}}this.minX=e,this.minY=s,this.maxX=t,this.maxY=a}aabbContainsPoint(e,s){return e>=this.minX&&e<=this.maxX&&s>=this.minY&&s<=this.maxY}aabbIntersectsSegment(e,s,t,a){let i=this.minX,c=this.minY,o=this.maxX,r=this.maxY;if(e<=i&&t<=i||s<=c&&a<=c||e>=o&&t>=o||s>=r&&a>=r)return!1;let l=(a-s)/(t-e),n=l*(i-e)+s;if(n>c&&n<r||(n=l*(o-e)+s,n>c&&n<r))return!0;let h=(c-s)/l+e;return!!(h>i&&h<o||(h=(r-s)/l+e,h>i&&h<o))}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,s){let t=this.polygons;for(let a=0,i=t.length;a<i;a++)if(this.containsPointPolygon(t[a],e,s))return this.boundingBoxes[a];return null}containsPointPolygon(e,s,t){let a=e,i=e.length,c=i-2,o=!1;for(let r=0;r<i;r+=2){let l=a[r+1],n=a[c+1];if(l<t&&n>=t||n<t&&l>=t){let h=a[r];h+(t-l)/(n-l)*(a[c]-h)<s&&(o=!o)}c=r}return o}intersectsSegment(e,s,t,a){let i=this.polygons;for(let c=0,o=i.length;c<o;c++)if(this.intersectsSegmentPolygon(i[c],e,s,t,a))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,s,t,a,i){let c=e,o=e.length,r=s-a,l=t-i,n=s*i-t*a,h=c[o-2],d=c[o-1];for(let f=0;f<o;f+=2){let u=c[f],g=c[f+1],x=h*g-d*u,p=h-u,y=d-g,m=r*y-l*p,w=(n*p-r*x)/m;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=s&&w<=a||w>=a&&w<=s)){let b=(n*y-l*x)/m;if((b>=d&&b<=g||b>=g&&b<=d)&&(b>=t&&b<=i||b>=i&&b<=t))return!0}h=u,d=g}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let s=this.boundingBoxes.indexOf(e);return s==-1?null:this.polygons[s]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},se=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new Pe(()=>new Array),this.polygonIndicesPool=new Pe(()=>new Array)}triangulate(e){let s=e,t=e.length>>1,a=this.indicesArray;a.length=0;for(let o=0;o<t;o++)a[o]=o;let i=this.isConcaveArray;i.length=0;for(let o=0,r=t;o<r;++o)i[o]=se.isConcave(o,t,s,a);let c=this.triangles;for(c.length=0;t>3;){let o=t-1,r=0,l=1;for(;;){e:if(!i[r]){let d=a[o]<<1,f=a[r]<<1,u=a[l]<<1,g=s[d],x=s[d+1],p=s[f],y=s[f+1],m=s[u],w=s[u+1];for(let b=(l+1)%t;b!=o;b=(b+1)%t){if(!i[b])continue;let v=a[b]<<1,S=s[v],A=s[v+1];if(se.positiveArea(m,w,g,x,S,A)&&se.positiveArea(g,x,p,y,S,A)&&se.positiveArea(p,y,m,w,S,A))break e}break}if(l==0){do{if(!i[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%t}c.push(a[(t+r-1)%t]),c.push(a[r]),c.push(a[(r+1)%t]),a.splice(r,1),i.splice(r,1),t--;let n=(t+r-1)%t,h=r==t?0:r;i[n]=se.isConcave(n,t,s,a),i[h]=se.isConcave(h,t,s,a)}return t==3&&(c.push(a[2]),c.push(a[0]),c.push(a[1])),c}decompose(e,s){let t=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,h=s.length;n<h;n+=3){let d=s[n]<<1,f=s[n+1]<<1,u=s[n+2]<<1,g=t[d],x=t[d+1],p=t[f],y=t[f+1],m=t[u],w=t[u+1],b=!1;if(r==d){let v=o.length-4,S=se.winding(o[v],o[v+1],o[v+2],o[v+3],m,w),A=se.winding(m,w,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(m),o.push(w),c.push(u),b=!0)}b||(o.length>0?(a.push(o),i.push(c)):(this.polygonPool.free(o),this.polygonIndicesPool.free(c)),o=this.polygonPool.obtain(),o.length=0,o.push(g),o.push(x),o.push(p),o.push(y),o.push(m),o.push(w),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(d),c.push(f),c.push(u),l=se.winding(g,x,p,y,m,w),r=d)}o.length>0&&(a.push(o),i.push(c));for(let n=0,h=a.length;n<h;n++){if(c=i[n],c.length==0)continue;let d=c[0],f=c[c.length-1];o=a[n];let u=o.length-4,g=o[u],x=o[u+1],p=o[u+2],y=o[u+3],m=o[0],w=o[1],b=o[2],v=o[3],S=se.winding(g,x,p,y,m,w);for(let A=0;A<h;A++){if(A==n)continue;let C=i[A];if(C.length!=3)continue;let Y=C[0],X=C[1],R=C[2],E=a[A],F=E[E.length-2],I=E[E.length-1];if(Y!=d||X!=f)continue;let T=se.winding(g,x,p,y,F,I),V=se.winding(F,I,m,w,b,v);T==S&&V==S&&(E.length=0,C.length=0,o.push(F),o.push(I),c.push(R),g=p,x=y,p=F,y=I,A=0)}}for(let n=a.length-1;n>=0;n--)o=a[n],o.length==0&&(a.splice(n,1),this.polygonPool.free(o),c=i[n],i.splice(n,1),this.polygonIndicesPool.free(c));return a}static isConcave(e,s,t,a){let i=a[(s+e-1)%s]<<1,c=a[e]<<1,o=a[(e+1)%s]<<1;return!this.positiveArea(t[i],t[i+1],t[c],t[c+1],t[o],t[o+1])}static positiveArea(e,s,t,a,i,c){return e*(c-a)+t*(s-c)+i*(a-s)>=0}static winding(e,s,t,a,i,c){let o=t-e,r=a-s;return i*r-c*o+o*s-e*r>=0?1:-1}},qt=class{constructor(){this.triangulator=new se,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let t=s.worldVerticesLength,a=B.setArraySize(this.clippingPolygon,t);s.computeWorldVertices(e,0,t,a,0,2);let i=this.clippingPolygon;qt.makeClockwise(i);let c=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let o=0,r=c.length;o<r;o++){let l=c[o];qt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return c.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){!this.clipAttachment||(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,t,a,i,c,o,r){let l=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,d=this.clippingPolygons,f=d.length,u=r?12:8,g=0;n.length=0,h.length=0;e:for(let x=0;x<a;x+=3){let p=t[x]<<1,y=e[p],m=e[p+1],w=i[p],b=i[p+1];p=t[x+1]<<1;let v=e[p],S=e[p+1],A=i[p],C=i[p+1];p=t[x+2]<<1;let Y=e[p],X=e[p+1],R=i[p],E=i[p+1];for(let F=0;F<f;F++){let I=n.length;if(this.clip(y,m,v,S,Y,X,d[F],l)){let T=l.length;if(T==0)continue;let V=S-X,U=Y-v,L=y-Y,W=X-m,O=1/(V*L+U*(m-X)),$=T>>1,q=this.clipOutput,N=B.setArraySize(n,I+$*u);for(let Z=0;Z<T;Z+=2){let de=q[Z],Q=q[Z+1];N[I]=de,N[I+1]=Q,N[I+2]=c.r,N[I+3]=c.g,N[I+4]=c.b,N[I+5]=c.a;let re=de-Y,ie=Q-X,ve=(V*re+U*ie)*O,Ee=(W*re+L*ie)*O,Ne=1-ve-Ee;N[I+6]=w*ve+A*Ee+R*Ne,N[I+7]=b*ve+C*Ee+E*Ne,r&&(N[I+8]=o.r,N[I+9]=o.g,N[I+10]=o.b,N[I+11]=o.a),I+=u}I=h.length;let G=B.setArraySize(h,I+3*($-2));$--;for(let Z=1;Z<$;Z++)G[I]=g,G[I+1]=g+Z,G[I+2]=g+Z+1,I+=3;g+=$+1}else{let T=B.setArraySize(n,I+3*u);T[I]=y,T[I+1]=m,T[I+2]=c.r,T[I+3]=c.g,T[I+4]=c.b,T[I+5]=c.a,r?(T[I+6]=w,T[I+7]=b,T[I+8]=o.r,T[I+9]=o.g,T[I+10]=o.b,T[I+11]=o.a,T[I+12]=v,T[I+13]=S,T[I+14]=c.r,T[I+15]=c.g,T[I+16]=c.b,T[I+17]=c.a,T[I+18]=A,T[I+19]=C,T[I+20]=o.r,T[I+21]=o.g,T[I+22]=o.b,T[I+23]=o.a,T[I+24]=Y,T[I+25]=X,T[I+26]=c.r,T[I+27]=c.g,T[I+28]=c.b,T[I+29]=c.a,T[I+30]=R,T[I+31]=E,T[I+32]=o.r,T[I+33]=o.g,T[I+34]=o.b,T[I+35]=o.a):(T[I+6]=w,T[I+7]=b,T[I+8]=v,T[I+9]=S,T[I+10]=c.r,T[I+11]=c.g,T[I+12]=c.b,T[I+13]=c.a,T[I+14]=A,T[I+15]=C,T[I+16]=Y,T[I+17]=X,T[I+18]=c.r,T[I+19]=c.g,T[I+20]=c.b,T[I+21]=c.a,T[I+22]=R,T[I+23]=E),I=h.length;let V=B.setArraySize(h,I+3);V[I]=g,V[I+1]=g+1,V[I+2]=g+2,g+=3;continue e}}}}clip(e,s,t,a,i,c,o,r){let l=r,n=!1,h;o.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(s),h.push(t),h.push(a),h.push(i),h.push(c),h.push(e),h.push(s),r.length=0;let d=o,f=o.length-4;for(let u=0;;u+=2){let g=d[u],x=d[u+1],p=d[u+2],y=d[u+3],m=g-p,w=x-y,b=h,v=h.length-2,S=r.length;for(let C=0;C<v;C+=2){let Y=b[C],X=b[C+1],R=b[C+2],E=b[C+3],F=m*(E-y)-w*(R-p)>0;if(m*(X-y)-w*(Y-p)>0){if(F){r.push(R),r.push(E);continue}let I=E-X,T=R-Y,V=I*(p-g)-T*(y-x);if(Math.abs(V)>1e-6){let U=(T*(x-X)-I*(g-Y))/V;r.push(g+(p-g)*U),r.push(x+(y-x)*U)}else r.push(g),r.push(x)}else if(F){let I=E-X,T=R-Y,V=I*(p-g)-T*(y-x);if(Math.abs(V)>1e-6){let U=(T*(x-X)-I*(g-Y))/V;r.push(g+(p-g)*U),r.push(x+(y-x)*U)}else r.push(g),r.push(x);r.push(R),r.push(E)}n=!0}if(S==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let A=r;r=h,r.length=0,h=A}if(l!=r){l.length=0;for(let u=0,g=r.length-2;u<g;u++)l[u]=r[u]}else l.length=l.length-2;return n}static makeClockwise(e){let s=e,t=e.length,a=s[t-2]*s[1]-s[0]*s[t-1],i=0,c=0,o=0,r=0;for(let l=0,n=t-3;l<n;l+=2)i=s[l],c=s[l+1],o=s[l+2],r=s[l+3],a+=i*r-o*c;if(!(a<0))for(let l=0,n=t-2,h=t>>1;l<h;l+=2){let d=s[l],f=s[l+1],u=n-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=d,s[u+1]=f}}},ir=class{constructor(e){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=e}readSkeletonData(e){let s=this.scale,t=new Vt,a=typeof e=="string"?JSON.parse(e):e,i=a.skeleton;if(i&&(t.hash=i.hash,t.version=i.spine,t.x=i.x,t.y=i.y,t.width=i.width,t.height=i.height,t.fps=i.fps,t.imagesPath=i.images),a.bones)for(let c=0;c<a.bones.length;c++){let o=a.bones[c],r=null,l=k(o,"parent",null);l&&(r=t.findBone(l));let n=new Xt(t.bones.length,o.name,r);n.length=k(o,"length",0)*s,n.x=k(o,"x",0)*s,n.y=k(o,"y",0)*s,n.rotation=k(o,"rotation",0),n.scaleX=k(o,"scaleX",1),n.scaleY=k(o,"scaleY",1),n.shearX=k(o,"shearX",0),n.shearY=k(o,"shearY",0),n.transformMode=B.enumValue(te,k(o,"transform","Normal")),n.skinRequired=k(o,"skin",!1);let h=k(o,"color",null);h&&n.color.setFromString(h),t.bones.push(n)}if(a.slots)for(let c=0;c<a.slots.length;c++){let o=a.slots[c],r=t.findBone(o.bone);if(!r)throw new Error(`Couldn't find bone ${o.bone} for slot ${o.name}`);let l=new Dt(t.slots.length,o.name,r),n=k(o,"color",null);n&&l.color.setFromString(n);let h=k(o,"dark",null);h&&(l.darkColor=D.fromString(h)),l.attachmentName=k(o,"attachment",null),l.blendMode=B.enumValue(De,k(o,"blend","normal")),t.slots.push(l)}if(a.ik)for(let c=0;c<a.ik.length;c++){let o=a.ik[c],r=new Bt(o.name);r.order=k(o,"order",0),r.skinRequired=k(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let h=t.findBone(o.bones[n]);if(!h)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(h)}let l=t.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=k(o,"mix",1),r.softness=k(o,"softness",0)*s,r.bendDirection=k(o,"bendPositive",!0)?1:-1,r.compress=k(o,"compress",!1),r.stretch=k(o,"stretch",!1),r.uniform=k(o,"uniform",!1),t.ikConstraints.push(r)}if(a.transform)for(let c=0;c<a.transform.length;c++){let o=a.transform[c],r=new Nt(o.name);r.order=k(o,"order",0),r.skinRequired=k(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let d=o.bones[h],f=t.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);r.bones.push(f)}let l=o.target,n=t.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=k(o,"local",!1),r.relative=k(o,"relative",!1),r.offsetRotation=k(o,"rotation",0),r.offsetX=k(o,"x",0)*s,r.offsetY=k(o,"y",0)*s,r.offsetScaleX=k(o,"scaleX",0),r.offsetScaleY=k(o,"scaleY",0),r.offsetShearY=k(o,"shearY",0),r.mixRotate=k(o,"mixRotate",1),r.mixX=k(o,"mixX",1),r.mixY=k(o,"mixY",r.mixX),r.mixScaleX=k(o,"mixScaleX",1),r.mixScaleY=k(o,"mixScaleY",r.mixScaleX),r.mixShearY=k(o,"mixShearY",1),t.transformConstraints.push(r)}if(a.path)for(let c=0;c<a.path.length;c++){let o=a.path[c],r=new Pt(o.name);r.order=k(o,"order",0),r.skinRequired=k(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let d=o.bones[h],f=t.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);r.bones.push(f)}let l=o.target,n=t.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=B.enumValue(oe,k(o,"positionMode","Percent")),r.spacingMode=B.enumValue(K,k(o,"spacingMode","Length")),r.rotateMode=B.enumValue(ye,k(o,"rotateMode","Tangent")),r.offsetRotation=k(o,"rotation",0),r.position=k(o,"position",0),r.positionMode==oe.Fixed&&(r.position*=s),r.spacing=k(o,"spacing",0),(r.spacingMode==K.Length||r.spacingMode==K.Fixed)&&(r.spacing*=s),r.mixRotate=k(o,"mixRotate",1),r.mixX=k(o,"mixX",1),r.mixY=k(o,"mixY",r.mixX),t.pathConstraints.push(r)}if(a.skins)for(let c=0;c<a.skins.length;c++){let o=a.skins[c],r=new je(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],h=t.findBone(n);if(!h)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],h=t.findIkConstraint(n);if(!h)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],h=t.findTransformConstraint(n);if(!h)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],h=t.findPathConstraint(n);if(!h)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}for(let l in o.attachments){let n=t.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let h=o.attachments[l];for(let d in h){let f=this.readAttachment(h[d],r,n.index,d,t);f&&r.setAttachment(n.index,d,f)}}t.skins.push(r),r.name=="default"&&(t.defaultSkin=r)}for(let c=0,o=this.linkedMeshes.length;c<o;c++){let r=this.linkedMeshes[c],l=r.skin?t.findSkin(r.skin):t.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.timelineAttahment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,a.events)for(let c in a.events){let o=a.events[c],r=new Rt(c);r.intValue=k(o,"int",0),r.floatValue=k(o,"float",0),r.stringValue=k(o,"string",""),r.audioPath=k(o,"audio",null),r.audioPath&&(r.volume=k(o,"volume",1),r.balance=k(o,"balance",0)),t.events.push(r)}if(a.animations)for(let c in a.animations){let o=a.animations[c];this.readAnimation(o,c,t)}return t}readAttachment(e,s,t,a,i){let c=this.scale;switch(a=k(e,"name",a),k(e,"type","region")){case"region":{let o=k(e,"path",a),r=this.readSequence(k(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(s,a,o,r);if(!l)return null;l.path=o,l.x=k(e,"x",0)*c,l.y=k(e,"y",0)*c,l.scaleX=k(e,"scaleX",1),l.scaleY=k(e,"scaleY",1),l.rotation=k(e,"rotation",0),l.width=e.width*c,l.height=e.height*c,l.sequence=r;let n=k(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(s,a);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=k(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=k(e,"path",a),r=this.readSequence(k(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(s,a,o,r);if(!l)return null;l.path=o;let n=k(e,"color",null);n&&l.color.setFromString(n),l.width=k(e,"width",0)*c,l.height=k(e,"height",0)*c,l.sequence=r;let h=k(e,"parent",null);if(h)return this.linkedMeshes.push(new ar(l,k(e,"skin",null),t,h,k(e,"timelines",!0))),l;let d=e.uvs;return this.readVertices(e,l,d.length),l.triangles=e.triangles,l.regionUVs=d,l.region!=null&&l.updateRegion(),l.edges=k(e,"edges",null),l.hullLength=k(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(s,a);if(!o)return null;o.closed=k(e,"closed",!1),o.constantSpeed=k(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=B.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)l[h]=e.lengths[h]*c;o.lengths=l;let n=k(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(s,a);if(!o)return null;o.x=k(e,"x",0)*c,o.y=k(e,"y",0)*c,o.rotation=k(e,"rotation",0);let r=k(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(s,a);if(!o)return null;let r=k(e,"end",null);r&&(o.endSlot=i.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=k(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let s=new tt(k(e,"count",0));return s.start=k(e,"start",1),s.digits=k(e,"digits",0),s.setupIndex=k(e,"setup",0),s}readVertices(e,s,t){let a=this.scale;s.worldVerticesLength=t;let i=e.vertices;if(t==i.length){let r=B.toFloatArray(i);if(a!=1)for(let l=0,n=i.length;l<n;l++)r[l]*=a;s.vertices=r;return}let c=new Array,o=new Array;for(let r=0,l=i.length;r<l;){let n=i[r++];o.push(n);for(let h=r+n*4;r<h;r+=4)o.push(i[r]),c.push(i[r+1]*a),c.push(i[r+2]*a),c.push(i[r+3])}s.bones=o,s.vertices=B.toFloatArray(c)}readAnimation(e,s,t){let a=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=t.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let h in r){let d=r[h];if(!d)continue;let f=d.length;if(h=="attachment"){let u=new Ae(f,n);for(let g=0;g<f;g++){let x=d[g];u.setFrame(g,k(x,"time",0),k(x,"name",null))}i.push(u)}else if(h=="rgba"){let u=new dt(f,f<<2,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.color);for(let y=0,m=0;;y++){u.setFrame(y,x,p.r,p.g,p.b,p.a);let w=d[y+1];if(!w){u.shrink(m);break}let b=k(w,"time",0),v=D.fromString(w.color),S=g.curve;S&&(m=z(S,u,m,y,0,x,b,p.r,v.r,1),m=z(S,u,m,y,1,x,b,p.g,v.g,1),m=z(S,u,m,y,2,x,b,p.b,v.b,1),m=z(S,u,m,y,3,x,b,p.a,v.a,1)),x=b,p=v,g=w}i.push(u)}else if(h=="rgb"){let u=new ft(f,f*3,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.color);for(let y=0,m=0;;y++){u.setFrame(y,x,p.r,p.g,p.b);let w=d[y+1];if(!w){u.shrink(m);break}let b=k(w,"time",0),v=D.fromString(w.color),S=g.curve;S&&(m=z(S,u,m,y,0,x,b,p.r,v.r,1),m=z(S,u,m,y,1,x,b,p.g,v.g,1),m=z(S,u,m,y,2,x,b,p.b,v.b,1)),x=b,p=v,g=w}i.push(u)}else if(h=="alpha")i.push(ue(d,new ut(f,f,n),0,1));else if(h=="rgba2"){let u=new mt(f,f*7,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.light),y=D.fromString(g.dark);for(let m=0,w=0;;m++){u.setFrame(m,x,p.r,p.g,p.b,p.a,y.r,y.g,y.b);let b=d[m+1];if(!b){u.shrink(w);break}let v=k(b,"time",0),S=D.fromString(b.light),A=D.fromString(b.dark),C=g.curve;C&&(w=z(C,u,w,m,0,x,v,p.r,S.r,1),w=z(C,u,w,m,1,x,v,p.g,S.g,1),w=z(C,u,w,m,2,x,v,p.b,S.b,1),w=z(C,u,w,m,3,x,v,p.a,S.a,1),w=z(C,u,w,m,4,x,v,y.r,A.r,1),w=z(C,u,w,m,5,x,v,y.g,A.g,1),w=z(C,u,w,m,6,x,v,y.b,A.b,1)),x=v,p=S,y=A,g=b}i.push(u)}else if(h=="rgb2"){let u=new gt(f,f*6,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.light),y=D.fromString(g.dark);for(let m=0,w=0;;m++){u.setFrame(m,x,p.r,p.g,p.b,y.r,y.g,y.b);let b=d[m+1];if(!b){u.shrink(w);break}let v=k(b,"time",0),S=D.fromString(b.light),A=D.fromString(b.dark),C=g.curve;C&&(w=z(C,u,w,m,0,x,v,p.r,S.r,1),w=z(C,u,w,m,1,x,v,p.g,S.g,1),w=z(C,u,w,m,2,x,v,p.b,S.b,1),w=z(C,u,w,m,3,x,v,y.r,A.r,1),w=z(C,u,w,m,4,x,v,y.g,A.g,1),w=z(C,u,w,m,5,x,v,y.b,A.b,1)),x=v,p=S,y=A,g=b}i.push(u)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=t.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let h in r){let d=r[h],f=d.length;if(f!=0){if(h==="rotate")i.push(ue(d,new Ve(f,f,n),0,1));else if(h==="translate"){let u=new st(f,f<<1,n);i.push(Ut(d,u,"x","y",0,a))}else if(h==="translatex"){let u=new rt(f,f,n);i.push(ue(d,u,0,a))}else if(h==="translatey"){let u=new it(f,f,n);i.push(ue(d,u,0,a))}else if(h==="scale"){let u=new at(f,f<<1,n);i.push(Ut(d,u,"x","y",1,1))}else if(h==="scalex"){let u=new nt(f,f,n);i.push(ue(d,u,1,1))}else if(h==="scaley"){let u=new lt(f,f,n);i.push(ue(d,u,1,1))}else if(h==="shear"){let u=new ot(f,f<<1,n);i.push(Ut(d,u,"x","y",0,1))}else if(h==="shearx"){let u=new ht(f,f,n);i.push(ue(d,u,0,1))}else if(h==="sheary"){let u=new ct(f,f,n);i.push(ue(d,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=t.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let h=t.ikConstraints.indexOf(n),d=new wt(r.length,r.length<<1,h),f=k(l,"time",0),u=k(l,"mix",1),g=k(l,"softness",0)*a;for(let x=0,p=0;;x++){d.setFrame(x,f,u,g,k(l,"bendPositive",!0)?1:-1,k(l,"compress",!1),k(l,"stretch",!1));let y=r[x+1];if(!y){d.shrink(p);break}let m=k(y,"time",0),w=k(y,"mix",1),b=k(y,"softness",0)*a,v=l.curve;v&&(p=z(v,d,p,x,0,f,m,u,w,1),p=z(v,d,p,x,1,f,m,g,b,a)),f=m,u=w,g=b,l=y}i.push(d)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=t.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let h=t.transformConstraints.indexOf(n),d=new bt(r.length,r.length*6,h),f=k(l,"time",0),u=k(l,"mixRotate",1),g=k(l,"mixX",1),x=k(l,"mixY",g),p=k(l,"mixScaleX",1),y=k(l,"mixScaleY",p),m=k(l,"mixShearY",1);for(let w=0,b=0;;w++){d.setFrame(w,f,u,g,x,p,y,m);let v=r[w+1];if(!v){d.shrink(b);break}let S=k(v,"time",0),A=k(v,"mixRotate",1),C=k(v,"mixX",1),Y=k(v,"mixY",C),X=k(v,"mixScaleX",1),R=k(v,"mixScaleY",X),E=k(v,"mixShearY",1),F=l.curve;F&&(b=z(F,d,b,w,0,f,S,u,A,1),b=z(F,d,b,w,1,f,S,g,C,1),b=z(F,d,b,w,2,f,S,x,Y,1),b=z(F,d,b,w,3,f,S,p,X,1),b=z(F,d,b,w,4,f,S,y,R,1),b=z(F,d,b,w,5,f,S,m,E,1)),f=S,u=A,g=C,x=Y,p=X,y=R,p=X,l=v}i.push(d)}if(e.path)for(let o in e.path){let r=e.path[o],l=t.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=t.pathConstraints.indexOf(l);for(let h in r){let d=r[h],f=d[0];if(!f)continue;let u=d.length;if(h==="position"){let g=new pt(u,u,n);i.push(ue(d,g,0,l.positionMode==oe.Fixed?a:1))}else if(h==="spacing"){let g=new yt(u,u,n);i.push(ue(d,g,0,l.spacingMode==K.Length||l.spacingMode==K.Fixed?a:1))}else if(h==="mix"){let g=new vt(u,u*3,n),x=k(f,"time",0),p=k(f,"mixRotate",1),y=k(f,"mixX",1),m=k(f,"mixY",y);for(let w=0,b=0;;w++){g.setFrame(w,x,p,y,m);let v=d[w+1];if(!v){g.shrink(b);break}let S=k(v,"time",0),A=k(v,"mixRotate",1),C=k(v,"mixX",1),Y=k(v,"mixY",C),X=f.curve;X&&(b=z(X,g,b,w,0,x,S,p,A,1),b=z(X,g,b,w,1,x,S,y,C,1),b=z(X,g,b,w,2,x,S,m,Y,1)),x=S,p=A,y=C,m=Y,f=v}i.push(g)}}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=t.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let h=r[n],d=t.findSlot(n);if(!d)throw new Error("Slot not found: "+n);let f=d.index;for(let u in h){let g=h[u],x=l.getAttachment(f,u);for(let p in g){let y=g[p],m=y[0];if(!!m){if(p=="deform"){let w=x.bones,b=x.vertices,v=w?b.length/3*2:b.length,S=new xt(y.length,y.length,f,x),A=k(m,"time",0);for(let C=0,Y=0;;C++){let X,R=k(m,"vertices",null);if(!R)X=w?B.newFloatArray(v):b;else{X=B.newFloatArray(v);let T=k(m,"offset",0);if(B.arrayCopy(R,0,X,T,R.length),a!=1)for(let V=T,U=V+R.length;V<U;V++)X[V]*=a;if(!w)for(let V=0;V<v;V++)X[V]+=b[V]}S.setFrame(C,A,X);let E=y[C+1];if(!E){S.shrink(Y);break}let F=k(E,"time",0),I=m.curve;I&&(Y=z(I,S,Y,C,0,A,F,0,1,1)),A=F,m=E}i.push(S)}else if(p=="sequence"){let w=new Xe(y.length,f,x),b=0;for(let v=0;v<y.length;v++){let S=k(m,"delay",b),A=k(m,"time",0),C=fe[k(m,"mode","hold")],Y=k(m,"index",0);w.setFrame(v,A,C,Y,S),b=S,m=y[v+1]}i.push(w)}}}}}}if(e.drawOrder){let o=new ke(e.drawOrder.length),r=t.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let h=e.drawOrder[n],d=null,f=k(h,"offsets",null);if(f){d=B.newArray(r,-1);let u=B.newArray(r-f.length,0),g=0,x=0;for(let p=0;p<f.length;p++){let y=f[p],m=t.findSlot(y.slot);if(!m)throw new Error("Slot not found: "+m);let w=m.index;for(;g!=w;)u[x++]=g++;d[g+y.offset]=g++}for(;g<r;)u[x++]=g++;for(let p=r-1;p>=0;p--)d[p]==-1&&(d[p]=u[--x])}o.setFrame(l,k(h,"time",0),d)}i.push(o)}if(e.events){let o=new Le(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],h=t.findEvent(n.name);if(!h)throw new Error("Event not found: "+n.name);let d=new Et(B.toSinglePrecision(k(n,"time",0)),h);d.intValue=k(n,"int",h.intValue),d.floatValue=k(n,"float",h.floatValue),d.stringValue=k(n,"string",h.stringValue),d.data.audioPath&&(d.volume=k(n,"volume",1),d.balance=k(n,"balance",0)),o.setFrame(r,d)}i.push(o)}let c=0;for(let o=0,r=i.length;o<r;o++)c=Math.max(c,i[o].getDuration());t.animations.push(new Ue(s,i,c))}},ar=class{constructor(e,s,t,a,i){this.mesh=e,this.skin=s,this.slotIndex=t,this.parent=a,this.inheritTimeline=i}};function ue(e,s,t,a){let i=e[0],c=k(i,"time",0),o=k(i,"value",t)*a,r=0;for(let l=0;;l++){s.setFrame(l,c,o);let n=e[l+1];if(!n)return s.shrink(r),s;let h=k(n,"time",0),d=k(n,"value",t)*a;i.curve&&(r=z(i.curve,s,r,l,0,c,h,o,d,a)),c=h,o=d,i=n}}function Ut(e,s,t,a,i,c){let o=e[0],r=k(o,"time",0),l=k(o,t,i)*c,n=k(o,a,i)*c,h=0;for(let d=0;;d++){s.setFrame(d,r,l,n);let f=e[d+1];if(!f)return s.shrink(h),s;let u=k(f,"time",0),g=k(f,t,i)*c,x=k(f,a,i)*c,p=o.curve;p&&(h=z(p,s,h,d,0,r,u,l,g,c),h=z(p,s,h,d,1,r,u,n,x,c)),r=u,l=g,n=x,o=f}}function z(e,s,t,a,i,c,o,r,l,n){if(e=="stepped")return s.setStepped(a),t;let h=i<<2,d=e[h],f=e[h+1]*n,u=e[h+2],g=e[h+3]*n;return s.setBezier(t,a,i,c,r,d,f,u,g,o,l),t+1}function k(e,s,t){return e[s]!==void 0?e[s]:t}(()=>{typeof Math.fround=="undefined"&&(Math.fround=function(e){return function(s){return e[0]=s,e[0]}}(new Float32Array(1)))})();var ms=class extends It{constructor(e){super(e)}setFilters(e,s){}setWraps(e,s){}dispose(){}},nr=class extends hs{constructor(e="",s=new Ft){super(t=>new ms(t),e,s)}},Je=class{constructor(e){this.triangleRendering=!1,this.debugRendering=!1,this.vertices=B.newFloatArray(8*1024),this.tempColor=new D,this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,t=this.tempColor,a=e.color,i=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let c=0,o=i.length;c<o;c++){let r=i[c],l=r.bone;if(!l.active)continue;let n=r.getAttachment();if(!(n instanceof P))continue;let h=n.region,d=h.page.texture.getImage(),f=r.color,u=n.color;t.set(a.r*f.r*u.r,a.g*f.g*u.g,a.b*f.b*u.b,a.a*f.a*u.a),s.save(),s.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),s.translate(n.offset[0],n.offset[1]),s.rotate(n.rotation*Math.PI/180);let g=n.width/h.originalWidth;s.scale(g*n.scaleX,g*n.scaleY);let x=h.width,p=h.height;if(s.translate(x/2,p/2),n.region.degrees==90){let y=x;x=p,p=y,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-x/2,-p/2),s.globalAlpha=t.a,s.drawImage(d,h.x,h.y,x,p,0,0,x,p),this.debugRendering&&s.strokeRect(0,0,x,p),s.restore()}}drawTriangles(e){let s=this.ctx,t=this.tempColor,a=e.color,i=e.drawOrder,c=null,o=this.vertices,r=null;for(let n=0,h=i.length;n<h;n++){let d=i[n],f=d.getAttachment(),u,g;if(f instanceof P){let x=f;o=this.computeRegionVertices(d,x,!1),r=Je.QUAD_TRIANGLES,g=x.region,u=g.page.texture.getImage()}else if(f instanceof Ye){let x=f;o=this.computeMeshVertices(d,x,!1),r=x.triangles,u=x.region.renderObject.page.texture.getImage()}else continue;if(u){d.data.blendMode!=c&&(c=d.data.blendMode);let x=d.color,p=f.color;t.set(a.r*x.r*p.r,a.g*x.g*p.g,a.b*x.b*p.b,a.a*x.a*p.a),s.globalAlpha=t.a;for(var l=0;l<r.length;l+=3){let y=r[l]*8,m=r[l+1]*8,w=r[l+2]*8,b=o[y],v=o[y+1],S=o[y+6],A=o[y+7],C=o[m],Y=o[m+1],X=o[m+6],R=o[m+7],E=o[w],F=o[w+1],I=o[w+6],T=o[w+7];this.drawTriangle(u,b,v,S,A,C,Y,X,R,E,F,I,T),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(b,v),s.lineTo(C,Y),s.lineTo(E,F),s.lineTo(b,v),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,t,a,i,c,o,r,l,n,h,d,f){let u=this.ctx;a*=e.width,i*=e.height,r*=e.width,l*=e.height,d*=e.width,f*=e.height,u.beginPath(),u.moveTo(s,t),u.lineTo(c,o),u.lineTo(n,h),u.closePath(),c-=s,o-=t,n-=s,h-=t,r-=a,l-=i,d-=a,f-=i;var g=1/(r*f-d*l),x=(f*c-l*n)*g,p=(f*o-l*h)*g,y=(r*n-d*c)*g,m=(r*h-d*o)*g,w=s-x*a-y*i,b=t-p*a-m*i;u.save(),u.transform(x,p,y,m,w,b),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,t){let a=e.bone.skeleton.color,i=e.color,c=s.color,o=a.a*i.a*c.a,r=t?o:1,l=this.tempColor;l.set(a.r*i.r*c.r*r,a.g*i.g*c.g*r,a.b*i.b*c.b*r,o),s.computeWorldVertices(e,this.vertices,0,Je.VERTEX_SIZE);let n=this.vertices,h=s.uvs;return n[P.C1R]=l.r,n[P.C1G]=l.g,n[P.C1B]=l.b,n[P.C1A]=l.a,n[P.U1]=h[0],n[P.V1]=h[1],n[P.C2R]=l.r,n[P.C2G]=l.g,n[P.C2B]=l.b,n[P.C2A]=l.a,n[P.U2]=h[2],n[P.V2]=h[3],n[P.C3R]=l.r,n[P.C3G]=l.g,n[P.C3B]=l.b,n[P.C3A]=l.a,n[P.U3]=h[4],n[P.V3]=h[5],n[P.C4R]=l.r,n[P.C4G]=l.g,n[P.C4B]=l.b,n[P.C4A]=l.a,n[P.U4]=h[6],n[P.V4]=h[7],n}computeMeshVertices(e,s,t){let a=e.bone.skeleton.color,i=e.color,c=s.color,o=a.a*i.a*c.a,r=t?o:1,l=this.tempColor;l.set(a.r*i.r*c.r*r,a.g*i.g*c.g*r,a.b*i.b*c.b*r,o);let n=s.worldVerticesLength/2,h=this.vertices;h.length<s.worldVerticesLength&&(this.vertices=h=B.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,h,0,Je.VERTEX_SIZE);let d=s.uvs;for(let f=0,u=0,g=2;f<n;f++)h[g++]=l.r,h[g++]=l.g,h[g++]=l.b,h[g++]=l.a,h[g++]=d[u++],h[g++]=d[u++],g+=2;return h}},_t=Je;return _t.QUAD_TRIANGLES=[0,1,2,2,3,0],_t.VERTEX_SIZE=2+2+4,Ht})();
1
+ var spine=(()=>{var $t=Object.defineProperty,ys=e=>$t(e,"__esModule",{value:!0}),vs=(e,s)=>{ys(e);for(var t in s)$t(e,t,{get:s[t],enumerable:!0})},Ht={};vs(Ht,{AlphaTimeline:()=>ut,Animation:()=>Ue,AnimationState:()=>es,AnimationStateAdapter:()=>Ys,AnimationStateData:()=>Ts,AssetManager:()=>nr,AssetManagerBase:()=>hs,AtlasAttachmentLoader:()=>Fs,Attachment:()=>et,AttachmentTimeline:()=>Ae,BinaryInput:()=>us,BlendMode:()=>De,Bone:()=>Mt,BoneData:()=>Xt,BoundingBoxAttachment:()=>He,CURRENT:()=>is,CanvasTexture:()=>ms,ClippingAttachment:()=>Ct,Color:()=>D,ConstraintData:()=>Ge,CurveTimeline:()=>ne,CurveTimeline1:()=>le,CurveTimeline2:()=>_e,DebugUtils:()=>ks,DeformTimeline:()=>xt,Downloader:()=>Ft,DrawOrderTimeline:()=>ke,Event:()=>Et,EventData:()=>Rt,EventQueue:()=>ss,EventTimeline:()=>Le,EventType:()=>ee,FIRST:()=>St,FakeTexture:()=>Xs,HOLD_FIRST:()=>$e,HOLD_MIX:()=>rs,HOLD_SUBSEQUENT:()=>At,IkConstraint:()=>cs,IkConstraintData:()=>Bt,IkConstraintTimeline:()=>wt,IntSet:()=>Ss,Interpolation:()=>Gt,MathUtils:()=>M,MeshAttachment:()=>Ye,MixBlend:()=>j,MixDirection:()=>ge,PathAttachment:()=>Me,PathConstraint:()=>Fe,PathConstraintData:()=>Pt,PathConstraintMixTimeline:()=>vt,PathConstraintPositionTimeline:()=>pt,PathConstraintSpacingTimeline:()=>yt,PointAttachment:()=>Tt,Pool:()=>Pe,PositionMode:()=>oe,Pow:()=>jt,PowOut:()=>As,RGB2Timeline:()=>gt,RGBA2Timeline:()=>mt,RGBATimeline:()=>dt,RGBTimeline:()=>ft,RegionAttachment:()=>P,RotateMode:()=>ye,RotateTimeline:()=>Ve,SETUP:()=>kt,SUBSEQUENT:()=>ze,ScaleTimeline:()=>at,ScaleXTimeline:()=>nt,ScaleYTimeline:()=>lt,SequenceTimeline:()=>Xe,ShearTimeline:()=>ot,ShearXTimeline:()=>ht,ShearYTimeline:()=>ct,Skeleton:()=>Es,SkeletonBinary:()=>Rs,SkeletonBounds:()=>rr,SkeletonClipping:()=>qt,SkeletonData:()=>Vt,SkeletonJson:()=>ir,SkeletonRenderer:()=>_t,Skin:()=>je,SkinEntry:()=>Lt,Slot:()=>ds,SlotData:()=>Dt,SpacingMode:()=>K,StringSet:()=>Ze,Texture:()=>It,TextureAtlas:()=>ns,TextureAtlasPage:()=>ls,TextureAtlasRegion:()=>Yt,TextureFilter:()=>Ce,TextureRegion:()=>as,TextureWrap:()=>Ie,TimeKeeper:()=>Cs,Timeline:()=>J,TrackEntry:()=>ts,TransformConstraint:()=>fs,TransformConstraintData:()=>Nt,TransformConstraintTimeline:()=>bt,TransformMode:()=>te,TranslateTimeline:()=>st,TranslateXTimeline:()=>rt,TranslateYTimeline:()=>it,Triangulator:()=>se,Utils:()=>B,Vector2:()=>Oe,VertexAttachment:()=>ae,WindowedMean:()=>Is});var Ss=class{constructor(){this.array=new Array}add(e){let s=this.contains(e);return this.array[e|0]=e|0,!s}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ze=class{constructor(){this.entries={},this.size=0}add(e){let s=this.entries[e];return this.entries[e]=!0,s?!1:(this.size++,!0)}addAll(e){let s=this.size;for(var t=0,a=e.length;t<a;t++)this.add(e[t]);return s!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},Se=class{constructor(e=0,s=0,t=0,a=0){this.r=e,this.g=s,this.b=t,this.a=a}set(e,s,t,a){return this.r=e,this.g=s,this.b=t,this.a=a,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,t,a){return this.r+=e,this.g+=s,this.b+=t,this.a+=a,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}static fromString(e){return new Se().setFromString(e)}},D=Se;D.WHITE=new Se(1,1,1,1),D.RED=new Se(1,0,0,1),D.GREEN=new Se(0,1,0,1),D.BLUE=new Se(0,0,1,1),D.MAGENTA=new Se(1,0,1,1);var me=class{static clamp(e,s,t){return e<s?s:e>t?t:e}static cosDeg(e){return Math.cos(e*me.degRad)}static sinDeg(e){return Math.sin(e*me.degRad)}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),1/3);return e<0?-s:s}static randomTriangular(e,s){return me.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,t){let a=Math.random(),i=s-e;return a<=(t-e)/i?e+Math.sqrt(a*i*(t-e)):s-Math.sqrt((1-a)*i*(s-t))}static isPowerOfTwo(e){return e&&(e&e-1)==0}},M=me;M.PI=3.1415927,M.PI2=me.PI*2,M.radiansToDegrees=180/me.PI,M.radDeg=me.radiansToDegrees,M.degreesToRadians=me.PI/180,M.degRad=me.degreesToRadians;var Gt=class{apply(e,s,t){return e+(s-e)*this.applyInternal(t)}},jt=class extends Gt{constructor(e){super();this.power=2,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}},As=class extends jt{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Te=class{static arrayCopy(e,s,t,a,i){for(let c=s,o=a;c<s+i;c++,o++)t[o]=e[c]}static arrayFill(e,s,t,a){for(let i=s;i<t;i++)e[i]=a}static setArraySize(e,s,t=0){let a=e.length;if(a==s)return e;if(e.length=s,a<s)for(let i=a;i<s;i++)e[i]=t;return e}static ensureArrayCapacity(e,s,t=0){return e.length>=s?e:Te.setArraySize(e,s,t)}static newArray(e,s){let t=new Array(e);for(let a=0;a<e;a++)t[a]=s;return t}static newFloatArray(e){if(Te.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let t=0;t<s.length;t++)s[t]=0;return s}}static newShortArray(e){if(Te.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let t=0;t<s.length;t++)s[t]=0;return s}}static toFloatArray(e){return Te.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Te.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,t=!0){for(var a=0;a<e.length;a++)if(e[a]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},B=Te;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array!="undefined";var ks=class{static logBones(e){for(let s=0;s<e.bones.length;s++){let t=e.bones[s];console.log(t.data.name+", "+t.a+", "+t.b+", "+t.c+", "+t.d+", "+t.worldX+", "+t.worldY)}}},Pe=class{constructor(e){this.items=new Array,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 s=0;s<e.length;s++)this.free(e[s])}clear(){this.items.length=0}},Oe=class{constructor(e=0,s=0){this.x=e,this.y=s}set(e,s){return this.x=e,this.y=s,this}length(){let e=this.x,s=this.y;return Math.sqrt(e*e+s*s)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},Cs=class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.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)}},Is=class{constructor(e=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,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 s=0;s<this.values.length;s++)e+=this.values[s];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},et=class{constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Jt=class extends et{constructor(e){super(e);this.id=Jt.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(e,s,t,a,i,c){t=i+(t>>1)*c;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,g=u.worldX,x=u.worldY,p=u.a,y=u.b,m=u.c,w=u.d;for(let b=s,v=i;v<t;b+=2,v+=c){let S=l[b],A=l[b+1];a[v]=S*p+A*y+g,a[v+1]=S*m+A*w+x}return}let h=0,d=0;for(let u=0;u<s;u+=2){let g=n[h];h+=g+1,d+=g}let f=o.bones;if(r.length==0)for(let u=i,g=d*3;u<t;u+=c){let x=0,p=0,y=n[h++];for(y+=h;h<y;h++,g+=3){let m=f[n[h]],w=l[g],b=l[g+1],v=l[g+2];x+=(w*m.a+b*m.b+m.worldX)*v,p+=(w*m.c+b*m.d+m.worldY)*v}a[u]=x,a[u+1]=p}else{let u=r;for(let g=i,x=d*3,p=d<<1;g<t;g+=c){let y=0,m=0,w=n[h++];for(w+=h;h<w;h++,x+=3,p+=2){let b=f[n[h]],v=l[x]+u[p],S=l[x+1]+u[p+1],A=l[x+2];y+=(v*b.a+S*b.b+b.worldX)*A,m+=(v*b.c+S*b.d+b.worldY)*A}a[g]=y,a[g+1]=m}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ae=Jt;ae.nextID=0;var qe=class{constructor(e){this.id=qe.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(e)}copy(){let e=new qe(this.regions.length);return B.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let t=e.sequenceIndex;t==-1&&(t=this.setupIndex),t>=this.regions.length&&(t=this.regions.length-1);let a=this.regions[t];s.region!=a&&(s.region=a,s.updateRegion())}getPath(e,s){let t=e,a=(this.start+s).toString();for(let i=this.digits-a.length;i>0;i--)t+="0";return t+=a,t}static nextID(){return qe._nextID++}},tt=qe;tt._nextID=0;var fe;(function(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"})(fe||(fe={}));var Kt=[0,1,2,3,4,5,6],Ue=class{constructor(e,s,t){if(this.timelines=[],this.timelineIds=new Ze,!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(s),this.duration=t}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var s=0;s<e.length;s++)this.timelineIds.addAll(e[s].getPropertyIds())}hasTimeline(e){for(let s=0;s<e.length;s++)if(this.timelineIds.contains(e[s]))return!0;return!1}apply(e,s,t,a,i,c,o,r){if(!e)throw new Error("skeleton cannot be null.");a&&this.duration!=0&&(t%=this.duration,s>0&&(s%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(e,s,t,i,c,o,r)}},j;(function(e){e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add"})(j||(j={}));var ge;(function(e){e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut"})(ge||(ge={}));var H={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,sequence:19},J=class{constructor(e,s){this.propertyIds=s,this.frames=B.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,s){let t=e.length;for(let a=1;a<t;a++)if(e[a]>s)return a-1;return t-1}static search(e,s,t){let a=e.length;for(let i=t;i<a;i+=t)if(e[i]>s)return i-t;return a-t}},ne=class extends J{constructor(e,s,t){super(e,t);this.curves=B.newFloatArray(e+s*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let s=this.getFrameCount()+e*18;if(this.curves.length>s){let t=B.newFloatArray(s);B.arrayCopy(this.curves,0,t,0,s),this.curves=t}}setBezier(e,s,t,a,i,c,o,r,l,n,h){let d=this.curves,f=this.getFrameCount()+e*18;t==0&&(d[s]=2+f);let u=(a-c*2+r)*.03,g=(i-o*2+l)*.03,x=((c-r)*3-a+n)*.006,p=((o-l)*3-i+h)*.006,y=u*2+x,m=g*2+p,w=(c-a)*.3+u+x*.16666667,b=(o-i)*.3+g+p*.16666667,v=a+w,S=i+b;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=S,w+=y,b+=m,y+=x,m+=p,v+=w,S+=b}getBezierValue(e,s,t,a){let i=this.curves;if(i[a]>e){let l=this.frames[s],n=this.frames[s+t];return n+(e-l)/(i[a]-l)*(i[a+1]-n)}let c=a+18;for(a+=2;a<c;a+=2)if(i[a]>=e){let l=i[a-2],n=i[a-1];return n+(e-l)/(i[a]-l)*(i[a+1]-n)}s+=this.getFrameEntries();let o=i[c-2],r=i[c-1];return r+(e-o)/(this.frames[s]-o)*(this.frames[s+t]-r)}},le=class extends ne{constructor(e,s,t){super(e,s,[t])}getFrameEntries(){return 2}setFrame(e,s,t){e<<=1,this.frames[e]=s,this.frames[e+1]=t}getCurveValue(e){let s=this.frames,t=s.length-2;for(let i=2;i<=t;i+=2)if(s[i]>e){t=i-2;break}let a=this.curves[t>>1];switch(a){case 0:let i=s[t],c=s[t+1];return c+(e-i)/(s[t+2]-i)*(s[t+2+1]-c);case 1:return s[t+1]}return this.getBezierValue(e,t,1,a-2)}},_e=class extends ne{constructor(e,s,t,a){super(e,s,[t,a])}getFrameEntries(){return 3}setFrame(e,s,t,a){e*=3,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a}},Ve=class extends le{constructor(e,s,t){super(e,s,H.rotate+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.rotation=r.data.rotation;return;case 1:r.rotation+=(r.data.rotation-r.rotation)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.rotation=r.data.rotation+n*i;break;case 1:case 2:n+=r.data.rotation-r.rotation;case 3:r.rotation+=n*i}}},st=class extends _e{constructor(e,s,t){super(e,s,H.x+"|"+t,H.y+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*i,r.y+=(r.data.y-r.y)*i}return}let n=0,h=0,d=J.search(l,t,3),f=this.curves[d/3];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+3]-u);n+=(l[d+3+1]-n)*g,h+=(l[d+3+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}switch(c){case 0:r.x=r.data.x+n*i,r.y=r.data.y+h*i;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*i,r.y+=(r.data.y+h-r.y)*i;break;case 3:r.x+=n*i,r.y+=h*i}}},rt=class extends le{constructor(e,s,t){super(e,s,H.x+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.x=r.data.x;return;case 1:r.x+=(r.data.x-r.x)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.x=r.data.x+n*i;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*i;break;case 3:r.x+=n*i}}},it=class extends le{constructor(e,s,t){super(e,s,H.y+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.y=r.data.y;return;case 1:r.y+=(r.data.y-r.y)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.y=r.data.y+n*i;break;case 1:case 2:r.y+=(r.data.y+n-r.y)*i;break;case 3:r.y+=n*i}}},at=class extends _e{constructor(e,s,t){super(e,s,H.scaleX+"|"+t,H.scaleY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*i,r.scaleY+=(r.data.scaleY-r.scaleY)*i}return}let n,h,d=J.search(l,t,3),f=this.curves[d/3];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+3]-u);n+=(l[d+3+1]-n)*g,h+=(l[d+3+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}if(n*=r.data.scaleX,h*=r.data.scaleY,i==1)c==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=n,r.scaleY=h);else{let u=0,g=0;if(o==1)switch(c){case 0:u=r.data.scaleX,g=r.data.scaleY,r.scaleX=u+(Math.abs(n)*M.signum(u)-u)*i,r.scaleY=g+(Math.abs(h)*M.signum(g)-g)*i;break;case 1:case 2:u=r.scaleX,g=r.scaleY,r.scaleX=u+(Math.abs(n)*M.signum(u)-u)*i,r.scaleY=g+(Math.abs(h)*M.signum(g)-g)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i,r.scaleY+=(h-r.data.scaleY)*i}else switch(c){case 0:u=Math.abs(r.data.scaleX)*M.signum(n),g=Math.abs(r.data.scaleY)*M.signum(h),r.scaleX=u+(n-u)*i,r.scaleY=g+(h-g)*i;break;case 1:case 2:u=Math.abs(r.scaleX)*M.signum(n),g=Math.abs(r.scaleY)*M.signum(h),r.scaleX=u+(n-u)*i,r.scaleY=g+(h-g)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i,r.scaleY+=(h-r.data.scaleY)*i}}}},nt=class extends le{constructor(e,s,t){super(e,s,H.scaleX+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*i}return}let n=this.getCurveValue(t)*r.data.scaleX;if(i==1)c==3?r.scaleX+=n-r.data.scaleX:r.scaleX=n;else{let h=0;if(o==1)switch(c){case 0:h=r.data.scaleX,r.scaleX=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 1:case 2:h=r.scaleX,r.scaleX=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i}else switch(c){case 0:h=Math.abs(r.data.scaleX)*M.signum(n),r.scaleX=h+(n-h)*i;break;case 1:case 2:h=Math.abs(r.scaleX)*M.signum(n),r.scaleX=h+(n-h)*i;break;case 3:r.scaleX+=(n-r.data.scaleX)*i}}}},lt=class extends le{constructor(e,s,t){super(e,s,H.scaleY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.scaleY=r.data.scaleY;return;case 1:r.scaleY+=(r.data.scaleY-r.scaleY)*i}return}let n=this.getCurveValue(t)*r.data.scaleY;if(i==1)c==3?r.scaleY+=n-r.data.scaleY:r.scaleY=n;else{let h=0;if(o==1)switch(c){case 0:h=r.data.scaleY,r.scaleY=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 1:case 2:h=r.scaleY,r.scaleY=h+(Math.abs(n)*M.signum(h)-h)*i;break;case 3:r.scaleY+=(n-r.data.scaleY)*i}else switch(c){case 0:h=Math.abs(r.data.scaleY)*M.signum(n),r.scaleY=h+(n-h)*i;break;case 1:case 2:h=Math.abs(r.scaleY)*M.signum(n),r.scaleY=h+(n-h)*i;break;case 3:r.scaleY+=(n-r.data.scaleY)*i}}}},ot=class extends _e{constructor(e,s,t){super(e,s,H.shearX+"|"+t,H.shearY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*i,r.shearY+=(r.data.shearY-r.shearY)*i}return}let n=0,h=0,d=J.search(l,t,3),f=this.curves[d/3];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+3]-u);n+=(l[d+3+1]-n)*g,h+=(l[d+3+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}switch(c){case 0:r.shearX=r.data.shearX+n*i,r.shearY=r.data.shearY+h*i;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*i,r.shearY+=(r.data.shearY+h-r.shearY)*i;break;case 3:r.shearX+=n*i,r.shearY+=h*i}}},ht=class extends le{constructor(e,s,t){super(e,s,H.shearX+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.shearX=r.data.shearX;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.shearX=r.data.shearX+n*i;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*i;break;case 3:r.shearX+=n*i}}},ct=class extends le{constructor(e,s,t){super(e,s,H.shearY+"|"+t);this.boneIndex=0,this.boneIndex=t}apply(e,s,t,a,i,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.shearY=r.data.shearY;return;case 1:r.shearY+=(r.data.shearY-r.shearY)*i}return}let n=this.getCurveValue(t);switch(c){case 0:r.shearY=r.data.shearY+n*i;break;case 1:case 2:r.shearY+=(r.data.shearY+n-r.shearY)*i;break;case 3:r.shearY+=n*i}}},dt=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t,H.alpha+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 5}setFrame(e,s,t,a,i,c){e*=5,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(t<l[0]){let p=r.data.color;switch(c){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*i,(p.g-n.g)*i,(p.b-n.b)*i,(p.a-n.a)*i)}return}let h=0,d=0,f=0,u=0,g=J.search(l,t,5),x=this.curves[g/5];switch(x){case 0:let p=l[g];h=l[g+1],d=l[g+2],f=l[g+3],u=l[g+4];let y=(t-p)/(l[g+5]-p);h+=(l[g+5+1]-h)*y,d+=(l[g+5+2]-d)*y,f+=(l[g+5+3]-f)*y,u+=(l[g+5+4]-u)*y;break;case 1:h=l[g+1],d=l[g+2],f=l[g+3],u=l[g+4];break;default:h=this.getBezierValue(t,g,1,x-2),d=this.getBezierValue(t,g,2,x+18-2),f=this.getBezierValue(t,g,3,x+18*2-2),u=this.getBezierValue(t,g,4,x+18*3-2)}i==1?n.set(h,d,f,u):(c==0&&n.setFromColor(r.data.color),n.add((h-n.r)*i,(d-n.g)*i,(f-n.b)*i,(u-n.a)*i))}},ft=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 4}setFrame(e,s,t,a,i){e<<=2,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(t<l[0]){let x=r.data.color;switch(c){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*i,n.g+=(x.g-n.g)*i,n.b+=(x.b-n.b)*i}return}let h=0,d=0,f=0,u=J.search(l,t,4),g=this.curves[u>>2];switch(g){case 0:let x=l[u];h=l[u+1],d=l[u+2],f=l[u+3];let p=(t-x)/(l[u+4]-x);h+=(l[u+4+1]-h)*p,d+=(l[u+4+2]-d)*p,f+=(l[u+4+3]-f)*p;break;case 1:h=l[u+1],d=l[u+2],f=l[u+3];break;default:h=this.getBezierValue(t,u,1,g-2),d=this.getBezierValue(t,u,2,g+18-2),f=this.getBezierValue(t,u,3,g+18*2-2)}if(i==1)n.r=h,n.g=d,n.b=f;else{if(c==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(h-n.r)*i,n.g+=(d-n.g)*i,n.b+=(f-n.b)*i}}},ut=class extends le{constructor(e,s,t){super(e,s,H.alpha+"|"+t);this.slotIndex=0,this.slotIndex=t}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(t<this.frames[0]){let h=r.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*i}return}let n=this.getCurveValue(t);i==1?l.a=n:(c==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*i)}},mt=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t,H.alpha+"|"+t,H.rgb2+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 8}setFrame(e,s,t,a,i,c,o,r,l){e<<=3,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(t<l[0]){let b=r.data.color,v=r.data.darkColor;switch(c){case 0:n.setFromColor(b),h.r=v.r,h.g=v.g,h.b=v.b;return;case 1:n.add((b.r-n.r)*i,(b.g-n.g)*i,(b.b-n.b)*i,(b.a-n.a)*i),h.r+=(v.r-h.r)*i,h.g+=(v.g-h.g)*i,h.b+=(v.b-h.b)*i}return}let d=0,f=0,u=0,g=0,x=0,p=0,y=0,m=J.search(l,t,8),w=this.curves[m>>3];switch(w){case 0:let b=l[m];d=l[m+1],f=l[m+2],u=l[m+3],g=l[m+4],x=l[m+5],p=l[m+6],y=l[m+7];let v=(t-b)/(l[m+8]-b);d+=(l[m+8+1]-d)*v,f+=(l[m+8+2]-f)*v,u+=(l[m+8+3]-u)*v,g+=(l[m+8+4]-g)*v,x+=(l[m+8+5]-x)*v,p+=(l[m+8+6]-p)*v,y+=(l[m+8+7]-y)*v;break;case 1:d=l[m+1],f=l[m+2],u=l[m+3],g=l[m+4],x=l[m+5],p=l[m+6],y=l[m+7];break;default:d=this.getBezierValue(t,m,1,w-2),f=this.getBezierValue(t,m,2,w+18-2),u=this.getBezierValue(t,m,3,w+18*2-2),g=this.getBezierValue(t,m,4,w+18*3-2),x=this.getBezierValue(t,m,5,w+18*4-2),p=this.getBezierValue(t,m,6,w+18*5-2),y=this.getBezierValue(t,m,7,w+18*6-2)}if(i==1)n.set(d,f,u,g),h.r=x,h.g=p,h.b=y;else{if(c==0){n.setFromColor(r.data.color);let b=r.data.darkColor;h.r=b.r,h.g=b.g,h.b=b.b}n.add((d-n.r)*i,(f-n.g)*i,(u-n.b)*i,(g-n.a)*i),h.r+=(x-h.r)*i,h.g+=(p-h.g)*i,h.b+=(y-h.b)*i}}},gt=class extends ne{constructor(e,s,t){super(e,s,[H.rgb+"|"+t,H.rgb2+"|"+t]);this.slotIndex=0,this.slotIndex=t}getFrameEntries(){return 7}setFrame(e,s,t,a,i,c,o,r){e*=7,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(t<l[0]){let b=r.data.color,v=r.data.darkColor;switch(c){case 0:n.r=b.r,n.g=b.g,n.b=b.b,h.r=v.r,h.g=v.g,h.b=v.b;return;case 1:n.r+=(b.r-n.r)*i,n.g+=(b.g-n.g)*i,n.b+=(b.b-n.b)*i,h.r+=(v.r-h.r)*i,h.g+=(v.g-h.g)*i,h.b+=(v.b-h.b)*i}return}let d=0,f=0,u=0,g=0,x=0,p=0,y=0,m=J.search(l,t,7),w=this.curves[m/7];switch(w){case 0:let b=l[m];d=l[m+1],f=l[m+2],u=l[m+3],x=l[m+4],p=l[m+5],y=l[m+6];let v=(t-b)/(l[m+7]-b);d+=(l[m+7+1]-d)*v,f+=(l[m+7+2]-f)*v,u+=(l[m+7+3]-u)*v,x+=(l[m+7+4]-x)*v,p+=(l[m+7+5]-p)*v,y+=(l[m+7+6]-y)*v;break;case 1:d=l[m+1],f=l[m+2],u=l[m+3],x=l[m+4],p=l[m+5],y=l[m+6];break;default:d=this.getBezierValue(t,m,1,w-2),f=this.getBezierValue(t,m,2,w+18-2),u=this.getBezierValue(t,m,3,w+18*2-2),x=this.getBezierValue(t,m,4,w+18*3-2),p=this.getBezierValue(t,m,5,w+18*4-2),y=this.getBezierValue(t,m,6,w+18*5-2)}if(i==1)n.r=d,n.g=f,n.b=u,h.r=x,h.g=p,h.b=y;else{if(c==0){let b=r.data.color,v=r.data.darkColor;n.r=b.r,n.g=b.g,n.b=b.b,h.r=v.r,h.g=v.g,h.b=v.b}n.r+=(d-n.r)*i,n.g+=(f-n.g)*i,n.b+=(u-n.b)*i,h.r+=(x-h.r)*i,h.g+=(p-h.g)*i,h.b+=(y-h.b)*i}}},Ae=class extends J{constructor(e,s){super(e,[H.attachment+"|"+s]);this.slotIndex=0,this.slotIndex=s,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,t){this.frames[e]=s,this.attachmentNames[e]=t}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!!r.bone.active){if(o==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(t<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,t)])}}setAttachment(e,s,t){s.setAttachment(t?e.getAttachment(this.slotIndex,t):null)}},xt=class extends ne{constructor(e,s,t,a){super(e,s,[H.deform+"|"+t+"|"+a.id]);this.slotIndex=0,this.slotIndex=t,this.attachment=a,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,t){this.frames[e]=s,this.vertices[e]=t}setBezier(e,s,t,a,i,c,o,r,l,n,h){let d=this.curves,f=this.getFrameCount()+e*18;t==0&&(d[s]=2+f);let u=(a-c*2+r)*.03,g=l*.03-o*.06,x=((c-r)*3-a+n)*.006,p=(o-l+.33333333)*.018,y=u*2+x,m=g*2+p,w=(c-a)*.3+u+x*.16666667,b=o*.3+g+p*.16666667,v=a+w,S=b;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=S,w+=y,b+=m,y+=x,m+=p,v+=w,S+=b}getCurvePercent(e,s){let t=this.curves,a=t[s];switch(a){case 0:let r=this.frames[s];return(e-r)/(this.frames[s+this.getFrameEntries()]-r);case 1:return 0}if(a-=2,t[a]>e){let r=this.frames[s];return t[a+1]*(e-r)/(t[a]-r)}let i=a+18;for(a+=2;a<i;a+=2)if(t[a]>=e){let r=t[a-2],l=t[a-1];return l+(e-r)/(t[a]-r)*(t[a+1]-l)}let c=t[i-2],o=t[i-1];return o+(1-o)*(e-c)/(this.frames[s+this.getFrameEntries()]-c)}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof ae)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(c=0);let h=this.vertices,d=h[0].length,f=this.frames;if(t<f[0]){switch(c){case 0:n.length=0;return;case 1:if(i==1){n.length=0;return}n.length=d;let m=l;if(m.bones){i=1-i;for(var u=0;u<d;u++)n[u]*=i}else{let w=m.vertices;for(var u=0;u<d;u++)n[u]+=(w[u]-n[u])*i}}return}if(n.length=d,t>=f[f.length-1]){let m=h[f.length-1];if(i==1)if(c==3){let w=l;if(w.bones)for(let b=0;b<d;b++)n[b]+=m[b];else{let b=w.vertices;for(let v=0;v<d;v++)n[v]+=m[v]-b[v]}}else B.arrayCopy(m,0,n,0,d);else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<d;v++)n[v]=m[v]*i;else{let v=b.vertices;for(let S=0;S<d;S++){let A=v[S];n[S]=A+(m[S]-A)*i}}break}case 1:case 2:for(let b=0;b<d;b++)n[b]+=(m[b]-n[b])*i;break;case 3:let w=l;if(w.bones)for(let b=0;b<d;b++)n[b]+=m[b]*i;else{let b=w.vertices;for(let v=0;v<d;v++)n[v]+=(m[v]-b[v])*i}}return}let g=J.search1(f,t),x=this.getCurvePercent(t,g),p=h[g],y=h[g+1];if(i==1)if(c==3){let m=l;if(m.bones)for(let w=0;w<d;w++){let b=p[w];n[w]+=b+(y[w]-b)*x}else{let w=m.vertices;for(let b=0;b<d;b++){let v=p[b];n[b]+=v+(y[b]-v)*x-w[b]}}}else for(let m=0;m<d;m++){let w=p[m];n[m]=w+(y[m]-w)*x}else switch(c){case 0:{let w=l;if(w.bones)for(let b=0;b<d;b++){let v=p[b];n[b]=(v+(y[b]-v)*x)*i}else{let b=w.vertices;for(let v=0;v<d;v++){let S=p[v],A=b[v];n[v]=A+(S+(y[v]-S)*x-A)*i}}break}case 1:case 2:for(let w=0;w<d;w++){let b=p[w];n[w]+=(b+(y[w]-b)*x-n[w])*i}break;case 3:let m=l;if(m.bones)for(let w=0;w<d;w++){let b=p[w];n[w]+=(b+(y[w]-b)*x)*i}else{let w=m.vertices;for(let b=0;b<d;b++){let v=p[b];n[b]+=(v+(y[b]-v)*x-w[b])*i}}}}},Qt=class extends J{constructor(e){super(e,Qt.propertyIds);this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,t,a,i,c,o){if(!a)return;let r=this.frames,l=this.frames.length;if(s>t)this.apply(e,s,Number.MAX_VALUE,a,i,c,o),s=-1;else if(s>=r[l-1])return;if(t<r[0])return;let n=0;if(s<r[0])n=0;else{n=J.search1(r,s)+1;let h=r[n];for(;n>0&&r[n-1]==h;)n--}for(;n<l&&t>=r[n];n++)a.push(this.events[n])}},Le=Qt;Le.propertyIds=[""+H.event];var Zt=class extends J{constructor(e){super(e,Zt.propertyIds);this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,t){this.frames[e]=s,this.drawOrders[e]=t}apply(e,s,t,a,i,c,o){if(o==1){c==0&&B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(t<this.frames[0]){(c==0||c==1)&&B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,t),l=this.drawOrders[r];if(!l)B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,h=e.slots;for(let d=0,f=l.length;d<f;d++)n[d]=h[l[d]]}}},ke=Zt;ke.propertyIds=[""+H.drawOrder];var wt=class extends ne{constructor(e,s,t){super(e,s,[H.ikConstraint+"|"+t]);this.ikConstraintIndex=0,this.ikConstraintIndex=t}getFrameEntries(){return 6}setFrame(e,s,t,a,i,c,o){e*=6,this.frames[e]=s,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,s,t,a,i,c,o){let r=e.ikConstraints[this.ikConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){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)*i,r.softness+=(r.data.softness-r.softness)*i,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,h=0,d=J.search(l,t,6),f=this.curves[d/6];switch(f){case 0:let u=l[d];n=l[d+1],h=l[d+2];let g=(t-u)/(l[d+6]-u);n+=(l[d+6+1]-n)*g,h+=(l[d+6+2]-h)*g;break;case 1:n=l[d+1],h=l[d+2];break;default:n=this.getBezierValue(t,d,1,f-2),h=this.getBezierValue(t,d,2,f+18-2)}c==0?(r.mix=r.data.mix+(n-r.data.mix)*i,r.softness=r.data.softness+(h-r.data.softness)*i,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[d+3],r.compress=l[d+4]!=0,r.stretch=l[d+5]!=0)):(r.mix+=(n-r.mix)*i,r.softness+=(h-r.softness)*i,o==0&&(r.bendDirection=l[d+3],r.compress=l[d+4]!=0,r.stretch=l[d+5]!=0))}},bt=class extends ne{constructor(e,s,t){super(e,s,[H.transformConstraint+"|"+t]);this.transformConstraintIndex=0,this.transformConstraintIndex=t}getFrameEntries(){return 7}setFrame(e,s,t,a,i,c,o,r){let l=this.frames;e*=7,l[e]=s,l[e+1]=t,l[e+2]=a,l[e+3]=i,l[e+4]=c,l[e+5]=o,l[e+6]=r}apply(e,s,t,a,i,c,o){let r=e.transformConstraints[this.transformConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){let y=r.data;switch(c){case 0:r.mixRotate=y.mixRotate,r.mixX=y.mixX,r.mixY=y.mixY,r.mixScaleX=y.mixScaleX,r.mixScaleY=y.mixScaleY,r.mixShearY=y.mixShearY;return;case 1:r.mixRotate+=(y.mixRotate-r.mixRotate)*i,r.mixX+=(y.mixX-r.mixX)*i,r.mixY+=(y.mixY-r.mixY)*i,r.mixScaleX+=(y.mixScaleX-r.mixScaleX)*i,r.mixScaleY+=(y.mixScaleY-r.mixScaleY)*i,r.mixShearY+=(y.mixShearY-r.mixShearY)*i}return}let n,h,d,f,u,g,x=J.search(l,t,7),p=this.curves[x/7];switch(p){case 0:let y=l[x];n=l[x+1],h=l[x+2],d=l[x+3],f=l[x+4],u=l[x+5],g=l[x+6];let m=(t-y)/(l[x+7]-y);n+=(l[x+7+1]-n)*m,h+=(l[x+7+2]-h)*m,d+=(l[x+7+3]-d)*m,f+=(l[x+7+4]-f)*m,u+=(l[x+7+5]-u)*m,g+=(l[x+7+6]-g)*m;break;case 1:n=l[x+1],h=l[x+2],d=l[x+3],f=l[x+4],u=l[x+5],g=l[x+6];break;default:n=this.getBezierValue(t,x,1,p-2),h=this.getBezierValue(t,x,2,p+18-2),d=this.getBezierValue(t,x,3,p+18*2-2),f=this.getBezierValue(t,x,4,p+18*3-2),u=this.getBezierValue(t,x,5,p+18*4-2),g=this.getBezierValue(t,x,6,p+18*5-2)}if(c==0){let y=r.data;r.mixRotate=y.mixRotate+(n-y.mixRotate)*i,r.mixX=y.mixX+(h-y.mixX)*i,r.mixY=y.mixY+(d-y.mixY)*i,r.mixScaleX=y.mixScaleX+(f-y.mixScaleX)*i,r.mixScaleY=y.mixScaleY+(u-y.mixScaleY)*i,r.mixShearY=y.mixShearY+(g-y.mixShearY)*i}else r.mixRotate+=(n-r.mixRotate)*i,r.mixX+=(h-r.mixX)*i,r.mixY+=(d-r.mixY)*i,r.mixScaleX+=(f-r.mixScaleX)*i,r.mixScaleY+=(u-r.mixScaleY)*i,r.mixShearY+=(g-r.mixShearY)*i}},pt=class extends le{constructor(e,s,t){super(e,s,H.pathConstraintPosition+"|"+t);this.pathConstraintIndex=0,this.pathConstraintIndex=t}apply(e,s,t,a,i,c,o){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.position=r.data.position;return;case 1:r.position+=(r.data.position-r.position)*i}return}let n=this.getCurveValue(t);c==0?r.position=r.data.position+(n-r.data.position)*i:r.position+=(n-r.position)*i}},yt=class extends le{constructor(e,s,t){super(e,s,H.pathConstraintSpacing+"|"+t);this.pathConstraintIndex=0,this.pathConstraintIndex=t}apply(e,s,t,a,i,c,o){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){case 0:r.spacing=r.data.spacing;return;case 1:r.spacing+=(r.data.spacing-r.spacing)*i}return}let n=this.getCurveValue(t);c==0?r.spacing=r.data.spacing+(n-r.data.spacing)*i:r.spacing+=(n-r.spacing)*i}},vt=class extends ne{constructor(e,s,t){super(e,s,[H.pathConstraintMix+"|"+t]);this.pathConstraintIndex=0,this.pathConstraintIndex=t}getFrameEntries(){return 4}setFrame(e,s,t,a,i){let c=this.frames;e<<=2,c[e]=s,c[e+1]=t,c[e+2]=a,c[e+3]=i}apply(e,s,t,a,i,c,o){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let l=this.frames;if(t<l[0]){switch(c){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)*i,r.mixX+=(r.data.mixX-r.mixX)*i,r.mixY+=(r.data.mixY-r.mixY)*i}return}let n,h,d,f=J.search(l,t,4),u=this.curves[f>>2];switch(u){case 0:let g=l[f];n=l[f+1],h=l[f+2],d=l[f+3];let x=(t-g)/(l[f+4]-g);n+=(l[f+4+1]-n)*x,h+=(l[f+4+2]-h)*x,d+=(l[f+4+3]-d)*x;break;case 1:n=l[f+1],h=l[f+2],d=l[f+3];break;default:n=this.getBezierValue(t,f,1,u-2),h=this.getBezierValue(t,f,2,u+18-2),d=this.getBezierValue(t,f,3,u+18*2-2)}if(c==0){let g=r.data;r.mixRotate=g.mixRotate+(n-g.mixRotate)*i,r.mixX=g.mixX+(h-g.mixX)*i,r.mixY=g.mixY+(d-g.mixY)*i}else r.mixRotate+=(n-r.mixRotate)*i,r.mixX+=(h-r.mixX)*i,r.mixY+=(d-r.mixY)*i}},pe=class extends J{constructor(e,s,t){super(e,[H.sequence+"|"+s+"|"+t.sequence.id]);this.slotIndex=s,this.attachment=t}getFrameEntries(){return pe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,t,a,i){let c=this.frames;e*=pe.ENTRIES,c[e]=s,c[e+pe.MODE]=t|a<<4,c[e+pe.DELAY]=i}apply(e,s,t,a,i,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof ae)||l.timelineAttachment!=n))return;let h=this.frames;if(t<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let d=J.search(h,t,pe.ENTRIES),f=h[d],u=h[d+pe.MODE],g=h[d+pe.DELAY];if(!this.attachment.sequence)return;let x=u>>4,p=this.attachment.sequence.regions.length,y=Kt[u&15];if(y!=fe.hold)switch(x+=(t-f)/g+1e-5|0,y){case fe.once:x=Math.min(p-1,x);break;case fe.loop:x%=p;break;case fe.pingpong:{let m=(p<<1)-2;x=m==0?0:x%m,x>=p&&(x=m-x);break}case fe.onceReverse:x=Math.max(p-1-x,0);break;case fe.loopReverse:x=p-1-x%p;break;case fe.pingpongReverse:{let m=(p<<1)-2;x=m==0?0:(x+p-1)%m,x>=p&&(x=m-x)}}r.sequenceIndex=x}},Xe=pe;Xe.ENTRIES=3,Xe.MODE=1,Xe.DELAY=2;var We=class{constructor(e){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new ss(this),this.propertyIDs=new Ze,this.animationsChanged=!1,this.trackEntryPool=new Pe(()=>new ts),this.data=e}static emptyAnimation(){return We._emptyAnimation}update(e){e*=this.timeScale;let s=this.tracks;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let c=e*i.timeScale;if(i.delay>0){if(i.delay-=c,i.delay>0)continue;c=-i.delay,i.delay=0}let o=i.next;if(o){let r=i.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=i.timeScale==0?0:(r/i.timeScale+e)*o.timeScale,i.trackTime+=c,this.setCurrent(t,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){s[t]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,e)){let r=i.mixingFrom;for(i.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}i.trackTime+=c}this.queue.drain()}updateMixingFrom(e,s){let t=e.mixingFrom;if(!t)return!0;let a=this.updateMixingFrom(t,s);return t.animationLast=t.nextAnimationLast,t.trackLast=t.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((t.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=t.mixingFrom,t.mixingFrom&&(t.mixingFrom.mixingTo=e),e.interruptAlpha=t.interruptAlpha,this.queue.end(t)),a):(t.trackTime+=s*t.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,t=this.tracks,a=!1;for(let d=0,f=t.length;d<f;d++){let u=t[d];if(!u||u.delay>0)continue;a=!0;let g=d==0?j.first:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,e,g):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let p=u.animationLast,y=u.getAnimationTime(),m=y,w=s;u.reverse&&(m=u.animation.duration-m,w=null);let b=u.animation.timelines,v=b.length;if(d==0&&x==1||g==j.add)for(let S=0;S<v;S++){B.webkit602BugfixHelper(x,g);var i=b[S];i instanceof Ae?this.applyAttachmentTimeline(i,e,m,g,!0):i.apply(e,p,m,w,x,g,ge.mixIn)}else{let S=u.timelineMode,A=u.shortestRotation,C=!A&&u.timelinesRotation.length!=v<<1;C&&(u.timelinesRotation.length=v<<1);for(let Y=0;Y<v;Y++){let X=b[Y],R=S[Y]==ze?g:j.setup;!A&&X instanceof Ve?this.applyRotateTimeline(X,e,m,x,R,u.timelinesRotation,Y<<1,C):X instanceof Ae?this.applyAttachmentTimeline(X,e,m,g,!0):(B.webkit602BugfixHelper(x,g),X.apply(e,p,m,w,x,R,ge.mixIn))}}this.queueEvents(u,y),s.length=0,u.nextAnimationLast=y,u.nextTrackLast=u.trackTime}for(var c=this.unkeyedState+kt,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==c){var h=n.data.attachmentName;n.setAttachment(h?e.getAttachment(n.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),a}applyMixingFrom(e,s,t){let a=e.mixingFrom;a.mixingFrom&&this.applyMixingFrom(a,s,t);let i=0;e.mixDuration==0?(i=1,t==j.first&&(t=j.setup)):(i=e.mixTime/e.mixDuration,i>1&&(i=1),t!=j.first&&(t=a.mixBlend));let c=i<a.attachmentThreshold,o=i<a.drawOrderThreshold,r=a.animation.timelines,l=r.length,n=a.alpha*e.interruptAlpha,h=n*(1-i),d=a.animationLast,f=a.getAnimationTime(),u=f,g=null;if(a.reverse?u=a.animation.duration-u:i<a.eventThreshold&&(g=this.events),t==j.add)for(let x=0;x<l;x++)r[x].apply(s,d,u,g,h,t,ge.mixOut);else{let x=a.timelineMode,p=a.timelineHoldMix,y=a.shortestRotation,m=!y&&a.timelinesRotation.length!=l<<1;m&&(a.timelinesRotation.length=l<<1),a.totalAlpha=0;for(let w=0;w<l;w++){let b=r[w],v=ge.mixOut,S,A=0;switch(x[w]){case ze:if(!o&&b instanceof ke)continue;S=t,A=h;break;case St:S=j.setup,A=h;break;case At:S=t,A=n;break;case $e:S=j.setup,A=n;break;default:S=j.setup;let C=p[w];A=n*Math.max(0,1-C.mixTime/C.mixDuration);break}a.totalAlpha+=A,!y&&b instanceof Ve?this.applyRotateTimeline(b,s,u,A,S,a.timelinesRotation,w<<1,m):b instanceof Ae?this.applyAttachmentTimeline(b,s,u,S,c):(B.webkit602BugfixHelper(A,t),o&&b instanceof ke&&S==j.setup&&(v=ge.mixIn),b.apply(s,d,u,g,A,S,v))}}return e.mixDuration>0&&this.queueEvents(a,f),this.events.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime,i}applyAttachmentTimeline(e,s,t,a,i){var c=s.slots[e.slotIndex];!c.bone.active||(t<e.frames[0]?(a==j.setup||a==j.first)&&this.setAttachment(s,c,c.data.attachmentName,i):this.setAttachment(s,c,e.attachmentNames[J.search1(e.frames,t)],i),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+kt))}setAttachment(e,s,t,a){s.setAttachment(t?e.getAttachment(s.data.index,t):null),a&&(s.attachmentState=this.unkeyedState+is)}applyRotateTimeline(e,s,t,a,i,c,o,r){if(r&&(c[o]=0),a==1){e.apply(s,0,t,null,1,i,ge.mixIn);return}let l=s.bones[e.boneIndex];if(!l.active)return;let n=e.frames,h=0,d=0;if(t<n[0])switch(i){case j.setup:l.rotation=l.data.rotation;default:return;case j.first:h=l.rotation,d=l.data.rotation}else h=i==j.setup?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(t);let f=0,u=d-h;if(u-=(16384-(16384.499999999996-u/360|0))*360,u==0)f=c[o];else{let g=0,x=0;r?(g=0,x=u):(g=c[o],x=c[o+1]);let p=u>0,y=g>=0;M.signum(x)!=M.signum(u)&&Math.abs(x)<=90&&(Math.abs(g)>180&&(g+=360*M.signum(g)),y=p),f=u+g-g%360,y!=p&&(f+=360*M.signum(g)),c[o]=f}c[o+1]=u,l.rotation=h+f*a}queueEvents(e,s){let t=e.animationStart,a=e.animationEnd,i=a-t,c=e.trackLast%i,o=this.events,r=0,l=o.length;for(;r<l;r++){let h=o[r];if(h.time<c)break;h.time>a||this.queue.event(e,h)}let n=!1;for(e.loop?n=i==0||c>e.trackTime%i:n=s>=a&&e.animationLast<a,n&&this.queue.complete(e);r<l;r++){let h=o[r];h.time<t||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,t=this.tracks.length;s<t;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let t=s;for(;;){let a=t.mixingFrom;if(!a)break;this.queue.end(a),t.mixingFrom=null,t.mixingTo=null,t=a}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,t){let a=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,a&&(t&&this.queue.interrupt(a),s.mixingFrom=a,a.mixingTo=s,s.mixTime=0,a.mixingFrom&&a.mixDuration>0&&(s.interruptAlpha*=Math.min(1,a.mixTime/a.mixDuration)),a.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,t=!1){let a=this.data.skeletonData.findAnimation(s);if(!a)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,a,t)}setAnimationWith(e,s,t=!1){if(!s)throw new Error("animation cannot be null.");let a=!0,i=this.expandToIndex(e);i&&(i.nextTrackLast==-1?(this.tracks[e]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,a=!1):this.clearNext(i));let c=this.trackEntry(e,s,t,i);return this.setCurrent(e,c,a),this.queue.drain(),c}addAnimation(e,s,t=!1,a=0){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,i,t,a)}addAnimationWith(e,s,t=!1,a=0){if(!s)throw new Error("animation cannot be null.");let i=this.expandToIndex(e);if(i)for(;i.next;)i=i.next;let c=this.trackEntry(e,s,t,i);return i?(i.next=c,c.previous=i,a<=0&&(a+=i.getTrackComplete()-c.mixDuration)):(this.setCurrent(e,c,!0),this.queue.drain()),c.delay=a,c}setEmptyAnimation(e,s=0){let t=this.setAnimationWith(e,We.emptyAnimation(),!1);return t.mixDuration=s,t.trackEnd=s,t}addEmptyAnimation(e,s=0,t=0){let a=this.addAnimationWith(e,We.emptyAnimation(),!1,t);return t<=0&&(a.delay+=a.mixDuration-s),a.mixDuration=s,a.trackEnd=s,a}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,a=this.tracks.length;t<a;t++){let i=this.tracks[t];i&&this.setEmptyAnimation(i.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,t,a){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=e,i.animation=s,i.loop=t,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.attachmentThreshold=0,i.drawOrderThreshold=0,i.animationStart=0,i.animationEnd=s.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=a?this.data.getMix(a.animation,s):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=j.replace,i}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,t=e.length;s<t;s++){let a=e[s];if(!!a){for(;a.mixingFrom;)a=a.mixingFrom;do(!a.mixingTo||a.mixBlend!=j.add)&&this.computeHold(a),a=a.mixingTo;while(a)}}}computeHold(e){let s=e.mixingTo,t=e.animation.timelines,a=e.animation.timelines.length,i=e.timelineMode;i.length=a;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(s&&s.holdPrevious){for(let r=0;r<a;r++)i[r]=o.addAll(t[r].getPropertyIds())?$e:At;return}e:for(let r=0;r<a;r++){let l=t[r],n=l.getPropertyIds();if(!o.addAll(n))i[r]=ze;else if(!s||l instanceof Ae||l instanceof ke||l instanceof Le||!s.animation.hasTimeline(n))i[r]=St;else{for(let h=s.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(n)){if(e.mixDuration>0){i[r]=rs,c[r]=h;continue e}break}i[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 s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},es=We;es._emptyAnimation=new Ue("<empty>",[],0);var ts=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=j.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.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}},ss=class{constructor(e){this.objects=[],this.drainDisabled=!1,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,s){this.objects.push(ee.event),this.objects.push(e),this.objects.push(s)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,s=this.animState.listeners;for(let t=0;t<e.length;t+=2){let a=e[t],i=e[t+1];switch(a){case ee.start:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<s.length;o++){let r=s[o];r.start&&r.start(i)}break;case ee.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<s.length;o++){let r=s[o];r.interrupt&&r.interrupt(i)}break;case ee.end:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<s.length;o++){let r=s[o];r.end&&r.end(i)}case ee.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<s.length;o++){let r=s[o];r.dispose&&r.dispose(i)}this.animState.trackEntryPool.free(i);break;case ee.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<s.length;o++){let r=s[o];r.complete&&r.complete(i)}break;case ee.event:let c=e[t+++2];i.listener&&i.listener.event&&i.listener.event(i,c);for(let o=0;o<s.length;o++){let r=s[o];r.event&&r.event(i,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ee;(function(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"})(ee||(ee={}));var Ys=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,s){}},ze=0,St=1,At=2,$e=3,rs=4,kt=1,is=2,Ts=class{constructor(e){if(this.animationToMixTime={},this.defaultMix=0,!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,s,t){let a=this.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);this.setMixWith(a,i,t)}setMixWith(e,s,t){if(!e)throw new Error("from cannot be null.");if(!s)throw new Error("to cannot be null.");let a=e.name+"."+s.name;this.animationToMixTime[a]=t}getMix(e,s){let t=e.name+"."+s.name,a=this.animationToMixTime[t];return a===void 0?this.defaultMix:a}},He=class extends ae{constructor(e){super(e);this.color=new D(1,1,1,1)}copy(){let e=new He(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ct=class extends ae{constructor(e){super(e);this.endSlot=null,this.color=new D(.2275,.2275,.8078,1)}copy(){let e=new Ct(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},It=class{constructor(e){this._image=e}getImage(){return this._image}},Ce;(function(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"})(Ce||(Ce={}));var Ie;(function(e){e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat"})(Ie||(Ie={}));var as=class{constructor(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Xs=class extends It{setFilters(e,s){}setWraps(e,s){}dispose(){}},ns=class{constructor(e){this.pages=new Array,this.regions=new Array;let s=new Ms(e),t=new Array(4),a={};a.size=n=>{n.width=parseInt(t[1]),n.height=parseInt(t[2])},a.format=()=>{},a.filter=n=>{n.minFilter=B.enumValue(Ce,t[1]),n.magFilter=B.enumValue(Ce,t[2])},a.repeat=n=>{t[1].indexOf("x")!=-1&&(n.uWrap=Ie.Repeat),t[1].indexOf("y")!=-1&&(n.vWrap=Ie.Repeat)},a.pma=n=>{n.pma=t[1]=="true"};var i={};i.xy=n=>{n.x=parseInt(t[1]),n.y=parseInt(t[2])},i.size=n=>{n.width=parseInt(t[1]),n.height=parseInt(t[2])},i.bounds=n=>{n.x=parseInt(t[1]),n.y=parseInt(t[2]),n.width=parseInt(t[3]),n.height=parseInt(t[4])},i.offset=n=>{n.offsetX=parseInt(t[1]),n.offsetY=parseInt(t[2])},i.orig=n=>{n.originalWidth=parseInt(t[1]),n.originalHeight=parseInt(t[2])},i.offsets=n=>{n.offsetX=parseInt(t[1]),n.offsetY=parseInt(t[2]),n.originalWidth=parseInt(t[3]),n.originalHeight=parseInt(t[4])},i.rotate=n=>{let h=t[1];h=="true"?n.degrees=90:h!="false"&&(n.degrees=parseInt(h))},i.index=n=>{n.index=parseInt(t[1])};let c=s.readLine();for(;c&&c.trim().length==0;)c=s.readLine();for(;!(!c||c.trim().length==0||s.readEntry(t,c)==0);)c=s.readLine();let o=null,r=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=s.readLine();else if(o){let n=new Yt(o,c);for(;;){let h=s.readEntry(t,c=s.readLine());if(h==0)break;let d=i[t[0]];if(d)d(n);else{r||(r=[]),l||(l=[]),r.push(t[0]);let f=[];for(let u=0;u<h;u++)f.push(parseInt(t[u+1]));l.push(f)}}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 ls(c.trim());s.readEntry(t,c=s.readLine())!=0;){let n=a[t[0]];n&&n(o)}this.pages.push(o)}}findRegion(e){for(let s=0;s<this.regions.length;s++)if(this.regions[s].name==e)return this.regions[s];return null}setTextures(e,s=""){for(let t of this.pages)t.setTexture(e.get(s+t.name))}dispose(){var e;for(let s=0;s<this.pages.length;s++)(e=this.pages[s].texture)==null||e.dispose()}},Ms=class{constructor(e){this.index=0,this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,s){if(!s||(s=s.trim(),s.length==0))return 0;let t=s.indexOf(":");if(t==-1)return 0;e[0]=s.substr(0,t).trim();for(let a=1,i=t+1;;a++){let c=s.indexOf(",",i);if(c==-1)return e[a]=s.substr(i).trim(),a;if(e[a]=s.substr(i,c-i).trim(),i=c+1,a==4)return 4}}},ls=class{constructor(e){this.minFilter=Ce.Nearest,this.magFilter=Ce.Nearest,this.uWrap=Ie.ClampToEdge,this.vWrap=Ie.ClampToEdge,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap)}},Yt=class extends as{constructor(e,s){super();this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=e,this.name=s}},Ye=class extends ae{constructor(e,s){super(e);this.region=null,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new D(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new D(0,0,0,0),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=B.newFloatArray(e.length));let s=this.uvs,t=this.uvs.length,a=this.region.u,i=this.region.v,c=0,o=0;if(this.region instanceof Yt){let r=this.region,l=r.page.texture.getImage(),n=l.width,h=l.height;switch(r.degrees){case 90:a-=(r.originalHeight-r.offsetY-r.height)/n,i-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let d=0;d<t;d+=2)s[d]=a+e[d+1]*c,s[d+1]=i+(1-e[d])*o;return;case 180:a-=(r.originalWidth-r.offsetX-r.width)/n,i-=r.offsetY/h,c=r.originalWidth/n,o=r.originalHeight/h;for(let d=0;d<t;d+=2)s[d]=a+(1-e[d])*c,s[d+1]=i+(1-e[d+1])*o;return;case 270:a-=r.offsetY/n,i-=r.offsetX/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let d=0;d<t;d+=2)s[d]=a+(1-e[d+1])*c,s[d+1]=i+e[d]*o;return}a-=r.offsetX/n,i-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/n,o=r.originalHeight/h}else this.region?(c=this.region.u2-a,o=this.region.v2-i):(a=i=0,c=o=1);for(let r=0;r<t;r+=2)s[r]=a+e[r]*c,s[r+1]=i+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 Ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),B.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),B.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),B.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,t,a,i,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,t,a,i,c)}newLinkedMesh(){let e=new Ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Me=class extends ae{constructor(e){super(e);this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new D(1,1,1,1)}copy(){let e=new Me(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Tt=class extends ae{constructor(e){super(e);this.x=0,this.y=0,this.rotation=0,this.color=new D(.38,.94,0,1)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){let s=M.cosDeg(this.rotation),t=M.sinDeg(this.rotation),a=s*e.a+t*e.b,i=s*e.c+t*e.d;return Math.atan2(i,a)*M.radDeg}copy(){let e=new Tt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},os=class extends et{constructor(e,s){super(e);this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new D(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new D(1,1,1,1),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*t,c=a+this.region.width*s,o=i+this.region.height*t,r=this.rotation*Math.PI/180,l=Math.cos(r),n=Math.sin(r),h=this.x,d=this.y,f=a*l+h,u=a*n,g=i*l+d,x=i*n,p=c*l+h,y=c*n,m=o*l+d,w=o*n,b=this.offset;b[0]=f-x,b[1]=g+u,b[2]=f-w,b[3]=m+u,b[4]=p-w,b[5]=m+y,b[6]=p-x,b[7]=g+y;let v=this.uvs;e.degrees==90?(v[2]=e.u,v[3]=e.v2,v[4]=e.u,v[5]=e.v,v[6]=e.u2,v[7]=e.v,v[0]=e.u2,v[1]=e.v2):(v[0]=e.u,v[1]=e.v2,v[2]=e.u,v[3]=e.v,v[4]=e.u2,v[5]=e.v,v[6]=e.u2,v[7]=e.v2)}computeWorldVertices(e,s,t,a){this.sequence!=null&&this.sequence.apply(e,this);let i=e.bone,c=this.offset,o=i.worldX,r=i.worldY,l=i.a,n=i.b,h=i.c,d=i.d,f=0,u=0;f=c[0],u=c[1],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r,t+=a,f=c[2],u=c[3],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r,t+=a,f=c[4],u=c[5],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r,t+=a,f=c[6],u=c[7],s[t]=f*l+u*n+o,s[t+1]=f*h+u*d+r}copy(){let e=new os(this.name,this.path);return e.region=this.region,e.rendererObject=this.rendererObject,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,B.arrayCopy(this.uvs,0,e.uvs,0,8),B.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},P=os;P.X1=0,P.Y1=1,P.C1R=2,P.C1G=3,P.C1B=4,P.C1A=5,P.U1=6,P.V1=7,P.X2=8,P.Y2=9,P.C2R=10,P.C2G=11,P.C2B=12,P.C2A=13,P.U2=14,P.V2=15,P.X3=16,P.Y3=17,P.C3R=18,P.C3G=19,P.C3B=20,P.C3A=21,P.U3=22,P.V3=23,P.X4=24,P.Y4=25,P.C4R=26,P.C4G=27,P.C4B=28,P.C4A=29,P.U4=30,P.V4=31;var Fs=class{constructor(e){this.atlas=e}loadSequence(e,s,t){let a=t.regions;for(let i=0,c=a.length;i<c;i++){let o=t.getPath(s,i),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");a[i]=r,a[i].renderObject=a[i]}}newRegionAttachment(e,s,t,a){let i=new P(s,t);if(a!=null)this.loadSequence(s,t,a);else{let c=this.atlas.findRegion(t);if(!c)throw new Error("Region not found in atlas: "+t+" (region attachment: "+s+")");c.renderObject=c,i.region=c}return i}newMeshAttachment(e,s,t,a){let i=new Ye(s,t);if(a!=null)this.loadSequence(s,t,a);else{let c=this.atlas.findRegion(t);if(!c)throw new Error("Region not found in atlas: "+t+" (mesh attachment: "+s+")");c.renderObject=c,i.region=c}return i}newBoundingBoxAttachment(e,s){return new He(s)}newPathAttachment(e,s){return new Me(s)}newPointAttachment(e,s){return new Tt(s)}newClippingAttachment(e,s){return new Ct(s)}},Xt=class{constructor(e,s,t){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=te.Normal,this.skinRequired=!1,this.color=new D,e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.name=s,this.parent=t}},te;(function(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"})(te||(te={}));var Mt=class{constructor(e,s,t){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=s,this.parent=t,this.setToSetupPose()}isActive(){return this.active}update(){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,s,t,a,i,c,o){this.ax=e,this.ay=s,this.arotation=t,this.ascaleX=a,this.ascaleY=i,this.ashearX=c,this.ashearY=o;let r=this.parent;if(!r){let f=this.skeleton,u=t+90+o,g=f.scaleX,x=f.scaleY;this.a=M.cosDeg(t+c)*a*g,this.b=M.cosDeg(u)*i*g,this.c=M.sinDeg(t+c)*a*x,this.d=M.sinDeg(u)*i*x,this.worldX=e*g+f.x,this.worldY=s*x+f.y;return}let l=r.a,n=r.b,h=r.c,d=r.d;switch(this.worldX=l*e+n*s+r.worldX,this.worldY=h*e+d*s+r.worldY,this.data.transformMode){case te.Normal:{let f=t+90+o,u=M.cosDeg(t+c)*a,g=M.cosDeg(f)*i,x=M.sinDeg(t+c)*a,p=M.sinDeg(f)*i;this.a=l*u+n*x,this.b=l*g+n*p,this.c=h*u+d*x,this.d=h*g+d*p;return}case te.OnlyTranslation:{let f=t+90+o;this.a=M.cosDeg(t+c)*a,this.b=M.cosDeg(f)*i,this.c=M.sinDeg(t+c)*a,this.d=M.sinDeg(f)*i;break}case te.NoRotationOrReflection:{let f=l*l+h*h,u=0;f>1e-4?(f=Math.abs(l*d-n*h)/f,l/=this.skeleton.scaleX,h/=this.skeleton.scaleY,n=h*f,d=l*f,u=Math.atan2(h,l)*M.radDeg):(l=0,h=0,u=90-Math.atan2(d,n)*M.radDeg);let g=t+c-u,x=t+o-u+90,p=M.cosDeg(g)*a,y=M.cosDeg(x)*i,m=M.sinDeg(g)*a,w=M.sinDeg(x)*i;this.a=l*p-n*m,this.b=l*y-n*w,this.c=h*p+d*m,this.d=h*y+d*w;break}case te.NoScale:case te.NoScaleOrReflection:{let f=M.cosDeg(t),u=M.sinDeg(t),g=(l*f+n*u)/this.skeleton.scaleX,x=(h*f+d*u)/this.skeleton.scaleY,p=Math.sqrt(g*g+x*x);p>1e-5&&(p=1/p),g*=p,x*=p,p=Math.sqrt(g*g+x*x),this.data.transformMode==te.NoScale&&l*d-n*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let y=Math.PI/2+Math.atan2(x,g),m=Math.cos(y)*p,w=Math.sin(y)*p,b=M.cosDeg(c)*a,v=M.cosDeg(90+o)*i,S=M.sinDeg(c)*a,A=M.sinDeg(90+o)*i;this.a=g*b+m*S,this.b=g*v+m*A,this.c=x*b+w*S,this.d=x*v+w*A;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}getWorldRotationX(){return Math.atan2(this.c,this.a)*M.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*M.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)}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)*M.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)*M.radDeg;return}let s=e.a,t=e.b,a=e.c,i=e.d,c=1/(s*i-t*a),o=this.worldX-e.worldX,r=this.worldY-e.worldY;this.ax=o*i*c-r*t*c,this.ay=r*s*c-o*a*c;let l=c*i,n=c*s,h=c*t,d=c*a,f=l*this.a-h*this.c,u=l*this.b-h*this.d,g=n*this.c-d*this.a,x=n*this.d-d*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+g*g),this.ascaleX>1e-4){let p=f*x-u*g;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(f*u+g*x,p)*M.radDeg,this.arotation=Math.atan2(g,f)*M.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*M.radDeg}worldToLocal(e){let s=1/(this.a*this.d-this.b*this.c),t=e.x-this.worldX,a=e.y-this.worldY;return e.x=t*this.d*s-a*this.b*s,e.y=a*this.a*s-t*this.c*s,e}localToWorld(e){let s=e.x,t=e.y;return e.x=s*this.a+t*this.b+this.worldX,e.y=s*this.c+t*this.d+this.worldY,e}worldToLocalRotation(e){let s=M.sinDeg(e),t=M.cosDeg(e);return Math.atan2(this.a*s-this.c*t,this.d*t-this.b*s)*M.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let s=M.sinDeg(e),t=M.cosDeg(e);return Math.atan2(t*this.c+s*this.d,t*this.a+s*this.b)*M.radDeg}rotateWorld(e){let s=this.a,t=this.b,a=this.c,i=this.d,c=M.cosDeg(e),o=M.sinDeg(e);this.a=c*s-o*a,this.b=c*t-o*i,this.c=o*s+c*a,this.d=o*t+c*i}},Ge=class{constructor(e,s,t){this.name=e,this.order=s,this.skinRequired=t}},hs=class{constructor(e,s="",t=new Ft){this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=e,this.pathPrefix=s,this.downloader=t}start(e){return this.toLoad++,this.pathPrefix+e}success(e,s,t){this.toLoad--,this.loaded++,this.assets[s]=t,e&&e(s,t)}error(e,s,t){this.toLoad--,this.loaded++,this.errors[s]=t,e&&e(s,t)}loadAll(){return new Promise((s,t)=>{let a=()=>{if(this.isLoadingComplete()){this.hasErrors()?t(this.errors):s(this);return}requestAnimationFrame(a)};requestAnimationFrame(a)})}setRawDataURI(e,s){this.downloader.rawDataUris[this.pathPrefix+e]=s}loadBinary(e,s=()=>{},t=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,a=>{this.success(s,e,a)},(a,i)=>{this.error(t,e,`Couldn't load binary ${e}: status ${a}, ${i}`)})}loadText(e,s=()=>{},t=()=>{}){e=this.start(e),this.downloader.downloadText(e,a=>{this.success(s,e,a)},(a,i)=>{this.error(t,e,`Couldn't load text ${e}: status ${a}, ${i}`)})}loadJson(e,s=()=>{},t=()=>{}){e=this.start(e),this.downloader.downloadJson(e,a=>{this.success(s,e,a)},(a,i)=>{this.error(t,e,`Couldn't load JSON ${e}: status ${a}, ${i}`)})}loadTexture(e,s=()=>{},t=()=>{}){if(e=this.start(e),!!!(typeof window!="undefined"&&typeof navigator!="undefined"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(t,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(s,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(s,e,this.textureLoader(c))},c.onerror=()=>{this.error(t,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,s=()=>{},t=()=>{},a){let i=e.lastIndexOf("/"),c=i>=0?e.substring(0,i+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new ns(o),l=r.pages.length,n=!1;for(let h of r.pages)this.loadTexture(a?a[h.name]:c+h.name,(d,f)=>{n||(h.setTexture(f),--l==0&&this.success(s,e,r))},(d,f)=>{n||this.error(t,e,`Couldn't load texture atlas ${e} page image: ${d}`),n=!0})}catch(r){this.error(t,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(t,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 s=this.assets[e];if(s)return s;let t=this.errors[e];throw Error("Asset not found: "+e+(t?`
2
+ `+t:""))}remove(e){e=this.pathPrefix+e;let s=this.assets[e];return s.dispose&&s.dispose(),delete this.assets[e],s}removeAll(){for(let e in this.assets){let s=this.assets[e];s.dispose&&s.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}},Ft=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let s=e.indexOf("base64,");return s!=-1?(s+="base64,".length,atob(e.substr(s))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var s=window.atob(e),t=s.length,a=new Uint8Array(t),i=0;i<t;i++)a[i]=s.charCodeAt(i);return a}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let s=e.indexOf("base64,");if(s==-1)throw new Error("Not a binary data URI.");return s+="base64,".length,this.base64ToUint8Array(e.substr(s))}downloadText(e,s,t){if(this.start(e,s,t))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let a=new XMLHttpRequest;a.overrideMimeType("text/html"),a.open("GET",e,!0);let i=()=>{this.finish(e,a.status,a.responseText)};a.onload=i,a.onerror=i,a.send()}downloadJson(e,s,t){this.downloadText(e,a=>{s(JSON.parse(a))},t)}downloadBinary(e,s,t){if(this.start(e,s,t))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer";let i=()=>{this.finish(e,a.status,a.response)};a.onload=()=>{a.status==200||a.status==0?this.finish(e,200,new Uint8Array(a.response)):i()},a.onerror=i,a.send()}start(e,s,t){let a=this.callbacks[e];try{if(a)return!0;this.callbacks[e]=a=[]}finally{a.push(s,t)}}finish(e,s,t){let a=this.callbacks[e];delete this.callbacks[e];let i=s==200||s==0?[t]:[s,t];for(let c=i.length-1,o=a.length;c<o;c+=2)a[c].apply(null,i)}},Et=class{constructor(e,s){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!s)throw new Error("data cannot be null.");this.time=e,this.data=s}},Rt=class{constructor(e){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=e}},cs=class{constructor(e,s){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)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 a=0;a<e.bones.length;a++){let i=s.findBone(e.bones[a].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[a].name}`);this.bones.push(i)}let t=s.findBone(e.target.name);if(!t)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=t}isActive(){return this.active}update(){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,s,t,a,i,c,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,h=r.c,d=r.d,f=-e.ashearX-e.arotation,u=0,g=0;switch(e.data.transformMode){case te.OnlyTranslation:u=s-e.worldX,g=t-e.worldY;break;case te.NoRotationOrReflection:let y=Math.abs(l*d-n*h)/(l*l+h*h),m=l/e.skeleton.scaleX,w=h/e.skeleton.scaleY;n=-w*y*e.skeleton.scaleX,d=m*y*e.skeleton.scaleY,f+=Math.atan2(w,m)*M.radDeg;default:let b=s-r.worldX,v=t-r.worldY,S=l*d-n*h;u=(b*d-v*n)/S-e.ax,g=(v*l-b*h)/S-e.ay}f+=Math.atan2(g,u)*M.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=e.ascaleX,p=e.ascaleY;if(a||i){switch(e.data.transformMode){case te.NoScale:case te.NoScaleOrReflection:u=s-e.worldX,g=t-e.worldY}let y=e.data.length*x,m=Math.sqrt(u*u+g*g);if(a&&m<y||i&&m>y&&y>1e-4){let w=(m/y-1)*o+1;x*=w,c&&(p*=w)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,x,p,e.ashearX,e.ashearY)}apply2(e,s,t,a,i,c,o,r,l){let n=e.ax,h=e.ay,d=e.ascaleX,f=e.ascaleY,u=d,g=f,x=s.ascaleX,p=0,y=0,m=0;d<0?(d=-d,p=180,m=-1):(p=0,m=1),f<0&&(f=-f,m=-m),x<0?(x=-x,y=180):y=0;let w=s.ax,b=0,v=0,S=0,A=e.a,C=e.b,Y=e.c,X=e.d,R=Math.abs(d-f)<=1e-4;!R||c?(b=0,v=A*w+e.worldX,S=Y*w+e.worldY):(b=s.ay,v=A*w+C*b+e.worldX,S=Y*w+X*b+e.worldY);let E=e.parent;if(!E)throw new Error("IK parent must itself have a parent.");A=E.a,C=E.b,Y=E.c,X=E.d;let F=1/(A*X-C*Y),I=v-E.worldX,T=S-E.worldY,V=(I*X-T*C)*F-n,U=(T*A-I*Y)*F-h,L=Math.sqrt(V*V+U*U),W=s.data.length*x,O,$;if(L<1e-4){this.apply1(e,t,a,!1,c,!1,l),s.updateWorldTransformWith(w,b,0,s.ascaleX,s.ascaleY,s.ashearX,s.ashearY);return}I=t-E.worldX,T=a-E.worldY;let q=(I*X-T*C)*F-n,N=(T*A-I*Y)*F-h,G=q*q+N*N;if(r!=0){r*=d*(x+1)*.5;let Q=Math.sqrt(G),re=Q-L-W*d+r;if(re>0){let ie=Math.min(1,re/(r*2))-1;ie=(re-r*(1-ie*ie))/Q,q-=ie*q,N-=ie*N,G=q*q+N*N}}e:if(R){W*=d;let Q=(G-L*L-W*W)/(2*L*W);Q<-1?(Q=-1,$=Math.PI*i):Q>1?(Q=1,$=0,c&&(A=(Math.sqrt(G)/(L+W)-1)*l+1,u*=A,o&&(g*=A))):$=Math.acos(Q)*i,A=L+W*Q,C=W*Math.sin($),O=Math.atan2(N*A-q*C,q*A+N*C)}else{A=d*W,C=f*W;let Q=A*A,re=C*C,ie=Math.atan2(N,q);Y=re*L*L+Q*G-Q*re;let ve=-2*re*L,Ee=re-Q;if(X=ve*ve-4*Ee*Y,X>=0){let Re=Math.sqrt(X);ve<0&&(Re=-Re),Re=-(ve+Re)*.5;let bs=Re/Ee,ps=Y/Re,Be=Math.abs(bs)<Math.abs(ps)?bs:ps;if(Be*Be<=G){T=Math.sqrt(G-Be*Be)*i,O=ie-Math.atan2(T,Be),$=Math.atan2(T/f,(Be-L)/d);break e}}let Ne=M.PI,Ke=L-A,Wt=Ke*Ke,gs=0,xs=0,Qe=L+A,zt=Qe*Qe,ws=0;Y=-A*L/(Q-re),Y>=-1&&Y<=1&&(Y=Math.acos(Y),I=A*Math.cos(Y)+L,T=C*Math.sin(Y),X=I*I+T*T,X<Wt&&(Ne=Y,Wt=X,Ke=I,gs=T),X>zt&&(xs=Y,zt=X,Qe=I,ws=T)),G<=(Wt+zt)*.5?(O=ie-Math.atan2(gs*i,Ke),$=Ne*i):(O=ie-Math.atan2(ws*i,Qe),$=xs*i)}let Z=Math.atan2(b,w)*m,de=e.arotation;O=(O-Z)*M.radDeg+p-de,O>180?O-=360:O<-180&&(O+=360),e.updateWorldTransformWith(n,h,de+O*l,u,g,0,0),de=s.arotation,$=(($+Z)*M.radDeg-s.ashearX)*m+y-de,$>180?$-=360:$<-180&&($+=360),s.updateWorldTransformWith(w,b,de+$*l,s.ascaleX,s.ascaleY,s.ashearX,s.ashearY)}},Bt=class extends Ge{constructor(e){super(e,0,!1);this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Pt=class extends Ge{constructor(e){super(e,0,!1);this.bones=new Array,this._target=null,this.positionMode=oe.Fixed,this.spacingMode=K.Fixed,this.rotateMode=ye.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},oe;(function(e){e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent"})(oe||(oe={}));var K;(function(e){e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional"})(K||(K={}));var ye;(function(e){e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale"})(ye||(ye={}));var xe=class{constructor(e,s){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let a=0,i=e.bones.length;a<i;a++){let c=s.findBone(e.bones[a].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[a].name}.`);this.bones.push(c)}let t=s.findSlot(e.target.name);if(!t)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=t,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}update(){let e=this.target.getAttachment();if(!(e instanceof Me))return;let s=this.mixRotate,t=this.mixX,a=this.mixY;if(s==0&&t==0&&a==0)return;let i=this.data,c=i.rotateMode==ye.Tangent,o=i.rotateMode==ye.ChainScale,r=this.bones,l=r.length,n=c?l:l+1,h=B.setArraySize(this.spaces,n),d=o?this.lengths=B.setArraySize(this.lengths,l):[],f=this.spacing;switch(i.spacingMode){case K.Percent:if(o)for(let b=0,v=n-1;b<v;b++){let S=r[b],A=S.data.length;if(A<xe.epsilon)d[b]=0;else{let C=A*S.a,Y=A*S.c;d[b]=Math.sqrt(C*C+Y*Y)}}B.arrayFill(h,1,n,f);break;case K.Proportional:let m=0;for(let b=0,v=n-1;b<v;){let S=r[b],A=S.data.length;if(A<xe.epsilon)o&&(d[b]=0),h[++b]=f;else{let C=A*S.a,Y=A*S.c,X=Math.sqrt(C*C+Y*Y);o&&(d[b]=X),h[++b]=X,m+=X}}if(m>0){m=n/m*f;for(let b=1;b<n;b++)h[b]*=m}break;default:let w=i.spacingMode==K.Length;for(let b=0,v=n-1;b<v;){let S=r[b],A=S.data.length;if(A<xe.epsilon)o&&(d[b]=0),h[++b]=f;else{let C=A*S.a,Y=A*S.c,X=Math.sqrt(C*C+Y*Y);o&&(d[b]=X),h[++b]=(w?A+f:f)*X/A}}}let u=this.computeWorldPositions(e,n,c),g=u[0],x=u[1],p=i.offsetRotation,y=!1;if(p==0)y=i.rotateMode==ye.Chain;else{y=!1;let m=this.target.bone;p*=m.a*m.d-m.b*m.c>0?M.degRad:-M.degRad}for(let m=0,w=3;m<l;m++,w+=3){let b=r[m];b.worldX+=(g-b.worldX)*t,b.worldY+=(x-b.worldY)*a;let v=u[w],S=u[w+1],A=v-g,C=S-x;if(o){let Y=d[m];if(Y!=0){let X=(Math.sqrt(A*A+C*C)/Y-1)*s+1;b.a*=X,b.c*=X}}if(g=v,x=S,s>0){let Y=b.a,X=b.b,R=b.c,E=b.d,F=0,I=0,T=0;if(c?F=u[w-1]:h[m+1]==0?F=u[w+2]:F=Math.atan2(C,A),F-=Math.atan2(R,Y),y){I=Math.cos(F),T=Math.sin(F);let V=b.data.length;g+=(V*(I*Y-T*R)-A)*s,x+=(V*(T*Y+I*R)-C)*s}else F+=p;F>M.PI?F-=M.PI2:F<-M.PI&&(F+=M.PI2),F*=s,I=Math.cos(F),T=Math.sin(F),b.a=I*Y-T*R,b.b=I*X-T*E,b.c=T*Y+I*R,b.d=T*X+I*E}b.updateAppliedTransform()}}computeWorldPositions(e,s,t){let a=this.target,i=this.position,c=this.spaces,o=B.setArraySize(this.positions,s*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,h=n/6,d=xe.NONE;if(!e.constantSpeed){let U=e.lengths;h-=l?1:2;let L=U[h];this.data.positionMode==oe.Percent&&(i*=L);let W;switch(this.data.spacingMode){case K.Percent:W=L;break;case K.Proportional:W=L/s;break;default:W=1}r=B.setArraySize(this.world,8);for(let O=0,$=0,q=0;O<s;O++,$+=3){let N=c[O]*W;i+=N;let G=i;if(l)G%=L,G<0&&(G+=L),q=0;else if(G<0){d!=xe.BEFORE&&(d=xe.BEFORE,e.computeWorldVertices(a,2,4,r,0,2)),this.addBeforePosition(G,r,0,o,$);continue}else if(G>L){d!=xe.AFTER&&(d=xe.AFTER,e.computeWorldVertices(a,n-6,4,r,0,2)),this.addAfterPosition(G-L,r,0,o,$);continue}for(;;q++){let Z=U[q];if(!(G>Z)){if(q==0)G/=Z;else{let de=U[q-1];G=(G-de)/(Z-de)}break}}q!=d&&(d=q,l&&q==h?(e.computeWorldVertices(a,n-4,4,r,0,2),e.computeWorldVertices(a,0,4,r,4,2)):e.computeWorldVertices(a,q*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,$,t||O>0&&N==0)}return o}l?(n+=2,r=B.setArraySize(this.world,n),e.computeWorldVertices(a,2,n-4,r,0,2),e.computeWorldVertices(a,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(h--,n-=4,r=B.setArraySize(this.world,n),e.computeWorldVertices(a,2,n,r,0,2));let f=B.setArraySize(this.curves,h),u=0,g=r[0],x=r[1],p=0,y=0,m=0,w=0,b=0,v=0,S=0,A=0,C=0,Y=0,X=0,R=0,E=0,F=0;for(let U=0,L=2;U<h;U++,L+=6)p=r[L],y=r[L+1],m=r[L+2],w=r[L+3],b=r[L+4],v=r[L+5],S=(g-p*2+m)*.1875,A=(x-y*2+w)*.1875,C=((p-m)*3-g+b)*.09375,Y=((y-w)*3-x+v)*.09375,X=S*2+C,R=A*2+Y,E=(p-g)*.75+S+C*.16666667,F=(y-x)*.75+A+Y*.16666667,u+=Math.sqrt(E*E+F*F),E+=X,F+=R,X+=C,R+=Y,u+=Math.sqrt(E*E+F*F),E+=X,F+=R,u+=Math.sqrt(E*E+F*F),E+=X+C,F+=R+Y,u+=Math.sqrt(E*E+F*F),f[U]=u,g=b,x=v;this.data.positionMode==oe.Percent&&(i*=u);let I;switch(this.data.spacingMode){case K.Percent:I=u;break;case K.Proportional:I=u/s;break;default:I=1}let T=this.segments,V=0;for(let U=0,L=0,W=0,O=0;U<s;U++,L+=3){let $=c[U]*I;i+=$;let q=i;if(l)q%=u,q<0&&(q+=u),W=0;else if(q<0){this.addBeforePosition(q,r,0,o,L);continue}else if(q>u){this.addAfterPosition(q-u,r,n-4,o,L);continue}for(;;W++){let N=f[W];if(!(q>N)){if(W==0)q/=N;else{let G=f[W-1];q=(q-G)/(N-G)}break}}if(W!=d){d=W;let N=W*6;for(g=r[N],x=r[N+1],p=r[N+2],y=r[N+3],m=r[N+4],w=r[N+5],b=r[N+6],v=r[N+7],S=(g-p*2+m)*.03,A=(x-y*2+w)*.03,C=((p-m)*3-g+b)*.006,Y=((y-w)*3-x+v)*.006,X=S*2+C,R=A*2+Y,E=(p-g)*.3+S+C*.16666667,F=(y-x)*.3+A+Y*.16666667,V=Math.sqrt(E*E+F*F),T[0]=V,N=1;N<8;N++)E+=X,F+=R,X+=C,R+=Y,V+=Math.sqrt(E*E+F*F),T[N]=V;E+=X,F+=R,V+=Math.sqrt(E*E+F*F),T[8]=V,E+=X+C,F+=R+Y,V+=Math.sqrt(E*E+F*F),T[9]=V,O=0}for(q*=V;;O++){let N=T[O];if(!(q>N)){if(O==0)q/=N;else{let G=T[O-1];q=O+(q-G)/(N-G)}break}}this.addCurvePosition(q*.1,g,x,p,y,m,w,b,v,o,L,t||U>0&&$==0)}return o}addBeforePosition(e,s,t,a,i){let c=s[t],o=s[t+1],r=s[t+2]-c,l=s[t+3]-o,n=Math.atan2(l,r);a[i]=c+e*Math.cos(n),a[i+1]=o+e*Math.sin(n),a[i+2]=n}addAfterPosition(e,s,t,a,i){let c=s[t+2],o=s[t+3],r=c-s[t],l=o-s[t+1],n=Math.atan2(l,r);a[i]=c+e*Math.cos(n),a[i+1]=o+e*Math.sin(n),a[i+2]=n}addCurvePosition(e,s,t,a,i,c,o,r,l,n,h,d){if(e==0||isNaN(e)){n[h]=s,n[h+1]=t,n[h+2]=Math.atan2(i-t,a-s);return}let f=e*e,u=f*e,g=1-e,x=g*g,p=x*g,y=g*e,m=y*3,w=g*m,b=m*e,v=s*p+a*w+c*b+r*u,S=t*p+i*w+o*b+l*u;n[h]=v,n[h+1]=S,d&&(e<.001?n[h+2]=Math.atan2(i-t,a-s):n[h+2]=Math.atan2(S-(t*x+i*y*2+o*f),v-(s*x+a*y*2+c*f)))}},Fe=xe;Fe.NONE=-1,Fe.BEFORE=-2,Fe.AFTER=-3,Fe.epsilon=1e-5;var ds=class{constructor(e,s){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!e)throw new Error("data cannot be null.");if(!s)throw new Error("bone cannot be null.");this.data=e,this.bone=s,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ae)||!(this.attachment instanceof ae)||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}},fs=class{constructor(e,s){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new Oe,this.active=!1,!e)throw new Error("data cannot be null.");if(!s)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 a=0;a<e.bones.length;a++){let i=s.findBone(e.bones[a].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[a].name}.`);this.bones.push(i)}let t=s.findBone(e.target.name);if(!t)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=t}isActive(){return this.active}update(){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleX==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,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=s!=0||t!=0,r=this.target,l=r.a,n=r.b,h=r.c,d=r.d,f=l*d-n*h>0?M.degRad:-M.degRad,u=this.data.offsetRotation*f,g=this.data.offsetShearY*f,x=this.bones;for(let p=0,y=x.length;p<y;p++){let m=x[p];if(e!=0){let w=m.a,b=m.b,v=m.c,S=m.d,A=Math.atan2(h,l)-Math.atan2(v,w)+u;A>M.PI?A-=M.PI2:A<-M.PI&&(A+=M.PI2),A*=e;let C=Math.cos(A),Y=Math.sin(A);m.a=C*w-Y*v,m.b=C*b-Y*S,m.c=Y*w+C*v,m.d=Y*b+C*S}if(o){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),m.worldX+=(w.x-m.worldX)*s,m.worldY+=(w.y-m.worldY)*t}if(a!=0){let w=Math.sqrt(m.a*m.a+m.c*m.c);w!=0&&(w=(w+(Math.sqrt(l*l+h*h)-w+this.data.offsetScaleX)*a)/w),m.a*=w,m.c*=w}if(i!=0){let w=Math.sqrt(m.b*m.b+m.d*m.d);w!=0&&(w=(w+(Math.sqrt(n*n+d*d)-w+this.data.offsetScaleY)*i)/w),m.b*=w,m.d*=w}if(c>0){let w=m.b,b=m.d,v=Math.atan2(b,w),S=Math.atan2(d,n)-Math.atan2(h,l)-(v-Math.atan2(m.c,m.a));S>M.PI?S-=M.PI2:S<-M.PI&&(S+=M.PI2),S=v+(S+g)*c;let A=Math.sqrt(w*w+b*b);m.b=Math.cos(S)*A,m.d=Math.sin(S)*A}m.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=s!=0||t!=0,r=this.target,l=r.a,n=r.b,h=r.c,d=r.d,f=l*d-n*h>0?M.degRad:-M.degRad,u=this.data.offsetRotation*f,g=this.data.offsetShearY*f,x=this.bones;for(let p=0,y=x.length;p<y;p++){let m=x[p];if(e!=0){let w=m.a,b=m.b,v=m.c,S=m.d,A=Math.atan2(h,l)+u;A>M.PI?A-=M.PI2:A<-M.PI&&(A+=M.PI2),A*=e;let C=Math.cos(A),Y=Math.sin(A);m.a=C*w-Y*v,m.b=C*b-Y*S,m.c=Y*w+C*v,m.d=Y*b+C*S}if(o){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),m.worldX+=w.x*s,m.worldY+=w.y*t}if(a!=0){let w=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*a+1;m.a*=w,m.c*=w}if(i!=0){let w=(Math.sqrt(n*n+d*d)-1+this.data.offsetScaleY)*i+1;m.b*=w,m.d*=w}if(c>0){let w=Math.atan2(d,n)-Math.atan2(h,l);w>M.PI?w-=M.PI2:w<-M.PI&&(w+=M.PI2);let b=m.b,v=m.d;w=Math.atan2(v,b)+(w-M.PI/2+g)*c;let S=Math.sqrt(b*b+v*v);m.b=Math.cos(w)*S,m.d=Math.sin(w)*S}m.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],d=h.arotation;if(e!=0){let y=o.arotation-d+this.data.offsetRotation;y-=(16384-(16384.499999999996-y/360|0))*360,d+=y*e}let f=h.ax,u=h.ay;f+=(o.ax-f+this.data.offsetX)*s,u+=(o.ay-u+this.data.offsetY)*t;let g=h.ascaleX,x=h.ascaleY;a!=0&&g!=0&&(g=(g+(o.ascaleX-g+this.data.offsetScaleX)*a)/g),i!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*i)/x);let p=h.ashearY;if(c!=0){let y=o.ashearY-p+this.data.offsetShearY;y-=(16384-(16384.499999999996-y/360|0))*360,p+=y*c}h.updateWorldTransformWith(f,u,d,g,x,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,s=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],d=h.arotation+(o.arotation+this.data.offsetRotation)*e,f=h.ax+(o.ax+this.data.offsetX)*s,u=h.ay+(o.ay+this.data.offsetY)*t,g=h.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*a+1),x=h.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),p=h.ashearY+(o.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(f,u,d,g,x,h.ashearX,p)}}},Es=class{constructor(e){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let t=e.bones[s],a;if(!t.parent)a=new Mt(t,this,null);else{let i=this.bones[t.parent.index];a=new Mt(t,this,i),i.children.push(a)}this.bones.push(a)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let t=e.slots[s],a=this.bones[t.boneData.index],i=new ds(t,a);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let t=e.ikConstraints[s];this.ikConstraints.push(new cs(t,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let t=e.transformConstraints[s];this.transformConstraints.push(new fs(t,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let t=e.pathConstraints[s];this.pathConstraints.push(new Fe(t,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let n=0,h=s.length;n<h;n++){let d=s[n];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let n=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let f=this.bones[n[h].index];do f.sorted=!1,f.active=!0,f=f.parent;while(f)}}let t=this.ikConstraints,a=this.transformConstraints,i=this.pathConstraints,c=t.length,o=a.length,r=i.length,l=c+o+r;e:for(let n=0;n<l;n++){for(let h=0;h<c;h++){let d=t[h];if(d.data.order==n){this.sortIkConstraint(d);continue e}}for(let h=0;h<o;h++){let d=a[h];if(d.data.order==n){this.sortTransformConstraint(d);continue e}}for(let h=0;h<r;h++){let d=i[h];if(d.data.order==n){this.sortPathConstraint(d);continue e}}}for(let n=0,h=s.length;n<h;n++)this.sortBone(s[n])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let t=e.bones,a=t[0];if(this.sortBone(a),t.length==1)this._updateCache.push(e),this.sortReset(a.children);else{let i=t[t.length-1];this.sortBone(i),this._updateCache.push(e),this.sortReset(a.children),i.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&B.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,t=s.data.index,a=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,t,a),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,t,a);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],t,a);let i=s.getAttachment();i instanceof Me&&this.sortPathConstraintAttachmentWith(i,a);let c=e.bones,o=c.length;for(let r=0;r<o;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(c[r].children);for(let r=0;r<o;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,t=s.length;if(e.data.local)for(let a=0;a<t;a++){let i=s[a];this.sortBone(i.parent),this.sortBone(i)}else for(let a=0;a<t;a++)this.sortBone(s[a]);this._updateCache.push(e);for(let a=0;a<t;a++)this.sortReset(s[a].children);for(let a=0;a<t;a++)s[a].sorted=!0}sortPathConstraintAttachment(e,s,t){let a=e.attachments[s];if(!!a)for(let i in a)this.sortPathConstraintAttachmentWith(a[i],t)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Me))return;let t=e.bones;if(!t)this.sortBone(s);else{let a=this.bones;for(let i=0,c=t.length;i<c;){let o=t[i++];for(o+=i;i<o;)this.sortBone(a[t[i++]])}}}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,t=e.length;s<t;s++){let a=e[s];!a.active||(a.sorted&&this.sortReset(a.children),a.sorted=!1)}}updateWorldTransform(){let e=this.bones;for(let t=0,a=e.length;t<a;t++){let i=e[t];i.ax=i.x,i.ay=i.y,i.arotation=i.rotation,i.ascaleX=i.scaleX,i.ascaleY=i.scaleY,i.ashearX=i.shearX,i.ashearY=i.shearY}let s=this._updateCache;for(let t=0,a=s.length;t<a;t++)s[t].update()}updateWorldTransformWith(e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let t=e.a,a=e.b,i=e.c,c=e.d;s.worldX=t*this.x+a*this.y+e.worldX,s.worldY=i*this.x+c*this.y+e.worldY;let o=s.rotation+90+s.shearY,r=M.cosDeg(s.rotation+s.shearX)*s.scaleX,l=M.cosDeg(o)*s.scaleY,n=M.sinDeg(s.rotation+s.shearX)*s.scaleX,h=M.sinDeg(o)*s.scaleY;s.a=(t*r+a*n)*this.scaleX,s.b=(t*l+a*h)*this.scaleX,s.c=(i*r+c*n)*this.scaleY,s.d=(i*l+c*h)*this.scaleY;let d=this._updateCache;for(let f=0,u=d.length;f<u;f++){let g=d[f];g!=s&&g.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let e=this.bones;for(let i=0,c=e.length;i<c;i++)e[i].setToSetupPose();let s=this.ikConstraints;for(let i=0,c=s.length;i<c;i++){let o=s[i];o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}let t=this.transformConstraints;for(let i=0,c=t.length;i<c;i++){let o=t[i],r=o.data;o.mixRotate=r.mixRotate,o.mixX=r.mixX,o.mixY=r.mixY,o.mixScaleX=r.mixScaleX,o.mixScaleY=r.mixScaleY,o.mixShearY=r.mixShearY}let a=this.pathConstraints;for(let i=0,c=a.length;i<c;i++){let o=a[i],r=o.data;o.position=r.position,o.spacing=r.spacing,o.mixRotate=r.mixRotate,o.mixX=r.mixX,o.mixY=r.mixY}}setSlotsToSetupPose(){let e=this.slots;B.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,t=e.length;s<t;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let t=0,a=s.length;t<a;t++){let i=s[t],c=i.data.attachmentName;if(c){let o=e.getAttachment(t,c);o&&i.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let t=this.data.findSlot(e);if(!t)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(t.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let t=this.skin.getAttachment(e,s);if(t)return t}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let a=0,i=t.length;a<i;a++){let c=t[a];if(c.data.name==e){let o=null;if(s&&(o=this.getAttachment(a,s),!o))throw new Error("Attachment not found: "+s+", for slot: "+e);c.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.ikConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.transformConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.pathConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.data.name==e)return i}return null}getBoundsRect(){let e=new Oe,s=new Oe;return this.getBounds(e,s),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(e,s,t=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let a=this.drawOrder,i=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l=0,n=a.length;l<n;l++){let h=a[l];if(!h.bone.active)continue;let d=0,f=null,u=h.getAttachment();if(u instanceof P)d=8,f=B.setArraySize(t,d,0),u.computeWorldVertices(h,f,0,2);else if(u instanceof Ye){let g=u;d=g.worldVerticesLength,f=B.setArraySize(t,d,0),g.computeWorldVertices(h,0,d,f,0,2)}if(f)for(let g=0,x=f.length;g<x;g+=2){let p=f[g],y=f[g+1];i=Math.min(i,p),c=Math.min(c,y),o=Math.max(o,p),r=Math.max(r,y)}}e.set(i,c),s.set(o-i,r-c)}},Vt=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let s=this.skins;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let s=this.events;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let s=this.animations;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.ikConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.transformConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let s=this.pathConstraints;for(let t=0,a=s.length;t<a;t++){let i=s[t];if(i.name==e)return i}return null}},Lt=class{constructor(e=0,s,t){this.slotIndex=e,this.name=s,this.attachment=t}},je=class{constructor(e){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,s,t){if(!t)throw new Error("attachment cannot be null.");let a=this.attachments;e>=a.length&&(a.length=e+1),a[e]||(a[e]={}),a[e][s]=t}addSkin(e){for(let a=0;a<e.bones.length;a++){let i=e.bones[a],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){c=!0;break}c||this.bones.push(i)}for(let a=0;a<e.constraints.length;a++){let i=e.constraints[a],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){c=!0;break}c||this.constraints.push(i)}let s=e.getAttachments();for(let a=0;a<s.length;a++){var t=s[a];this.setAttachment(t.slotIndex,t.name,t.attachment)}}copySkin(e){for(let a=0;a<e.bones.length;a++){let i=e.bones[a],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){c=!0;break}c||this.bones.push(i)}for(let a=0;a<e.constraints.length;a++){let i=e.constraints[a],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){c=!0;break}c||this.constraints.push(i)}let s=e.getAttachments();for(let a=0;a<s.length;a++){var t=s[a];!t.attachment||(t.attachment instanceof Ye?(t.attachment=t.attachment.newLinkedMesh(),this.setAttachment(t.slotIndex,t.name,t.attachment)):(t.attachment=t.attachment.copy(),this.setAttachment(t.slotIndex,t.name,t.attachment)))}}getAttachment(e,s){let t=this.attachments[e];return t?t[s]:null}removeAttachment(e,s){let t=this.attachments[e];t&&delete t[s]}getAttachments(){let e=new Array;for(var s=0;s<this.attachments.length;s++){let t=this.attachments[s];if(t)for(let a in t){let i=t[a];i&&e.push(new Lt(s,a,i))}}return e}getAttachmentsForSlot(e,s){let t=this.attachments[e];if(t)for(let a in t){let i=t[a];i&&s.push(new Lt(e,a,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,s){let t=0;for(let a=0;a<e.slots.length;a++){let i=e.slots[a],c=i.getAttachment();if(c&&t<s.attachments.length){let o=s.attachments[t];for(let r in o){let l=o[r];if(c==l){let n=this.getAttachment(t,r);n&&i.setAttachment(n);break}}}t++}}},Dt=class{constructor(e,s,t){if(this.index=0,this.color=new D(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=De.Normal,e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");if(!t)throw new Error("boneData cannot be null.");this.index=e,this.name=s,this.boneData=t}},De;(function(e){e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"})(De||(De={}));var Nt=class extends Ge{constructor(e){super(e,0,!1);this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Rs=class{constructor(e){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=e}readSkeletonData(e){let s=this.scale,t=new Vt;t.name="";let a=new us(e),i=a.readInt32(),c=a.readInt32();t.hash=c==0&&i==0?null:c.toString(16)+i.toString(16),t.version=a.readString(),t.x=a.readFloat(),t.y=a.readFloat(),t.width=a.readFloat(),t.height=a.readFloat();let o=a.readBoolean();o&&(t.fps=a.readFloat(),t.imagesPath=a.readString(),t.audioPath=a.readString());let r=0;r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("String in string table must not be null.");a.strings.push(h)}r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("Bone name must not be null.");let d=n==0?null:t.bones[a.readInt(!0)],f=new Xt(n,h,d);f.rotation=a.readFloat(),f.x=a.readFloat()*s,f.y=a.readFloat()*s,f.scaleX=a.readFloat(),f.scaleY=a.readFloat(),f.shearX=a.readFloat(),f.shearY=a.readFloat(),f.length=a.readFloat()*s,f.transformMode=a.readInt(!0),f.skinRequired=a.readBoolean(),o&&D.rgba8888ToColor(f.color,a.readInt32()),t.bones.push(f)}r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("Slot name must not be null.");let d=t.bones[a.readInt(!0)],f=new Dt(n,h,d);D.rgba8888ToColor(f.color,a.readInt32());let u=a.readInt32();u!=-1&&D.rgb888ToColor(f.darkColor=new D,u),f.attachmentName=a.readStringRef(),f.blendMode=a.readInt(!0),t.slots.push(f)}r=a.readInt(!0);for(let n=0,h;n<r;n++){let d=a.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Bt(d);f.order=a.readInt(!0),f.skinRequired=a.readBoolean(),h=a.readInt(!0);for(let u=0;u<h;u++)f.bones.push(t.bones[a.readInt(!0)]);f.target=t.bones[a.readInt(!0)],f.mix=a.readFloat(),f.softness=a.readFloat()*s,f.bendDirection=a.readByte(),f.compress=a.readBoolean(),f.stretch=a.readBoolean(),f.uniform=a.readBoolean(),t.ikConstraints.push(f)}r=a.readInt(!0);for(let n=0,h;n<r;n++){let d=a.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Nt(d);f.order=a.readInt(!0),f.skinRequired=a.readBoolean(),h=a.readInt(!0);for(let u=0;u<h;u++)f.bones.push(t.bones[a.readInt(!0)]);f.target=t.bones[a.readInt(!0)],f.local=a.readBoolean(),f.relative=a.readBoolean(),f.offsetRotation=a.readFloat(),f.offsetX=a.readFloat()*s,f.offsetY=a.readFloat()*s,f.offsetScaleX=a.readFloat(),f.offsetScaleY=a.readFloat(),f.offsetShearY=a.readFloat(),f.mixRotate=a.readFloat(),f.mixX=a.readFloat(),f.mixY=a.readFloat(),f.mixScaleX=a.readFloat(),f.mixScaleY=a.readFloat(),f.mixShearY=a.readFloat(),t.transformConstraints.push(f)}r=a.readInt(!0);for(let n=0,h;n<r;n++){let d=a.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Pt(d);f.order=a.readInt(!0),f.skinRequired=a.readBoolean(),h=a.readInt(!0);for(let u=0;u<h;u++)f.bones.push(t.bones[a.readInt(!0)]);f.target=t.slots[a.readInt(!0)],f.positionMode=a.readInt(!0),f.spacingMode=a.readInt(!0),f.rotateMode=a.readInt(!0),f.offsetRotation=a.readFloat(),f.position=a.readFloat(),f.positionMode==oe.Fixed&&(f.position*=s),f.spacing=a.readFloat(),(f.spacingMode==K.Length||f.spacingMode==K.Fixed)&&(f.spacing*=s),f.mixRotate=a.readFloat(),f.mixX=a.readFloat(),f.mixY=a.readFloat(),t.pathConstraints.push(f)}let l=this.readSkin(a,t,!0,o);l&&(t.defaultSkin=l,t.skins.push(l));{let n=t.skins.length;for(B.setArraySize(t.skins,r=n+a.readInt(!0));n<r;n++){let h=this.readSkin(a,t,!1,o);if(!h)throw new Error("readSkin() should not have returned null.");t.skins[n]=h}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let h=this.linkedMeshes[n],d=h.skin?t.findSkin(h.skin):t.defaultSkin;if(!d)throw new Error("Not skin found for linked mesh.");if(!h.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(h.slotIndex,h.parent);if(!f)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?f:h.mesh,h.mesh.setParentMesh(f),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readStringRef();if(!h)throw new Error;let d=new Rt(h);d.intValue=a.readInt(!1),d.floatValue=a.readFloat(),d.stringValue=a.readString(),d.audioPath=a.readString(),d.audioPath&&(d.volume=a.readFloat(),d.balance=a.readFloat()),t.events.push(d)}r=a.readInt(!0);for(let n=0;n<r;n++){let h=a.readString();if(!h)throw new Error("Animatio name must not be null.");t.animations.push(this.readAnimation(a,h,t))}return t}readSkin(e,s,t,a){let i=null,c=0;if(t){if(c=e.readInt(!0),c==0)return null;i=new je("default")}else{let o=e.readStringRef();if(!o)throw new Error("Skin name must not be null.");i=new je(o),i.bones.length=e.readInt(!0);for(let r=0,l=i.bones.length;r<l;r++)i.bones[r]=s.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)i.constraints.push(s.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)i.constraints.push(s.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)i.constraints.push(s.pathConstraints[e.readInt(!0)]);c=e.readInt(!0)}for(let o=0;o<c;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,s,i,r,h,a);d&&i.setAttachment(r,h,d)}}return i}readAttachment(e,s,t,a,i,c){let o=this.scale,r=e.readStringRef();switch(r||(r=i),e.readByte()){case we.Region:{let l=e.readStringRef(),n=e.readFloat(),h=e.readFloat(),d=e.readFloat(),f=e.readFloat(),u=e.readFloat(),g=e.readFloat(),x=e.readFloat(),p=e.readInt32(),y=this.readSequence(e);l||(l=r);let m=this.attachmentLoader.newRegionAttachment(t,r,l,y);return m?(m.path=l,m.x=h*o,m.y=d*o,m.scaleX=f,m.scaleY=u,m.rotation=n,m.width=g*o,m.height=x*o,D.rgba8888ToColor(m.color,p),m.sequence=y,y==null&&m.updateRegion(),m):null}case we.BoundingBox:{let l=e.readInt(!0),n=this.readVertices(e,l),h=c?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(t,r);return d?(d.worldVerticesLength=l<<1,d.vertices=n.vertices,d.bones=n.bones,c&&D.rgba8888ToColor(d.color,h),d):null}case we.Mesh:{let l=e.readStringRef(),n=e.readInt32(),h=e.readInt(!0),d=this.readFloatArray(e,h<<1,1),f=this.readShortArray(e),u=this.readVertices(e,h),g=e.readInt(!0),x=this.readSequence(e),p=[],y=0,m=0;c&&(p=this.readShortArray(e),y=e.readFloat(),m=e.readFloat()),l||(l=r);let w=this.attachmentLoader.newMeshAttachment(t,r,l,x);return w?(w.path=l,D.rgba8888ToColor(w.color,n),w.bones=u.bones,w.vertices=u.vertices,w.worldVerticesLength=h<<1,w.triangles=f,w.regionUVs=d,x==null&&w.updateRegion(),w.hullLength=g<<1,w.sequence=x,c&&(w.edges=p,w.width=y*o,w.height=m*o),w):null}case we.LinkedMesh:{let l=e.readStringRef(),n=e.readInt32(),h=e.readStringRef(),d=e.readStringRef(),f=e.readBoolean(),u=this.readSequence(e),g=0,x=0;c&&(g=e.readFloat(),x=e.readFloat()),l||(l=r);let p=this.attachmentLoader.newMeshAttachment(t,r,l,u);return p?(p.path=l,D.rgba8888ToColor(p.color,n),p.sequence=u,c&&(p.width=g*o,p.height=x*o),this.linkedMeshes.push(new Bs(p,h,a,d,f)),p):null}case we.Path:{let l=e.readBoolean(),n=e.readBoolean(),h=e.readInt(!0),d=this.readVertices(e,h),f=B.newArray(h/3,0);for(let x=0,p=f.length;x<p;x++)f[x]=e.readFloat()*o;let u=c?e.readInt32():0,g=this.attachmentLoader.newPathAttachment(t,r);return g?(g.closed=l,g.constantSpeed=n,g.worldVerticesLength=h<<1,g.vertices=d.vertices,g.bones=d.bones,g.lengths=f,c&&D.rgba8888ToColor(g.color,u),g):null}case we.Point:{let l=e.readFloat(),n=e.readFloat(),h=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(t,r);return f?(f.x=n*o,f.y=h*o,f.rotation=l,c&&D.rgba8888ToColor(f.color,d),f):null}case we.Clipping:{let l=e.readInt(!0),n=e.readInt(!0),h=this.readVertices(e,n),d=c?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(t,r);return f?(f.endSlot=s.slots[l],f.worldVerticesLength=n<<1,f.vertices=h.vertices,f.bones=h.bones,c&&D.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){if(!e.readBoolean())return null;let s=new tt(e.readInt(!0));return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,s){let t=this.scale,a=s<<1,i=new Ps;if(!e.readBoolean())return i.vertices=this.readFloatArray(e,a,t),i;let c=new Array,o=new Array;for(let r=0;r<s;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),c.push(e.readFloat()*t),c.push(e.readFloat()*t),c.push(e.readFloat())}return i.vertices=B.toFloatArray(c),i.bones=o,i}readFloatArray(e,s,t){let a=new Array(s);if(t==1)for(let i=0;i<s;i++)a[i]=e.readFloat();else for(let i=0;i<s;i++)a[i]=e.readFloat()*t;return a}readShortArray(e){let s=e.readInt(!0),t=new Array(s);for(let a=0;a<s;a++)t[a]=e.readShort();return t}readAnimation(e,s,t){e.readInt(!0);let a=new Array,i=this.scale,c=new D,o=new D;for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,g=e.readInt(!0);u<g;u++){let x=e.readByte(),p=e.readInt(!0),y=p-1;switch(x){case $s:{let m=new Ae(p,f);for(let w=0;w<p;w++)m.setFrame(w,e.readFloat(),e.readStringRef());a.push(m);break}case Hs:{let m=e.readInt(!0),w=new dt(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let Y=0,X=0;w.setFrame(Y,b,v,S,A,C),Y!=y;Y++){let R=e.readFloat(),E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(Y);break;case ce:_(e,w,X++,Y,0,b,R,v,E,1),_(e,w,X++,Y,1,b,R,S,F,1),_(e,w,X++,Y,2,b,R,A,I,1),_(e,w,X++,Y,3,b,R,C,T,1)}b=R,v=E,S=F,A=I,C=T}a.push(w);break}case Gs:{let m=e.readInt(!0),w=new ft(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,Y=0;w.setFrame(C,b,v,S,A),C!=y;C++){let X=e.readFloat(),R=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(C);break;case ce:_(e,w,Y++,C,0,b,X,v,R,1),_(e,w,Y++,C,1,b,X,S,E,1),_(e,w,Y++,C,2,b,X,A,F,1)}b=X,v=R,S=E,A=F}a.push(w);break}case js:{let m=e.readInt(!0),w=new mt(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let E=0,F=0;w.setFrame(E,b,v,S,A,C,Y,X,R),E!=y;E++){let I=e.readFloat(),T=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,$=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(E);break;case ce:_(e,w,F++,E,0,b,I,v,T,1),_(e,w,F++,E,1,b,I,S,V,1),_(e,w,F++,E,2,b,I,A,U,1),_(e,w,F++,E,3,b,I,C,L,1),_(e,w,F++,E,4,b,I,Y,W,1),_(e,w,F++,E,5,b,I,X,O,1),_(e,w,F++,E,6,b,I,R,$,1)}b=I,v=T,S=V,A=U,C=L,Y=W,X=O,R=$}a.push(w);break}case Js:{let m=e.readInt(!0),w=new gt(p,m,f),b=e.readFloat(),v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255;for(let R=0,E=0;w.setFrame(R,b,v,S,A,C,Y,X),R!=y;R++){let F=e.readFloat(),I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(R);break;case ce:_(e,w,E++,R,0,b,F,v,I,1),_(e,w,E++,R,1,b,F,S,T,1),_(e,w,E++,R,2,b,F,A,V,1),_(e,w,E++,R,3,b,F,C,U,1),_(e,w,E++,R,4,b,F,Y,L,1),_(e,w,E++,R,5,b,F,X,W,1)}b=F,v=I,S=T,A=V,C=U,Y=L,X=W}a.push(w);break}case Ks:{let m=new ut(p,e.readInt(!0),f),w=e.readFloat(),b=e.readUnsignedByte()/255;for(let v=0,S=0;m.setFrame(v,w,b),v!=y;v++){let A=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case he:m.setStepped(v);break;case ce:_(e,m,S++,v,0,w,A,b,C,1)}w=A,b=C}a.push(m)}}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,g=e.readInt(!0);u<g;u++){let x=e.readByte(),p=e.readInt(!0),y=e.readInt(!0);switch(x){case Vs:a.push(be(e,new Ve(p,y,f),1));break;case Ls:a.push(Ot(e,new st(p,y,f),i));break;case Ds:a.push(be(e,new rt(p,y,f),i));break;case Ns:a.push(be(e,new it(p,y,f),i));break;case Os:a.push(Ot(e,new at(p,y,f),1));break;case qs:a.push(be(e,new nt(p,y,f),1));break;case Us:a.push(be(e,new lt(p,y,f),1));break;case _s:a.push(Ot(e,new ot(p,y,f),1));break;case Ws:a.push(be(e,new ht(p,y,f),1));break;case zs:a.push(be(e,new ct(p,y,f),1))}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),g=u-1,x=new wt(u,e.readInt(!0),f),p=e.readFloat(),y=e.readFloat(),m=e.readFloat()*i;for(let w=0,b=0;x.setFrame(w,p,y,m,e.readByte(),e.readBoolean(),e.readBoolean()),w!=g;w++){let v=e.readFloat(),S=e.readFloat(),A=e.readFloat()*i;switch(e.readByte()){case he:x.setStepped(w);break;case ce:_(e,x,b++,w,0,p,v,y,S,1),_(e,x,b++,w,1,p,v,m,A,i)}p=v,y=S,m=A}a.push(x)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),g=u-1,x=new bt(u,e.readInt(!0),f),p=e.readFloat(),y=e.readFloat(),m=e.readFloat(),w=e.readFloat(),b=e.readFloat(),v=e.readFloat(),S=e.readFloat();for(let A=0,C=0;x.setFrame(A,p,y,m,w,b,v,S),A!=g;A++){let Y=e.readFloat(),X=e.readFloat(),R=e.readFloat(),E=e.readFloat(),F=e.readFloat(),I=e.readFloat(),T=e.readFloat();switch(e.readByte()){case he:x.setStepped(A);break;case ce:_(e,x,C++,A,0,p,Y,y,X,1),_(e,x,C++,A,1,p,Y,m,R,1),_(e,x,C++,A,2,p,Y,w,E,1),_(e,x,C++,A,3,p,Y,b,F,1),_(e,x,C++,A,4,p,Y,v,I,1),_(e,x,C++,A,5,p,Y,S,T,1)}p=Y,y=X,m=R,w=E,b=F,v=I,S=T}a.push(x)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=t.pathConstraints[f];for(let g=0,x=e.readInt(!0);g<x;g++)switch(e.readByte()){case er:a.push(be(e,new pt(e.readInt(!0),e.readInt(!0),f),u.positionMode==oe.Fixed?i:1));break;case tr:a.push(be(e,new yt(e.readInt(!0),e.readInt(!0),f),u.spacingMode==K.Length||u.spacingMode==K.Fixed?i:1));break;case sr:let p=new vt(e.readInt(!0),e.readInt(!0),f),y=e.readFloat(),m=e.readFloat(),w=e.readFloat(),b=e.readFloat();for(let v=0,S=0,A=p.getFrameCount()-1;p.setFrame(v,y,m,w,b),v!=A;v++){let C=e.readFloat(),Y=e.readFloat(),X=e.readFloat(),R=e.readFloat();switch(e.readByte()){case he:p.setStepped(v);break;case ce:_(e,p,S++,v,0,y,C,m,Y,1),_(e,p,S++,v,1,y,C,w,X,1),_(e,p,S++,v,2,y,C,b,R,1)}y=C,m=Y,w=X,b=R}a.push(p)}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=t.skins[e.readInt(!0)];for(let u=0,g=e.readInt(!0);u<g;u++){let x=e.readInt(!0);for(let p=0,y=e.readInt(!0);p<y;p++){let m=e.readStringRef();if(!m)throw new Error("attachmentName must not be null.");let w=f.getAttachment(x,m),b=e.readByte(),v=e.readInt(!0),S=v-1;switch(b){case Qs:{let A=w,C=A.bones,Y=A.vertices,X=C?Y.length/3*2:Y.length,R=e.readInt(!0),E=new xt(v,R,x,A),F=e.readFloat();for(let I=0,T=0;;I++){let V,U=e.readInt(!0);if(U==0)V=C?B.newFloatArray(X):Y;else{V=B.newFloatArray(X);let W=e.readInt(!0);if(U+=W,i==1)for(let O=W;O<U;O++)V[O]=e.readFloat();else for(let O=W;O<U;O++)V[O]=e.readFloat()*i;if(!C)for(let O=0,$=V.length;O<$;O++)V[O]+=Y[O]}if(E.setFrame(I,F,V),I==S)break;let L=e.readFloat();switch(e.readByte()){case he:E.setStepped(I);break;case ce:_(e,E,T++,I,0,F,L,0,1,1)}F=L}a.push(E);break}case Zs:{let A=new Xe(v,x,w);for(let C=0;C<v;C++){let Y=e.readFloat(),X=e.readInt32();A.setFrame(C,Y,Kt[X&15],X>>4,e.readFloat())}a.push(A);break}}}}}let r=e.readInt(!0);if(r>0){let h=new ke(r),d=t.slots.length;for(let f=0;f<r;f++){let u=e.readFloat(),g=e.readInt(!0),x=B.newArray(d,0);for(let w=d-1;w>=0;w--)x[w]=-1;let p=B.newArray(d-g,0),y=0,m=0;for(let w=0;w<g;w++){let b=e.readInt(!0);for(;y!=b;)p[m++]=y++;x[y+e.readInt(!0)]=y++}for(;y<d;)p[m++]=y++;for(let w=d-1;w>=0;w--)x[w]==-1&&(x[w]=p[--m]);h.setFrame(f,u,x)}a.push(h)}let l=e.readInt(!0);if(l>0){let h=new Le(l);for(let d=0;d<l;d++){let f=e.readFloat(),u=t.events[e.readInt(!0)],g=new Et(f,u);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readBoolean()?e.readString():u.stringValue,g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),h.setFrame(d,g)}a.push(h)}let n=0;for(let h=0,d=a.length;h<d;h++)n=Math.max(n,a[h].getDuration());return new Ue(s,a,n)}},us=class{constructor(e,s=new Array,t=0,a=new DataView(e.buffer)){this.strings=s,this.index=t,this.buffer=a}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 s=this.readByte(),t=s&127;return(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<7,(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<14,(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<21,(s&128)!=0&&(s=this.readByte(),t|=(s&127)<<28)))),e?t:t>>>1^-(t&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 s="",t=0;for(let a=0;a<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:s+=String.fromCharCode((i&31)<<6|this.readByte()&63),a+=2;break;case 14:s+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),a+=3;break;default:s+=String.fromCharCode(i),a++}}return s}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Bs=class{constructor(e,s,t,a,i){this.mesh=e,this.skin=s,this.slotIndex=t,this.parent=a,this.inheritTimeline=i}},Ps=class{constructor(e=null,s=null){this.bones=e,this.vertices=s}},we;(function(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"})(we||(we={}));function be(e,s,t){let a=e.readFloat(),i=e.readFloat()*t;for(let c=0,o=0,r=s.getFrameCount()-1;s.setFrame(c,a,i),c!=r;c++){let l=e.readFloat(),n=e.readFloat()*t;switch(e.readByte()){case he:s.setStepped(c);break;case ce:_(e,s,o++,c,0,a,l,i,n,t)}a=l,i=n}return s}function Ot(e,s,t){let a=e.readFloat(),i=e.readFloat()*t,c=e.readFloat()*t;for(let o=0,r=0,l=s.getFrameCount()-1;s.setFrame(o,a,i,c),o!=l;o++){let n=e.readFloat(),h=e.readFloat()*t,d=e.readFloat()*t;switch(e.readByte()){case he:s.setStepped(o);break;case ce:_(e,s,r++,o,0,a,n,i,h,t),_(e,s,r++,o,1,a,n,c,d,t)}a=n,i=h,c=d}return s}function _(e,s,t,a,i,c,o,r,l,n){s.setBezier(t,a,i,c,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var Vs=0,Ls=1,Ds=2,Ns=3,Os=4,qs=5,Us=6,_s=7,Ws=8,zs=9,$s=0,Hs=1,Gs=2,js=3,Js=4,Ks=5,Qs=0,Zs=1,er=0,tr=1,sr=2,he=1,ce=2,rr=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new Pe(()=>B.newFloatArray(16))}update(e,s){if(!e)throw new Error("skeleton cannot be null.");let t=this.boundingBoxes,a=this.polygons,i=this.polygonPool,c=e.slots,o=c.length;t.length=0,i.freeAll(a),a.length=0;for(let r=0;r<o;r++){let l=c[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof He){let h=n;t.push(h);let d=i.obtain();d.length!=h.worldVerticesLength&&(d=B.newFloatArray(h.worldVerticesLength)),a.push(d),h.computeWorldVertices(l,0,h.worldVerticesLength,d,0,2)}}s?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,s=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=this.polygons;for(let c=0,o=i.length;c<o;c++){let r=i[c],l=r;for(let n=0,h=r.length;n<h;n+=2){let d=l[n],f=l[n+1];e=Math.min(e,d),s=Math.min(s,f),t=Math.max(t,d),a=Math.max(a,f)}}this.minX=e,this.minY=s,this.maxX=t,this.maxY=a}aabbContainsPoint(e,s){return e>=this.minX&&e<=this.maxX&&s>=this.minY&&s<=this.maxY}aabbIntersectsSegment(e,s,t,a){let i=this.minX,c=this.minY,o=this.maxX,r=this.maxY;if(e<=i&&t<=i||s<=c&&a<=c||e>=o&&t>=o||s>=r&&a>=r)return!1;let l=(a-s)/(t-e),n=l*(i-e)+s;if(n>c&&n<r||(n=l*(o-e)+s,n>c&&n<r))return!0;let h=(c-s)/l+e;return!!(h>i&&h<o||(h=(r-s)/l+e,h>i&&h<o))}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,s){let t=this.polygons;for(let a=0,i=t.length;a<i;a++)if(this.containsPointPolygon(t[a],e,s))return this.boundingBoxes[a];return null}containsPointPolygon(e,s,t){let a=e,i=e.length,c=i-2,o=!1;for(let r=0;r<i;r+=2){let l=a[r+1],n=a[c+1];if(l<t&&n>=t||n<t&&l>=t){let h=a[r];h+(t-l)/(n-l)*(a[c]-h)<s&&(o=!o)}c=r}return o}intersectsSegment(e,s,t,a){let i=this.polygons;for(let c=0,o=i.length;c<o;c++)if(this.intersectsSegmentPolygon(i[c],e,s,t,a))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,s,t,a,i){let c=e,o=e.length,r=s-a,l=t-i,n=s*i-t*a,h=c[o-2],d=c[o-1];for(let f=0;f<o;f+=2){let u=c[f],g=c[f+1],x=h*g-d*u,p=h-u,y=d-g,m=r*y-l*p,w=(n*p-r*x)/m;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=s&&w<=a||w>=a&&w<=s)){let b=(n*y-l*x)/m;if((b>=d&&b<=g||b>=g&&b<=d)&&(b>=t&&b<=i||b>=i&&b<=t))return!0}h=u,d=g}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let s=this.boundingBoxes.indexOf(e);return s==-1?null:this.polygons[s]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},se=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new Pe(()=>new Array),this.polygonIndicesPool=new Pe(()=>new Array)}triangulate(e){let s=e,t=e.length>>1,a=this.indicesArray;a.length=0;for(let o=0;o<t;o++)a[o]=o;let i=this.isConcaveArray;i.length=0;for(let o=0,r=t;o<r;++o)i[o]=se.isConcave(o,t,s,a);let c=this.triangles;for(c.length=0;t>3;){let o=t-1,r=0,l=1;for(;;){e:if(!i[r]){let d=a[o]<<1,f=a[r]<<1,u=a[l]<<1,g=s[d],x=s[d+1],p=s[f],y=s[f+1],m=s[u],w=s[u+1];for(let b=(l+1)%t;b!=o;b=(b+1)%t){if(!i[b])continue;let v=a[b]<<1,S=s[v],A=s[v+1];if(se.positiveArea(m,w,g,x,S,A)&&se.positiveArea(g,x,p,y,S,A)&&se.positiveArea(p,y,m,w,S,A))break e}break}if(l==0){do{if(!i[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%t}c.push(a[(t+r-1)%t]),c.push(a[r]),c.push(a[(r+1)%t]),a.splice(r,1),i.splice(r,1),t--;let n=(t+r-1)%t,h=r==t?0:r;i[n]=se.isConcave(n,t,s,a),i[h]=se.isConcave(h,t,s,a)}return t==3&&(c.push(a[2]),c.push(a[0]),c.push(a[1])),c}decompose(e,s){let t=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,h=s.length;n<h;n+=3){let d=s[n]<<1,f=s[n+1]<<1,u=s[n+2]<<1,g=t[d],x=t[d+1],p=t[f],y=t[f+1],m=t[u],w=t[u+1],b=!1;if(r==d){let v=o.length-4,S=se.winding(o[v],o[v+1],o[v+2],o[v+3],m,w),A=se.winding(m,w,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(m),o.push(w),c.push(u),b=!0)}b||(o.length>0?(a.push(o),i.push(c)):(this.polygonPool.free(o),this.polygonIndicesPool.free(c)),o=this.polygonPool.obtain(),o.length=0,o.push(g),o.push(x),o.push(p),o.push(y),o.push(m),o.push(w),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(d),c.push(f),c.push(u),l=se.winding(g,x,p,y,m,w),r=d)}o.length>0&&(a.push(o),i.push(c));for(let n=0,h=a.length;n<h;n++){if(c=i[n],c.length==0)continue;let d=c[0],f=c[c.length-1];o=a[n];let u=o.length-4,g=o[u],x=o[u+1],p=o[u+2],y=o[u+3],m=o[0],w=o[1],b=o[2],v=o[3],S=se.winding(g,x,p,y,m,w);for(let A=0;A<h;A++){if(A==n)continue;let C=i[A];if(C.length!=3)continue;let Y=C[0],X=C[1],R=C[2],E=a[A],F=E[E.length-2],I=E[E.length-1];if(Y!=d||X!=f)continue;let T=se.winding(g,x,p,y,F,I),V=se.winding(F,I,m,w,b,v);T==S&&V==S&&(E.length=0,C.length=0,o.push(F),o.push(I),c.push(R),g=p,x=y,p=F,y=I,A=0)}}for(let n=a.length-1;n>=0;n--)o=a[n],o.length==0&&(a.splice(n,1),this.polygonPool.free(o),c=i[n],i.splice(n,1),this.polygonIndicesPool.free(c));return a}static isConcave(e,s,t,a){let i=a[(s+e-1)%s]<<1,c=a[e]<<1,o=a[(e+1)%s]<<1;return!this.positiveArea(t[i],t[i+1],t[c],t[c+1],t[o],t[o+1])}static positiveArea(e,s,t,a,i,c){return e*(c-a)+t*(s-c)+i*(a-s)>=0}static winding(e,s,t,a,i,c){let o=t-e,r=a-s;return i*r-c*o+o*s-e*r>=0?1:-1}},qt=class{constructor(){this.triangulator=new se,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let t=s.worldVerticesLength,a=B.setArraySize(this.clippingPolygon,t);s.computeWorldVertices(e,0,t,a,0,2);let i=this.clippingPolygon;qt.makeClockwise(i);let c=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let o=0,r=c.length;o<r;o++){let l=c[o];qt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return c.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){!this.clipAttachment||(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,t,a,i,c,o,r){let l=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,d=this.clippingPolygons,f=d.length,u=r?12:8,g=0;n.length=0,h.length=0;e:for(let x=0;x<a;x+=3){let p=t[x]<<1,y=e[p],m=e[p+1],w=i[p],b=i[p+1];p=t[x+1]<<1;let v=e[p],S=e[p+1],A=i[p],C=i[p+1];p=t[x+2]<<1;let Y=e[p],X=e[p+1],R=i[p],E=i[p+1];for(let F=0;F<f;F++){let I=n.length;if(this.clip(y,m,v,S,Y,X,d[F],l)){let T=l.length;if(T==0)continue;let V=S-X,U=Y-v,L=y-Y,W=X-m,O=1/(V*L+U*(m-X)),$=T>>1,q=this.clipOutput,N=B.setArraySize(n,I+$*u);for(let Z=0;Z<T;Z+=2){let de=q[Z],Q=q[Z+1];N[I]=de,N[I+1]=Q,N[I+2]=c.r,N[I+3]=c.g,N[I+4]=c.b,N[I+5]=c.a;let re=de-Y,ie=Q-X,ve=(V*re+U*ie)*O,Ee=(W*re+L*ie)*O,Ne=1-ve-Ee;N[I+6]=w*ve+A*Ee+R*Ne,N[I+7]=b*ve+C*Ee+E*Ne,r&&(N[I+8]=o.r,N[I+9]=o.g,N[I+10]=o.b,N[I+11]=o.a),I+=u}I=h.length;let G=B.setArraySize(h,I+3*($-2));$--;for(let Z=1;Z<$;Z++)G[I]=g,G[I+1]=g+Z,G[I+2]=g+Z+1,I+=3;g+=$+1}else{let T=B.setArraySize(n,I+3*u);T[I]=y,T[I+1]=m,T[I+2]=c.r,T[I+3]=c.g,T[I+4]=c.b,T[I+5]=c.a,r?(T[I+6]=w,T[I+7]=b,T[I+8]=o.r,T[I+9]=o.g,T[I+10]=o.b,T[I+11]=o.a,T[I+12]=v,T[I+13]=S,T[I+14]=c.r,T[I+15]=c.g,T[I+16]=c.b,T[I+17]=c.a,T[I+18]=A,T[I+19]=C,T[I+20]=o.r,T[I+21]=o.g,T[I+22]=o.b,T[I+23]=o.a,T[I+24]=Y,T[I+25]=X,T[I+26]=c.r,T[I+27]=c.g,T[I+28]=c.b,T[I+29]=c.a,T[I+30]=R,T[I+31]=E,T[I+32]=o.r,T[I+33]=o.g,T[I+34]=o.b,T[I+35]=o.a):(T[I+6]=w,T[I+7]=b,T[I+8]=v,T[I+9]=S,T[I+10]=c.r,T[I+11]=c.g,T[I+12]=c.b,T[I+13]=c.a,T[I+14]=A,T[I+15]=C,T[I+16]=Y,T[I+17]=X,T[I+18]=c.r,T[I+19]=c.g,T[I+20]=c.b,T[I+21]=c.a,T[I+22]=R,T[I+23]=E),I=h.length;let V=B.setArraySize(h,I+3);V[I]=g,V[I+1]=g+1,V[I+2]=g+2,g+=3;continue e}}}}clip(e,s,t,a,i,c,o,r){let l=r,n=!1,h;o.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(s),h.push(t),h.push(a),h.push(i),h.push(c),h.push(e),h.push(s),r.length=0;let d=o,f=o.length-4;for(let u=0;;u+=2){let g=d[u],x=d[u+1],p=d[u+2],y=d[u+3],m=g-p,w=x-y,b=h,v=h.length-2,S=r.length;for(let C=0;C<v;C+=2){let Y=b[C],X=b[C+1],R=b[C+2],E=b[C+3],F=m*(E-y)-w*(R-p)>0;if(m*(X-y)-w*(Y-p)>0){if(F){r.push(R),r.push(E);continue}let I=E-X,T=R-Y,V=I*(p-g)-T*(y-x);if(Math.abs(V)>1e-6){let U=(T*(x-X)-I*(g-Y))/V;r.push(g+(p-g)*U),r.push(x+(y-x)*U)}else r.push(g),r.push(x)}else if(F){let I=E-X,T=R-Y,V=I*(p-g)-T*(y-x);if(Math.abs(V)>1e-6){let U=(T*(x-X)-I*(g-Y))/V;r.push(g+(p-g)*U),r.push(x+(y-x)*U)}else r.push(g),r.push(x);r.push(R),r.push(E)}n=!0}if(S==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let A=r;r=h,r.length=0,h=A}if(l!=r){l.length=0;for(let u=0,g=r.length-2;u<g;u++)l[u]=r[u]}else l.length=l.length-2;return n}static makeClockwise(e){let s=e,t=e.length,a=s[t-2]*s[1]-s[0]*s[t-1],i=0,c=0,o=0,r=0;for(let l=0,n=t-3;l<n;l+=2)i=s[l],c=s[l+1],o=s[l+2],r=s[l+3],a+=i*r-o*c;if(!(a<0))for(let l=0,n=t-2,h=t>>1;l<h;l+=2){let d=s[l],f=s[l+1],u=n-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=d,s[u+1]=f}}},ir=class{constructor(e){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=e}readSkeletonData(e){let s=this.scale,t=new Vt,a=typeof e=="string"?JSON.parse(e):e,i=a.skeleton;if(i&&(t.hash=i.hash,t.version=i.spine,t.x=i.x,t.y=i.y,t.width=i.width,t.height=i.height,t.fps=i.fps,t.imagesPath=i.images),a.bones)for(let c=0;c<a.bones.length;c++){let o=a.bones[c],r=null,l=k(o,"parent",null);l&&(r=t.findBone(l));let n=new Xt(t.bones.length,o.name,r);n.length=k(o,"length",0)*s,n.x=k(o,"x",0)*s,n.y=k(o,"y",0)*s,n.rotation=k(o,"rotation",0),n.scaleX=k(o,"scaleX",1),n.scaleY=k(o,"scaleY",1),n.shearX=k(o,"shearX",0),n.shearY=k(o,"shearY",0),n.transformMode=B.enumValue(te,k(o,"transform","Normal")),n.skinRequired=k(o,"skin",!1);let h=k(o,"color",null);h&&n.color.setFromString(h),t.bones.push(n)}if(a.slots)for(let c=0;c<a.slots.length;c++){let o=a.slots[c],r=t.findBone(o.bone);if(!r)throw new Error(`Couldn't find bone ${o.bone} for slot ${o.name}`);let l=new Dt(t.slots.length,o.name,r),n=k(o,"color",null);n&&l.color.setFromString(n);let h=k(o,"dark",null);h&&(l.darkColor=D.fromString(h)),l.attachmentName=k(o,"attachment",null),l.blendMode=B.enumValue(De,k(o,"blend","normal")),t.slots.push(l)}if(a.ik)for(let c=0;c<a.ik.length;c++){let o=a.ik[c],r=new Bt(o.name);r.order=k(o,"order",0),r.skinRequired=k(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let h=t.findBone(o.bones[n]);if(!h)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(h)}let l=t.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=k(o,"mix",1),r.softness=k(o,"softness",0)*s,r.bendDirection=k(o,"bendPositive",!0)?1:-1,r.compress=k(o,"compress",!1),r.stretch=k(o,"stretch",!1),r.uniform=k(o,"uniform",!1),t.ikConstraints.push(r)}if(a.transform)for(let c=0;c<a.transform.length;c++){let o=a.transform[c],r=new Nt(o.name);r.order=k(o,"order",0),r.skinRequired=k(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let d=o.bones[h],f=t.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);r.bones.push(f)}let l=o.target,n=t.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=k(o,"local",!1),r.relative=k(o,"relative",!1),r.offsetRotation=k(o,"rotation",0),r.offsetX=k(o,"x",0)*s,r.offsetY=k(o,"y",0)*s,r.offsetScaleX=k(o,"scaleX",0),r.offsetScaleY=k(o,"scaleY",0),r.offsetShearY=k(o,"shearY",0),r.mixRotate=k(o,"mixRotate",1),r.mixX=k(o,"mixX",1),r.mixY=k(o,"mixY",r.mixX),r.mixScaleX=k(o,"mixScaleX",1),r.mixScaleY=k(o,"mixScaleY",r.mixScaleX),r.mixShearY=k(o,"mixShearY",1),t.transformConstraints.push(r)}if(a.path)for(let c=0;c<a.path.length;c++){let o=a.path[c],r=new Pt(o.name);r.order=k(o,"order",0),r.skinRequired=k(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let d=o.bones[h],f=t.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);r.bones.push(f)}let l=o.target,n=t.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=B.enumValue(oe,k(o,"positionMode","Percent")),r.spacingMode=B.enumValue(K,k(o,"spacingMode","Length")),r.rotateMode=B.enumValue(ye,k(o,"rotateMode","Tangent")),r.offsetRotation=k(o,"rotation",0),r.position=k(o,"position",0),r.positionMode==oe.Fixed&&(r.position*=s),r.spacing=k(o,"spacing",0),(r.spacingMode==K.Length||r.spacingMode==K.Fixed)&&(r.spacing*=s),r.mixRotate=k(o,"mixRotate",1),r.mixX=k(o,"mixX",1),r.mixY=k(o,"mixY",r.mixX),t.pathConstraints.push(r)}if(a.skins)for(let c=0;c<a.skins.length;c++){let o=a.skins[c],r=new je(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],h=t.findBone(n);if(!h)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],h=t.findIkConstraint(n);if(!h)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],h=t.findTransformConstraint(n);if(!h)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],h=t.findPathConstraint(n);if(!h)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}for(let l in o.attachments){let n=t.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let h=o.attachments[l];for(let d in h){let f=this.readAttachment(h[d],r,n.index,d,t);f&&r.setAttachment(n.index,d,f)}}t.skins.push(r),r.name=="default"&&(t.defaultSkin=r)}for(let c=0,o=this.linkedMeshes.length;c<o;c++){let r=this.linkedMeshes[c],l=r.skin?t.findSkin(r.skin):t.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,a.events)for(let c in a.events){let o=a.events[c],r=new Rt(c);r.intValue=k(o,"int",0),r.floatValue=k(o,"float",0),r.stringValue=k(o,"string",""),r.audioPath=k(o,"audio",null),r.audioPath&&(r.volume=k(o,"volume",1),r.balance=k(o,"balance",0)),t.events.push(r)}if(a.animations)for(let c in a.animations){let o=a.animations[c];this.readAnimation(o,c,t)}return t}readAttachment(e,s,t,a,i){let c=this.scale;switch(a=k(e,"name",a),k(e,"type","region")){case"region":{let o=k(e,"path",a),r=this.readSequence(k(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(s,a,o,r);if(!l)return null;l.path=o,l.x=k(e,"x",0)*c,l.y=k(e,"y",0)*c,l.scaleX=k(e,"scaleX",1),l.scaleY=k(e,"scaleY",1),l.rotation=k(e,"rotation",0),l.width=e.width*c,l.height=e.height*c,l.sequence=r;let n=k(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(s,a);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=k(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=k(e,"path",a),r=this.readSequence(k(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(s,a,o,r);if(!l)return null;l.path=o;let n=k(e,"color",null);n&&l.color.setFromString(n),l.width=k(e,"width",0)*c,l.height=k(e,"height",0)*c,l.sequence=r;let h=k(e,"parent",null);if(h)return this.linkedMeshes.push(new ar(l,k(e,"skin",null),t,h,k(e,"timelines",!0))),l;let d=e.uvs;return this.readVertices(e,l,d.length),l.triangles=e.triangles,l.regionUVs=d,l.region!=null&&l.updateRegion(),l.edges=k(e,"edges",null),l.hullLength=k(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(s,a);if(!o)return null;o.closed=k(e,"closed",!1),o.constantSpeed=k(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=B.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)l[h]=e.lengths[h]*c;o.lengths=l;let n=k(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(s,a);if(!o)return null;o.x=k(e,"x",0)*c,o.y=k(e,"y",0)*c,o.rotation=k(e,"rotation",0);let r=k(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(s,a);if(!o)return null;let r=k(e,"end",null);r&&(o.endSlot=i.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=k(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let s=new tt(k(e,"count",0));return s.start=k(e,"start",1),s.digits=k(e,"digits",0),s.setupIndex=k(e,"setup",0),s}readVertices(e,s,t){let a=this.scale;s.worldVerticesLength=t;let i=e.vertices;if(t==i.length){let r=B.toFloatArray(i);if(a!=1)for(let l=0,n=i.length;l<n;l++)r[l]*=a;s.vertices=r;return}let c=new Array,o=new Array;for(let r=0,l=i.length;r<l;){let n=i[r++];o.push(n);for(let h=r+n*4;r<h;r+=4)o.push(i[r]),c.push(i[r+1]*a),c.push(i[r+2]*a),c.push(i[r+3])}s.bones=o,s.vertices=B.toFloatArray(c)}readAnimation(e,s,t){let a=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=t.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let h in r){let d=r[h];if(!d)continue;let f=d.length;if(h=="attachment"){let u=new Ae(f,n);for(let g=0;g<f;g++){let x=d[g];u.setFrame(g,k(x,"time",0),k(x,"name",null))}i.push(u)}else if(h=="rgba"){let u=new dt(f,f<<2,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.color);for(let y=0,m=0;;y++){u.setFrame(y,x,p.r,p.g,p.b,p.a);let w=d[y+1];if(!w){u.shrink(m);break}let b=k(w,"time",0),v=D.fromString(w.color),S=g.curve;S&&(m=z(S,u,m,y,0,x,b,p.r,v.r,1),m=z(S,u,m,y,1,x,b,p.g,v.g,1),m=z(S,u,m,y,2,x,b,p.b,v.b,1),m=z(S,u,m,y,3,x,b,p.a,v.a,1)),x=b,p=v,g=w}i.push(u)}else if(h=="rgb"){let u=new ft(f,f*3,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.color);for(let y=0,m=0;;y++){u.setFrame(y,x,p.r,p.g,p.b);let w=d[y+1];if(!w){u.shrink(m);break}let b=k(w,"time",0),v=D.fromString(w.color),S=g.curve;S&&(m=z(S,u,m,y,0,x,b,p.r,v.r,1),m=z(S,u,m,y,1,x,b,p.g,v.g,1),m=z(S,u,m,y,2,x,b,p.b,v.b,1)),x=b,p=v,g=w}i.push(u)}else if(h=="alpha")i.push(ue(d,new ut(f,f,n),0,1));else if(h=="rgba2"){let u=new mt(f,f*7,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.light),y=D.fromString(g.dark);for(let m=0,w=0;;m++){u.setFrame(m,x,p.r,p.g,p.b,p.a,y.r,y.g,y.b);let b=d[m+1];if(!b){u.shrink(w);break}let v=k(b,"time",0),S=D.fromString(b.light),A=D.fromString(b.dark),C=g.curve;C&&(w=z(C,u,w,m,0,x,v,p.r,S.r,1),w=z(C,u,w,m,1,x,v,p.g,S.g,1),w=z(C,u,w,m,2,x,v,p.b,S.b,1),w=z(C,u,w,m,3,x,v,p.a,S.a,1),w=z(C,u,w,m,4,x,v,y.r,A.r,1),w=z(C,u,w,m,5,x,v,y.g,A.g,1),w=z(C,u,w,m,6,x,v,y.b,A.b,1)),x=v,p=S,y=A,g=b}i.push(u)}else if(h=="rgb2"){let u=new gt(f,f*6,n),g=d[0],x=k(g,"time",0),p=D.fromString(g.light),y=D.fromString(g.dark);for(let m=0,w=0;;m++){u.setFrame(m,x,p.r,p.g,p.b,y.r,y.g,y.b);let b=d[m+1];if(!b){u.shrink(w);break}let v=k(b,"time",0),S=D.fromString(b.light),A=D.fromString(b.dark),C=g.curve;C&&(w=z(C,u,w,m,0,x,v,p.r,S.r,1),w=z(C,u,w,m,1,x,v,p.g,S.g,1),w=z(C,u,w,m,2,x,v,p.b,S.b,1),w=z(C,u,w,m,3,x,v,y.r,A.r,1),w=z(C,u,w,m,4,x,v,y.g,A.g,1),w=z(C,u,w,m,5,x,v,y.b,A.b,1)),x=v,p=S,y=A,g=b}i.push(u)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=t.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let h in r){let d=r[h],f=d.length;if(f!=0){if(h==="rotate")i.push(ue(d,new Ve(f,f,n),0,1));else if(h==="translate"){let u=new st(f,f<<1,n);i.push(Ut(d,u,"x","y",0,a))}else if(h==="translatex"){let u=new rt(f,f,n);i.push(ue(d,u,0,a))}else if(h==="translatey"){let u=new it(f,f,n);i.push(ue(d,u,0,a))}else if(h==="scale"){let u=new at(f,f<<1,n);i.push(Ut(d,u,"x","y",1,1))}else if(h==="scalex"){let u=new nt(f,f,n);i.push(ue(d,u,1,1))}else if(h==="scaley"){let u=new lt(f,f,n);i.push(ue(d,u,1,1))}else if(h==="shear"){let u=new ot(f,f<<1,n);i.push(Ut(d,u,"x","y",0,1))}else if(h==="shearx"){let u=new ht(f,f,n);i.push(ue(d,u,0,1))}else if(h==="sheary"){let u=new ct(f,f,n);i.push(ue(d,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=t.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let h=t.ikConstraints.indexOf(n),d=new wt(r.length,r.length<<1,h),f=k(l,"time",0),u=k(l,"mix",1),g=k(l,"softness",0)*a;for(let x=0,p=0;;x++){d.setFrame(x,f,u,g,k(l,"bendPositive",!0)?1:-1,k(l,"compress",!1),k(l,"stretch",!1));let y=r[x+1];if(!y){d.shrink(p);break}let m=k(y,"time",0),w=k(y,"mix",1),b=k(y,"softness",0)*a,v=l.curve;v&&(p=z(v,d,p,x,0,f,m,u,w,1),p=z(v,d,p,x,1,f,m,g,b,a)),f=m,u=w,g=b,l=y}i.push(d)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=t.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let h=t.transformConstraints.indexOf(n),d=new bt(r.length,r.length*6,h),f=k(l,"time",0),u=k(l,"mixRotate",1),g=k(l,"mixX",1),x=k(l,"mixY",g),p=k(l,"mixScaleX",1),y=k(l,"mixScaleY",p),m=k(l,"mixShearY",1);for(let w=0,b=0;;w++){d.setFrame(w,f,u,g,x,p,y,m);let v=r[w+1];if(!v){d.shrink(b);break}let S=k(v,"time",0),A=k(v,"mixRotate",1),C=k(v,"mixX",1),Y=k(v,"mixY",C),X=k(v,"mixScaleX",1),R=k(v,"mixScaleY",X),E=k(v,"mixShearY",1),F=l.curve;F&&(b=z(F,d,b,w,0,f,S,u,A,1),b=z(F,d,b,w,1,f,S,g,C,1),b=z(F,d,b,w,2,f,S,x,Y,1),b=z(F,d,b,w,3,f,S,p,X,1),b=z(F,d,b,w,4,f,S,y,R,1),b=z(F,d,b,w,5,f,S,m,E,1)),f=S,u=A,g=C,x=Y,p=X,y=R,p=X,l=v}i.push(d)}if(e.path)for(let o in e.path){let r=e.path[o],l=t.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=t.pathConstraints.indexOf(l);for(let h in r){let d=r[h],f=d[0];if(!f)continue;let u=d.length;if(h==="position"){let g=new pt(u,u,n);i.push(ue(d,g,0,l.positionMode==oe.Fixed?a:1))}else if(h==="spacing"){let g=new yt(u,u,n);i.push(ue(d,g,0,l.spacingMode==K.Length||l.spacingMode==K.Fixed?a:1))}else if(h==="mix"){let g=new vt(u,u*3,n),x=k(f,"time",0),p=k(f,"mixRotate",1),y=k(f,"mixX",1),m=k(f,"mixY",y);for(let w=0,b=0;;w++){g.setFrame(w,x,p,y,m);let v=d[w+1];if(!v){g.shrink(b);break}let S=k(v,"time",0),A=k(v,"mixRotate",1),C=k(v,"mixX",1),Y=k(v,"mixY",C),X=f.curve;X&&(b=z(X,g,b,w,0,x,S,p,A,1),b=z(X,g,b,w,1,x,S,y,C,1),b=z(X,g,b,w,2,x,S,m,Y,1)),x=S,p=A,y=C,m=Y,f=v}i.push(g)}}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=t.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let h=r[n],d=t.findSlot(n);if(!d)throw new Error("Slot not found: "+n);let f=d.index;for(let u in h){let g=h[u],x=l.getAttachment(f,u);for(let p in g){let y=g[p],m=y[0];if(!!m){if(p=="deform"){let w=x.bones,b=x.vertices,v=w?b.length/3*2:b.length,S=new xt(y.length,y.length,f,x),A=k(m,"time",0);for(let C=0,Y=0;;C++){let X,R=k(m,"vertices",null);if(!R)X=w?B.newFloatArray(v):b;else{X=B.newFloatArray(v);let T=k(m,"offset",0);if(B.arrayCopy(R,0,X,T,R.length),a!=1)for(let V=T,U=V+R.length;V<U;V++)X[V]*=a;if(!w)for(let V=0;V<v;V++)X[V]+=b[V]}S.setFrame(C,A,X);let E=y[C+1];if(!E){S.shrink(Y);break}let F=k(E,"time",0),I=m.curve;I&&(Y=z(I,S,Y,C,0,A,F,0,1,1)),A=F,m=E}i.push(S)}else if(p=="sequence"){let w=new Xe(y.length,f,x),b=0;for(let v=0;v<y.length;v++){let S=k(m,"delay",b),A=k(m,"time",0),C=fe[k(m,"mode","hold")],Y=k(m,"index",0);w.setFrame(v,A,C,Y,S),b=S,m=y[v+1]}i.push(w)}}}}}}if(e.drawOrder){let o=new ke(e.drawOrder.length),r=t.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let h=e.drawOrder[n],d=null,f=k(h,"offsets",null);if(f){d=B.newArray(r,-1);let u=B.newArray(r-f.length,0),g=0,x=0;for(let p=0;p<f.length;p++){let y=f[p],m=t.findSlot(y.slot);if(!m)throw new Error("Slot not found: "+m);let w=m.index;for(;g!=w;)u[x++]=g++;d[g+y.offset]=g++}for(;g<r;)u[x++]=g++;for(let p=r-1;p>=0;p--)d[p]==-1&&(d[p]=u[--x])}o.setFrame(l,k(h,"time",0),d)}i.push(o)}if(e.events){let o=new Le(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],h=t.findEvent(n.name);if(!h)throw new Error("Event not found: "+n.name);let d=new Et(B.toSinglePrecision(k(n,"time",0)),h);d.intValue=k(n,"int",h.intValue),d.floatValue=k(n,"float",h.floatValue),d.stringValue=k(n,"string",h.stringValue),d.data.audioPath&&(d.volume=k(n,"volume",1),d.balance=k(n,"balance",0)),o.setFrame(r,d)}i.push(o)}let c=0;for(let o=0,r=i.length;o<r;o++)c=Math.max(c,i[o].getDuration());t.animations.push(new Ue(s,i,c))}},ar=class{constructor(e,s,t,a,i){this.mesh=e,this.skin=s,this.slotIndex=t,this.parent=a,this.inheritTimeline=i}};function ue(e,s,t,a){let i=e[0],c=k(i,"time",0),o=k(i,"value",t)*a,r=0;for(let l=0;;l++){s.setFrame(l,c,o);let n=e[l+1];if(!n)return s.shrink(r),s;let h=k(n,"time",0),d=k(n,"value",t)*a;i.curve&&(r=z(i.curve,s,r,l,0,c,h,o,d,a)),c=h,o=d,i=n}}function Ut(e,s,t,a,i,c){let o=e[0],r=k(o,"time",0),l=k(o,t,i)*c,n=k(o,a,i)*c,h=0;for(let d=0;;d++){s.setFrame(d,r,l,n);let f=e[d+1];if(!f)return s.shrink(h),s;let u=k(f,"time",0),g=k(f,t,i)*c,x=k(f,a,i)*c,p=o.curve;p&&(h=z(p,s,h,d,0,r,u,l,g,c),h=z(p,s,h,d,1,r,u,n,x,c)),r=u,l=g,n=x,o=f}}function z(e,s,t,a,i,c,o,r,l,n){if(e=="stepped")return s.setStepped(a),t;let h=i<<2,d=e[h],f=e[h+1]*n,u=e[h+2],g=e[h+3]*n;return s.setBezier(t,a,i,c,r,d,f,u,g,o,l),t+1}function k(e,s,t){return e[s]!==void 0?e[s]:t}(()=>{typeof Math.fround=="undefined"&&(Math.fround=function(e){return function(s){return e[0]=s,e[0]}}(new Float32Array(1)))})();var ms=class extends It{constructor(e){super(e)}setFilters(e,s){}setWraps(e,s){}dispose(){}},nr=class extends hs{constructor(e="",s=new Ft){super(t=>new ms(t),e,s)}},Je=class{constructor(e){this.triangleRendering=!1,this.debugRendering=!1,this.vertices=B.newFloatArray(8*1024),this.tempColor=new D,this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,t=this.tempColor,a=e.color,i=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let c=0,o=i.length;c<o;c++){let r=i[c],l=r.bone;if(!l.active)continue;let n=r.getAttachment();if(!(n instanceof P))continue;let h=n.region,d=h.page.texture.getImage(),f=r.color,u=n.color;t.set(a.r*f.r*u.r,a.g*f.g*u.g,a.b*f.b*u.b,a.a*f.a*u.a),s.save(),s.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),s.translate(n.offset[0],n.offset[1]),s.rotate(n.rotation*Math.PI/180);let g=n.width/h.originalWidth;s.scale(g*n.scaleX,g*n.scaleY);let x=h.width,p=h.height;if(s.translate(x/2,p/2),n.region.degrees==90){let y=x;x=p,p=y,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-x/2,-p/2),s.globalAlpha=t.a,s.drawImage(d,h.x,h.y,x,p,0,0,x,p),this.debugRendering&&s.strokeRect(0,0,x,p),s.restore()}}drawTriangles(e){let s=this.ctx,t=this.tempColor,a=e.color,i=e.drawOrder,c=null,o=this.vertices,r=null;for(let n=0,h=i.length;n<h;n++){let d=i[n],f=d.getAttachment(),u,g;if(f instanceof P){let x=f;o=this.computeRegionVertices(d,x,!1),r=Je.QUAD_TRIANGLES,g=x.region,u=g.page.texture.getImage()}else if(f instanceof Ye){let x=f;o=this.computeMeshVertices(d,x,!1),r=x.triangles,u=x.region.renderObject.page.texture.getImage()}else continue;if(u){d.data.blendMode!=c&&(c=d.data.blendMode);let x=d.color,p=f.color;t.set(a.r*x.r*p.r,a.g*x.g*p.g,a.b*x.b*p.b,a.a*x.a*p.a),s.globalAlpha=t.a;for(var l=0;l<r.length;l+=3){let y=r[l]*8,m=r[l+1]*8,w=r[l+2]*8,b=o[y],v=o[y+1],S=o[y+6],A=o[y+7],C=o[m],Y=o[m+1],X=o[m+6],R=o[m+7],E=o[w],F=o[w+1],I=o[w+6],T=o[w+7];this.drawTriangle(u,b,v,S,A,C,Y,X,R,E,F,I,T),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(b,v),s.lineTo(C,Y),s.lineTo(E,F),s.lineTo(b,v),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,t,a,i,c,o,r,l,n,h,d,f){let u=this.ctx;a*=e.width,i*=e.height,r*=e.width,l*=e.height,d*=e.width,f*=e.height,u.beginPath(),u.moveTo(s,t),u.lineTo(c,o),u.lineTo(n,h),u.closePath(),c-=s,o-=t,n-=s,h-=t,r-=a,l-=i,d-=a,f-=i;var g=1/(r*f-d*l),x=(f*c-l*n)*g,p=(f*o-l*h)*g,y=(r*n-d*c)*g,m=(r*h-d*o)*g,w=s-x*a-y*i,b=t-p*a-m*i;u.save(),u.transform(x,p,y,m,w,b),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,t){let a=e.bone.skeleton.color,i=e.color,c=s.color,o=a.a*i.a*c.a,r=t?o:1,l=this.tempColor;l.set(a.r*i.r*c.r*r,a.g*i.g*c.g*r,a.b*i.b*c.b*r,o),s.computeWorldVertices(e,this.vertices,0,Je.VERTEX_SIZE);let n=this.vertices,h=s.uvs;return n[P.C1R]=l.r,n[P.C1G]=l.g,n[P.C1B]=l.b,n[P.C1A]=l.a,n[P.U1]=h[0],n[P.V1]=h[1],n[P.C2R]=l.r,n[P.C2G]=l.g,n[P.C2B]=l.b,n[P.C2A]=l.a,n[P.U2]=h[2],n[P.V2]=h[3],n[P.C3R]=l.r,n[P.C3G]=l.g,n[P.C3B]=l.b,n[P.C3A]=l.a,n[P.U3]=h[4],n[P.V3]=h[5],n[P.C4R]=l.r,n[P.C4G]=l.g,n[P.C4B]=l.b,n[P.C4A]=l.a,n[P.U4]=h[6],n[P.V4]=h[7],n}computeMeshVertices(e,s,t){let a=e.bone.skeleton.color,i=e.color,c=s.color,o=a.a*i.a*c.a,r=t?o:1,l=this.tempColor;l.set(a.r*i.r*c.r*r,a.g*i.g*c.g*r,a.b*i.b*c.b*r,o);let n=s.worldVerticesLength/2,h=this.vertices;h.length<s.worldVerticesLength&&(this.vertices=h=B.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,h,0,Je.VERTEX_SIZE);let d=s.uvs;for(let f=0,u=0,g=2;f<n;f++)h[g++]=l.r,h[g++]=l.g,h[g++]=l.b,h[g++]=l.a,h[g++]=d[u++],h[g++]=d[u++],g+=2;return h}},_t=Je;return _t.QUAD_TRIANGLES=[0,1,2,2,3,0],_t.VERTEX_SIZE=2+2+4,Ht})();