@esotericsoftware/spine-pixi-v8 4.2.87 → 4.2.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Spine.js +4 -4
- package/dist/assets/atlasLoader.js +5 -4
- package/dist/assets/skeletonLoader.js +4 -3
- package/dist/esm/spine-pixi-v8.min.mjs +3 -3
- package/dist/esm/spine-pixi-v8.mjs +22 -22
- package/dist/esm/spine-pixi-v8.mjs.map +4 -4
- package/dist/iife/spine-pixi-v8.js +11 -11
- package/dist/iife/spine-pixi-v8.js.map +4 -4
- package/dist/iife/spine-pixi-v8.min.js +3 -3
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var spine=(()=>{var ne=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,di=Object.getOwnPropertyNames,ui=Object.prototype.hasOwnProperty,pt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),fi=(e,t)=>{for(var s in t)ne(e,s,{get:t[s],enumerable:!0})},mi=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of di(t))!ui.call(e,i)&&i!==s&&ne(e,i,{get:()=>t[i],enumerable:!(r=ci(t,i))||r.enumerable});return e},gi=e=>mi(ne({},"__esModule",{value:!0}),e),ps={};if(fi(ps,{AABBRectangleBoundsProvider:()=>wr,AlphaTimeline:()=>ye,Animation:()=>Ut,AnimationState:()=>Ve,AnimationStateAdapter:()=>Ci,AnimationStateData:()=>Ys,AssetCache:()=>Rs,AssetManagerBase:()=>ki,AtlasAttachmentLoader:()=>Es,Attachment:()=>oe,AttachmentTimeline:()=>Ct,BinaryInput:()=>Ws,BlendMode:()=>ss,Bone:()=>Ge,BoneData:()=>ze,BoundingBoxAttachment:()=>Ue,CURRENT:()=>Ms,ClippingAttachment:()=>St,Color:()=>V,ConstraintData:()=>Dt,CurveTimeline:()=>at,CurveTimeline1:()=>nt,CurveTimeline2:()=>qt,DebugUtils:()=>wi,DeformTimeline:()=>Se,Downloader:()=>Ds,DrawOrderTimeline:()=>It,Event:()=>He,EventData:()=>$e,EventQueue:()=>ks,EventTimeline:()=>Wt,EventType:()=>Ts,FIRST:()=>Ne,FakeTexture:()=>Si,HOLD_FIRST:()=>Gt,HOLD_MIX:()=>Is,HOLD_SUBSEQUENT:()=>Oe,IkConstraint:()=>Ls,IkConstraintData:()=>je,IkConstraintTimeline:()=>Ae,Inherit:()=>jt,InheritTimeline:()=>xe,IntSet:()=>xi,Interpolation:()=>xs,MathUtils:()=>B,MeshAttachment:()=>ut,MixBlend:()=>Cs,MixDirection:()=>Ss,PathAttachment:()=>Mt,PathConstraint:()=>Vs,PathConstraintData:()=>Je,PathConstraintMixTimeline:()=>Me,PathConstraintPositionTimeline:()=>Te,PathConstraintSpacingTimeline:()=>Ie,Physics:()=>_s,PhysicsConstraintDampingTimeline:()=>Xe,PhysicsConstraintGravityTimeline:()=>Ee,PhysicsConstraintInertiaTimeline:()=>Ye,PhysicsConstraintMassTimeline:()=>Fe,PhysicsConstraintMixTimeline:()=>Re,PhysicsConstraintResetTimeline:()=>De,PhysicsConstraintStrengthTimeline:()=>Pe,PhysicsConstraintTimeline:()=>bt,PhysicsConstraintWindTimeline:()=>Be,PointAttachment:()=>Bs,Pool:()=>Tt,PositionMode:()=>Ke,Pow:()=>bs,PowOut:()=>bi,RGB2Timeline:()=>Ce,RGBA2Timeline:()=>ve,RGBATimeline:()=>be,RGBTimeline:()=>we,RegionAttachment:()=>ot,RotateMode:()=>Ze,RotateTimeline:()=>Rt,SETUP:()=>_e,SUBSEQUENT:()=>zt,ScaleTimeline:()=>de,ScaleXTimeline:()=>ue,ScaleYTimeline:()=>fe,SequenceTimeline:()=>Le,SetupPoseBoundsProvider:()=>yr,ShearTimeline:()=>me,ShearXTimeline:()=>ge,ShearYTimeline:()=>pe,Skeleton:()=>Yt,SkeletonBinary:()=>qs,SkeletonBounds:()=>ns,SkeletonClipping:()=>Jt,SkeletonData:()=>Lt,SkeletonJson:()=>Gs,Skin:()=>Vt,SkinEntry:()=>ts,SkinsAndAnimationBoundsProvider:()=>vr,Slot:()=>Ns,SlotData:()=>es,SpacingMode:()=>Qe,Spine:()=>Cr,SpineDebugRenderer:()=>Sr,SpinePipe:()=>$s,SpineTexture:()=>os,StringSet:()=>ae,Texture:()=>qe,TextureAtlas:()=>$t,TextureAtlasPage:()=>Fs,TextureAtlasRegion:()=>We,TextureFilter:()=>Ht,TextureRegion:()=>Xs,TextureWrap:()=>Ps,TimeKeeper:()=>yi,Timeline:()=>$,TrackEntry:()=>As,TransformConstraint:()=>Os,TransformConstraintData:()=>is,TransformConstraintTimeline:()=>ke,TranslateTimeline:()=>le,TranslateXTimeline:()=>he,TranslateYTimeline:()=>ce,Triangulator:()=>zs,Utils:()=>E,Vector2:()=>Et,VertexAttachment:()=>dt,WindowedMean:()=>vi}),typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}var K=pt("pixi.js"),pi=pt("pixi.js"),xi=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},ae=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},V=class kt{constructor(t=0,s=0,r=0,i=0){this.r=t,this.g=s,this.b=r,this.a=i}static WHITE=new kt(1,1,1,1);static RED=new kt(1,0,0,1);static GREEN=new kt(0,1,0,1);static BLUE=new kt(0,0,1,1);static MAGENTA=new kt(1,0,1,1);set(t,s,r,i){return this.r=t,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,r,i){return this.r+=t,this.g+=s,this.b+=r,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new kt){return s.setFromString(t)}},B=class ct{static PI=3.1415927;static PI2=ct.PI*2;static invPI2=1/ct.PI2;static radiansToDegrees=180/ct.PI;static radDeg=ct.radiansToDegrees;static degreesToRadians=ct.PI/180;static degRad=ct.degreesToRadians;static clamp(t,s,r){return t<s?s:t>r?r:t}static cosDeg(t){return Math.cos(t*ct.degRad)}static sinDeg(t){return Math.sin(t*ct.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ct.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ct.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,r){let i=Math.random(),l=s-t;return i<=(r-t)/l?t+Math.sqrt(i*l*(r-t)):s-Math.sqrt((1-i)*l*(s-r))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},xs=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},bs=class extends xs{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},bi=class extends bs{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},E=class Bt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,l){for(let o=s,n=i;o<s+l;o++,n++)r[n]=t[o]}static arrayFill(t,s,r,i){for(let l=s;l<r;l++)t[l]=i}static setArraySize(t,s,r=0){let i=t.length;if(i==s)return t;if(t.length=s,i<s)for(let l=i;l<s;l++)t[l]=r;return t}static ensureArrayCapacity(t,s,r=0){return t.length>=s?t:Bt.setArraySize(t,s,r)}static newArray(t,s){let r=new Array(t);for(let i=0;i<t;i++)r[i]=s;return r}static newFloatArray(t){if(Bt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(t){if(Bt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(t){return Bt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Bt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,r=!0){for(var i=0;i<t.length;i++)if(t[i]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},wi=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Tt=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Et=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},yi=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},vi=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},oe=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},dt=class ti extends oe{static nextID=0;id=ti.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,l,o){r=l+(r>>1)*o;let n=t.bone.skeleton,a=t.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let f=t.bone,p=f.worldX,b=f.worldY,w=f.a,g=f.b,x=f.c,y=f.d;for(let v=s,C=l;C<r;v+=2,C+=o){let S=h[v],k=h[v+1];i[C]=S*w+k*g+p,i[C+1]=S*x+k*y+b}return}let u=0,d=0;for(let f=0;f<s;f+=2){let p=c[u];u+=p+1,d+=p}let m=n.bones;if(a.length==0)for(let f=l,p=d*3;f<r;f+=o){let b=0,w=0,g=c[u++];for(g+=u;u<g;u++,p+=3){let x=m[c[u]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}i[f]=b,i[f+1]=w}else{let f=a;for(let p=l,b=d*3,w=d<<1;p<r;p+=o){let g=0,x=0,y=c[u++];for(y+=u;u<y;u++,b+=3,w+=2){let v=m[c[u]],C=h[b]+f[w],S=h[b+1]+f[w+1],k=h[b+2];g+=(C*v.a+S*v.b+v.worldX)*k,x+=(C*v.c+S*v.d+v.worldY)*k}i[p]=g,i[p+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},ws=class se{static _nextID=0;id=se.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new se(this.regions.length);return E.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let r=t.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(t,s){let r=t,i=(this.start+s).toString();for(let l=this.digits-i.length;l>0;l--)r+="0";return r+=i,r}static nextID(){return se._nextID++}},ys=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(ys||{}),vs=[0,1,2,3,4,5,6],Ut=class{name;timelines=[];timelineIds=new ae;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,i,l,o,n){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(e,t,s,i,l,o,n)}},Cs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Cs||{}),Ss=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Ss||{}),N={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},$=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=E.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let i=s;i<r;i+=s)if(e[i]>t)return i-s;return r-s}},at=class extends ${curves;constructor(e,t,s){super(e,s),this.curves=E.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=E.newFloatArray(t);E.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,i,l,o,n,a,h,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let m=(r-l*2+n)*.03,f=(i-o*2+a)*.03,p=((l-n)*3-r+h)*.006,b=((o-a)*3-i+c)*.006,w=m*2+p,g=f*2+b,x=(l-r)*.3+m+p*.16666667,y=(o-i)*.3+f+b*.16666667,v=r+x,C=i+y;for(let S=d+18;d<S;d+=2)u[d]=v,u[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let a=this.frames[t],h=this.frames[t+s];return h+(e-a)/(i[r]-a)*(i[r+1]-h)}let l=r+18;for(r+=2;r<l;r+=2)if(i[r]>=e){let a=i[r-2],h=i[r-1];return h+(e-a)/(i[r]-a)*(i[r+1]-h)}t+=this.getFrameEntries();let o=i[l-2],n=i[l-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},nt=class extends at{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=t[s],l=t[s+1];return l+(e-i)/(t[s+2]-i)*(t[s+2+1]-l);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let l=this.getCurveValue(e);switch(s){case 0:return i+l*t;case 1:case 2:l+=i-r}return r+l*t}getAbsoluteValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let l=this.getCurveValue(e);return s==0?i+(l-i)*t:r+(l-r)*t}getAbsoluteValue2(e,t,s,r,i,l){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}return s==0?i+(l-i)*t:r+(l-r)*t}getScaleValue(e,t,s,r,i,l){const o=this.frames;if(e<o[0]){switch(s){case 0:return l;case 1:return i+(l-i)*t}return i}let n=this.getCurveValue(e)*l;if(t==1)return s==3?i+n-l:n;if(r==1)switch(s){case 0:return l+(Math.abs(n)*B.signum(l)-l)*t;case 1:case 2:return i+(Math.abs(n)*B.signum(i)-i)*t}else{let a=0;switch(s){case 0:return a=Math.abs(l)*B.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(i)*B.signum(n),a+(n-a)*t}}return i+(n-l)*t}},qt=class extends at{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Rt=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,i,l,n.rotation,n.data.rotation))}},le=class extends qt{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*i,n.y+=(n.data.y-n.y)*i}return}let h=0,c=0,u=$.search(a,s,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+3]-m);h+=(a[u+3+1]-h)*f,c+=(a[u+3+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(l){case 0:n.x=n.data.x+h*i,n.y=n.data.y+c*i;break;case 1:case 2:n.x+=(n.data.x+h-n.x)*i,n.y+=(n.data.y+c-n.y)*i;break;case 3:n.x+=h*i,n.y+=c*i}}},he=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,i,l,n.x,n.data.x))}},ce=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,i,l,n.y,n.data.y))}},de=class extends qt{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*i,n.scaleY+=(n.data.scaleY-n.scaleY)*i}return}let h,c,u=$.search(a,s,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+3]-m);h+=(a[u+3+1]-h)*f,c+=(a[u+3+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,i==1)l==3?(n.scaleX+=h-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=h,n.scaleY=c);else{let m=0,f=0;if(o==1)switch(l){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*i,n.scaleY=f+(Math.abs(c)*B.signum(f)-f)*i;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*i,n.scaleY=f+(Math.abs(c)*B.signum(f)-f)*i;break;case 3:n.scaleX+=(h-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}else switch(l){case 0:m=Math.abs(n.data.scaleX)*B.signum(h),f=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(h-m)*i,n.scaleY=f+(c-f)*i;break;case 1:case 2:m=Math.abs(n.scaleX)*B.signum(h),f=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(h-m)*i,n.scaleY=f+(c-f)*i;break;case 3:n.scaleX+=(h-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}}}},ue=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,i,l,o,n.scaleX,n.data.scaleX))}},fe=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,i,l,o,n.scaleY,n.data.scaleY))}},me=class extends qt{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*i,n.shearY+=(n.data.shearY-n.shearY)*i}return}let h=0,c=0,u=$.search(a,s,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+3]-m);h+=(a[u+3+1]-h)*f,c+=(a[u+3+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(l){case 0:n.shearX=n.data.shearX+h*i,n.shearY=n.data.shearY+c*i;break;case 1:case 2:n.shearX+=(n.data.shearX+h-n.shearX)*i,n.shearY+=(n.data.shearY+c-n.shearY)*i;break;case 3:n.shearX+=h*i,n.shearY+=c*i}}},ge=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,i,l,n.shearX,n.data.shearX))}},pe=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,i,l,n.shearY,n.data.shearY))}},xe=class extends ${boneIndex=0;constructor(e,t){super(e,[N.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){l==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==0||l==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[$.search(a,s,2)+1]}},be=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,r,i,l){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let b=n.data.color;switch(l){case 0:h.setFromColor(b);return;case 1:h.add((b.r-h.r)*i,(b.g-h.g)*i,(b.b-h.b)*i,(b.a-h.a)*i)}return}let c=0,u=0,d=0,m=0,f=$.search(a,s,5),p=this.curves[f/5];switch(p){case 0:let b=a[f];c=a[f+1],u=a[f+2],d=a[f+3],m=a[f+4];let w=(s-b)/(a[f+5]-b);c+=(a[f+5+1]-c)*w,u+=(a[f+5+2]-u)*w,d+=(a[f+5+3]-d)*w,m+=(a[f+5+4]-m)*w;break;case 1:c=a[f+1],u=a[f+2],d=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),u=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2),m=this.getBezierValue(s,f,4,p+18*3-2)}i==1?h.set(c,u,d,m):(l==0&&h.setFromColor(n.data.color),h.add((c-h.r)*i,(u-h.g)*i,(d-h.b)*i,(m-h.a)*i))}},we=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let p=n.data.color;switch(l){case 0:h.r=p.r,h.g=p.g,h.b=p.b;return;case 1:h.r+=(p.r-h.r)*i,h.g+=(p.g-h.g)*i,h.b+=(p.b-h.b)*i}return}let c=0,u=0,d=0,m=$.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let p=a[m];c=a[m+1],u=a[m+2],d=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,u+=(a[m+4+2]-u)*b,d+=(a[m+4+3]-d)*b;break;case 1:c=a[m+1],u=a[m+2],d=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),u=this.getBezierValue(s,m,2,f+18-2),d=this.getBezierValue(s,m,3,f+18*2-2)}if(i==1)h.r=c,h.g=u,h.b=d;else{if(l==0){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*i,h.g+=(u-h.g)*i,h.b+=(d-h.b)*i}}},ye=class extends nt{slotIndex=0;constructor(e,t,s){super(e,t,N.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(l){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*i}return}let h=this.getCurveValue(s);i==1?a.a=h:(l==0&&(a.a=n.data.color.a),a.a+=(h-a.a)*i)}},ve=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.alpha+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,i,l,o,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.add((y.r-h.r)*i,(y.g-h.g)*i,(y.b-h.b)*i,(y.a-h.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let u=0,d=0,m=0,f=0,p=0,b=0,w=0,g=$.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];u=a[g+1],d=a[g+2],m=a[g+3],f=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];let v=(s-y)/(a[g+8]-y);u+=(a[g+8+1]-u)*v,d+=(a[g+8+2]-d)*v,m+=(a[g+8+3]-m)*v,f+=(a[g+8+4]-f)*v,p+=(a[g+8+5]-p)*v,b+=(a[g+8+6]-b)*v,w+=(a[g+8+7]-w)*v;break;case 1:u=a[g+1],d=a[g+2],m=a[g+3],f=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];break;default:u=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),f=this.getBezierValue(s,g,4,x+18*3-2),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),w=this.getBezierValue(s,g,7,x+18*6-2)}if(i==1)h.set(u,d,m,f),c.r=p,c.g=b,c.b=w;else{if(l==0){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((u-h.r)*i,(d-h.g)*i,(m-h.b)*i,(f-h.a)*i),c.r+=(p-c.r)*i,c.g+=(b-c.g)*i,c.b+=(w-c.b)*i}}},Ce=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,l,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.r+=(y.r-h.r)*i,h.g+=(y.g-h.g)*i,h.b+=(y.b-h.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let u=0,d=0,m=0,f=0,p=0,b=0,w=0,g=$.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];u=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];let v=(s-y)/(a[g+7]-y);u+=(a[g+7+1]-u)*v,d+=(a[g+7+2]-d)*v,m+=(a[g+7+3]-m)*v,p+=(a[g+7+4]-p)*v,b+=(a[g+7+5]-b)*v,w+=(a[g+7+6]-w)*v;break;case 1:u=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];break;default:u=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(i==1)h.r=u,h.g=d,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==0){let y=n.data.color,v=n.data.darkColor;h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}h.r+=(u-h.r)*i,h.g+=(d-h.g)*i,h.b+=(m-h.b)*i,c.r+=(p-c.r)*i,c.g+=(b-c.g)*i,c.b+=(w-c.b)*i}}},Ct=class extends ${slotIndex=0;attachmentNames;constructor(e,t){super(e,[N.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){l==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==0||l==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[$.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Se=class extends at{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[N.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,r,i,l,o,n,a,h,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let m=(r-l*2+n)*.03,f=a*.03-o*.06,p=((l-n)*3-r+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=f*2+b,x=(l-r)*.3+m+p*.16666667,y=o*.3+f+b*.16666667,v=r+x,C=y;for(let S=d+18;d<S;d+=2)u[d]=v,u[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,s[r]>e){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let l=s[i-2],o=s[i-1];return o+(1-o)*(e-l)/(this.frames[t+this.getFrameEntries()]-l)}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof dt)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=0);let c=this.vertices,u=c[0].length,d=this.frames;if(s<d[0]){switch(l){case 0:h.length=0;return;case 1:if(i==1){h.length=0;return}h.length=u;let g=a;if(g.bones){i=1-i;for(var m=0;m<u;m++)h[m]*=i}else{let x=g.vertices;for(var m=0;m<u;m++)h[m]+=(x[m]-h[m])*i}}return}if(h.length=u,s>=d[d.length-1]){let g=c[d.length-1];if(i==1)if(l==3){let x=a;if(x.bones)for(let y=0;y<u;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<u;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,u);else switch(l){case 0:{let y=a;if(y.bones)for(let v=0;v<u;v++)h[v]=g[v]*i;else{let v=y.vertices;for(let C=0;C<u;C++){let S=v[C];h[C]=S+(g[C]-S)*i}}break}case 1:case 2:for(let y=0;y<u;y++)h[y]+=(g[y]-h[y])*i;break;case 3:let x=a;if(x.bones)for(let y=0;y<u;y++)h[y]+=g[y]*i;else{let y=x.vertices;for(let v=0;v<u;v++)h[v]+=(g[v]-y[v])*i}}return}let f=$.search1(d,s),p=this.getCurvePercent(s,f),b=c[f],w=c[f+1];if(i==1)if(l==3){let g=a;if(g.bones)for(let x=0;x<u;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<u;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<u;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case 0:{let x=a;if(x.bones)for(let y=0;y<u;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*i}else{let y=x.vertices;for(let v=0;v<u;v++){let C=b[v],S=y[v];h[v]=S+(C+(w[v]-C)*p-S)*i}}break}case 1:case 2:for(let x=0;x<u;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*i}break;case 3:let g=a;if(g.bones)for(let x=0;x<u;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*i}else{let x=g.vertices;for(let y=0;y<u;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*i}}}}},Wt=class ei extends ${static propertyIds=[""+N.event];events;constructor(t){super(t,ei.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,r,i,l,o,n){if(!i)return;let a=this.frames,h=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,l,o,n),s=-1;else if(s>=a[h-1])return;if(r<a[0])return;let c=0;if(s<a[0])c=0;else{c=$.search1(a,s)+1;let u=a[c];for(;c>0&&a[c-1]==u;)c--}for(;c<h&&r>=a[c];c++)i.push(this.events[c])}},It=class si extends ${static propertyIds=[""+N.drawOrder];drawOrders;constructor(t){super(t,si.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,r){this.frames[t]=s,this.drawOrders[t]=r}apply(t,s,r,i,l,o,n){if(n==1){o==0&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=$.search1(this.frames,r),h=this.drawOrders[a];if(!h)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,u=t.slots;for(let d=0,m=h.length;d<m;d++)c[d]=u[h[d]]}}},Ae=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[N.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,i,l,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,i,l,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*i,n.softness+=(n.data.softness-n.softness)*i,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,u=$.search(a,s,6),d=this.curves[u/6];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+6]-m);h+=(a[u+6+1]-h)*f,c+=(a[u+6+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}l==0?(n.mix=n.data.mix+(h-n.data.mix)*i,n.softness=n.data.softness+(c-n.data.softness)*i,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[u+3],n.compress=a[u+4]!=0,n.stretch=a[u+5]!=0)):(n.mix+=(h-n.mix)*i,n.softness+=(c-n.softness)*i,o==0&&(n.bendDirection=a[u+3],n.compress=a[u+4]!=0,n.stretch=a[u+5]!=0))}},ke=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[N.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,l,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=r,a[e+3]=i,a[e+4]=l,a[e+5]=o,a[e+6]=n}apply(e,t,s,r,i,l,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case 0:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case 1:n.mixRotate+=(w.mixRotate-n.mixRotate)*i,n.mixX+=(w.mixX-n.mixX)*i,n.mixY+=(w.mixY-n.mixY)*i,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*i,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*i,n.mixShearY+=(w.mixShearY-n.mixShearY)*i}return}let h,c,u,d,m,f,p=$.search(a,s,7),b=this.curves[p/7];switch(b){case 0:let w=a[p];h=a[p+1],c=a[p+2],u=a[p+3],d=a[p+4],m=a[p+5],f=a[p+6];let g=(s-w)/(a[p+7]-w);h+=(a[p+7+1]-h)*g,c+=(a[p+7+2]-c)*g,u+=(a[p+7+3]-u)*g,d+=(a[p+7+4]-d)*g,m+=(a[p+7+5]-m)*g,f+=(a[p+7+6]-f)*g;break;case 1:h=a[p+1],c=a[p+2],u=a[p+3],d=a[p+4],m=a[p+5],f=a[p+6];break;default:h=this.getBezierValue(s,p,1,b-2),c=this.getBezierValue(s,p,2,b+18-2),u=this.getBezierValue(s,p,3,b+18*2-2),d=this.getBezierValue(s,p,4,b+18*3-2),m=this.getBezierValue(s,p,5,b+18*4-2),f=this.getBezierValue(s,p,6,b+18*5-2)}if(l==0){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*i,n.mixX=w.mixX+(c-w.mixX)*i,n.mixY=w.mixY+(u-w.mixY)*i,n.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*i,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*i,n.mixShearY=w.mixShearY+(f-w.mixShearY)*i}else n.mixRotate+=(h-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(u-n.mixY)*i,n.mixScaleX+=(d-n.mixScaleX)*i,n.mixScaleY+=(m-n.mixScaleY)*i,n.mixShearY+=(f-n.mixShearY)*i}},Te=class extends nt{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,i,l,n.position,n.data.position))}},Ie=class extends nt{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,i,l,n.spacing,n.data.spacing))}},Me=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[N.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){let l=this.frames;e<<=2,l[e]=t,l[e+1]=s,l[e+2]=r,l[e+3]=i}apply(e,t,s,r,i,l,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*i,n.mixX+=(n.data.mixX-n.mixX)*i,n.mixY+=(n.data.mixY-n.mixY)*i}return}let h,c,u,d=$.search(a,s,4),m=this.curves[d>>2];switch(m){case 0:let f=a[d];h=a[d+1],c=a[d+2],u=a[d+3];let p=(s-f)/(a[d+4]-f);h+=(a[d+4+1]-h)*p,c+=(a[d+4+2]-c)*p,u+=(a[d+4+3]-u)*p;break;case 1:h=a[d+1],c=a[d+2],u=a[d+3];break;default:h=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),u=this.getBezierValue(s,d,3,m+18*2-2)}if(l==0){let f=n.data;n.mixRotate=f.mixRotate+(h-f.mixRotate)*i,n.mixX=f.mixX+(c-f.mixX)*i,n.mixY=f.mixY+(u-f.mixY)*i}else n.mixRotate+=(h-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(u-n.mixY)*i}},bt=class extends nt{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of e.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,i,l,this.get(h),this.setup(h),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,l,this.get(n),this.setup(n)))}},Ye=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Pe=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Xe=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Fe=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Be=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ee=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Re=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},De=class ii extends ${static propertyIds=[N.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,ii.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,l,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(r<h[0])&&(s<h[0]||r>=h[$.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},Le=class yt extends ${static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[N.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,r,i,l){let o=this.frames;t*=yt.ENTRIES,o[t]=s,o[t+yt.MODE]=r|i<<4,o[t+yt.DELAY]=l}apply(t,s,r,i,l,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof dt)||h.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let u=this.frames;if(r<u[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let d=$.search(u,r,yt.ENTRIES),m=u[d],f=u[d+yt.MODE],p=u[d+yt.DELAY];if(!this.attachment.sequence)return;let b=f>>4,w=this.attachment.sequence.regions.length,g=vs[f&15];if(g!=0)switch(b+=(r-m)/p+1e-5|0,g){case 1:b=Math.min(w-1,b);break;case 2:b%=w;break;case 3:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case 4:b=Math.max(w-1-b,0);break;case 5:b=w-1-b%w;break;case 6:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Ve=class ie{static _emptyAnimation=new Ut("<empty>",[],0);static emptyAnimation(){return ie._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ks(this);propertyIDs=new ae;animationsChanged=!1;trackEntryPool=new Tt(()=>new As);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let l=s[r];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=t*l.timeScale;if(l.delay>0){if(l.delay-=o,l.delay>0)continue;o=-l.delay,l.delay=0}let n=l.next;if(n){let a=l.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=l.timeScale==0?0:(a/l.timeScale+t)*n.timeScale,l.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[r]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,t)){let a=l.mixingFrom;for(l.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}l.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let r=t.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((r.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let d=0,m=r.length;d<m;d++){let f=r[d];if(!f||f.delay>0)continue;i=!0;let p=d==0?1:f.mixBlend,b=f.alpha;f.mixingFrom?b*=this.applyMixingFrom(f,t,p):f.trackTime>=f.trackEnd&&!f.next&&(b=0);let w=b>=f.alphaAttachmentThreshold,g=f.animationLast,x=f.getAnimationTime(),y=x,v=s;f.reverse&&(y=f.animation.duration-y,v=null);let C=f.animation.timelines,S=C.length;if(d==0&&b==1||p==3){d==0&&(w=!0);for(let k=0;k<S;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof Ct?this.applyAttachmentTimeline(l,t,y,p,w):l.apply(t,g,y,v,b,p,0)}}else{let k=f.timelineMode,T=f.shortestRotation,Y=!T&&f.timelinesRotation.length!=S<<1;Y&&(f.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let X=C[M],F=k[M]==zt?p:0;!T&&X instanceof Rt?this.applyRotateTimeline(X,t,y,b,F,f.timelinesRotation,M<<1,Y):X instanceof Ct?this.applyAttachmentTimeline(X,t,y,p,w):(E.webkit602BugfixHelper(b,p),X.apply(t,g,y,v,b,F,0))}}this.queueEvents(f,x),s.length=0,f.nextAnimationLast=x,f.nextTrackLast=f.trackTime}for(var o=this.unkeyedState+_e,n=t.slots,a=0,h=t.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var u=c.data.attachmentName;c.setAttachment(u?t.getAttachment(c.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,s,r){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let l=0;t.mixDuration==0?(l=1,r==1&&(r=0)):(l=t.mixTime/t.mixDuration,l>1&&(l=1),r!=1&&(r=i.mixBlend));let o=l<i.mixAttachmentThreshold,n=l<i.mixDrawOrderThreshold,a=i.animation.timelines,h=a.length,c=i.alpha*t.interruptAlpha,u=c*(1-l),d=i.animationLast,m=i.getAnimationTime(),f=m,p=null;if(i.reverse?f=i.animation.duration-f:l<i.eventThreshold&&(p=this.events),r==3)for(let b=0;b<h;b++)a[b].apply(s,d,f,p,u,r,1);else{let b=i.timelineMode,w=i.timelineHoldMix,g=i.shortestRotation,x=!g&&i.timelinesRotation.length!=h<<1;x&&(i.timelinesRotation.length=h<<1),i.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=1,S,k=0;switch(b[y]){case zt:if(!n&&v instanceof It)continue;S=r,k=u;break;case Ne:S=0,k=u;break;case Oe:S=r,k=c;break;case Gt:S=0,k=c;break;default:S=0;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=k,!g&&v instanceof Rt?this.applyRotateTimeline(v,s,f,k,S,i.timelinesRotation,y<<1,x):v instanceof Ct?this.applyAttachmentTimeline(v,s,f,S,o&&k>=i.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,r),n&&v instanceof It&&S==0&&(C=0),v.apply(s,d,f,p,k,S,C))}}return t.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,l}applyAttachmentTimeline(t,s,r,i,l){var o=s.slots[t.slotIndex];o.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,t.attachmentNames[$.search1(t.frames,r)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+_e))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+Ms)}applyRotateTimeline(t,s,r,i,l,o,n,a){if(a&&(o[n]=0),i==1){t.apply(s,0,r,null,1,l,0);return}let h=s.bones[t.boneIndex];if(!h.active)return;let c=t.frames,u=0,d=0;if(r<c[0])switch(l){case 0:h.rotation=h.data.rotation;default:return;case 1:u=h.rotation,d=h.data.rotation}else u=l==0?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(r);let m=0,f=d-u;if(f-=Math.ceil(f/360-.5)*360,f==0)m=o[n];else{let p=0,b=0;a?(p=0,b=f):(p=o[n],b=o[n+1]);let w=p-p%360;m=f+w;let g=f>=0,x=p>=0;Math.abs(b)<=90&&B.signum(b)!=B.signum(f)&&(Math.abs(p-w)>180?(m+=360*B.signum(p),x=g):w!=0?m-=360*B.signum(p):x=g),x!=g&&(m+=360*B.signum(p)),o[n]=m}o[n+1]=f,h.rotation=u+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,l=i-r,o=t.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let u=n[a];if(u.time<o)break;u.time>i||this.queue.event(t,u)}let c=!1;if(t.loop)if(l==0)c=!0;else{const u=Math.floor(t.trackTime/l);c=u>0&&u>Math.floor(t.trackLast/l)}else c=s>=i&&t.animationLast<i;for(c&&this.queue.complete(t);a<h;a++){let u=n[a];u.time<r||this.queue.event(t,u)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,r){let i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,i,r)}setAnimationWith(t,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,l=this.expandToIndex(t);l&&(l.nextTrackLast==-1?(this.tracks[t]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,i=!1):this.clearNext(l));let o=this.trackEntry(t,s,r,l);return this.setCurrent(t,o,i),this.queue.drain(),o}addAnimation(t,s,r=!1,i=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,l,r,i)}addAnimationWith(t,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(t);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(t,s,r,l);return l?(l.next=o,o.previous=l,i<=0&&(i=Math.max(i+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,ie.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,ie.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let l=this.tracks[r];l&&this.setEmptyAnimation(l.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,r,i){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=t,l.animation=s,l.loop=r,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=i?this.data.getMix(i.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=2,l}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let s=t.mixingTo,r=t.animation.timelines,i=t.animation.timelines.length,l=t.timelineMode;l.length=i;let o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<i;a++)l[a]=n.addAll(r[a].getPropertyIds())?Gt:Oe;return}t:for(let a=0;a<i;a++){let h=r[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=zt;else if(!s||h instanceof Ct||h instanceof It||h instanceof Wt||!s.animation.hasTimeline(c))l[a]=Ne;else{for(let u=s.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(t.mixDuration>0){l[a]=Is,o[a]=u;continue t}break}l[a]=Gt}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},As=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ks=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let r=e[s],i=e[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<t.length;o++){let n=t[o];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(i)}break;case 5:let l=e[s+++2];i.listener&&i.listener.event&&i.listener.event(i,l);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(i,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Ts=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Ts||{}),Ci=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},zt=0,Ne=1,Oe=2,Gt=3,Is=4,_e=1,Ms=2,Ys=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);this.setMixWith(r,i,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ue=class ri extends dt{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new ri(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},St=class ni extends dt{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new ni(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},qe=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ht=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Ht||{}),Ps=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Ps||{}),Xs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Si=class extends qe{setFilters(e,t){}setWraps(e,t){}dispose(){}},$t=class{pages=new Array;regions=new Array;constructor(e){let t=new Ai(e),s=new Array(4),r={};r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.format=()=>{},r.filter=h=>{h.minFilter=E.enumValue(Ht,s[1]),h.magFilter=E.enumValue(Ht,s[2])},r.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=10497),s[1].indexOf("y")!=-1&&(h.vWrap=10497)},r.pma=h=>{h.pma=s[1]=="true"};var i={};i.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},i.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},i.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},i.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},i.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},i.index=h=>{h.index=parseInt(s[1])};let l=t.readLine();for(;l&&l.trim().length==0;)l=t.readLine();for(;!(!l||l.trim().length==0||t.readEntry(s,l)==0);)l=t.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=t.readLine();else if(o){let h=new We(o,l);for(;;){let c=t.readEntry(s,l=t.readLine());if(c==0)break;let u=i[s[0]];if(u)u(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));a.push(d)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Fs(l.trim());t.readEntry(s,l=t.readLine())!=0;){let h=r[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Ai=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let r=1,i=s+1;;r++){let l=t.indexOf(",",i);if(l==-1)return e[r]=t.substr(i).trim(),r;if(e[r]=t.substr(i,l-i).trim(),i=l+1,r==4)return 4}}},Fs=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},We=class extends Xs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ut=class us extends dt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=E.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof We){let a=this.region,h=a.page,c=h.width,u=h.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/u,o=a.originalHeight/c,n=a.originalWidth/u;for(let d=0;d<r;d+=2)s[d]=i+t[d+1]*o,s[d+1]=l+(1-t[d])*n;return;case 180:i-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/u,o=a.originalWidth/c,n=a.originalHeight/u;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d])*o,s[d+1]=l+(1-t[d+1])*n;return;case 270:i-=a.offsetY/c,l-=a.offsetX/u,o=a.originalHeight/c,n=a.originalWidth/u;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d+1])*o,s[d+1]=l+t[d]*n;return}i-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/u,o=a.originalWidth/c,n=a.originalHeight/u}else this.region?(o=this.region.u2-i,n=this.region.v2-l):(i=l=0,o=n=1);for(let a=0;a<r;a+=2)s[a]=i+t[a]*o,s[a+1]=l+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new us(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,r,i,l,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,l,o)}newLinkedMesh(){let t=new us(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},Mt=class ai extends dt{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new ai(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Bs=class oi extends dt{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*B.degRad,r=Math.cos(s),i=Math.sin(s),l=r*t.a+i*t.b,o=r*t.c+i*t.d;return B.atan2Deg(o,l)}copy(){let t=new oi(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},ot=class li extends oe{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,n=l+this.region.width*r,a=o+this.region.height*i,h=this.rotation*B.degRad,c=Math.cos(h),u=Math.sin(h),d=this.x,m=this.y,f=l*c+d,p=l*u,b=o*c+m,w=o*u,g=n*c+d,x=n*u,y=a*c+m,v=a*u,C=this.offset;C[0]=f-w,C[1]=b+p,C[2]=f-v,C[3]=y+p,C[4]=g-v,C[5]=y+x,C[6]=g-w,C[7]=b+x,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,r,i){this.sequence!=null&&this.sequence.apply(t,this);let l=t.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,u=l.c,d=l.d,m=0,f=0;m=o[0],f=o[1],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a,r+=i,m=o[2],f=o[3],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a,r+=i,m=o[4],f=o[5],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a,r+=i,m=o[6],f=o[7],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a}copy(){let t=new li(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Es=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let i=0,l=r.length;i<l;i++){let o=s.getPath(t,i),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[i]=n}}newRegionAttachment(e,t,s,r){let i=new ot(t,s);if(r!=null)this.loadSequence(t,s,r);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");i.region=l}return i}newMeshAttachment(e,t,s,r){let i=new ut(t,s);if(r!=null)this.loadSequence(t,s,r);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");i.region=l}return i}newBoundingBoxAttachment(e,t){return new Ue(t)}newPathAttachment(e,t){return new Mt(t)}newPointAttachment(e,t){return new Bs(t)}newClippingAttachment(e,t){return new St(t)}},ze=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new V;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},jt=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(jt||{}),Ge=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,r,i,l,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let d=this.skeleton;const m=d.scaleX,f=d.scaleY,p=(s+l)*B.degRad,b=(s+90+o)*B.degRad;this.a=Math.cos(p)*r*m,this.b=Math.cos(b)*i*m,this.c=Math.sin(p)*r*f,this.d=Math.sin(b)*i*f,this.worldX=e*m+d.x,this.worldY=t*f+d.y;return}let a=n.a,h=n.b,c=n.c,u=n.d;switch(this.worldX=a*e+h*t+n.worldX,this.worldY=c*e+u*t+n.worldY,this.inherit){case 0:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad,f=Math.cos(d)*r,p=Math.cos(m)*i,b=Math.sin(d)*r,w=Math.sin(m)*i;this.a=a*f+h*b,this.b=a*p+h*w,this.c=c*f+u*b,this.d=c*p+u*w;return}case 1:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(m)*i,this.c=Math.sin(d)*r,this.d=Math.sin(m)*i;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=d,c*=m;let f=a*a+c*c,p=0;f>1e-4?(f=Math.abs(a*u*m-h*d*c)/f,h=c*f,u=a*f,p=Math.atan2(c,a)*B.radDeg):(a=0,c=0,p=90-Math.atan2(u,h)*B.radDeg);const b=(s+l-p)*B.degRad,w=(s+o-p+90)*B.degRad,g=Math.cos(b)*r,x=Math.cos(w)*i,y=Math.sin(b)*r,v=Math.sin(w)*i;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+u*y,this.d=c*x+u*v;break}case 3:case 4:{s*=B.degRad;const d=Math.cos(s),m=Math.sin(s);let f=(a*d+h*m)/this.skeleton.scaleX,p=(c*d+u*m)/this.skeleton.scaleY,b=Math.sqrt(f*f+p*p);b>1e-5&&(b=1/b),f*=b,p*=b,b=Math.sqrt(f*f+p*p),this.inherit==3&&a*u-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,f);const w=Math.cos(s)*b,g=Math.sin(s)*b;l*=B.degRad,o=(90+o)*B.degRad;const x=Math.cos(l)*r,y=Math.cos(o)*i,v=Math.sin(l)*r,C=Math.sin(o)*i;this.a=f*x+w*v,this.b=f*y+w*C,this.c=p*x+g*v,this.d=p*y+g*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,l=1/(t*i-s*r),o=i*l,n=s*l,a=r*l,h=t*l,c=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=c*o-u*n,this.ay=u*h-c*a;let d,m,f,p;if(this.inherit==1)d=this.a,m=this.b,f=this.c,p=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*i-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=t*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(t*i-s*r),o=i*l,n=s*l;break}case 3:case 4:let b=B.cosDeg(this.rotation),w=B.sinDeg(this.rotation);t=(t*b+s*w)/this.skeleton.scaleX,r=(r*b+i*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=B.PI/2+Math.atan2(r,t);s=Math.cos(x)*g,i=Math.sin(x)*g,l=1/(t*i-s*r),o=i*l,n=s*l,a=r*l,h=t*l}d=o*this.a-n*this.c,m=o*this.b-n*this.d,f=h*this.c-a*this.a,p=h*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){let b=d*p-m*f;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+f*p,b)*B.radDeg,this.arotation=Math.atan2(f,d)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*B.radDeg}rotateWorld(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,i=this.b;this.a=s*r-t*this.c,this.b=s*i-t*this.d,this.c=t*r+s*this.c,this.d=t*i+s*this.d}},Dt=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ki=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Ds,r=new Rs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=r}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadBinary(e,l=>{this.success(t,e,l),r(l)},(l,o)=>{const n=`Couldn't load binary ${e}: status ${l}, ${o}`;this.error(s,e,n),i(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadJson(e,l=>{this.success(t,e,l),r(l)},(l,o)=>{const n=`Couldn't load JSON ${e}: status ${l}, ${o}`;this.error(s,e,n),i(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[e],i=r!==void 0;return i&&(this.cache.assetsLoaded[e]=r.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(t,e,l),l)).catch(l=>this.error(s,e,l))),i}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(t,e,a),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let i=e.lastIndexOf("/"),l=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,n)=>{this.downloader.downloadText(e,a=>{try{let h=new $t(a),c=h.pages.length,u=!1;for(let d of h.pages)this.loadTexture(r?r[d.name]:l+d.name,(m,f)=>{u||(d.setTexture(f),--c==0&&(this.success(t,e,h),o(h)))},(m,f)=>{if(!u){const p=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,p),n(p)}u=!0})}catch(h){const c=`Couldn't parse texture atlas ${e}: ${h.message}`;this.error(s,e,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${h}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},r){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,l)=>{this.downloader.downloadText(e,o=>{try{const n=new $t(o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),l(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(r,i)=>t(i),(r,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
-
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){--this.cache.assetsRefCount[e]===0&&this.remove(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Rs=class re{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=re.AVAILABLE_CACHES.get(t);if(s)return s;const r=new re;return re.AVAILABLE_CACHES.set(t,r),r}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Ds=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=t.charCodeAt(i);return r}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToString(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||e,!0);let l=()=>{this.finish(e,i.status,i.responseText)};i.onload=l,i.onerror=l,i.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||e,!0),i.responseType="arraybuffer";let l=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):l()},i.onerror=l,i.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let i=t==200||t==0?[s]:[t,s];for(let l=i.length-1,o=r.length;l<o;l+=2)r[l].apply(null,i)}},He=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},$e=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Ls=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,r,i,l,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,u=n.d,d=-e.ashearX-e.arotation,m=0,f=0;switch(e.inherit){case 1:m=(t-e.worldX)*B.signum(e.skeleton.scaleX),f=(s-e.worldY)*B.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(a*u-h*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;h=-x*w*e.skeleton.scaleX,u=g*w*e.skeleton.scaleY,d+=Math.atan2(x,g)*B.radDeg;default:let y=t-n.worldX,v=s-n.worldY,C=a*u-h*c;Math.abs(C)<=1e-4?(m=0,f=0):(m=(y*u-v*h)/C-e.ax,f=(v*a-y*c)/C-e.ay)}d+=Math.atan2(f,m)*B.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let p=e.ascaleX,b=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,f=s-e.worldY}const w=e.data.length*p;if(w>1e-4){const g=m*m+f*f;if(r&&g<w*w||i&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,p,b,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,l,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let h=e.ax,c=e.ay,u=e.ascaleX,d=e.ascaleY,m=u,f=d,p=t.ascaleX,b=0,w=0,g=0;u<0?(u=-u,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),p<0?(p=-p,w=180):w=0;let x=t.ax,y=0,v=0,C=0,S=e.a,k=e.b,T=e.c,Y=e.d,M=Math.abs(u-d)<=1e-4;!M||l?(y=0,v=S*x+e.worldX,C=T*x+e.worldY):(y=t.ay,v=S*x+k*y+e.worldX,C=T*x+Y*y+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");S=X.a,k=X.b,T=X.c,Y=X.d;let F=S*Y-k*T,I=v-X.worldX,P=C-X.worldY;F=Math.abs(F)<=1e-4?0:1/F;let D=(I*Y-P*k)*F-h,O=(P*S-I*T)*F-c,L=Math.sqrt(D*D+O*O),_=t.data.length*p,H,z;if(L<1e-4){this.apply1(e,s,r,!1,l,!1,a),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-X.worldX,P=r-X.worldY;let j=(I*Y-P*k)*F-h,R=(P*S-I*T)*F-c,U=j*j+R*R;if(n!=0){n*=u*(p+1)*.5;let J=Math.sqrt(U),Z=J-L-_*u+n;if(Z>0){let tt=Math.min(1,Z/(n*2))-1;tt=(Z-n*(1-tt*tt))/J,j-=tt*j,R-=tt*R,U=j*j+R*R}}t:if(M){_*=u;let J=(U-L*L-_*_)/(2*L*_);J<-1?(J=-1,z=Math.PI*i):J>1?(J=1,z=0,l&&(S=(Math.sqrt(U)/(L+_)-1)*a+1,m*=S,o&&(f*=S))):z=Math.acos(J)*i,S=L+_*J,k=_*Math.sin(z),H=Math.atan2(R*S-j*k,j*S+R*k)}else{S=u*_,k=d*_;let J=S*S,Z=k*k,tt=Math.atan2(R,j);T=Z*L*L+J*U-J*Z;let ht=-2*Z*L,Xt=Z-J;if(Y=ht*ht-4*Xt*T,Y>=0){let Ft=Math.sqrt(Y);ht<0&&(Ft=-Ft),Ft=-(ht+Ft)*.5;let _t=Ft/Xt,Zs=T/Ft,ee=Math.abs(_t)<Math.abs(Zs)?_t:Zs;if(_t=U-ee*ee,_t>=0){P=Math.sqrt(_t)*i,H=tt-Math.atan2(P,ee),z=Math.atan2(P/d,(ee-L)/u);break t}}let Ot=B.PI,Zt=L-S,cs=Zt*Zt,Js=0,Ks=0,te=L+S,ds=te*te,Qs=0;T=-S*L/(J-Z),T>=-1&&T<=1&&(T=Math.acos(T),I=S*Math.cos(T)+L,P=k*Math.sin(T),Y=I*I+P*P,Y<cs&&(Ot=T,cs=Y,Zt=I,Js=P),Y>ds&&(Ks=T,ds=Y,te=I,Qs=P)),U<=(cs+ds)*.5?(H=tt-Math.atan2(Js*i,Zt),z=Ot*i):(H=tt-Math.atan2(Qs*i,te),z=Ks*i)}let G=Math.atan2(y,x)*g,st=e.arotation;H=(H-G)*B.radDeg+b-st,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(h,c,st+H*a,m,f,0,0),st=t.arotation,z=((z+G)*B.radDeg-t.ashearX)*g+w-st,z>180?z-=360:z<-180&&(z+=360),t.updateWorldTransformWith(x,y,st+z*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},je=class extends Dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},Je=class extends Dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Ke=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Ke||{}),Qe=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Qe||{}),Ze=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Ze||{}),Vs=class vt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0,l=t.bones.length;i<l;i++){let o=s.findBone(t.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(t.target.name);if(!r)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=r,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof Mt))return;let r=this.mixRotate,i=this.mixX,l=this.mixY;if(r==0&&i==0&&l==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,h=this.bones,c=h.length,u=n?c:c+1,d=E.setArraySize(this.spaces,u),m=a?this.lengths=E.setArraySize(this.lengths,c):[],f=this.spacing;switch(o.spacingMode){case 2:if(a)for(let C=0,S=u-1;C<S;C++){let k=h[C],T=k.data.length,Y=T*k.a,M=T*k.c;m[C]=Math.sqrt(Y*Y+M*M)}E.arrayFill(d,1,u,f);break;case 3:let y=0;for(let C=0,S=u-1;C<S;){let k=h[C],T=k.data.length;if(T<vt.epsilon)a&&(m[C]=0),d[++C]=f;else{let Y=T*k.a,M=T*k.c,X=Math.sqrt(Y*Y+M*M);a&&(m[C]=X),d[++C]=X,y+=X}}if(y>0){y=u/y*f;for(let C=1;C<u;C++)d[C]*=y}break;default:let v=o.spacingMode==0;for(let C=0,S=u-1;C<S;){let k=h[C],T=k.data.length;if(T<vt.epsilon)a&&(m[C]=0),d[++C]=f;else{let Y=T*k.a,M=T*k.c,X=Math.sqrt(Y*Y+M*M);a&&(m[C]=X),d[++C]=(v?T+f:f)*X/T}}}let p=this.computeWorldPositions(s,u,n),b=p[0],w=p[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*i,C.worldY+=(w-C.worldY)*l;let S=p[v],k=p[v+1],T=S-b,Y=k-w;if(a){let M=m[y];if(M!=0){let X=(Math.sqrt(T*T+Y*Y)/M-1)*r+1;C.a*=X,C.c*=X}}if(b=S,w=k,r>0){let M=C.a,X=C.b,F=C.c,I=C.d,P=0,D=0,O=0;if(n?P=p[v-1]:d[y+1]==0?P=p[v+2]:P=Math.atan2(Y,T),P-=Math.atan2(F,M),x){D=Math.cos(P),O=Math.sin(P);let L=C.data.length;b+=(L*(D*M-O*F)-T)*r,w+=(L*(O*M+D*F)-Y)*r}else P+=g;P>B.PI?P-=B.PI2:P<-B.PI&&(P+=B.PI2),P*=r,D=Math.cos(P),O=Math.sin(P),C.a=D*M-O*F,C.b=D*X-O*I,C.c=O*M+D*F,C.d=O*X+D*I}C.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=t.closed,c=t.worldVerticesLength,u=c/6,d=vt.NONE;if(!t.constantSpeed){let L=t.lengths;u-=h?1:2;let _=L[u];this.data.positionMode==1&&(l*=_);let H;switch(this.data.spacingMode){case 2:H=_;break;case 3:H=_/s;break;default:H=1}a=E.setArraySize(this.world,8);for(let z=0,j=0,R=0;z<s;z++,j+=3){let U=o[z]*H;l+=U;let G=l;if(h)G%=_,G<0&&(G+=_),R=0;else if(G<0){d!=vt.BEFORE&&(d=vt.BEFORE,t.computeWorldVertices(i,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>_){d!=vt.AFTER&&(d=vt.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-_,a,0,n,j);continue}for(;;R++){let st=L[R];if(!(G>st)){if(R==0)G/=st;else{let J=L[R-1];G=(G-J)/(st-J)}break}}R!=d&&(d=R,h&&R==u?(t.computeWorldVertices(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,R*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,j,r||z>0&&U==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(u--,c-=4,a=E.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=E.setArraySize(this.curves,u),f=0,p=a[0],b=a[1],w=0,g=0,x=0,y=0,v=0,C=0,S=0,k=0,T=0,Y=0,M=0,X=0,F=0,I=0;for(let L=0,_=2;L<u;L++,_+=6)w=a[_],g=a[_+1],x=a[_+2],y=a[_+3],v=a[_+4],C=a[_+5],S=(p-w*2+x)*.1875,k=(b-g*2+y)*.1875,T=((w-x)*3-p+v)*.09375,Y=((g-y)*3-b+C)*.09375,M=S*2+T,X=k*2+Y,F=(w-p)*.75+S+T*.16666667,I=(g-b)*.75+k+Y*.16666667,f+=Math.sqrt(F*F+I*I),F+=M,I+=X,M+=T,X+=Y,f+=Math.sqrt(F*F+I*I),F+=M,I+=X,f+=Math.sqrt(F*F+I*I),F+=M+T,I+=X+Y,f+=Math.sqrt(F*F+I*I),m[L]=f,p=v,b=C;this.data.positionMode==1&&(l*=f);let P;switch(this.data.spacingMode){case 2:P=f;break;case 3:P=f/s;break;default:P=1}let D=this.segments,O=0;for(let L=0,_=0,H=0,z=0;L<s;L++,_+=3){let j=o[L]*P;l+=j;let R=l;if(h)R%=f,R<0&&(R+=f),H=0;else if(R<0){this.addBeforePosition(R,a,0,n,_);continue}else if(R>f){this.addAfterPosition(R-f,a,c-4,n,_);continue}for(;;H++){let U=m[H];if(!(R>U)){if(H==0)R/=U;else{let G=m[H-1];R=(R-G)/(U-G)}break}}if(H!=d){d=H;let U=H*6;for(p=a[U],b=a[U+1],w=a[U+2],g=a[U+3],x=a[U+4],y=a[U+5],v=a[U+6],C=a[U+7],S=(p-w*2+x)*.03,k=(b-g*2+y)*.03,T=((w-x)*3-p+v)*.006,Y=((g-y)*3-b+C)*.006,M=S*2+T,X=k*2+Y,F=(w-p)*.3+S+T*.16666667,I=(g-b)*.3+k+Y*.16666667,O=Math.sqrt(F*F+I*I),D[0]=O,U=1;U<8;U++)F+=M,I+=X,M+=T,X+=Y,O+=Math.sqrt(F*F+I*I),D[U]=O;F+=M,I+=X,O+=Math.sqrt(F*F+I*I),D[8]=O,F+=M+T,I+=X+Y,O+=Math.sqrt(F*F+I*I),D[9]=O,z=0}for(R*=O;;z++){let U=D[z];if(!(R>U)){if(z==0)R/=U;else{let G=D[z-1];R=z+(R-G)/(U-G)}break}}this.addCurvePosition(R*.1,p,b,w,g,x,y,v,C,n,_,r||L>0&&j==0)}return n}addBeforePosition(t,s,r,i,l){let o=s[r],n=s[r+1],a=s[r+2]-o,h=s[r+3]-n,c=Math.atan2(h,a);i[l]=o+t*Math.cos(c),i[l+1]=n+t*Math.sin(c),i[l+2]=c}addAfterPosition(t,s,r,i,l){let o=s[r+2],n=s[r+3],a=o-s[r],h=n-s[r+1],c=Math.atan2(h,a);i[l]=o+t*Math.cos(c),i[l+1]=n+t*Math.sin(c),i[l+2]=c}addCurvePosition(t,s,r,i,l,o,n,a,h,c,u,d){if(t==0||isNaN(t)){c[u]=s,c[u+1]=r,c[u+2]=Math.atan2(l-r,i-s);return}let m=t*t,f=m*t,p=1-t,b=p*p,w=b*p,g=p*t,x=g*3,y=p*x,v=x*t,C=s*w+i*y+o*v+a*f,S=r*w+l*y+n*v+h*f;c[u]=C,c[u+1]=S,d&&(t<.001?c[u+2]=Math.atan2(l-r,i-s):c[u+2]=Math.atan2(S-(r*b+l*g*2+n*m),C-(s*b+i*g*2+o*m)))}},Ti=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.time;const c=o.worldX,u=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=u;else{let d=this.remaining,m=this.inertia,f=this.data.step,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||r){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(r){const x=(this.uy-u)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=u}if(d>=f){b=Math.pow(this.damping,60*f);const x=this.massInverse*f,y=this.strength,v=this.wind*p*a.scaleX,C=this.gravity*p*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*f,this.xVelocity*=b),r&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*f,this.yVelocity*=b),d-=f;while(d>=f)}s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||l){let x=Math.atan2(o.c,o.a),y=0,v=0,C=0,S=this.cx-o.worldX,k=this.cy-o.worldY;if(S>w?S=w:S<-w&&(S=-w),k>g?k=g:k<-g&&(k=-g),i){C=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(k+this.ty,S+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*B.invPI2-.5)*B.PI2)*m,T=this.rotateOffset*C+x,y=Math.cos(T),v=Math.sin(T),l&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(S*y+k*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(S*y+k*v)*m/T)}if(d=this.remaining,d>=f){b==-1&&(b=Math.pow(this.damping,60*f));const T=this.massInverse*f,Y=this.strength,M=this.wind,X=Yt.yDown?-this.gravity:this.gravity,F=n/p;for(;;)if(d-=f,l&&(this.scaleVelocity+=(M*y-X*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=b),i){if(this.rotateVelocity-=((M*v+X*y)*F+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=b,d<f)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(d<f)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i){let a=this.rotateOffset*t,h=0,c=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*this.data.rotate,h=Math.sin(d),c=Math.cos(d),u=o.b,o.b=c*u-h*o.d,o.d=h*u+c*o.d),d+=a*this.data.shearX,h=Math.sin(d),c=Math.cos(d),u=o.a,o.a=c*u-h*o.c,o.c=h*u+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),u=o.a,o.a=c*u-h*o.c,o.c=h*u+c*o.c,u=o.b,o.b=c*u-h*o.d,o.d=h*u+c*o.d}if(l){const a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*B.degRad,i=Math.cos(r),l=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*l-o,o*l+n*i-n)}},Ns=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new V,this.darkColor=e.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof dt)||!(this.attachment instanceof dt)||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}},Os=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Et;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,u=n.d,d=a*u-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,S=Math.atan2(c,a)-Math.atan2(v,x)+m;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=e;let k=Math.cos(S),T=Math.sin(S);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*t,g.worldY+=(x.y-g.worldY)*s}if(r!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*r)/x),g.a*=x,g.c*=x}if(i!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+u*u)-x+this.data.offsetScaleY)*i)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(u,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+f)*l;let S=Math.sqrt(x*x+y*y);g.b=Math.cos(C)*S,g.d=Math.sin(C)*S}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,u=n.d,d=a*u-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,S=Math.atan2(c,a)+m;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=e;let k=Math.cos(S),T=Math.sin(S);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*t,g.worldY+=x.y*s}if(r!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=x,g.c*=x}if(i!=0){let x=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleY)*i+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(u,h)-Math.atan2(c,a);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-B.PI/2+f)*l;let C=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*C,g.d=Math.sin(x)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],u=c.arotation;e!=0&&(u+=(o.arotation-u+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let f=c.ascaleX,p=c.ascaleY;r!=0&&f!=0&&(f=(f+(o.ascaleX-f+this.data.offsetScaleX)*r)/f),i!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*i)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(d,m,u,f,p,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],u=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,m=c.ay+(o.ay+this.data.offsetY)*s,f=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(d,m,u,f,p,c.ashearX,b)}}},Yt=class fs{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return fs.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=t.bones[s],i;if(!r.parent)i=new Ge(r,this,null);else{let l=this.bones[r.parent.index];i=new Ge(r,this,l),l.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let r=t.slots[s],i=this.bones[r.boneData.index],l=new Ns(r,i);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let r=t.ikConstraints[s];this.ikConstraints.push(new Ls(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new Os(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new Vs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new Ti(r,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let f=s[d];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let p=this.bones[d[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let r=this.ikConstraints,i=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=r.length,a=i.length,h=l.length,c=this.physicsConstraints.length,u=n+a+h+c;t:for(let d=0;d<u;d++){for(let m=0;m<n;m++){let f=r[m];if(f.data.order==d){this.sortIkConstraint(f);continue t}}for(let m=0;m<a;m++){let f=i[m];if(f.data.order==d){this.sortTransformConstraint(f);continue t}}for(let m=0;m<h;m++){let f=l[m];if(f.data.order==d){this.sortPathConstraint(f);continue t}}for(let m=0;m<c;m++){const f=o[m];if(f.data.order==d){this.sortPhysicsConstraint(f);continue t}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let r=t.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let l=r[r.length-1];this.sortBone(l),this._updateCache.push(t),this.sortReset(i.children),l.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,i);let l=s.getAttachment();l instanceof Mt&&this.sortPathConstraintAttachmentWith(l,i);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,r=s.length;if(t.data.local)for(let i=0;i<r;i++){let l=s[i];this.sortBone(l.parent),this.sortBone(l)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(t);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(t,s,r){let i=t.attachments[s];if(i)for(let l in i)this.sortPathConstraintAttachmentWith(i[l],r)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Mt))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let l=0,o=r.length;l<o;){let n=r[l++];for(n+=l;l<n;)this.sortBone(i[r[l++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,r=t.length;s<r;s++){let i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,l=s.length;i<l;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,l=r.length;i<l;i++)r[i].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let b=1,w=r.length;b<w;b++){let g=r[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;i.worldX=l*this.x+o*this.y+s.worldX,i.worldY=n*this.x+a*this.y+s.worldY;const h=(i.rotation+i.shearX)*B.degRad,c=(i.rotation+90+i.shearY)*B.degRad,u=Math.cos(h)*i.scaleX,d=Math.cos(c)*i.scaleY,m=Math.sin(h)*i.scaleX,f=Math.sin(c)*i.scaleY;i.a=(l*u+o*m)*this.scaleX,i.b=(l*d+o*f)*this.scaleX,i.c=(n*u+a*m)*this.scaleY,i.d=(n*d+a*f)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=i&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;E.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,r=t.length;s<r;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let l=s[r];if(l.data.name==t)return l}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let l=s[r];if(l.data.name==t)return l}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let l=s[r],o=l.data.attachmentName;if(o){let n=t.getAttachment(r,o);n&&l.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let r=this.data.findSlot(t);if(!r)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(r.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(t,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,l=r.length;i<l;i++){let o=r[i];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(i,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Et,r=new Et;return this.getBounds(s,r,void 0,t),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(t,s,r=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let l=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let c=0,u=l.length;c<u;c++){let d=l[c];if(!d.bone.active)continue;let m=0,f=null,p=null,b=d.getAttachment();if(b instanceof ot)m=8,f=E.setArraySize(r,m,0),b.computeWorldVertices(d,f,0,2),p=fs.quadTriangles;else if(b instanceof ut){let w=b;m=w.worldVerticesLength,f=E.setArraySize(r,m,0),w.computeWorldVertices(d,0,m,f,0,2),p=w.triangles}else if(b instanceof St&&i!=null){i.clipStart(d,b);continue}if(f&&p){i!=null&&i.isClipping()&&(i.clipTriangles(f,p,p.length),f=i.clippedVertices,m=i.clippedVertices.length);for(let w=0,g=f.length;w<g;w+=2){let x=f[w],y=f[w+1];o=Math.min(o,x),n=Math.min(n,y),a=Math.max(a,x),h=Math.max(h,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(o,n),s.set(a-o,h-n)}update(t){this.time+=t}physicsTranslate(t,s){const r=this.physicsConstraints;for(let i=0,l=r.length;i<l;i++)r[i].translate(t,s)}physicsRotate(t,s,r){const i=this.physicsConstraints;for(let l=0,o=i.length;l<o;l++)i[l].rotate(t,s,r)}},_s=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(_s||{}),Us=class extends Dt{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Lt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}},ts=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Vt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){l=!0;break}l||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){l=!0;break}l||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){l=!0;break}l||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){l=!0;break}l||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof ut?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new ts(t,r,i))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new ts(e,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let i=e.slots[r],l=i.getAttachment();if(l&&s<t.attachments.length){let o=t.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&i.setAttachment(h);break}}}s++}}},es=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},ss=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(ss||{}),is=class extends Dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},qs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Lt;s.name="";let r=new Ws(e),i=r.readInt32(),l=r.readInt32();s.hash=l==0&&i==0?null:l.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let u=h==0?null:s.bones[r.readInt(!0)],d=new ze(h,c,u);d.rotation=r.readFloat(),d.x=r.readFloat()*t,d.y=r.readFloat()*t,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*t,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),o&&(V.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let u=s.bones[r.readInt(!0)],d=new es(h,c,u);V.rgba8888ToColor(d.color,r.readInt32());let m=r.readInt32();m!=-1&&V.rgb888ToColor(d.darkColor=new V,m),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),o&&(d.visible=r.readBoolean()),s.slots.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){let u=r.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new je(u);d.order=r.readInt(!0),c=r.readInt(!0);for(let f=0;f<c;f++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(d.softness=r.readFloat()*t),s.ikConstraints.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){let u=r.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new is(u);d.order=r.readInt(!0),c=r.readInt(!0);for(let f=0;f<c;f++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=r.readFloat()),(m&16)!=0&&(d.offsetX=r.readFloat()*t),(m&32)!=0&&(d.offsetY=r.readFloat()*t),(m&64)!=0&&(d.offsetScaleX=r.readFloat()),(m&128)!=0&&(d.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(d.offsetShearY=r.readFloat()),(m&2)!=0&&(d.mixRotate=r.readFloat()),(m&4)!=0&&(d.mixX=r.readFloat()),(m&8)!=0&&(d.mixY=r.readFloat()),(m&16)!=0&&(d.mixScaleX=r.readFloat()),(m&32)!=0&&(d.mixScaleY=r.readFloat()),(m&64)!=0&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){let u=r.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new Je(u);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let f=0;f<c;f++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const m=r.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){const u=r.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Us(u);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=r.readFloat()),(m&4)!=0&&(d.y=r.readFloat()),(m&8)!=0&&(d.rotate=r.readFloat()),(m&16)!=0&&(d.scaleX=r.readFloat()),(m&32)!=0&&(d.shearX=r.readFloat()),d.limit=((m&64)!=0?r.readFloat():5e3)*t,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=(m&128)!=0?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(d)}let a=this.readSkin(r,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+r.readInt(!0));h<n;h++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];const u=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let u=new $e(c);u.intValue=r.readInt(!1),u.floatValue=r.readFloat(),u.stringValue=r.readString(),u.audioPath=r.readString(),u.audioPath&&(u.volume=r.readFloat(),u.balance=r.readFloat()),s.events.push(u)}n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(e,t,s,r){let i=null,l=0;if(s){if(l=e.readInt(!0),l==0)return null;i=new Vt("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");i=new Vt(o),r&&V.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let n=0,a=i.bones.length;n<a;n++)i.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);l=e.readInt(!0)}for(let o=0;o<l;o++){let n=e.readInt(!0);for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let u=this.readAttachment(e,t,i,n,c,r);u&&i.setAttachment(n,c,u)}}return i}readAttachment(e,t,s,r,i,l){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():i;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let h=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,u=(n&64)!=0?this.readSequence(e):null;let d=(n&128)!=0?e.readFloat():0,m=e.readFloat(),f=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,u);return x?(x.path=h,x.x=m*o,x.y=f*o,x.scaleX=p,x.scaleY=b,x.rotation=d,x.width=w*o,x.height=g*o,V.rgba8888ToColor(x.color,c),x.sequence=u,u==null&&x.updateRegion(),x):null}case 1:{let h=this.readVertices(e,(n&16)!=0),c=l?e.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,a);return u?(u.worldVerticesLength=h.length,u.vertices=h.vertices,u.bones=h.bones,l&&V.rgba8888ToColor(u.color,c),u):null}case 2:{let h=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,u=(n&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),f=this.readFloatArray(e,m.length,1),p=this.readShortArray(e,(m.length-d-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,u);return x?(x.path=h,V.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=f,u==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=u,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case 3:{const h=(n&16)!=0?e.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,u=(n&64)!=0?this.readSequence(e):null,d=(n&128)!=0,m=e.readInt(!0),f=e.readStringRef();let p=0,b=0;l&&(p=e.readFloat(),b=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,u);return w?(w.path=h,V.rgba8888ToColor(w.color,c),w.sequence=u,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Ii(w,m,r,f,d)),w):null}case 4:{const h=(n&16)!=0,c=(n&32)!=0,u=this.readVertices(e,(n&64)!=0),d=E.newArray(u.length/6,0);for(let p=0,b=d.length;p<b;p++)d[p]=e.readFloat()*o;const m=l?e.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=h,f.constantSpeed=c,f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,f.lengths=d,l&&V.rgba8888ToColor(f.color,m),f):null}case 5:{const h=e.readFloat(),c=e.readFloat(),u=e.readFloat(),d=l?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=u*o,m.rotation=h,l&&V.rgba8888ToColor(m.color,d),m):null}case 6:{const h=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let u=l?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,a);return d?(d.endSlot=t.slots[h],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,l&&V.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(e){let t=new ws(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,r=e.readInt(!0),i=new Mi;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let l=new Array,o=new Array;for(let n=0;n<r;n++){let a=e.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(e.readInt(!0)),l.push(e.readFloat()*s),l.push(e.readFloat()*s),l.push(e.readFloat())}return i.vertices=E.toFloatArray(l),i.bones=o,i}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let i=0;i<t;i++)r[i]=e.readFloat();else for(let i=0;i<t;i++)r[i]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,i=this.scale;for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let m=e.readByte(),f=e.readInt(!0),p=f-1;switch(m){case Oi:{let b=new Ct(f,c);for(let w=0;w<f;w++)b.setFrame(w,e.readFloat(),e.readStringRef());r.push(b);break}case _i:{let b=e.readInt(!0),w=new be(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let S=0,k=0;w.setFrame(S,g,x,y,v,C),S!=p;S++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(S);break;case mt:q(e,w,k++,S,0,g,T,x,Y,1),q(e,w,k++,S,1,g,T,y,M,1),q(e,w,k++,S,2,g,T,v,X,1),q(e,w,k++,S,3,g,T,C,F,1)}g=T,x=Y,y=M,v=X,C=F}r.push(w);break}case Ui:{let b=e.readInt(!0),w=new we(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let C=0,S=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(C);break;case mt:q(e,w,S++,C,0,g,k,x,T,1),q(e,w,S++,C,1,g,k,y,Y,1),q(e,w,S++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}r.push(w);break}case qi:{let b=e.readInt(!0),w=new ve(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,S,k,T),Y!=p;Y++){let X=e.readFloat(),F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(Y);break;case mt:q(e,w,M++,Y,0,g,X,x,F,1),q(e,w,M++,Y,1,g,X,y,I,1),q(e,w,M++,Y,2,g,X,v,P,1),q(e,w,M++,Y,3,g,X,C,D,1),q(e,w,M++,Y,4,g,X,S,O,1),q(e,w,M++,Y,5,g,X,k,L,1),q(e,w,M++,Y,6,g,X,T,_,1)}g=X,x=F,y=I,v=P,C=D,S=O,k=L,T=_}r.push(w);break}case Wi:{let b=e.readInt(!0),w=new Ce(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,S,k),T!=p;T++){let M=e.readFloat(),X=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(T);break;case mt:q(e,w,Y++,T,0,g,M,x,X,1),q(e,w,Y++,T,1,g,M,y,F,1),q(e,w,Y++,T,2,g,M,v,I,1),q(e,w,Y++,T,3,g,M,C,P,1),q(e,w,Y++,T,4,g,M,S,D,1),q(e,w,Y++,T,5,g,M,k,O,1)}g=M,x=X,y=F,v=I,C=P,S=D,k=O}r.push(w);break}case zi:{let b=new ye(f,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case ft:b.setStepped(x);break;case mt:q(e,b,y++,x,0,w,v,g,C,1)}w=v,g=C}r.push(b)}}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let m=e.readByte(),f=e.readInt(!0);if(m==Ni){let b=new xe(f,c);for(let w=0;w<f;w++)b.setFrame(w,e.readFloat(),e.readByte());r.push(b);continue}let p=e.readInt(!0);switch(m){case Yi:r.push(Q(e,new Rt(f,p,c),1));break;case Pi:r.push(rs(e,new le(f,p,c),i));break;case Xi:r.push(Q(e,new he(f,p,c),i));break;case Fi:r.push(Q(e,new ce(f,p,c),i));break;case Bi:r.push(rs(e,new de(f,p,c),1));break;case Ei:r.push(Q(e,new ue(f,p,c),1));break;case Ri:r.push(Q(e,new fe(f,p,c),1));break;case Di:r.push(rs(e,new me(f,p,c),1));break;case Li:r.push(Q(e,new ge(f,p,c),1));break;case Vi:r.push(Q(e,new pe(f,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),u=e.readInt(!0),d=u-1,m=new Ae(u,e.readInt(!0),c),f=e.readByte(),p=e.readFloat(),b=(f&1)!=0?(f&2)!=0?e.readFloat():1:0,w=(f&4)!=0?e.readFloat()*i:0;for(let g=0,x=0;m.setFrame(g,p,b,w,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),g!=d;g++){f=e.readByte();const y=e.readFloat(),v=(f&1)!=0?(f&2)!=0?e.readFloat():1:0,C=(f&4)!=0?e.readFloat()*i:0;(f&64)!=0?m.setStepped(g):(f&128)!=0&&(q(e,m,x++,g,0,p,y,b,v,1),q(e,m,x++,g,1,p,y,w,C,i)),p=y,b=v,w=C}r.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),u=e.readInt(!0),d=u-1,m=new ke(u,e.readInt(!0),c),f=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,C=0;m.setFrame(v,f,p,b,w,g,x,y),v!=d;v++){let S=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),X=e.readFloat(),F=e.readFloat();switch(e.readByte()){case ft:m.setStepped(v);break;case mt:q(e,m,C++,v,0,f,S,p,k,1),q(e,m,C++,v,1,f,S,b,T,1),q(e,m,C++,v,2,f,S,w,Y,1),q(e,m,C++,v,3,f,S,g,M,1),q(e,m,C++,v,4,f,S,x,X,1),q(e,m,C++,v,5,f,S,y,F,1)}f=S,p=k,b=T,w=Y,g=M,x=X,y=F}r.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),u=s.pathConstraints[c];for(let d=0,m=e.readInt(!0);d<m;d++){const f=e.readByte(),p=e.readInt(!0),b=e.readInt(!0);switch(f){case $i:r.push(Q(e,new Te(p,b,c),u.positionMode==0?i:1));break;case ji:r.push(Q(e,new Ie(p,b,c),u.spacingMode==0||u.spacingMode==1?i:1));break;case Ji:let w=new Me(p,b,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let C=0,S=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),X=e.readFloat();switch(e.readByte()){case ft:w.setStepped(C);break;case mt:q(e,w,S++,C,0,g,T,x,Y,1),q(e,w,S++,C,1,g,T,y,M,1),q(e,w,S++,C,2,g,T,v,X,1)}g=T,x=Y,y=M,v=X}r.push(w)}}}for(let a=0,h=e.readInt(!0);a<h;a++){const c=e.readInt(!0)-1;for(let u=0,d=e.readInt(!0);u<d;u++){const m=e.readByte(),f=e.readInt(!0);if(m==rr){const b=new De(f,c);for(let w=0;w<f;w++)b.setFrame(w,e.readFloat());r.push(b);continue}const p=e.readInt(!0);switch(m){case Ki:r.push(Q(e,new Ye(f,p,c),1));break;case Qi:r.push(Q(e,new Pe(f,p,c),1));break;case Zi:r.push(Q(e,new Xe(f,p,c),1));break;case tr:r.push(Q(e,new Fe(f,p,c),1));break;case er:r.push(Q(e,new Be(f,p,c),1));break;case sr:r.push(Q(e,new Ee(f,p,c),1));break;case ir:r.push(Q(e,new Re(f,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=s.skins[e.readInt(!0)];for(let u=0,d=e.readInt(!0);u<d;u++){let m=e.readInt(!0);for(let f=0,p=e.readInt(!0);f<p;f++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case Gi:{let v=w,C=v.bones,S=v.vertices,k=C?S.length/3*2:S.length,T=e.readInt(!0),Y=new Se(x,T,m,v),M=e.readFloat();for(let X=0,F=0;;X++){let I,P=e.readInt(!0);if(P==0)I=C?E.newFloatArray(k):S;else{I=E.newFloatArray(k);let O=e.readInt(!0);if(P+=O,i==1)for(let L=O;L<P;L++)I[L]=e.readFloat();else for(let L=O;L<P;L++)I[L]=e.readFloat()*i;if(!C)for(let L=0,_=I.length;L<_;L++)I[L]+=S[L]}if(Y.setFrame(X,M,I),X==y)break;let D=e.readFloat();switch(e.readByte()){case ft:Y.setStepped(X);break;case mt:q(e,Y,F++,X,0,M,D,0,1,1)}M=D}r.push(Y);break}case Hi:{let v=new Le(x,m,w);for(let C=0;C<x;C++){let S=e.readFloat(),k=e.readInt32();v.setFrame(C,S,vs[k&15],k>>4,e.readFloat())}r.push(v);break}}}}}let l=e.readInt(!0);if(l>0){let a=new It(l),h=s.slots.length;for(let c=0;c<l;c++){let u=e.readFloat(),d=e.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let f=E.newArray(h-d,0),p=0,b=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;p!=g;)f[b++]=p++;m[p+e.readInt(!0)]=p++}for(;p<h;)f[b++]=p++;for(let w=h-1;w>=0;w--)m[w]==-1&&(m[w]=f[--b]);a.setFrame(c,u,m)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=new Wt(o);for(let h=0;h<o;h++){let c=e.readFloat(),u=s.events[e.readInt(!0)],d=new He(c,u);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),a.setFrame(h,d)}r.push(a)}let n=0;for(let a=0,h=r.length;a<h;a++)n=Math.max(n,r[a].getDuration());return new Ut(t,r,n)}},Ws=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let r=0;r<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(i),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ii=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},Mi=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function Q(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let l=0,o=0,n=t.getFrameCount()-1;t.setFrame(l,r,i),l!=n;l++){let a=e.readFloat(),h=e.readFloat()*s;switch(e.readByte()){case ft:t.setStepped(l);break;case mt:q(e,t,o++,l,0,r,a,i,h,s)}r=a,i=h}return t}function rs(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,l=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,l),o!=a;o++){let h=e.readFloat(),c=e.readFloat()*s,u=e.readFloat()*s;switch(e.readByte()){case ft:t.setStepped(o);break;case mt:q(e,t,n++,o,0,r,h,i,c,s),q(e,t,n++,o,1,r,h,l,u,s)}r=h,i=c,l=u}return t}function q(e,t,s,r,i,l,o,n,a,h){t.setBezier(s,r,i,l,n,e.readFloat(),e.readFloat()*h,e.readFloat(),e.readFloat()*h,o,a)}var Yi=0,Pi=1,Xi=2,Fi=3,Bi=4,Ei=5,Ri=6,Di=7,Li=8,Vi=9,Ni=10,Oi=0,_i=1,Ui=2,qi=3,Wi=4,zi=5,Gi=0,Hi=1,$i=0,ji=1,Ji=2,Ki=0,Qi=1,Zi=2,tr=4,er=5,sr=6,ir=7,rr=8,ft=1,mt=2,ns=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Tt(()=>E.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,l=e.slots,o=l.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof Ue){let c=h;s.push(c);let u=i.obtain();u.length!=c.worldVerticesLength&&(u=E.newFloatArray(c.worldVerticesLength)),r.push(u),c.computeWorldVertices(a,0,c.worldVerticesLength,u,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let l=0,o=i.length;l<o;l++){let n=i[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let u=a[h],d=a[h+1];e=Math.min(e,u),t=Math.min(t,d),s=Math.max(s,u),r=Math.max(r,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let i=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=l&&r<=l||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),h=a*(i-e)+t;if(h>l&&h<n||(h=a*(o-e)+t,h>l&&h<n))return!0;let c=(l-t)/a+e;return c>i&&c<o||(c=(n-t)/a+e,c>i&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,i=e.length,l=i-2,o=!1;for(let n=0;n<i;n+=2){let a=r[n+1],h=r[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=r[n];c+(s-a)/(h-a)*(r[l]-c)<t&&(o=!o)}l=n}return o}intersectsSegment(e,t,s,r){let i=this.polygons;for(let l=0,o=i.length;l<o;l++)if(this.intersectsSegmentPolygon(i[l],e,t,s,r))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(e,t,s,r,i){let l=e,o=e.length,n=t-r,a=s-i,h=t*i-s*r,c=l[o-2],u=l[o-1];for(let d=0;d<o;d+=2){let m=l[d],f=l[d+1],p=c*f-u*m,b=c-m,w=u-f,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=r||x>=r&&x<=t)){let y=(h*w-a*p)/g;if((y>=u&&y<=f||y>=f&&y<=u)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,u=f}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},zs=class rt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Tt(()=>new Array);polygonIndicesPool=new Tt(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n<r;n++)i[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=r;n<a;++n)l[n]=rt.isConcave(n,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let n=r-1,a=0,h=1;for(;;){t:if(!l[a]){let d=i[n]<<1,m=i[a]<<1,f=i[h]<<1,p=s[d],b=s[d+1],w=s[m],g=s[m+1],x=s[f],y=s[f+1];for(let v=(h+1)%r;v!=n;v=(v+1)%r){if(!l[v])continue;let C=i[v]<<1,S=s[C],k=s[C+1];if(rt.positiveArea(x,y,p,b,S,k)&&rt.positiveArea(p,b,w,g,S,k)&&rt.positiveArea(w,g,x,y,S,k))break t}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),l.splice(a,1),r--;let c=(r+a-1)%r,u=a==r?0:a;l[c]=rt.isConcave(c,r,s,i),l[u]=rt.isConcave(u,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(t,s){let r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=0;for(let c=0,u=s.length;c<u;c+=3){let d=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,p=r[d],b=r[d+1],w=r[m],g=r[m+1],x=r[f],y=r[f+1],v=!1;if(a==d){let C=n.length-4,S=rt.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=rt.winding(x,y,n[0],n[1],n[2],n[3]);S==h&&k==h&&(n.push(x),n.push(y),o.push(f),v=!0)}v||(n.length>0?(i.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(f),h=rt.winding(p,b,w,g,x,y),a=d)}n.length>0&&(i.push(n),l.push(o));for(let c=0,u=i.length;c<u;c++){if(o=l[c],o.length==0)continue;let d=o[0],m=o[o.length-1];n=i[c];let f=n.length-4,p=n[f],b=n[f+1],w=n[f+2],g=n[f+3],x=n[0],y=n[1],v=n[2],C=n[3],S=rt.winding(p,b,w,g,x,y);for(let k=0;k<u;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],X=T[2],F=i[k],I=F[F.length-2],P=F[F.length-1];if(Y!=d||M!=m)continue;let D=rt.winding(p,b,w,g,I,P),O=rt.winding(I,P,x,y,v,C);D==S&&O==S&&(F.length=0,T.length=0,n.push(I),n.push(P),o.push(X),p=w,b=g,w=I,g=P,k=0)}}for(let c=i.length-1;c>=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let l=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[l],r[l+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,l,o){return t*(o-i)+r*(s-o)+l*(i-s)>=0}static winding(t,s,r,i,l,o){let n=r-t,a=i-s;return l*a-o*n+n*s-t*a>=0?1:-1}},Jt=class ms{triangulator=new zs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=E.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let l=this.clippingPolygon;ms.makeClockwise(l);let o=this.clippingPolygons=this.triangulator.decompose(l,this.triangulator.triangulate(l));for(let n=0,a=o.length;n<a;n++){let h=o[n];ms.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,s,r,i,l,o,n,a){let h,c,u,d,m,f;typeof s=="number"?(h=r,c=i,u=l,d=o,m=n,f=a):(h=s,c=r,u=i,d=l,m=o,f=n),u&&d&&m&&typeof f=="boolean"?this.clipTrianglesRender(t,h,c,u,d,m,f):this.clipTrianglesNoRender(t,h,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<r;c+=3){let u=s[c]<<1,d=t[u],m=t[u+1];u=s[c+1]<<1;let f=t[u],p=t[u+1];u=s[c+2]<<1;let b=t[u],w=t[u+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(d,m,f,p,b,w,n[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,S=E.setArraySize(l,x+v*2);for(let T=0;T<y;T+=2,x+=2){let Y=C[T],M=C[T+1];S[x]=Y,S[x+1]=M}x=o.length;let k=E.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)k[x]=h,k[x+1]=h+T,k[x+2]=h+T+1;h+=v+1}else{let y=E.setArraySize(l,x+6);y[x]=d,y[x+1]=m,y[x+2]=f,y[x+3]=p,y[x+4]=b,y[x+5]=w,x=o.length;let v=E.setArraySize(o,x+3);v[x]=h,v[x+1]=h+1,v[x+2]=h+2,h+=3;break}}}}clipTrianglesRender(t,s,r,i,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,u=this.clippingPolygons,d=u.length,m=n?12:8,f=0;h.length=0,c.length=0;for(let p=0;p<r;p+=3){let b=s[p]<<1,w=t[b],g=t[b+1],x=i[b],y=i[b+1];b=s[p+1]<<1;let v=t[b],C=t[b+1],S=i[b],k=i[b+1];b=s[p+2]<<1;let T=t[b],Y=t[b+1],M=i[b],X=i[b+1];for(let F=0;F<d;F++){let I=h.length;if(this.clip(w,g,v,C,T,Y,u[F],a)){let P=a.length;if(P==0)continue;let D=C-Y,O=T-v,L=w-T,_=Y-g,H=1/(D*L+O*(g-Y)),z=P>>1,j=this.clipOutput,R=E.setArraySize(h,I+z*m);for(let G=0;G<P;G+=2,I+=m){let st=j[G],J=j[G+1];R[I]=st,R[I+1]=J,R[I+2]=l.r,R[I+3]=l.g,R[I+4]=l.b,R[I+5]=l.a;let Z=st-T,tt=J-Y,ht=(D*Z+O*tt)*H,Xt=(_*Z+L*tt)*H,Ot=1-ht-Xt;R[I+6]=x*ht+S*Xt+M*Ot,R[I+7]=y*ht+k*Xt+X*Ot,n&&(R[I+8]=o.r,R[I+9]=o.g,R[I+10]=o.b,R[I+11]=o.a)}I=c.length;let U=E.setArraySize(c,I+3*(z-2));z--;for(let G=1;G<z;G++,I+=3)U[I]=f,U[I+1]=f+G,U[I+2]=f+G+1;f+=z+1}else{let P=E.setArraySize(h,I+3*m);P[I]=w,P[I+1]=g,P[I+2]=l.r,P[I+3]=l.g,P[I+4]=l.b,P[I+5]=l.a,n?(P[I+6]=x,P[I+7]=y,P[I+8]=o.r,P[I+9]=o.g,P[I+10]=o.b,P[I+11]=o.a,P[I+12]=v,P[I+13]=C,P[I+14]=l.r,P[I+15]=l.g,P[I+16]=l.b,P[I+17]=l.a,P[I+18]=S,P[I+19]=k,P[I+20]=o.r,P[I+21]=o.g,P[I+22]=o.b,P[I+23]=o.a,P[I+24]=T,P[I+25]=Y,P[I+26]=l.r,P[I+27]=l.g,P[I+28]=l.b,P[I+29]=l.a,P[I+30]=M,P[I+31]=X,P[I+32]=o.r,P[I+33]=o.g,P[I+34]=o.b,P[I+35]=o.a):(P[I+6]=x,P[I+7]=y,P[I+8]=v,P[I+9]=C,P[I+10]=l.r,P[I+11]=l.g,P[I+12]=l.b,P[I+13]=l.a,P[I+14]=S,P[I+15]=k,P[I+16]=T,P[I+17]=Y,P[I+18]=l.r,P[I+19]=l.g,P[I+20]=l.b,P[I+21]=l.a,P[I+22]=M,P[I+23]=X),I=c.length;let D=E.setArraySize(c,I+3);D[I]=f,D[I+1]=f+1,D[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(t,s,r,i){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,u=0;o.length=0,n.length=0,a.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,f=t[m],p=t[m+1],b=i[m],w=i[m+1];m=s[d+1]<<1;let g=t[m],x=t[m+1],y=i[m],v=i[m+1];m=s[d+2]<<1;let C=t[m],S=t[m+1],k=i[m],T=i[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(f,p,g,x,C,S,h[Y],l)){let X=l.length;if(X==0)continue;let F=x-S,I=C-g,P=f-C,D=S-p,O=1/(F*P+I*(p-S)),L=X>>1,_=this.clipOutput,H=E.setArraySize(o,M+L*2),z=E.setArraySize(n,M+L*2);for(let R=0;R<X;R+=2,M+=2){let U=_[R],G=_[R+1];H[M]=U,H[M+1]=G;let st=U-C,J=G-S,Z=(F*st+I*J)*O,tt=(D*st+P*J)*O,ht=1-Z-tt;z[M]=b*Z+y*tt+k*ht,z[M+1]=w*Z+v*tt+T*ht}M=a.length;let j=E.setArraySize(a,M+3*(L-2));L--;for(let R=1;R<L;R++,M+=3)j[M]=u,j[M+1]=u+R,j[M+2]=u+R+1;u+=L+1}else{let X=E.setArraySize(o,M+6);X[M]=f,X[M+1]=p,X[M+2]=g,X[M+3]=x,X[M+4]=C,X[M+5]=S;let F=E.setArraySize(n,M+3*2);F[M]=b,F[M+1]=w,F[M+2]=y,F[M+3]=v,F[M+4]=k,F[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=u,I[M+1]=u+1,I[M+2]=u+2,u+=3;break}}}}clip(t,s,r,i,l,o,n,a){let h=a,c=!1,u;n.length%4>=2?(u=a,a=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(s),u.push(r),u.push(i),u.push(l),u.push(o),u.push(t),u.push(s),a.length=0;let d=n.length-4,m=n;for(let f=0;;f+=2){let p=m[f],b=m[f+1],w=p-m[f+2],g=b-m[f+3],x=a.length,y=u;for(let C=0,S=u.length-2;C<S;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],X=g*(p-Y)>w*(b-M),F=g*(p-k)-w*(b-T);if(F>0){if(X){a.push(Y),a.push(M);continue}let I=Y-k,P=M-T,D=F/(I*g-P*w);if(D>=0&&D<=1)a.push(k+I*D),a.push(T+P*D);else{a.push(Y),a.push(M);continue}}else if(X){let I=Y-k,P=M-T,D=F/(I*g-P*w);if(D>=0&&D<=1)a.push(k+I*D),a.push(T+P*D),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==d)break;let v=a;a=u,a.length=0,u=v}if(h!=a){h.length=0;for(let f=0,p=a.length-2;f<p;f++)h[f]=a[f]}else h.length=h.length-2;return c}static makeClockwise(t){let s=t,r=t.length,i=s[r-2]*s[1]-s[0]*s[r-1],l=0,o=0,n=0,a=0;for(let h=0,c=r-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],i+=l*a-n*o;if(!(i<0))for(let h=0,c=r-2,u=r>>1;h<u;h+=2){let d=s[h],m=s[h+1],f=c-h;s[h]=s[f],s[h+1]=s[f+1],s[f]=d,s[f+1]=m}}},Gs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Lt,r=typeof e=="string"?JSON.parse(e):e,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=A(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let l=0;l<r.bones.length;l++){let o=r.bones[l],n=null,a=A(o,"parent",null);a&&(n=s.findBone(a));let h=new ze(s.bones.length,o.name,n);h.length=A(o,"length",0)*t,h.x=A(o,"x",0)*t,h.y=A(o,"y",0)*t,h.rotation=A(o,"rotation",0),h.scaleX=A(o,"scaleX",1),h.scaleY=A(o,"scaleY",1),h.shearX=A(o,"shearX",0),h.shearY=A(o,"shearY",0),h.inherit=E.enumValue(jt,A(o,"inherit","Normal")),h.skinRequired=A(o,"skin",!1);let c=A(o,"color",null);c&&h.color.setFromString(c),s.bones.push(h)}if(r.slots)for(let l=0;l<r.slots.length;l++){let o=r.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new es(s.slots.length,n,a),c=A(o,"color",null);c&&h.color.setFromString(c);let u=A(o,"dark",null);u&&(h.darkColor=V.fromString(u)),h.attachmentName=A(o,"attachment",null),h.blendMode=E.enumValue(ss,A(o,"blend","normal")),h.visible=A(o,"visible",!0),s.slots.push(h)}if(r.ik)for(let l=0;l<r.ik.length;l++){let o=r.ik[l],n=new je(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let c=s.findBone(o.bones[h]);if(!c)throw new Error(`Couldn't find bone ${o.bones[h]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=A(o,"mix",1),n.softness=A(o,"softness",0)*t,n.bendDirection=A(o,"bendPositive",!0)?1:-1,n.compress=A(o,"compress",!1),n.stretch=A(o,"stretch",!1),n.uniform=A(o,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let l=0;l<r.transform.length;l++){let o=r.transform[l],n=new is(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=o.bones[c],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${o.name}.`);n.bones.push(d)}let a=o.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=h,n.local=A(o,"local",!1),n.relative=A(o,"relative",!1),n.offsetRotation=A(o,"rotation",0),n.offsetX=A(o,"x",0)*t,n.offsetY=A(o,"y",0)*t,n.offsetScaleX=A(o,"scaleX",0),n.offsetScaleY=A(o,"scaleY",0),n.offsetShearY=A(o,"shearY",0),n.mixRotate=A(o,"mixRotate",1),n.mixX=A(o,"mixX",1),n.mixY=A(o,"mixY",n.mixX),n.mixScaleX=A(o,"mixScaleX",1),n.mixScaleY=A(o,"mixScaleY",n.mixScaleX),n.mixShearY=A(o,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let l=0;l<r.path.length;l++){let o=r.path[l],n=new Je(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=o.bones[c],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${o.name}.`);n.bones.push(d)}let a=o.target,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=h,n.positionMode=E.enumValue(Ke,A(o,"positionMode","Percent")),n.spacingMode=E.enumValue(Qe,A(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Ze,A(o,"rotateMode","Tangent")),n.offsetRotation=A(o,"rotation",0),n.position=A(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=A(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=A(o,"mixRotate",1),n.mixX=A(o,"mixX",1),n.mixY=A(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let l=0;l<r.physics.length;l++){const o=r.physics[l],n=new Us(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);const a=o.bone,h=s.findBone(a);if(h==null)throw new Error("Physics bone not found: "+a);n.bone=h,n.x=A(o,"x",0),n.y=A(o,"y",0),n.rotate=A(o,"rotate",0),n.scaleX=A(o,"scaleX",0),n.shearX=A(o,"shearX",0),n.limit=A(o,"limit",5e3)*t,n.step=1/A(o,"fps",60),n.inertia=A(o,"inertia",1),n.strength=A(o,"strength",100),n.damping=A(o,"damping",1),n.massInverse=1/A(o,"mass",1),n.wind=A(o,"wind",0),n.gravity=A(o,"gravity",0),n.mix=A(o,"mix",1),n.inertiaGlobal=A(o,"inertiaGlobal",!1),n.strengthGlobal=A(o,"strengthGlobal",!1),n.dampingGlobal=A(o,"dampingGlobal",!1),n.massGlobal=A(o,"massGlobal",!1),n.windGlobal=A(o,"windGlobal",!1),n.gravityGlobal=A(o,"gravityGlobal",!1),n.mixGlobal=A(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let l=0;l<r.skins.length;l++){let o=r.skins[l],n=new Vt(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let u in c){let d=this.readAttachment(c[u],n,h.index,u,s);d&&n.setAttachment(h.index,u,d)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let l in r.events){let o=r.events[l],n=new $e(l);n.intValue=A(o,"int",0),n.floatValue=A(o,"float",0),n.stringValue=A(o,"string",""),n.audioPath=A(o,"audio",null),n.audioPath&&(n.volume=A(o,"volume",1),n.balance=A(o,"balance",0)),s.events.push(n)}if(r.animations)for(let l in r.animations){let o=r.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(e,t,s,r,i){let l=this.scale;switch(r=A(e,"name",r),A(e,"type","region")){case"region":{let o=A(e,"path",r),n=this.readSequence(A(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,r,o,n);if(!a)return null;a.path=o,a.x=A(e,"x",0)*l,a.y=A(e,"y",0)*l,a.scaleX=A(e,"scaleX",1),a.scaleY=A(e,"scaleY",1),a.rotation=A(e,"rotation",0),a.width=e.width*l,a.height=e.height*l,a.sequence=n;let h=A(e,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=A(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=A(e,"path",r),n=this.readSequence(A(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,r,o,n);if(!a)return null;a.path=o;let h=A(e,"color",null);h&&a.color.setFromString(h),a.width=A(e,"width",0)*l,a.height=A(e,"height",0)*l,a.sequence=n;let c=A(e,"parent",null);if(c)return this.linkedMeshes.push(new nr(a,A(e,"skin",null),s,c,A(e,"timelines",!0))),a;let u=e.uvs;return this.readVertices(e,a,u.length),a.triangles=e.triangles,a.regionUVs=u,a.region!=null&&a.updateRegion(),a.edges=A(e,"edges",null),a.hullLength=A(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=A(e,"closed",!1),o.constantSpeed=A(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*l;o.lengths=a;let h=A(e,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=A(e,"x",0)*l,o.y=A(e,"y",0)*l,o.rotation=A(e,"rotation",0);let n=A(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let n=A(e,"end",null);n&&(o.endSlot=i.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let h=A(e,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(e){if(e==null)return null;let t=new ws(A(e,"count",0));return t.start=A(e,"start",1),t.digits=A(e,"digits",0),t.setupIndex=A(e,"setup",0),t}readVertices(e,t,s){let r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let n=E.toFloatArray(i);if(r!=1)for(let a=0,h=i.length;a<h;a++)n[a]*=r;t.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=i.length;n<a;){let h=i[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(i[n]),l.push(i[n+1]*r),l.push(i[n+2]*r),l.push(i[n+3])}t.bones=o,t.vertices=E.toFloatArray(l)}readAnimation(e,t,s){let r=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let h=a.index;for(let c in n){let u=n[c];if(!u)continue;let d=u.length;if(c=="attachment"){let m=new Ct(d,h);for(let f=0;f<d;f++){let p=u[f];m.setFrame(f,A(p,"time",0),A(p,"name",null))}i.push(m)}else if(c=="rgba"){let m=new be(d,d<<2,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=u[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=V.fromString(x.color),C=f.curve;C&&(g=W(C,m,g,w,0,p,y,b.r,v.r,1),g=W(C,m,g,w,1,p,y,b.g,v.g,1),g=W(C,m,g,w,2,p,y,b.b,v.b,1),g=W(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,f=x}i.push(m)}else if(c=="rgb"){let m=new we(d,d*3,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=u[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=V.fromString(x.color),C=f.curve;C&&(g=W(C,m,g,w,0,p,y,b.r,v.r,1),g=W(C,m,g,w,1,p,y,b.g,v.g,1),g=W(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,f=x}i.push(m)}else if(c=="alpha")i.push(lt(u,new ye(d,d,h),0,1));else if(c=="rgba2"){let m=new ve(d,d*7,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.light),w=V.fromString(f.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let y=u[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=V.fromString(y.light),S=V.fromString(y.dark),k=f.curve;k&&(x=W(k,m,x,g,0,p,v,b.r,C.r,1),x=W(k,m,x,g,1,p,v,b.g,C.g,1),x=W(k,m,x,g,2,p,v,b.b,C.b,1),x=W(k,m,x,g,3,p,v,b.a,C.a,1),x=W(k,m,x,g,4,p,v,w.r,S.r,1),x=W(k,m,x,g,5,p,v,w.g,S.g,1),x=W(k,m,x,g,6,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}i.push(m)}else if(c=="rgb2"){let m=new Ce(d,d*6,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.light),w=V.fromString(f.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,w.r,w.g,w.b);let y=u[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=V.fromString(y.light),S=V.fromString(y.dark),k=f.curve;k&&(x=W(k,m,x,g,0,p,v,b.r,C.r,1),x=W(k,m,x,g,1,p,v,b.g,C.g,1),x=W(k,m,x,g,2,p,v,b.b,C.b,1),x=W(k,m,x,g,3,p,v,w.r,S.r,1),x=W(k,m,x,g,4,p,v,w.g,S.g,1),x=W(k,m,x,g,5,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}i.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let h=a.index;for(let c in n){let u=n[c],d=u.length;if(d!=0){if(c==="rotate")i.push(lt(u,new Rt(d,d,h),0,1));else if(c==="translate"){let m=new le(d,d<<1,h);i.push(as(u,m,"x","y",0,r))}else if(c==="translatex"){let m=new he(d,d,h);i.push(lt(u,m,0,r))}else if(c==="translatey"){let m=new ce(d,d,h);i.push(lt(u,m,0,r))}else if(c==="scale"){let m=new de(d,d<<1,h);i.push(as(u,m,"x","y",1,1))}else if(c==="scalex"){let m=new ue(d,d,h);i.push(lt(u,m,1,1))}else if(c==="scaley"){let m=new fe(d,d,h);i.push(lt(u,m,1,1))}else if(c==="shear"){let m=new me(d,d<<1,h);i.push(as(u,m,"x","y",0,1))}else if(c==="shearx"){let m=new ge(d,d,h);i.push(lt(u,m,0,1))}else if(c==="sheary"){let m=new pe(d,d,h);i.push(lt(u,m,0,1))}else if(c==="inherit"){let m=new xe(d,a.index);for(let f=0;f<u.length;f++){let p=u[f];m.setFrame(f,A(p,"time",0),E.enumValue(jt,A(p,"inherit","Normal")))}i.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let h=s.findIkConstraint(o);if(!h)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(h),u=new Ae(n.length,n.length<<1,c),d=A(a,"time",0),m=A(a,"mix",1),f=A(a,"softness",0)*r;for(let p=0,b=0;;p++){u.setFrame(p,d,m,f,A(a,"bendPositive",!0)?1:-1,A(a,"compress",!1),A(a,"stretch",!1));let w=n[p+1];if(!w){u.shrink(b);break}let g=A(w,"time",0),x=A(w,"mix",1),y=A(w,"softness",0)*r,v=a.curve;v&&(b=W(v,u,b,p,0,d,g,m,x,1),b=W(v,u,b,p,1,d,g,f,y,r)),d=g,m=x,f=y,a=w}i.push(u)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let h=s.findTransformConstraint(o);if(!h)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(h),u=new ke(n.length,n.length*6,c),d=A(a,"time",0),m=A(a,"mixRotate",1),f=A(a,"mixX",1),p=A(a,"mixY",f),b=A(a,"mixScaleX",1),w=A(a,"mixScaleY",b),g=A(a,"mixShearY",1);for(let x=0,y=0;;x++){u.setFrame(x,d,m,f,p,b,w,g);let v=n[x+1];if(!v){u.shrink(y);break}let C=A(v,"time",0),S=A(v,"mixRotate",1),k=A(v,"mixX",1),T=A(v,"mixY",k),Y=A(v,"mixScaleX",1),M=A(v,"mixScaleY",Y),X=A(v,"mixShearY",1),F=a.curve;F&&(y=W(F,u,y,x,0,d,C,m,S,1),y=W(F,u,y,x,1,d,C,f,k,1),y=W(F,u,y,x,2,d,C,p,T,1),y=W(F,u,y,x,3,d,C,b,Y,1),y=W(F,u,y,x,4,d,C,w,M,1),y=W(F,u,y,x,5,d,C,g,X,1)),d=C,m=S,f=k,p=T,b=Y,w=M,b=Y,a=v}i.push(u)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let h=s.pathConstraints.indexOf(a);for(let c in n){let u=n[c],d=u[0];if(!d)continue;let m=u.length;if(c==="position"){let f=new Te(m,m,h);i.push(lt(u,f,0,a.positionMode==0?r:1))}else if(c==="spacing"){let f=new Ie(m,m,h);i.push(lt(u,f,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(c==="mix"){let f=new Me(m,m*3,h),p=A(d,"time",0),b=A(d,"mixRotate",1),w=A(d,"mixX",1),g=A(d,"mixY",w);for(let x=0,y=0;;x++){f.setFrame(x,p,b,w,g);let v=u[x+1];if(!v){f.shrink(y);break}let C=A(v,"time",0),S=A(v,"mixRotate",1),k=A(v,"mixX",1),T=A(v,"mixY",k),Y=d.curve;Y&&(y=W(Y,f,y,x,0,p,C,b,S,1),y=W(Y,f,y,x,1,p,C,w,k,1),y=W(Y,f,y,x,2,p,C,g,T,1)),p=C,b=S,w=k,g=T,d=v}i.push(f)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let h=s.findPhysicsConstraint(o);if(!h)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(h)}for(let h in n){let c=n[h],u=c[0];if(!u)continue;let d=c.length;if(h=="reset"){const f=new De(d,a);for(let p=0;u!=null;u=c[p+1],p++)f.setFrame(p,A(u,"time",0));i.push(f);continue}let m;if(h=="inertia")m=new Ye(d,d,a);else if(h=="strength")m=new Pe(d,d,a);else if(h=="damping")m=new Xe(d,d,a);else if(h=="mass")m=new Fe(d,d,a);else if(h=="wind")m=new Be(d,d,a);else if(h=="gravity")m=new Ee(d,d,a);else if(h=="mix")m=new Re(d,d,a);else continue;i.push(lt(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],u=s.findSlot(h);if(!u)throw new Error("Slot not found: "+h);let d=u.index;for(let m in c){let f=c[m],p=a.getAttachment(d,m);for(let b in f){let w=f[b],g=w[0];if(g){if(b=="deform"){let x=p.bones,y=p.vertices,v=x?y.length/3*2:y.length,C=new Se(w.length,w.length,d,p),S=A(g,"time",0);for(let k=0,T=0;;k++){let Y,M=A(g,"vertices",null);if(!M)Y=x?E.newFloatArray(v):y;else{Y=E.newFloatArray(v);let P=A(g,"offset",0);if(E.arrayCopy(M,0,Y,P,M.length),r!=1)for(let D=P,O=D+M.length;D<O;D++)Y[D]*=r;if(!x)for(let D=0;D<v;D++)Y[D]+=y[D]}C.setFrame(k,S,Y);let X=w[k+1];if(!X){C.shrink(T);break}let F=A(X,"time",0),I=g.curve;I&&(T=W(I,C,T,k,0,S,F,0,1,1)),S=F,g=X}i.push(C)}else if(b=="sequence"){let x=new Le(w.length,d,p),y=0;for(let v=0;v<w.length;v++){let C=A(g,"delay",y),S=A(g,"time",0),k=ys[A(g,"mode","hold")],T=A(g,"index",0);x.setFrame(v,S,k,T,C),y=C,g=w[v+1]}i.push(x)}}}}}}if(e.drawOrder){let o=new It(e.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<e.drawOrder.length;h++,a++){let c=e.drawOrder[h],u=null,d=A(c,"offsets",null);if(d){u=E.newArray(n,-1);let m=E.newArray(n-d.length,0),f=0,p=0;for(let b=0;b<d.length;b++){let w=d[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;f!=x;)m[p++]=f++;u[f+w.offset]=f++}for(;f<n;)m[p++]=f++;for(let b=n-1;b>=0;b--)u[b]==-1&&(u[b]=m[--p])}o.setFrame(a,A(c,"time",0),u)}i.push(o)}if(e.events){let o=new Wt(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let h=e.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let u=new He(E.toSinglePrecision(A(h,"time",0)),c);u.intValue=A(h,"int",c.intValue),u.floatValue=A(h,"float",c.floatValue),u.stringValue=A(h,"string",c.stringValue),u.data.audioPath&&(u.volume=A(h,"volume",1),u.balance=A(h,"balance",0)),o.setFrame(n,u)}i.push(o)}let l=0;for(let o=0,n=i.length;o<n;o++)l=Math.max(l,i[o].getDuration());s.animations.push(new Ut(t,i,l))}},nr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function lt(e,t,s,r){let i=e[0],l=A(i,"time",0),o=A(i,"value",s)*r,n=0;for(let a=0;;a++){t.setFrame(a,l,o);let h=e[a+1];if(!h)return t.shrink(n),t;let c=A(h,"time",0),u=A(h,"value",s)*r;i.curve&&(n=W(i.curve,t,n,a,0,l,c,o,u,r)),l=c,o=u,i=h}}function as(e,t,s,r,i,l){let o=e[0],n=A(o,"time",0),a=A(o,s,i)*l,h=A(o,r,i)*l,c=0;for(let u=0;;u++){t.setFrame(u,n,a,h);let d=e[u+1];if(!d)return t.shrink(c),t;let m=A(d,"time",0),f=A(d,s,i)*l,p=A(d,r,i)*l,b=o.curve;b&&(c=W(b,t,c,u,0,n,m,a,f,l),c=W(b,t,c,u,1,n,m,h,p,l)),n=m,a=f,h=p,o=d}}function W(e,t,s,r,i,l,o,n,a,h){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,u=e[c],d=e[c+1]*h,m=e[c+2],f=e[c+3]*h;return t.setBezier(s,r,i,l,n,u,d,m,f,o,a),s+1}function A(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var os=class xt extends qe{static textureMap=new Map;static from(t){return xt.textureMap.has(t)?xt.textureMap.get(t):new xt(t)}texture;constructor(t){super(t.resource),this.texture=pi.Texture.from(t)}setFilters(t,s){const r=this.texture.source.style;r.minFilter=xt.toPixiTextureFilter(t),r.magFilter=xt.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=xt.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,s){const r=this.texture.source.style;r.addressModeU=xt.toPixiTextureWrap(t),r.addressModeV=xt.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},ls="spineTextureAtlasLoader",ar={extension:K.ExtensionType.Asset,resolver:{test:e=>(0,K.checkExtension)(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(K.Resolver.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:ls,extension:{type:K.ExtensionType.LoadParser,priority:K.LoaderParserPriority.Normal,name:ls},test(e){return(0,K.checkExtension)(e,".atlas")},async load(e){return await(await K.DOMAdapter.get().fetch(e)).text()},testParse(e,t){const s=(0,K.checkExtension)(t.src,".atlas"),r=typeof e=="string",i=t.loadParser===ls;return Promise.resolve((s||i)&&r)},unload(e){e.dispose()},async parse(e,t,s){const r=t.data||{};let i=K.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const l=new $t(e);if(r.images instanceof K.TextureSource||typeof r.images=="string"){const n=r.images;r.images={},r.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=r?.images?r.images[a]:void 0;if(h instanceof K.TextureSource)n.setTexture(os.from(h));else{const c=h??K.path.normalize([...i.split(K.path.sep),a].join(K.path.sep)),u={src:(0,K.copySearchParams)(c,t.src),data:{...r.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=s.load(u).then(m=>{n.setTexture(os.from(m.source))});o.push(d)}}return await Promise.all(o),l}}};K.extensions.add(ar);var wt=pt("pixi.js"),hs="spineSkeletonLoader";function or(e){return Object.prototype.hasOwnProperty.call(e,"bones")}function lr(e){return e instanceof Uint8Array}var hr={extension:wt.ExtensionType.Asset,loader:{name:hs,extension:{type:wt.ExtensionType.LoadParser,priority:wt.LoaderParserPriority.Normal,name:hs},test(e){return(0,wt.checkExtension)(e,".skel")},async load(e){const t=await wt.DOMAdapter.get().fetch(e);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=(0,wt.checkExtension)(t.src,".json")&&or(e),r=(0,wt.checkExtension)(t.src,".skel")&&lr(e),i=t.loadParser===hs;return Promise.resolve(s||r||i)}}};wt.extensions.add(hr);var Kt=pt("pixi.js"),At=pt("pixi.js"),cr=new Float32Array(1),dr=new Uint32Array(1),ur=class extends At.Geometry{constructor(){const t=new At.Buffer({data:cr,label:"attribute-batch-buffer",usage:At.BufferUsage.VERTEX|At.BufferUsage.COPY_DST,shrinkToFit:!1}),s=new At.Buffer({data:dr,label:"index-batch-buffer",usage:At.BufferUsage.INDEX|At.BufferUsage.COPY_DST,shrinkToFit:!1}),r=7*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:r,offset:0},aUV:{buffer:t,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:r,offset:4*4},aDarkColor:{buffer:t,format:"unorm8x4",stride:r,offset:5*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:r,offset:6*4}},indexBuffer:s})}},gt=pt("pixi.js"),fr={name:"color-bit",vertex:{header:`
|
|
1
|
+
"use strict";var spine=(()=>{var oe=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,di=Object.getOwnPropertyNames,ui=Object.prototype.hasOwnProperty,pt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),fi=(e,t)=>{for(var s in t)oe(e,s,{get:t[s],enumerable:!0})},mi=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of di(t))!ui.call(e,i)&&i!==s&&oe(e,i,{get:()=>t[i],enumerable:!(r=ci(t,i))||r.enumerable});return e},gi=e=>mi(oe({},"__esModule",{value:!0}),e),ps={};if(fi(ps,{AABBRectangleBoundsProvider:()=>wr,AlphaTimeline:()=>Ce,Animation:()=>Wt,AnimationState:()=>Oe,AnimationStateAdapter:()=>vi,AnimationStateData:()=>Ys,AssetCache:()=>Rs,AssetManagerBase:()=>Ai,AtlasAttachmentLoader:()=>Es,Attachment:()=>he,AttachmentTimeline:()=>Ct,BinaryInput:()=>Ws,BlendMode:()=>rs,Bone:()=>$e,BoneData:()=>He,BoundingBoxAttachment:()=>We,CURRENT:()=>Ms,ClippingAttachment:()=>St,Color:()=>V,ConstraintData:()=>Dt,CurveTimeline:()=>at,CurveTimeline1:()=>nt,CurveTimeline2:()=>zt,DebugUtils:()=>bi,DeformTimeline:()=>ke,Downloader:()=>Ds,DrawOrderTimeline:()=>It,Event:()=>je,EventData:()=>Je,EventQueue:()=>ks,EventTimeline:()=>Gt,EventType:()=>Ts,FIRST:()=>_e,FakeTexture:()=>Ci,HOLD_FIRST:()=>$t,HOLD_MIX:()=>Is,HOLD_SUBSEQUENT:()=>Ue,IkConstraint:()=>Ls,IkConstraintData:()=>Ke,IkConstraintTimeline:()=>Te,Inherit:()=>Kt,InheritTimeline:()=>we,IntSet:()=>pi,Interpolation:()=>xs,MathUtils:()=>B,MeshAttachment:()=>ut,MixBlend:()=>Cs,MixDirection:()=>Ss,PathAttachment:()=>Mt,PathConstraint:()=>Vs,PathConstraintData:()=>Qe,PathConstraintMixTimeline:()=>Pe,PathConstraintPositionTimeline:()=>Me,PathConstraintSpacingTimeline:()=>Ye,Physics:()=>_s,PhysicsConstraintDampingTimeline:()=>Be,PhysicsConstraintGravityTimeline:()=>De,PhysicsConstraintInertiaTimeline:()=>Xe,PhysicsConstraintMassTimeline:()=>Ee,PhysicsConstraintMixTimeline:()=>Le,PhysicsConstraintResetTimeline:()=>Ve,PhysicsConstraintStrengthTimeline:()=>Fe,PhysicsConstraintTimeline:()=>bt,PhysicsConstraintWindTimeline:()=>Re,PointAttachment:()=>Bs,Pool:()=>Tt,PositionMode:()=>Ze,Pow:()=>bs,PowOut:()=>xi,RGB2Timeline:()=>Ae,RGBA2Timeline:()=>Se,RGBATimeline:()=>ye,RGBTimeline:()=>ve,RegionAttachment:()=>ot,RotateMode:()=>es,RotateTimeline:()=>Rt,SETUP:()=>qe,SUBSEQUENT:()=>Ht,ScaleTimeline:()=>fe,ScaleXTimeline:()=>me,ScaleYTimeline:()=>ge,SequenceTimeline:()=>Ne,SetupPoseBoundsProvider:()=>yr,ShearTimeline:()=>pe,ShearXTimeline:()=>xe,ShearYTimeline:()=>be,Skeleton:()=>Yt,SkeletonBinary:()=>qs,SkeletonBounds:()=>os,SkeletonClipping:()=>Qt,SkeletonData:()=>Lt,SkeletonJson:()=>Gs,Skin:()=>Vt,SkinEntry:()=>ss,SkinsAndAnimationBoundsProvider:()=>vr,Slot:()=>Ns,SlotData:()=>is,SpacingMode:()=>ts,Spine:()=>Cr,SpineDebugRenderer:()=>Sr,SpinePipe:()=>$s,SpineTexture:()=>hs,StringSet:()=>le,Texture:()=>ze,TextureAtlas:()=>Jt,TextureAtlasPage:()=>Fs,TextureAtlasRegion:()=>Ge,TextureFilter:()=>jt,TextureRegion:()=>Xs,TextureWrap:()=>Ps,TimeKeeper:()=>wi,Timeline:()=>$,TrackEntry:()=>As,TransformConstraint:()=>Os,TransformConstraintData:()=>ns,TransformConstraintTimeline:()=>Ie,TranslateTimeline:()=>ce,TranslateXTimeline:()=>de,TranslateYTimeline:()=>ue,Triangulator:()=>zs,Utils:()=>E,Vector2:()=>Et,VertexAttachment:()=>dt,WindowedMean:()=>yi}),typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}var pi=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},le=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},V=class kt{constructor(t=0,s=0,r=0,i=0){this.r=t,this.g=s,this.b=r,this.a=i}static WHITE=new kt(1,1,1,1);static RED=new kt(1,0,0,1);static GREEN=new kt(0,1,0,1);static BLUE=new kt(0,0,1,1);static MAGENTA=new kt(1,0,1,1);set(t,s,r,i){return this.r=t,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,r,i){return this.r+=t,this.g+=s,this.b+=r,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new kt){return s.setFromString(t)}},B=class ct{static PI=3.1415927;static PI2=ct.PI*2;static invPI2=1/ct.PI2;static radiansToDegrees=180/ct.PI;static radDeg=ct.radiansToDegrees;static degreesToRadians=ct.PI/180;static degRad=ct.degreesToRadians;static clamp(t,s,r){return t<s?s:t>r?r:t}static cosDeg(t){return Math.cos(t*ct.degRad)}static sinDeg(t){return Math.sin(t*ct.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ct.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ct.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,r){let i=Math.random(),l=s-t;return i<=(r-t)/l?t+Math.sqrt(i*l*(r-t)):s-Math.sqrt((1-i)*l*(s-r))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},xs=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},bs=class extends xs{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},xi=class extends bs{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},E=class Bt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,l){for(let o=s,n=i;o<s+l;o++,n++)r[n]=t[o]}static arrayFill(t,s,r,i){for(let l=s;l<r;l++)t[l]=i}static setArraySize(t,s,r=0){let i=t.length;if(i==s)return t;if(t.length=s,i<s)for(let l=i;l<s;l++)t[l]=r;return t}static ensureArrayCapacity(t,s,r=0){return t.length>=s?t:Bt.setArraySize(t,s,r)}static newArray(t,s){let r=new Array(t);for(let i=0;i<t;i++)r[i]=s;return r}static newFloatArray(t){if(Bt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(t){if(Bt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(t){return Bt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Bt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,r=!0){for(var i=0;i<t.length;i++)if(t[i]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},bi=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Tt=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Et=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},wi=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},yi=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},he=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},dt=class ti extends he{static nextID=0;id=ti.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,l,o){r=l+(r>>1)*o;let n=t.bone.skeleton,a=t.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let f=t.bone,p=f.worldX,b=f.worldY,w=f.a,g=f.b,x=f.c,y=f.d;for(let v=s,C=l;C<r;v+=2,C+=o){let S=h[v],k=h[v+1];i[C]=S*w+k*g+p,i[C+1]=S*x+k*y+b}return}let u=0,d=0;for(let f=0;f<s;f+=2){let p=c[u];u+=p+1,d+=p}let m=n.bones;if(a.length==0)for(let f=l,p=d*3;f<r;f+=o){let b=0,w=0,g=c[u++];for(g+=u;u<g;u++,p+=3){let x=m[c[u]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}i[f]=b,i[f+1]=w}else{let f=a;for(let p=l,b=d*3,w=d<<1;p<r;p+=o){let g=0,x=0,y=c[u++];for(y+=u;u<y;u++,b+=3,w+=2){let v=m[c[u]],C=h[b]+f[w],S=h[b+1]+f[w+1],k=h[b+2];g+=(C*v.a+S*v.b+v.worldX)*k,x+=(C*v.c+S*v.d+v.worldY)*k}i[p]=g,i[p+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},ws=class re{static _nextID=0;id=re.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new re(this.regions.length);return E.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let r=t.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(t,s){let r=t,i=(this.start+s).toString();for(let l=this.digits-i.length;l>0;l--)r+="0";return r+=i,r}static nextID(){return re._nextID++}},ys=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(ys||{}),vs=[0,1,2,3,4,5,6],Wt=class{name;timelines=[];timelineIds=new le;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,i,l,o,n){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(e,t,s,i,l,o,n)}},Cs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Cs||{}),Ss=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Ss||{}),N={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},$=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=E.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let i=s;i<r;i+=s)if(e[i]>t)return i-s;return r-s}},at=class extends ${curves;constructor(e,t,s){super(e,s),this.curves=E.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=E.newFloatArray(t);E.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,i,l,o,n,a,h,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let m=(r-l*2+n)*.03,f=(i-o*2+a)*.03,p=((l-n)*3-r+h)*.006,b=((o-a)*3-i+c)*.006,w=m*2+p,g=f*2+b,x=(l-r)*.3+m+p*.16666667,y=(o-i)*.3+f+b*.16666667,v=r+x,C=i+y;for(let S=d+18;d<S;d+=2)u[d]=v,u[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let a=this.frames[t],h=this.frames[t+s];return h+(e-a)/(i[r]-a)*(i[r+1]-h)}let l=r+18;for(r+=2;r<l;r+=2)if(i[r]>=e){let a=i[r-2],h=i[r-1];return h+(e-a)/(i[r]-a)*(i[r+1]-h)}t+=this.getFrameEntries();let o=i[l-2],n=i[l-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},nt=class extends at{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=t[s],l=t[s+1];return l+(e-i)/(t[s+2]-i)*(t[s+2+1]-l);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let l=this.getCurveValue(e);switch(s){case 0:return i+l*t;case 1:case 2:l+=i-r}return r+l*t}getAbsoluteValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let l=this.getCurveValue(e);return s==0?i+(l-i)*t:r+(l-r)*t}getAbsoluteValue2(e,t,s,r,i,l){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}return s==0?i+(l-i)*t:r+(l-r)*t}getScaleValue(e,t,s,r,i,l){const o=this.frames;if(e<o[0]){switch(s){case 0:return l;case 1:return i+(l-i)*t}return i}let n=this.getCurveValue(e)*l;if(t==1)return s==3?i+n-l:n;if(r==1)switch(s){case 0:return l+(Math.abs(n)*B.signum(l)-l)*t;case 1:case 2:return i+(Math.abs(n)*B.signum(i)-i)*t}else{let a=0;switch(s){case 0:return a=Math.abs(l)*B.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(i)*B.signum(n),a+(n-a)*t}}return i+(n-l)*t}},zt=class extends at{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Rt=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,i,l,n.rotation,n.data.rotation))}},ce=class extends zt{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*i,n.y+=(n.data.y-n.y)*i}return}let h=0,c=0,u=$.search(a,s,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+3]-m);h+=(a[u+3+1]-h)*f,c+=(a[u+3+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(l){case 0:n.x=n.data.x+h*i,n.y=n.data.y+c*i;break;case 1:case 2:n.x+=(n.data.x+h-n.x)*i,n.y+=(n.data.y+c-n.y)*i;break;case 3:n.x+=h*i,n.y+=c*i}}},de=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,i,l,n.x,n.data.x))}},ue=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,i,l,n.y,n.data.y))}},fe=class extends zt{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*i,n.scaleY+=(n.data.scaleY-n.scaleY)*i}return}let h,c,u=$.search(a,s,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+3]-m);h+=(a[u+3+1]-h)*f,c+=(a[u+3+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,i==1)l==3?(n.scaleX+=h-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=h,n.scaleY=c);else{let m=0,f=0;if(o==1)switch(l){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*i,n.scaleY=f+(Math.abs(c)*B.signum(f)-f)*i;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*i,n.scaleY=f+(Math.abs(c)*B.signum(f)-f)*i;break;case 3:n.scaleX+=(h-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}else switch(l){case 0:m=Math.abs(n.data.scaleX)*B.signum(h),f=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(h-m)*i,n.scaleY=f+(c-f)*i;break;case 1:case 2:m=Math.abs(n.scaleX)*B.signum(h),f=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(h-m)*i,n.scaleY=f+(c-f)*i;break;case 3:n.scaleX+=(h-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}}}},me=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,i,l,o,n.scaleX,n.data.scaleX))}},ge=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,i,l,o,n.scaleY,n.data.scaleY))}},pe=class extends zt{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*i,n.shearY+=(n.data.shearY-n.shearY)*i}return}let h=0,c=0,u=$.search(a,s,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+3]-m);h+=(a[u+3+1]-h)*f,c+=(a[u+3+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}switch(l){case 0:n.shearX=n.data.shearX+h*i,n.shearY=n.data.shearY+c*i;break;case 1:case 2:n.shearX+=(n.data.shearX+h-n.shearX)*i,n.shearY+=(n.data.shearY+c-n.shearY)*i;break;case 3:n.shearX+=h*i,n.shearY+=c*i}}},xe=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,i,l,n.shearX,n.data.shearX))}},be=class extends nt{boneIndex=0;constructor(e,t,s){super(e,t,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,i,l,n.shearY,n.data.shearY))}},we=class extends ${boneIndex=0;constructor(e,t){super(e,[N.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,r,i,l,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){l==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==0||l==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[$.search(a,s,2)+1]}},ye=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,r,i,l){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let b=n.data.color;switch(l){case 0:h.setFromColor(b);return;case 1:h.add((b.r-h.r)*i,(b.g-h.g)*i,(b.b-h.b)*i,(b.a-h.a)*i)}return}let c=0,u=0,d=0,m=0,f=$.search(a,s,5),p=this.curves[f/5];switch(p){case 0:let b=a[f];c=a[f+1],u=a[f+2],d=a[f+3],m=a[f+4];let w=(s-b)/(a[f+5]-b);c+=(a[f+5+1]-c)*w,u+=(a[f+5+2]-u)*w,d+=(a[f+5+3]-d)*w,m+=(a[f+5+4]-m)*w;break;case 1:c=a[f+1],u=a[f+2],d=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),u=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2),m=this.getBezierValue(s,f,4,p+18*3-2)}i==1?h.set(c,u,d,m):(l==0&&h.setFromColor(n.data.color),h.add((c-h.r)*i,(u-h.g)*i,(d-h.b)*i,(m-h.a)*i))}},ve=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let p=n.data.color;switch(l){case 0:h.r=p.r,h.g=p.g,h.b=p.b;return;case 1:h.r+=(p.r-h.r)*i,h.g+=(p.g-h.g)*i,h.b+=(p.b-h.b)*i}return}let c=0,u=0,d=0,m=$.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let p=a[m];c=a[m+1],u=a[m+2],d=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,u+=(a[m+4+2]-u)*b,d+=(a[m+4+3]-d)*b;break;case 1:c=a[m+1],u=a[m+2],d=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),u=this.getBezierValue(s,m,2,f+18-2),d=this.getBezierValue(s,m,3,f+18*2-2)}if(i==1)h.r=c,h.g=u,h.b=d;else{if(l==0){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*i,h.g+=(u-h.g)*i,h.b+=(d-h.b)*i}}},Ce=class extends nt{slotIndex=0;constructor(e,t,s){super(e,t,N.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(l){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*i}return}let h=this.getCurveValue(s);i==1?a.a=h:(l==0&&(a.a=n.data.color.a),a.a+=(h-a.a)*i)}},Se=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.alpha+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,i,l,o,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.add((y.r-h.r)*i,(y.g-h.g)*i,(y.b-h.b)*i,(y.a-h.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let u=0,d=0,m=0,f=0,p=0,b=0,w=0,g=$.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];u=a[g+1],d=a[g+2],m=a[g+3],f=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];let v=(s-y)/(a[g+8]-y);u+=(a[g+8+1]-u)*v,d+=(a[g+8+2]-d)*v,m+=(a[g+8+3]-m)*v,f+=(a[g+8+4]-f)*v,p+=(a[g+8+5]-p)*v,b+=(a[g+8+6]-b)*v,w+=(a[g+8+7]-w)*v;break;case 1:u=a[g+1],d=a[g+2],m=a[g+3],f=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];break;default:u=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),f=this.getBezierValue(s,g,4,x+18*3-2),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),w=this.getBezierValue(s,g,7,x+18*6-2)}if(i==1)h.set(u,d,m,f),c.r=p,c.g=b,c.b=w;else{if(l==0){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((u-h.r)*i,(d-h.g)*i,(m-h.b)*i,(f-h.a)*i),c.r+=(p-c.r)*i,c.g+=(b-c.g)*i,c.b+=(w-c.b)*i}}},Ae=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,l,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case 0:h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:h.r+=(y.r-h.r)*i,h.g+=(y.g-h.g)*i,h.b+=(y.b-h.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let u=0,d=0,m=0,f=0,p=0,b=0,w=0,g=$.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];u=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];let v=(s-y)/(a[g+7]-y);u+=(a[g+7+1]-u)*v,d+=(a[g+7+2]-d)*v,m+=(a[g+7+3]-m)*v,p+=(a[g+7+4]-p)*v,b+=(a[g+7+5]-b)*v,w+=(a[g+7+6]-w)*v;break;case 1:u=a[g+1],d=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];break;default:u=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(i==1)h.r=u,h.g=d,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==0){let y=n.data.color,v=n.data.darkColor;h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}h.r+=(u-h.r)*i,h.g+=(d-h.g)*i,h.b+=(m-h.b)*i,c.r+=(p-c.r)*i,c.g+=(b-c.g)*i,c.b+=(w-c.b)*i}}},Ct=class extends ${slotIndex=0;attachmentNames;constructor(e,t){super(e,[N.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){l==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==0||l==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[$.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ke=class extends at{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[N.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,r,i,l,o,n,a,h,c){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let m=(r-l*2+n)*.03,f=a*.03-o*.06,p=((l-n)*3-r+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=f*2+b,x=(l-r)*.3+m+p*.16666667,y=o*.3+f+b*.16666667,v=r+x,C=y;for(let S=d+18;d<S;d+=2)u[d]=v,u[d+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,s[r]>e){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let l=s[i-2],o=s[i-1];return o+(1-o)*(e-l)/(this.frames[t+this.getFrameEntries()]-l)}apply(e,t,s,r,i,l,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof dt)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=0);let c=this.vertices,u=c[0].length,d=this.frames;if(s<d[0]){switch(l){case 0:h.length=0;return;case 1:if(i==1){h.length=0;return}h.length=u;let g=a;if(g.bones){i=1-i;for(var m=0;m<u;m++)h[m]*=i}else{let x=g.vertices;for(var m=0;m<u;m++)h[m]+=(x[m]-h[m])*i}}return}if(h.length=u,s>=d[d.length-1]){let g=c[d.length-1];if(i==1)if(l==3){let x=a;if(x.bones)for(let y=0;y<u;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<u;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,u);else switch(l){case 0:{let y=a;if(y.bones)for(let v=0;v<u;v++)h[v]=g[v]*i;else{let v=y.vertices;for(let C=0;C<u;C++){let S=v[C];h[C]=S+(g[C]-S)*i}}break}case 1:case 2:for(let y=0;y<u;y++)h[y]+=(g[y]-h[y])*i;break;case 3:let x=a;if(x.bones)for(let y=0;y<u;y++)h[y]+=g[y]*i;else{let y=x.vertices;for(let v=0;v<u;v++)h[v]+=(g[v]-y[v])*i}}return}let f=$.search1(d,s),p=this.getCurvePercent(s,f),b=c[f],w=c[f+1];if(i==1)if(l==3){let g=a;if(g.bones)for(let x=0;x<u;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<u;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<u;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case 0:{let x=a;if(x.bones)for(let y=0;y<u;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*i}else{let y=x.vertices;for(let v=0;v<u;v++){let C=b[v],S=y[v];h[v]=S+(C+(w[v]-C)*p-S)*i}}break}case 1:case 2:for(let x=0;x<u;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*i}break;case 3:let g=a;if(g.bones)for(let x=0;x<u;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*i}else{let x=g.vertices;for(let y=0;y<u;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*i}}}}},Gt=class ei extends ${static propertyIds=[""+N.event];events;constructor(t){super(t,ei.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,r,i,l,o,n){if(!i)return;let a=this.frames,h=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,l,o,n),s=-1;else if(s>=a[h-1])return;if(r<a[0])return;let c=0;if(s<a[0])c=0;else{c=$.search1(a,s)+1;let u=a[c];for(;c>0&&a[c-1]==u;)c--}for(;c<h&&r>=a[c];c++)i.push(this.events[c])}},It=class si extends ${static propertyIds=[""+N.drawOrder];drawOrders;constructor(t){super(t,si.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,r){this.frames[t]=s,this.drawOrders[t]=r}apply(t,s,r,i,l,o,n){if(n==1){o==0&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=$.search1(this.frames,r),h=this.drawOrders[a];if(!h)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,u=t.slots;for(let d=0,m=h.length;d<m;d++)c[d]=u[h[d]]}}},Te=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[N.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,i,l,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=l?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,i,l,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*i,n.softness+=(n.data.softness-n.softness)*i,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,u=$.search(a,s,6),d=this.curves[u/6];switch(d){case 0:let m=a[u];h=a[u+1],c=a[u+2];let f=(s-m)/(a[u+6]-m);h+=(a[u+6+1]-h)*f,c+=(a[u+6+2]-c)*f;break;case 1:h=a[u+1],c=a[u+2];break;default:h=this.getBezierValue(s,u,1,d-2),c=this.getBezierValue(s,u,2,d+18-2)}l==0?(n.mix=n.data.mix+(h-n.data.mix)*i,n.softness=n.data.softness+(c-n.data.softness)*i,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[u+3],n.compress=a[u+4]!=0,n.stretch=a[u+5]!=0)):(n.mix+=(h-n.mix)*i,n.softness+=(c-n.softness)*i,o==0&&(n.bendDirection=a[u+3],n.compress=a[u+4]!=0,n.stretch=a[u+5]!=0))}},Ie=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[N.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,l,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=r,a[e+3]=i,a[e+4]=l,a[e+5]=o,a[e+6]=n}apply(e,t,s,r,i,l,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case 0:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case 1:n.mixRotate+=(w.mixRotate-n.mixRotate)*i,n.mixX+=(w.mixX-n.mixX)*i,n.mixY+=(w.mixY-n.mixY)*i,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*i,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*i,n.mixShearY+=(w.mixShearY-n.mixShearY)*i}return}let h,c,u,d,m,f,p=$.search(a,s,7),b=this.curves[p/7];switch(b){case 0:let w=a[p];h=a[p+1],c=a[p+2],u=a[p+3],d=a[p+4],m=a[p+5],f=a[p+6];let g=(s-w)/(a[p+7]-w);h+=(a[p+7+1]-h)*g,c+=(a[p+7+2]-c)*g,u+=(a[p+7+3]-u)*g,d+=(a[p+7+4]-d)*g,m+=(a[p+7+5]-m)*g,f+=(a[p+7+6]-f)*g;break;case 1:h=a[p+1],c=a[p+2],u=a[p+3],d=a[p+4],m=a[p+5],f=a[p+6];break;default:h=this.getBezierValue(s,p,1,b-2),c=this.getBezierValue(s,p,2,b+18-2),u=this.getBezierValue(s,p,3,b+18*2-2),d=this.getBezierValue(s,p,4,b+18*3-2),m=this.getBezierValue(s,p,5,b+18*4-2),f=this.getBezierValue(s,p,6,b+18*5-2)}if(l==0){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*i,n.mixX=w.mixX+(c-w.mixX)*i,n.mixY=w.mixY+(u-w.mixY)*i,n.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*i,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*i,n.mixShearY=w.mixShearY+(f-w.mixShearY)*i}else n.mixRotate+=(h-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(u-n.mixY)*i,n.mixScaleX+=(d-n.mixScaleX)*i,n.mixScaleY+=(m-n.mixScaleY)*i,n.mixShearY+=(f-n.mixShearY)*i}},Me=class extends nt{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,i,l,n.position,n.data.position))}},Ye=class extends nt{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,l,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,i,l,n.spacing,n.data.spacing))}},Pe=class extends at{constraintIndex=0;constructor(e,t,s){super(e,t,[N.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){let l=this.frames;e<<=2,l[e]=t,l[e+1]=s,l[e+2]=r,l[e+3]=i}apply(e,t,s,r,i,l,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*i,n.mixX+=(n.data.mixX-n.mixX)*i,n.mixY+=(n.data.mixY-n.mixY)*i}return}let h,c,u,d=$.search(a,s,4),m=this.curves[d>>2];switch(m){case 0:let f=a[d];h=a[d+1],c=a[d+2],u=a[d+3];let p=(s-f)/(a[d+4]-f);h+=(a[d+4+1]-h)*p,c+=(a[d+4+2]-c)*p,u+=(a[d+4+3]-u)*p;break;case 1:h=a[d+1],c=a[d+2],u=a[d+3];break;default:h=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),u=this.getBezierValue(s,d,3,m+18*2-2)}if(l==0){let f=n.data;n.mixRotate=f.mixRotate+(h-f.mixRotate)*i,n.mixX=f.mixX+(c-f.mixX)*i,n.mixY=f.mixY+(u-f.mixY)*i}else n.mixRotate+=(h-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(u-n.mixY)*i}},bt=class extends nt{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of e.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,i,l,this.get(h),this.setup(h),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,l,this.get(n),this.setup(n)))}},Xe=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Fe=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Be=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Ee=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Re=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},De=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Le=class extends bt{constructor(e,t,s){super(e,t,s,N.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ve=class ii extends ${static propertyIds=[N.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,ii.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,l,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(r<h[0])&&(s<h[0]||r>=h[$.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},Ne=class yt extends ${static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[N.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,r,i,l){let o=this.frames;t*=yt.ENTRIES,o[t]=s,o[t+yt.MODE]=r|i<<4,o[t+yt.DELAY]=l}apply(t,s,r,i,l,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof dt)||h.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let u=this.frames;if(r<u[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let d=$.search(u,r,yt.ENTRIES),m=u[d],f=u[d+yt.MODE],p=u[d+yt.DELAY];if(!this.attachment.sequence)return;let b=f>>4,w=this.attachment.sequence.regions.length,g=vs[f&15];if(g!=0)switch(b+=(r-m)/p+1e-5|0,g){case 1:b=Math.min(w-1,b);break;case 2:b%=w;break;case 3:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case 4:b=Math.max(w-1-b,0);break;case 5:b=w-1-b%w;break;case 6:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Oe=class ne{static _emptyAnimation=new Wt("<empty>",[],0);static emptyAnimation(){return ne._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ks(this);propertyIDs=new le;animationsChanged=!1;trackEntryPool=new Tt(()=>new As);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let l=s[r];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=t*l.timeScale;if(l.delay>0){if(l.delay-=o,l.delay>0)continue;o=-l.delay,l.delay=0}let n=l.next;if(n){let a=l.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=l.timeScale==0?0:(a/l.timeScale+t)*n.timeScale,l.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[r]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,t)){let a=l.mixingFrom;for(l.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}l.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let r=t.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((r.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let d=0,m=r.length;d<m;d++){let f=r[d];if(!f||f.delay>0)continue;i=!0;let p=d==0?1:f.mixBlend,b=f.alpha;f.mixingFrom?b*=this.applyMixingFrom(f,t,p):f.trackTime>=f.trackEnd&&!f.next&&(b=0);let w=b>=f.alphaAttachmentThreshold,g=f.animationLast,x=f.getAnimationTime(),y=x,v=s;f.reverse&&(y=f.animation.duration-y,v=null);let C=f.animation.timelines,S=C.length;if(d==0&&b==1||p==3){d==0&&(w=!0);for(let k=0;k<S;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof Ct?this.applyAttachmentTimeline(l,t,y,p,w):l.apply(t,g,y,v,b,p,0)}}else{let k=f.timelineMode,T=f.shortestRotation,Y=!T&&f.timelinesRotation.length!=S<<1;Y&&(f.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let X=C[M],F=k[M]==Ht?p:0;!T&&X instanceof Rt?this.applyRotateTimeline(X,t,y,b,F,f.timelinesRotation,M<<1,Y):X instanceof Ct?this.applyAttachmentTimeline(X,t,y,p,w):(E.webkit602BugfixHelper(b,p),X.apply(t,g,y,v,b,F,0))}}this.queueEvents(f,x),s.length=0,f.nextAnimationLast=x,f.nextTrackLast=f.trackTime}for(var o=this.unkeyedState+qe,n=t.slots,a=0,h=t.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var u=c.data.attachmentName;c.setAttachment(u?t.getAttachment(c.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,s,r){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let l=0;t.mixDuration==0?(l=1,r==1&&(r=0)):(l=t.mixTime/t.mixDuration,l>1&&(l=1),r!=1&&(r=i.mixBlend));let o=l<i.mixAttachmentThreshold,n=l<i.mixDrawOrderThreshold,a=i.animation.timelines,h=a.length,c=i.alpha*t.interruptAlpha,u=c*(1-l),d=i.animationLast,m=i.getAnimationTime(),f=m,p=null;if(i.reverse?f=i.animation.duration-f:l<i.eventThreshold&&(p=this.events),r==3)for(let b=0;b<h;b++)a[b].apply(s,d,f,p,u,r,1);else{let b=i.timelineMode,w=i.timelineHoldMix,g=i.shortestRotation,x=!g&&i.timelinesRotation.length!=h<<1;x&&(i.timelinesRotation.length=h<<1),i.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=1,S,k=0;switch(b[y]){case Ht:if(!n&&v instanceof It)continue;S=r,k=u;break;case _e:S=0,k=u;break;case Ue:S=r,k=c;break;case $t:S=0,k=c;break;default:S=0;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=k,!g&&v instanceof Rt?this.applyRotateTimeline(v,s,f,k,S,i.timelinesRotation,y<<1,x):v instanceof Ct?this.applyAttachmentTimeline(v,s,f,S,o&&k>=i.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,r),n&&v instanceof It&&S==0&&(C=0),v.apply(s,d,f,p,k,S,C))}}return t.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,l}applyAttachmentTimeline(t,s,r,i,l){var o=s.slots[t.slotIndex];o.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,t.attachmentNames[$.search1(t.frames,r)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+qe))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+Ms)}applyRotateTimeline(t,s,r,i,l,o,n,a){if(a&&(o[n]=0),i==1){t.apply(s,0,r,null,1,l,0);return}let h=s.bones[t.boneIndex];if(!h.active)return;let c=t.frames,u=0,d=0;if(r<c[0])switch(l){case 0:h.rotation=h.data.rotation;default:return;case 1:u=h.rotation,d=h.data.rotation}else u=l==0?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(r);let m=0,f=d-u;if(f-=Math.ceil(f/360-.5)*360,f==0)m=o[n];else{let p=0,b=0;a?(p=0,b=f):(p=o[n],b=o[n+1]);let w=p-p%360;m=f+w;let g=f>=0,x=p>=0;Math.abs(b)<=90&&B.signum(b)!=B.signum(f)&&(Math.abs(p-w)>180?(m+=360*B.signum(p),x=g):w!=0?m-=360*B.signum(p):x=g),x!=g&&(m+=360*B.signum(p)),o[n]=m}o[n+1]=f,h.rotation=u+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,l=i-r,o=t.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let u=n[a];if(u.time<o)break;u.time>i||this.queue.event(t,u)}let c=!1;if(t.loop)if(l==0)c=!0;else{const u=Math.floor(t.trackTime/l);c=u>0&&u>Math.floor(t.trackLast/l)}else c=s>=i&&t.animationLast<i;for(c&&this.queue.complete(t);a<h;a++){let u=n[a];u.time<r||this.queue.event(t,u)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,r){let i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,i,r)}setAnimationWith(t,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,l=this.expandToIndex(t);l&&(l.nextTrackLast==-1?(this.tracks[t]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,i=!1):this.clearNext(l));let o=this.trackEntry(t,s,r,l);return this.setCurrent(t,o,i),this.queue.drain(),o}addAnimation(t,s,r=!1,i=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,l,r,i)}addAnimationWith(t,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(t);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(t,s,r,l);return l?(l.next=o,o.previous=l,i<=0&&(i=Math.max(i+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,ne.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,ne.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let l=this.tracks[r];l&&this.setEmptyAnimation(l.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,r,i){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=t,l.animation=s,l.loop=r,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=i?this.data.getMix(i.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=2,l}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let s=t.mixingTo,r=t.animation.timelines,i=t.animation.timelines.length,l=t.timelineMode;l.length=i;let o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<i;a++)l[a]=n.addAll(r[a].getPropertyIds())?$t:Ue;return}t:for(let a=0;a<i;a++){let h=r[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=Ht;else if(!s||h instanceof Ct||h instanceof It||h instanceof Gt||!s.animation.hasTimeline(c))l[a]=_e;else{for(let u=s.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(t.mixDuration>0){l[a]=Is,o[a]=u;continue t}break}l[a]=$t}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},As=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ks=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let r=e[s],i=e[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<t.length;o++){let n=t[o];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(i)}break;case 5:let l=e[s+++2];i.listener&&i.listener.event&&i.listener.event(i,l);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(i,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Ts=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Ts||{}),vi=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Ht=0,_e=1,Ue=2,$t=3,Is=4,qe=1,Ms=2,Ys=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);this.setMixWith(r,i,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},We=class ri extends dt{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new ri(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},St=class ni extends dt{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new ni(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},ze=class{_image;constructor(e){this._image=e}getImage(){return this._image}},jt=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(jt||{}),Ps=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Ps||{}),Xs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ci=class extends ze{setFilters(e,t){}setWraps(e,t){}dispose(){}},Jt=class{pages=new Array;regions=new Array;constructor(e){let t=new Si(e),s=new Array(4),r={};r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.format=()=>{},r.filter=h=>{h.minFilter=E.enumValue(jt,s[1]),h.magFilter=E.enumValue(jt,s[2])},r.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=10497),s[1].indexOf("y")!=-1&&(h.vWrap=10497)},r.pma=h=>{h.pma=s[1]=="true"};var i={};i.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},i.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},i.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},i.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},i.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},i.index=h=>{h.index=parseInt(s[1])};let l=t.readLine();for(;l&&l.trim().length==0;)l=t.readLine();for(;!(!l||l.trim().length==0||t.readEntry(s,l)==0);)l=t.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=t.readLine();else if(o){let h=new Ge(o,l);for(;;){let c=t.readEntry(s,l=t.readLine());if(c==0)break;let u=i[s[0]];if(u)u(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));a.push(d)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Fs(l.trim());t.readEntry(s,l=t.readLine())!=0;){let h=r[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Si=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let r=1,i=s+1;;r++){let l=t.indexOf(",",i);if(l==-1)return e[r]=t.substr(i).trim(),r;if(e[r]=t.substr(i,l-i).trim(),i=l+1,r==4)return 4}}},Fs=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Ge=class extends Xs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ut=class us extends dt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=E.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof Ge){let a=this.region,h=a.page,c=h.width,u=h.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/u,o=a.originalHeight/c,n=a.originalWidth/u;for(let d=0;d<r;d+=2)s[d]=i+t[d+1]*o,s[d+1]=l+(1-t[d])*n;return;case 180:i-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/u,o=a.originalWidth/c,n=a.originalHeight/u;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d])*o,s[d+1]=l+(1-t[d+1])*n;return;case 270:i-=a.offsetY/c,l-=a.offsetX/u,o=a.originalHeight/c,n=a.originalWidth/u;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d+1])*o,s[d+1]=l+t[d]*n;return}i-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/u,o=a.originalWidth/c,n=a.originalHeight/u}else this.region?(o=this.region.u2-i,n=this.region.v2-l):(i=l=0,o=n=1);for(let a=0;a<r;a+=2)s[a]=i+t[a]*o,s[a+1]=l+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new us(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,r,i,l,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,l,o)}newLinkedMesh(){let t=new us(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},Mt=class ai extends dt{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new ai(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Bs=class oi extends dt{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*B.degRad,r=Math.cos(s),i=Math.sin(s),l=r*t.a+i*t.b,o=r*t.c+i*t.d;return B.atan2Deg(o,l)}copy(){let t=new oi(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},ot=class li extends he{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,n=l+this.region.width*r,a=o+this.region.height*i,h=this.rotation*B.degRad,c=Math.cos(h),u=Math.sin(h),d=this.x,m=this.y,f=l*c+d,p=l*u,b=o*c+m,w=o*u,g=n*c+d,x=n*u,y=a*c+m,v=a*u,C=this.offset;C[0]=f-w,C[1]=b+p,C[2]=f-v,C[3]=y+p,C[4]=g-v,C[5]=y+x,C[6]=g-w,C[7]=b+x,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,r,i){this.sequence!=null&&this.sequence.apply(t,this);let l=t.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,u=l.c,d=l.d,m=0,f=0;m=o[0],f=o[1],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a,r+=i,m=o[2],f=o[3],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a,r+=i,m=o[4],f=o[5],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a,r+=i,m=o[6],f=o[7],s[r]=m*h+f*c+n,s[r+1]=m*u+f*d+a}copy(){let t=new li(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Es=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let i=0,l=r.length;i<l;i++){let o=s.getPath(t,i),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[i]=n}}newRegionAttachment(e,t,s,r){let i=new ot(t,s);if(r!=null)this.loadSequence(t,s,r);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");i.region=l}return i}newMeshAttachment(e,t,s,r){let i=new ut(t,s);if(r!=null)this.loadSequence(t,s,r);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");i.region=l}return i}newBoundingBoxAttachment(e,t){return new We(t)}newPathAttachment(e,t){return new Mt(t)}newPointAttachment(e,t){return new Bs(t)}newClippingAttachment(e,t){return new St(t)}},He=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new V;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Kt=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Kt||{}),$e=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,r,i,l,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let d=this.skeleton;const m=d.scaleX,f=d.scaleY,p=(s+l)*B.degRad,b=(s+90+o)*B.degRad;this.a=Math.cos(p)*r*m,this.b=Math.cos(b)*i*m,this.c=Math.sin(p)*r*f,this.d=Math.sin(b)*i*f,this.worldX=e*m+d.x,this.worldY=t*f+d.y;return}let a=n.a,h=n.b,c=n.c,u=n.d;switch(this.worldX=a*e+h*t+n.worldX,this.worldY=c*e+u*t+n.worldY,this.inherit){case 0:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad,f=Math.cos(d)*r,p=Math.cos(m)*i,b=Math.sin(d)*r,w=Math.sin(m)*i;this.a=a*f+h*b,this.b=a*p+h*w,this.c=c*f+u*b,this.d=c*p+u*w;return}case 1:{const d=(s+l)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(m)*i,this.c=Math.sin(d)*r,this.d=Math.sin(m)*i;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=d,c*=m;let f=a*a+c*c,p=0;f>1e-4?(f=Math.abs(a*u*m-h*d*c)/f,h=c*f,u=a*f,p=Math.atan2(c,a)*B.radDeg):(a=0,c=0,p=90-Math.atan2(u,h)*B.radDeg);const b=(s+l-p)*B.degRad,w=(s+o-p+90)*B.degRad,g=Math.cos(b)*r,x=Math.cos(w)*i,y=Math.sin(b)*r,v=Math.sin(w)*i;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+u*y,this.d=c*x+u*v;break}case 3:case 4:{s*=B.degRad;const d=Math.cos(s),m=Math.sin(s);let f=(a*d+h*m)/this.skeleton.scaleX,p=(c*d+u*m)/this.skeleton.scaleY,b=Math.sqrt(f*f+p*p);b>1e-5&&(b=1/b),f*=b,p*=b,b=Math.sqrt(f*f+p*p),this.inherit==3&&a*u-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,f);const w=Math.cos(s)*b,g=Math.sin(s)*b;l*=B.degRad,o=(90+o)*B.degRad;const x=Math.cos(l)*r,y=Math.cos(o)*i,v=Math.sin(l)*r,C=Math.sin(o)*i;this.a=f*x+w*v,this.b=f*y+w*C,this.c=p*x+g*v,this.d=p*y+g*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,l=1/(t*i-s*r),o=i*l,n=s*l,a=r*l,h=t*l,c=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=c*o-u*n,this.ay=u*h-c*a;let d,m,f,p;if(this.inherit==1)d=this.a,m=this.b,f=this.c,p=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*i-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=t*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(t*i-s*r),o=i*l,n=s*l;break}case 3:case 4:let b=B.cosDeg(this.rotation),w=B.sinDeg(this.rotation);t=(t*b+s*w)/this.skeleton.scaleX,r=(r*b+i*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=B.PI/2+Math.atan2(r,t);s=Math.cos(x)*g,i=Math.sin(x)*g,l=1/(t*i-s*r),o=i*l,n=s*l,a=r*l,h=t*l}d=o*this.a-n*this.c,m=o*this.b-n*this.d,f=h*this.c-a*this.a,p=h*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){let b=d*p-m*f;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+f*p,b)*B.radDeg,this.arotation=Math.atan2(f,d)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=B.sinDeg(e),s=B.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*B.radDeg}rotateWorld(e){e*=B.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,i=this.b;this.a=s*r-t*this.c,this.b=s*i-t*this.d,this.c=t*r+s*this.c,this.d=t*i+s*this.d}},Dt=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},Ai=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Ds,r=new Rs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=r}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadBinary(e,l=>{this.success(t,e,l),r(l)},(l,o)=>{const n=`Couldn't load binary ${e}: status ${l}, ${o}`;this.error(s,e,n),i(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadJson(e,l=>{this.success(t,e,l),r(l)},(l,o)=>{const n=`Couldn't load JSON ${e}: status ${l}, ${o}`;this.error(s,e,n),i(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[e],i=r!==void 0;return i&&(this.cache.assetsLoaded[e]=r.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(t,e,l),l)).catch(l=>this.error(s,e,l))),i}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(t,e,a),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let i=e.lastIndexOf("/"),l=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,n)=>{this.downloader.downloadText(e,a=>{try{let h=new Jt(a),c=h.pages.length,u=!1;for(let d of h.pages)this.loadTexture(r?r[d.name]:l+d.name,(m,f)=>{u||(d.setTexture(f),--c==0&&(this.success(t,e,h),o(h)))},(m,f)=>{if(!u){const p=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,p),n(p)}u=!0})}catch(h){const c=`Couldn't parse texture atlas ${e}: ${h.message}`;this.error(s,e,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${h}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},r){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,l)=>{this.downloader.downloadText(e,o=>{try{const n=new Jt(o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),l(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(r,i)=>t(i),(r,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
+
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){--this.cache.assetsRefCount[e]===0&&this.remove(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Rs=class ae{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ae.AVAILABLE_CACHES.get(t);if(s)return s;const r=new ae;return ae.AVAILABLE_CACHES.set(t,r),r}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Ds=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=t.charCodeAt(i);return r}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToString(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||e,!0);let l=()=>{this.finish(e,i.status,i.responseText)};i.onload=l,i.onerror=l,i.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||e,!0),i.responseType="arraybuffer";let l=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):l()},i.onerror=l,i.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let i=t==200||t==0?[s]:[t,s];for(let l=i.length-1,o=r.length;l<o;l+=2)r[l].apply(null,i)}},je=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Je=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Ls=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,r,i,l,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,u=n.d,d=-e.ashearX-e.arotation,m=0,f=0;switch(e.inherit){case 1:m=(t-e.worldX)*B.signum(e.skeleton.scaleX),f=(s-e.worldY)*B.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(a*u-h*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;h=-x*w*e.skeleton.scaleX,u=g*w*e.skeleton.scaleY,d+=Math.atan2(x,g)*B.radDeg;default:let y=t-n.worldX,v=s-n.worldY,C=a*u-h*c;Math.abs(C)<=1e-4?(m=0,f=0):(m=(y*u-v*h)/C-e.ax,f=(v*a-y*c)/C-e.ay)}d+=Math.atan2(f,m)*B.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let p=e.ascaleX,b=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,f=s-e.worldY}const w=e.data.length*p;if(w>1e-4){const g=m*m+f*f;if(r&&g<w*w||i&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,p,b,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,l,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let h=e.ax,c=e.ay,u=e.ascaleX,d=e.ascaleY,m=u,f=d,p=t.ascaleX,b=0,w=0,g=0;u<0?(u=-u,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),p<0?(p=-p,w=180):w=0;let x=t.ax,y=0,v=0,C=0,S=e.a,k=e.b,T=e.c,Y=e.d,M=Math.abs(u-d)<=1e-4;!M||l?(y=0,v=S*x+e.worldX,C=T*x+e.worldY):(y=t.ay,v=S*x+k*y+e.worldX,C=T*x+Y*y+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");S=X.a,k=X.b,T=X.c,Y=X.d;let F=S*Y-k*T,I=v-X.worldX,P=C-X.worldY;F=Math.abs(F)<=1e-4?0:1/F;let D=(I*Y-P*k)*F-h,O=(P*S-I*T)*F-c,L=Math.sqrt(D*D+O*O),_=t.data.length*p,H,z;if(L<1e-4){this.apply1(e,s,r,!1,l,!1,a),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-X.worldX,P=r-X.worldY;let j=(I*Y-P*k)*F-h,R=(P*S-I*T)*F-c,U=j*j+R*R;if(n!=0){n*=u*(p+1)*.5;let J=Math.sqrt(U),Z=J-L-_*u+n;if(Z>0){let tt=Math.min(1,Z/(n*2))-1;tt=(Z-n*(1-tt*tt))/J,j-=tt*j,R-=tt*R,U=j*j+R*R}}t:if(M){_*=u;let J=(U-L*L-_*_)/(2*L*_);J<-1?(J=-1,z=Math.PI*i):J>1?(J=1,z=0,l&&(S=(Math.sqrt(U)/(L+_)-1)*a+1,m*=S,o&&(f*=S))):z=Math.acos(J)*i,S=L+_*J,k=_*Math.sin(z),H=Math.atan2(R*S-j*k,j*S+R*k)}else{S=u*_,k=d*_;let J=S*S,Z=k*k,tt=Math.atan2(R,j);T=Z*L*L+J*U-J*Z;let ht=-2*Z*L,Xt=Z-J;if(Y=ht*ht-4*Xt*T,Y>=0){let Ft=Math.sqrt(Y);ht<0&&(Ft=-Ft),Ft=-(ht+Ft)*.5;let qt=Ft/Xt,Zs=T/Ft,ie=Math.abs(qt)<Math.abs(Zs)?qt:Zs;if(qt=U-ie*ie,qt>=0){P=Math.sqrt(qt)*i,H=tt-Math.atan2(P,ie),z=Math.atan2(P/d,(ie-L)/u);break t}}let Ut=B.PI,ee=L-S,cs=ee*ee,Js=0,Ks=0,se=L+S,ds=se*se,Qs=0;T=-S*L/(J-Z),T>=-1&&T<=1&&(T=Math.acos(T),I=S*Math.cos(T)+L,P=k*Math.sin(T),Y=I*I+P*P,Y<cs&&(Ut=T,cs=Y,ee=I,Js=P),Y>ds&&(Ks=T,ds=Y,se=I,Qs=P)),U<=(cs+ds)*.5?(H=tt-Math.atan2(Js*i,ee),z=Ut*i):(H=tt-Math.atan2(Qs*i,se),z=Ks*i)}let G=Math.atan2(y,x)*g,st=e.arotation;H=(H-G)*B.radDeg+b-st,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(h,c,st+H*a,m,f,0,0),st=t.arotation,z=((z+G)*B.radDeg-t.ashearX)*g+w-st,z>180?z-=360:z<-180&&(z+=360),t.updateWorldTransformWith(x,y,st+z*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ke=class extends Dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},Qe=class extends Dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Ze=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Ze||{}),ts=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ts||{}),es=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(es||{}),Vs=class vt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0,l=t.bones.length;i<l;i++){let o=s.findBone(t.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(t.target.name);if(!r)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=r,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof Mt))return;let r=this.mixRotate,i=this.mixX,l=this.mixY;if(r==0&&i==0&&l==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,h=this.bones,c=h.length,u=n?c:c+1,d=E.setArraySize(this.spaces,u),m=a?this.lengths=E.setArraySize(this.lengths,c):[],f=this.spacing;switch(o.spacingMode){case 2:if(a)for(let C=0,S=u-1;C<S;C++){let k=h[C],T=k.data.length,Y=T*k.a,M=T*k.c;m[C]=Math.sqrt(Y*Y+M*M)}E.arrayFill(d,1,u,f);break;case 3:let y=0;for(let C=0,S=u-1;C<S;){let k=h[C],T=k.data.length;if(T<vt.epsilon)a&&(m[C]=0),d[++C]=f;else{let Y=T*k.a,M=T*k.c,X=Math.sqrt(Y*Y+M*M);a&&(m[C]=X),d[++C]=X,y+=X}}if(y>0){y=u/y*f;for(let C=1;C<u;C++)d[C]*=y}break;default:let v=o.spacingMode==0;for(let C=0,S=u-1;C<S;){let k=h[C],T=k.data.length;if(T<vt.epsilon)a&&(m[C]=0),d[++C]=f;else{let Y=T*k.a,M=T*k.c,X=Math.sqrt(Y*Y+M*M);a&&(m[C]=X),d[++C]=(v?T+f:f)*X/T}}}let p=this.computeWorldPositions(s,u,n),b=p[0],w=p[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*i,C.worldY+=(w-C.worldY)*l;let S=p[v],k=p[v+1],T=S-b,Y=k-w;if(a){let M=m[y];if(M!=0){let X=(Math.sqrt(T*T+Y*Y)/M-1)*r+1;C.a*=X,C.c*=X}}if(b=S,w=k,r>0){let M=C.a,X=C.b,F=C.c,I=C.d,P=0,D=0,O=0;if(n?P=p[v-1]:d[y+1]==0?P=p[v+2]:P=Math.atan2(Y,T),P-=Math.atan2(F,M),x){D=Math.cos(P),O=Math.sin(P);let L=C.data.length;b+=(L*(D*M-O*F)-T)*r,w+=(L*(O*M+D*F)-Y)*r}else P+=g;P>B.PI?P-=B.PI2:P<-B.PI&&(P+=B.PI2),P*=r,D=Math.cos(P),O=Math.sin(P),C.a=D*M-O*F,C.b=D*X-O*I,C.c=O*M+D*F,C.d=O*X+D*I}C.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=t.closed,c=t.worldVerticesLength,u=c/6,d=vt.NONE;if(!t.constantSpeed){let L=t.lengths;u-=h?1:2;let _=L[u];this.data.positionMode==1&&(l*=_);let H;switch(this.data.spacingMode){case 2:H=_;break;case 3:H=_/s;break;default:H=1}a=E.setArraySize(this.world,8);for(let z=0,j=0,R=0;z<s;z++,j+=3){let U=o[z]*H;l+=U;let G=l;if(h)G%=_,G<0&&(G+=_),R=0;else if(G<0){d!=vt.BEFORE&&(d=vt.BEFORE,t.computeWorldVertices(i,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>_){d!=vt.AFTER&&(d=vt.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-_,a,0,n,j);continue}for(;;R++){let st=L[R];if(!(G>st)){if(R==0)G/=st;else{let J=L[R-1];G=(G-J)/(st-J)}break}}R!=d&&(d=R,h&&R==u?(t.computeWorldVertices(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,R*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,j,r||z>0&&U==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(u--,c-=4,a=E.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=E.setArraySize(this.curves,u),f=0,p=a[0],b=a[1],w=0,g=0,x=0,y=0,v=0,C=0,S=0,k=0,T=0,Y=0,M=0,X=0,F=0,I=0;for(let L=0,_=2;L<u;L++,_+=6)w=a[_],g=a[_+1],x=a[_+2],y=a[_+3],v=a[_+4],C=a[_+5],S=(p-w*2+x)*.1875,k=(b-g*2+y)*.1875,T=((w-x)*3-p+v)*.09375,Y=((g-y)*3-b+C)*.09375,M=S*2+T,X=k*2+Y,F=(w-p)*.75+S+T*.16666667,I=(g-b)*.75+k+Y*.16666667,f+=Math.sqrt(F*F+I*I),F+=M,I+=X,M+=T,X+=Y,f+=Math.sqrt(F*F+I*I),F+=M,I+=X,f+=Math.sqrt(F*F+I*I),F+=M+T,I+=X+Y,f+=Math.sqrt(F*F+I*I),m[L]=f,p=v,b=C;this.data.positionMode==1&&(l*=f);let P;switch(this.data.spacingMode){case 2:P=f;break;case 3:P=f/s;break;default:P=1}let D=this.segments,O=0;for(let L=0,_=0,H=0,z=0;L<s;L++,_+=3){let j=o[L]*P;l+=j;let R=l;if(h)R%=f,R<0&&(R+=f),H=0;else if(R<0){this.addBeforePosition(R,a,0,n,_);continue}else if(R>f){this.addAfterPosition(R-f,a,c-4,n,_);continue}for(;;H++){let U=m[H];if(!(R>U)){if(H==0)R/=U;else{let G=m[H-1];R=(R-G)/(U-G)}break}}if(H!=d){d=H;let U=H*6;for(p=a[U],b=a[U+1],w=a[U+2],g=a[U+3],x=a[U+4],y=a[U+5],v=a[U+6],C=a[U+7],S=(p-w*2+x)*.03,k=(b-g*2+y)*.03,T=((w-x)*3-p+v)*.006,Y=((g-y)*3-b+C)*.006,M=S*2+T,X=k*2+Y,F=(w-p)*.3+S+T*.16666667,I=(g-b)*.3+k+Y*.16666667,O=Math.sqrt(F*F+I*I),D[0]=O,U=1;U<8;U++)F+=M,I+=X,M+=T,X+=Y,O+=Math.sqrt(F*F+I*I),D[U]=O;F+=M,I+=X,O+=Math.sqrt(F*F+I*I),D[8]=O,F+=M+T,I+=X+Y,O+=Math.sqrt(F*F+I*I),D[9]=O,z=0}for(R*=O;;z++){let U=D[z];if(!(R>U)){if(z==0)R/=U;else{let G=D[z-1];R=z+(R-G)/(U-G)}break}}this.addCurvePosition(R*.1,p,b,w,g,x,y,v,C,n,_,r||L>0&&j==0)}return n}addBeforePosition(t,s,r,i,l){let o=s[r],n=s[r+1],a=s[r+2]-o,h=s[r+3]-n,c=Math.atan2(h,a);i[l]=o+t*Math.cos(c),i[l+1]=n+t*Math.sin(c),i[l+2]=c}addAfterPosition(t,s,r,i,l){let o=s[r+2],n=s[r+3],a=o-s[r],h=n-s[r+1],c=Math.atan2(h,a);i[l]=o+t*Math.cos(c),i[l+1]=n+t*Math.sin(c),i[l+2]=c}addCurvePosition(t,s,r,i,l,o,n,a,h,c,u,d){if(t==0||isNaN(t)){c[u]=s,c[u+1]=r,c[u+2]=Math.atan2(l-r,i-s);return}let m=t*t,f=m*t,p=1-t,b=p*p,w=b*p,g=p*t,x=g*3,y=p*x,v=x*t,C=s*w+i*y+o*v+a*f,S=r*w+l*y+n*v+h*f;c[u]=C,c[u+1]=S,d&&(t<.001?c[u+2]=Math.atan2(l-r,i-s):c[u+2]=Math.atan2(S-(r*b+l*g*2+n*m),C-(s*b+i*g*2+o*m)))}},ki=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.time;const c=o.worldX,u=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=u;else{let d=this.remaining,m=this.inertia,f=this.data.step,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||r){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(r){const x=(this.uy-u)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=u}if(d>=f){b=Math.pow(this.damping,60*f);const x=this.massInverse*f,y=this.strength,v=this.wind*p*a.scaleX,C=this.gravity*p*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*f,this.xVelocity*=b),r&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*f,this.yVelocity*=b),d-=f;while(d>=f)}s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||l){let x=Math.atan2(o.c,o.a),y=0,v=0,C=0,S=this.cx-o.worldX,k=this.cy-o.worldY;if(S>w?S=w:S<-w&&(S=-w),k>g?k=g:k<-g&&(k=-g),i){C=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(k+this.ty,S+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*B.invPI2-.5)*B.PI2)*m,T=this.rotateOffset*C+x,y=Math.cos(T),v=Math.sin(T),l&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(S*y+k*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(S*y+k*v)*m/T)}if(d=this.remaining,d>=f){b==-1&&(b=Math.pow(this.damping,60*f));const T=this.massInverse*f,Y=this.strength,M=this.wind,X=Yt.yDown?-this.gravity:this.gravity,F=n/p;for(;;)if(d-=f,l&&(this.scaleVelocity+=(M*y-X*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=b),i){if(this.rotateVelocity-=((M*v+X*y)*F+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=b,d<f)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(d<f)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i){let a=this.rotateOffset*t,h=0,c=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*this.data.rotate,h=Math.sin(d),c=Math.cos(d),u=o.b,o.b=c*u-h*o.d,o.d=h*u+c*o.d),d+=a*this.data.shearX,h=Math.sin(d),c=Math.cos(d),u=o.a,o.a=c*u-h*o.c,o.c=h*u+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),u=o.a,o.a=c*u-h*o.c,o.c=h*u+c*o.c,u=o.b,o.b=c*u-h*o.d,o.d=h*u+c*o.d}if(l){const a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*B.degRad,i=Math.cos(r),l=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*l-o,o*l+n*i-n)}},Ns=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new V,this.darkColor=e.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof dt)||!(this.attachment instanceof dt)||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}},Os=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Et;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,u=n.d,d=a*u-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,S=Math.atan2(c,a)-Math.atan2(v,x)+m;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=e;let k=Math.cos(S),T=Math.sin(S);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*t,g.worldY+=(x.y-g.worldY)*s}if(r!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*r)/x),g.a*=x,g.c*=x}if(i!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+u*u)-x+this.data.offsetScaleY)*i)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(u,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+f)*l;let S=Math.sqrt(x*x+y*y);g.b=Math.cos(C)*S,g.d=Math.sin(C)*S}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,u=n.d,d=a*u-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(e!=0){let x=g.a,y=g.b,v=g.c,C=g.d,S=Math.atan2(c,a)+m;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=e;let k=Math.cos(S),T=Math.sin(S);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*t,g.worldY+=x.y*s}if(r!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=x,g.c*=x}if(i!=0){let x=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleY)*i+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(u,h)-Math.atan2(c,a);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-B.PI/2+f)*l;let C=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*C,g.d=Math.sin(x)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],u=c.arotation;e!=0&&(u+=(o.arotation-u+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let f=c.ascaleX,p=c.ascaleY;r!=0&&f!=0&&(f=(f+(o.ascaleX-f+this.data.offsetScaleX)*r)/f),i!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*i)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(d,m,u,f,p,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],u=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,m=c.ay+(o.ay+this.data.offsetY)*s,f=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(d,m,u,f,p,c.ashearX,b)}}},Yt=class fs{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return fs.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=t.bones[s],i;if(!r.parent)i=new $e(r,this,null);else{let l=this.bones[r.parent.index];i=new $e(r,this,l),l.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let r=t.slots[s],i=this.bones[r.boneData.index],l=new Ns(r,i);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let r=t.ikConstraints[s];this.ikConstraints.push(new Ls(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new Os(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new Vs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new ki(r,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let f=s[d];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let p=this.bones[d[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let r=this.ikConstraints,i=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=r.length,a=i.length,h=l.length,c=this.physicsConstraints.length,u=n+a+h+c;t:for(let d=0;d<u;d++){for(let m=0;m<n;m++){let f=r[m];if(f.data.order==d){this.sortIkConstraint(f);continue t}}for(let m=0;m<a;m++){let f=i[m];if(f.data.order==d){this.sortTransformConstraint(f);continue t}}for(let m=0;m<h;m++){let f=l[m];if(f.data.order==d){this.sortPathConstraint(f);continue t}}for(let m=0;m<c;m++){const f=o[m];if(f.data.order==d){this.sortPhysicsConstraint(f);continue t}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let r=t.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let l=r[r.length-1];this.sortBone(l),this._updateCache.push(t),this.sortReset(i.children),l.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,i);let l=s.getAttachment();l instanceof Mt&&this.sortPathConstraintAttachmentWith(l,i);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,r=s.length;if(t.data.local)for(let i=0;i<r;i++){let l=s[i];this.sortBone(l.parent),this.sortBone(l)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(t);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(t,s,r){let i=t.attachments[s];if(i)for(let l in i)this.sortPathConstraintAttachmentWith(i[l],r)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Mt))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let l=0,o=r.length;l<o;){let n=r[l++];for(n+=l;l<n;)this.sortBone(i[r[l++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,r=t.length;s<r;s++){let i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,l=s.length;i<l;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,l=r.length;i<l;i++)r[i].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let b=1,w=r.length;b<w;b++){let g=r[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;i.worldX=l*this.x+o*this.y+s.worldX,i.worldY=n*this.x+a*this.y+s.worldY;const h=(i.rotation+i.shearX)*B.degRad,c=(i.rotation+90+i.shearY)*B.degRad,u=Math.cos(h)*i.scaleX,d=Math.cos(c)*i.scaleY,m=Math.sin(h)*i.scaleX,f=Math.sin(c)*i.scaleY;i.a=(l*u+o*m)*this.scaleX,i.b=(l*d+o*f)*this.scaleX,i.c=(n*u+a*m)*this.scaleY,i.d=(n*d+a*f)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=i&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;E.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,r=t.length;s<r;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let l=s[r];if(l.data.name==t)return l}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let l=s[r];if(l.data.name==t)return l}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let l=s[r],o=l.data.attachmentName;if(o){let n=t.getAttachment(r,o);n&&l.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let r=this.data.findSlot(t);if(!r)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(r.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(t,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,l=r.length;i<l;i++){let o=r[i];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(i,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Et,r=new Et;return this.getBounds(s,r,void 0,t),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(t,s,r=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let l=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let c=0,u=l.length;c<u;c++){let d=l[c];if(!d.bone.active)continue;let m=0,f=null,p=null,b=d.getAttachment();if(b instanceof ot)m=8,f=E.setArraySize(r,m,0),b.computeWorldVertices(d,f,0,2),p=fs.quadTriangles;else if(b instanceof ut){let w=b;m=w.worldVerticesLength,f=E.setArraySize(r,m,0),w.computeWorldVertices(d,0,m,f,0,2),p=w.triangles}else if(b instanceof St&&i!=null){i.clipStart(d,b);continue}if(f&&p){i!=null&&i.isClipping()&&(i.clipTriangles(f,p,p.length),f=i.clippedVertices,m=i.clippedVertices.length);for(let w=0,g=f.length;w<g;w+=2){let x=f[w],y=f[w+1];o=Math.min(o,x),n=Math.min(n,y),a=Math.max(a,x),h=Math.max(h,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(o,n),s.set(a-o,h-n)}update(t){this.time+=t}physicsTranslate(t,s){const r=this.physicsConstraints;for(let i=0,l=r.length;i<l;i++)r[i].translate(t,s)}physicsRotate(t,s,r){const i=this.physicsConstraints;for(let l=0,o=i.length;l<o;l++)i[l].rotate(t,s,r)}},_s=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(_s||{}),Us=class extends Dt{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Lt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}},ss=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Vt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){l=!0;break}l||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){l=!0;break}l||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){l=!0;break}l||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){l=!0;break}l||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof ut?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new ss(t,r,i))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new ss(e,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let i=e.slots[r],l=i.getAttachment();if(l&&s<t.attachments.length){let o=t.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&i.setAttachment(h);break}}}s++}}},is=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},rs=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(rs||{}),ns=class extends Dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},qs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Lt;s.name="";let r=new Ws(e),i=r.readInt32(),l=r.readInt32();s.hash=l==0&&i==0?null:l.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let u=h==0?null:s.bones[r.readInt(!0)],d=new He(h,c,u);d.rotation=r.readFloat(),d.x=r.readFloat()*t,d.y=r.readFloat()*t,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*t,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),o&&(V.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let u=s.bones[r.readInt(!0)],d=new is(h,c,u);V.rgba8888ToColor(d.color,r.readInt32());let m=r.readInt32();m!=-1&&V.rgb888ToColor(d.darkColor=new V,m),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),o&&(d.visible=r.readBoolean()),s.slots.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){let u=r.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new Ke(u);d.order=r.readInt(!0),c=r.readInt(!0);for(let f=0;f<c;f++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(d.softness=r.readFloat()*t),s.ikConstraints.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){let u=r.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new ns(u);d.order=r.readInt(!0),c=r.readInt(!0);for(let f=0;f<c;f++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=r.readFloat()),(m&16)!=0&&(d.offsetX=r.readFloat()*t),(m&32)!=0&&(d.offsetY=r.readFloat()*t),(m&64)!=0&&(d.offsetScaleX=r.readFloat()),(m&128)!=0&&(d.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(d.offsetShearY=r.readFloat()),(m&2)!=0&&(d.mixRotate=r.readFloat()),(m&4)!=0&&(d.mixX=r.readFloat()),(m&8)!=0&&(d.mixY=r.readFloat()),(m&16)!=0&&(d.mixScaleX=r.readFloat()),(m&32)!=0&&(d.mixScaleY=r.readFloat()),(m&64)!=0&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){let u=r.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new Qe(u);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let f=0;f<c;f++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const m=r.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}n=r.readInt(!0);for(let h=0,c;h<n;h++){const u=r.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Us(u);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=r.readFloat()),(m&4)!=0&&(d.y=r.readFloat()),(m&8)!=0&&(d.rotate=r.readFloat()),(m&16)!=0&&(d.scaleX=r.readFloat()),(m&32)!=0&&(d.shearX=r.readFloat()),d.limit=((m&64)!=0?r.readFloat():5e3)*t,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=(m&128)!=0?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(d)}let a=this.readSkin(r,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+r.readInt(!0));h<n;h++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];const u=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let u=new Je(c);u.intValue=r.readInt(!1),u.floatValue=r.readFloat(),u.stringValue=r.readString(),u.audioPath=r.readString(),u.audioPath&&(u.volume=r.readFloat(),u.balance=r.readFloat()),s.events.push(u)}n=r.readInt(!0);for(let h=0;h<n;h++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(e,t,s,r){let i=null,l=0;if(s){if(l=e.readInt(!0),l==0)return null;i=new Vt("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");i=new Vt(o),r&&V.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let n=0,a=i.bones.length;n<a;n++)i.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);l=e.readInt(!0)}for(let o=0;o<l;o++){let n=e.readInt(!0);for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let u=this.readAttachment(e,t,i,n,c,r);u&&i.setAttachment(n,c,u)}}return i}readAttachment(e,t,s,r,i,l){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():i;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let h=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,u=(n&64)!=0?this.readSequence(e):null;let d=(n&128)!=0?e.readFloat():0,m=e.readFloat(),f=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,u);return x?(x.path=h,x.x=m*o,x.y=f*o,x.scaleX=p,x.scaleY=b,x.rotation=d,x.width=w*o,x.height=g*o,V.rgba8888ToColor(x.color,c),x.sequence=u,u==null&&x.updateRegion(),x):null}case 1:{let h=this.readVertices(e,(n&16)!=0),c=l?e.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,a);return u?(u.worldVerticesLength=h.length,u.vertices=h.vertices,u.bones=h.bones,l&&V.rgba8888ToColor(u.color,c),u):null}case 2:{let h=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,u=(n&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),f=this.readFloatArray(e,m.length,1),p=this.readShortArray(e,(m.length-d-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,u);return x?(x.path=h,V.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=f,u==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=u,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case 3:{const h=(n&16)!=0?e.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,u=(n&64)!=0?this.readSequence(e):null,d=(n&128)!=0,m=e.readInt(!0),f=e.readStringRef();let p=0,b=0;l&&(p=e.readFloat(),b=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,u);return w?(w.path=h,V.rgba8888ToColor(w.color,c),w.sequence=u,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Ti(w,m,r,f,d)),w):null}case 4:{const h=(n&16)!=0,c=(n&32)!=0,u=this.readVertices(e,(n&64)!=0),d=E.newArray(u.length/6,0);for(let p=0,b=d.length;p<b;p++)d[p]=e.readFloat()*o;const m=l?e.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=h,f.constantSpeed=c,f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,f.lengths=d,l&&V.rgba8888ToColor(f.color,m),f):null}case 5:{const h=e.readFloat(),c=e.readFloat(),u=e.readFloat(),d=l?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=u*o,m.rotation=h,l&&V.rgba8888ToColor(m.color,d),m):null}case 6:{const h=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let u=l?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,a);return d?(d.endSlot=t.slots[h],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,l&&V.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(e){let t=new ws(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,r=e.readInt(!0),i=new Ii;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let l=new Array,o=new Array;for(let n=0;n<r;n++){let a=e.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(e.readInt(!0)),l.push(e.readFloat()*s),l.push(e.readFloat()*s),l.push(e.readFloat())}return i.vertices=E.toFloatArray(l),i.bones=o,i}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let i=0;i<t;i++)r[i]=e.readFloat();else for(let i=0;i<t;i++)r[i]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,i=this.scale;for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let m=e.readByte(),f=e.readInt(!0),p=f-1;switch(m){case Ni:{let b=new Ct(f,c);for(let w=0;w<f;w++)b.setFrame(w,e.readFloat(),e.readStringRef());r.push(b);break}case Oi:{let b=e.readInt(!0),w=new ye(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let S=0,k=0;w.setFrame(S,g,x,y,v,C),S!=p;S++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(S);break;case mt:q(e,w,k++,S,0,g,T,x,Y,1),q(e,w,k++,S,1,g,T,y,M,1),q(e,w,k++,S,2,g,T,v,X,1),q(e,w,k++,S,3,g,T,C,F,1)}g=T,x=Y,y=M,v=X,C=F}r.push(w);break}case _i:{let b=e.readInt(!0),w=new ve(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let C=0,S=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(C);break;case mt:q(e,w,S++,C,0,g,k,x,T,1),q(e,w,S++,C,1,g,k,y,Y,1),q(e,w,S++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}r.push(w);break}case Ui:{let b=e.readInt(!0),w=new Se(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,S,k,T),Y!=p;Y++){let X=e.readFloat(),F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(Y);break;case mt:q(e,w,M++,Y,0,g,X,x,F,1),q(e,w,M++,Y,1,g,X,y,I,1),q(e,w,M++,Y,2,g,X,v,P,1),q(e,w,M++,Y,3,g,X,C,D,1),q(e,w,M++,Y,4,g,X,S,O,1),q(e,w,M++,Y,5,g,X,k,L,1),q(e,w,M++,Y,6,g,X,T,_,1)}g=X,x=F,y=I,v=P,C=D,S=O,k=L,T=_}r.push(w);break}case qi:{let b=e.readInt(!0),w=new Ae(f,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,S,k),T!=p;T++){let M=e.readFloat(),X=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case ft:w.setStepped(T);break;case mt:q(e,w,Y++,T,0,g,M,x,X,1),q(e,w,Y++,T,1,g,M,y,F,1),q(e,w,Y++,T,2,g,M,v,I,1),q(e,w,Y++,T,3,g,M,C,P,1),q(e,w,Y++,T,4,g,M,S,D,1),q(e,w,Y++,T,5,g,M,k,O,1)}g=M,x=X,y=F,v=I,C=P,S=D,k=O}r.push(w);break}case Wi:{let b=new Ce(f,e.readInt(!0),c),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case ft:b.setStepped(x);break;case mt:q(e,b,y++,x,0,w,v,g,C,1)}w=v,g=C}r.push(b)}}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let m=e.readByte(),f=e.readInt(!0);if(m==Vi){let b=new we(f,c);for(let w=0;w<f;w++)b.setFrame(w,e.readFloat(),e.readByte());r.push(b);continue}let p=e.readInt(!0);switch(m){case Mi:r.push(K(e,new Rt(f,p,c),1));break;case Yi:r.push(as(e,new ce(f,p,c),i));break;case Pi:r.push(K(e,new de(f,p,c),i));break;case Xi:r.push(K(e,new ue(f,p,c),i));break;case Fi:r.push(as(e,new fe(f,p,c),1));break;case Bi:r.push(K(e,new me(f,p,c),1));break;case Ei:r.push(K(e,new ge(f,p,c),1));break;case Ri:r.push(as(e,new pe(f,p,c),1));break;case Di:r.push(K(e,new xe(f,p,c),1));break;case Li:r.push(K(e,new be(f,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),u=e.readInt(!0),d=u-1,m=new Te(u,e.readInt(!0),c),f=e.readByte(),p=e.readFloat(),b=(f&1)!=0?(f&2)!=0?e.readFloat():1:0,w=(f&4)!=0?e.readFloat()*i:0;for(let g=0,x=0;m.setFrame(g,p,b,w,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),g!=d;g++){f=e.readByte();const y=e.readFloat(),v=(f&1)!=0?(f&2)!=0?e.readFloat():1:0,C=(f&4)!=0?e.readFloat()*i:0;(f&64)!=0?m.setStepped(g):(f&128)!=0&&(q(e,m,x++,g,0,p,y,b,v,1),q(e,m,x++,g,1,p,y,w,C,i)),p=y,b=v,w=C}r.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),u=e.readInt(!0),d=u-1,m=new Ie(u,e.readInt(!0),c),f=e.readFloat(),p=e.readFloat(),b=e.readFloat(),w=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,C=0;m.setFrame(v,f,p,b,w,g,x,y),v!=d;v++){let S=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),X=e.readFloat(),F=e.readFloat();switch(e.readByte()){case ft:m.setStepped(v);break;case mt:q(e,m,C++,v,0,f,S,p,k,1),q(e,m,C++,v,1,f,S,b,T,1),q(e,m,C++,v,2,f,S,w,Y,1),q(e,m,C++,v,3,f,S,g,M,1),q(e,m,C++,v,4,f,S,x,X,1),q(e,m,C++,v,5,f,S,y,F,1)}f=S,p=k,b=T,w=Y,g=M,x=X,y=F}r.push(m)}for(let a=0,h=e.readInt(!0);a<h;a++){let c=e.readInt(!0),u=s.pathConstraints[c];for(let d=0,m=e.readInt(!0);d<m;d++){const f=e.readByte(),p=e.readInt(!0),b=e.readInt(!0);switch(f){case Hi:r.push(K(e,new Me(p,b,c),u.positionMode==0?i:1));break;case $i:r.push(K(e,new Ye(p,b,c),u.spacingMode==0||u.spacingMode==1?i:1));break;case ji:let w=new Pe(p,b,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let C=0,S=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),X=e.readFloat();switch(e.readByte()){case ft:w.setStepped(C);break;case mt:q(e,w,S++,C,0,g,T,x,Y,1),q(e,w,S++,C,1,g,T,y,M,1),q(e,w,S++,C,2,g,T,v,X,1)}g=T,x=Y,y=M,v=X}r.push(w)}}}for(let a=0,h=e.readInt(!0);a<h;a++){const c=e.readInt(!0)-1;for(let u=0,d=e.readInt(!0);u<d;u++){const m=e.readByte(),f=e.readInt(!0);if(m==ir){const b=new Ve(f,c);for(let w=0;w<f;w++)b.setFrame(w,e.readFloat());r.push(b);continue}const p=e.readInt(!0);switch(m){case Ji:r.push(K(e,new Xe(f,p,c),1));break;case Ki:r.push(K(e,new Fe(f,p,c),1));break;case Qi:r.push(K(e,new Be(f,p,c),1));break;case Zi:r.push(K(e,new Ee(f,p,c),1));break;case tr:r.push(K(e,new Re(f,p,c),1));break;case er:r.push(K(e,new De(f,p,c),1));break;case sr:r.push(K(e,new Le(f,p,c),1))}}}for(let a=0,h=e.readInt(!0);a<h;a++){let c=s.skins[e.readInt(!0)];for(let u=0,d=e.readInt(!0);u<d;u++){let m=e.readInt(!0);for(let f=0,p=e.readInt(!0);f<p;f++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case zi:{let v=w,C=v.bones,S=v.vertices,k=C?S.length/3*2:S.length,T=e.readInt(!0),Y=new ke(x,T,m,v),M=e.readFloat();for(let X=0,F=0;;X++){let I,P=e.readInt(!0);if(P==0)I=C?E.newFloatArray(k):S;else{I=E.newFloatArray(k);let O=e.readInt(!0);if(P+=O,i==1)for(let L=O;L<P;L++)I[L]=e.readFloat();else for(let L=O;L<P;L++)I[L]=e.readFloat()*i;if(!C)for(let L=0,_=I.length;L<_;L++)I[L]+=S[L]}if(Y.setFrame(X,M,I),X==y)break;let D=e.readFloat();switch(e.readByte()){case ft:Y.setStepped(X);break;case mt:q(e,Y,F++,X,0,M,D,0,1,1)}M=D}r.push(Y);break}case Gi:{let v=new Ne(x,m,w);for(let C=0;C<x;C++){let S=e.readFloat(),k=e.readInt32();v.setFrame(C,S,vs[k&15],k>>4,e.readFloat())}r.push(v);break}}}}}let l=e.readInt(!0);if(l>0){let a=new It(l),h=s.slots.length;for(let c=0;c<l;c++){let u=e.readFloat(),d=e.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let f=E.newArray(h-d,0),p=0,b=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;p!=g;)f[b++]=p++;m[p+e.readInt(!0)]=p++}for(;p<h;)f[b++]=p++;for(let w=h-1;w>=0;w--)m[w]==-1&&(m[w]=f[--b]);a.setFrame(c,u,m)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=new Gt(o);for(let h=0;h<o;h++){let c=e.readFloat(),u=s.events[e.readInt(!0)],d=new je(c,u);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),a.setFrame(h,d)}r.push(a)}let n=0;for(let a=0,h=r.length;a<h;a++)n=Math.max(n,r[a].getDuration());return new Wt(t,r,n)}},Ws=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let r=0;r<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(i),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ti=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},Ii=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function K(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let l=0,o=0,n=t.getFrameCount()-1;t.setFrame(l,r,i),l!=n;l++){let a=e.readFloat(),h=e.readFloat()*s;switch(e.readByte()){case ft:t.setStepped(l);break;case mt:q(e,t,o++,l,0,r,a,i,h,s)}r=a,i=h}return t}function as(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,l=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,l),o!=a;o++){let h=e.readFloat(),c=e.readFloat()*s,u=e.readFloat()*s;switch(e.readByte()){case ft:t.setStepped(o);break;case mt:q(e,t,n++,o,0,r,h,i,c,s),q(e,t,n++,o,1,r,h,l,u,s)}r=h,i=c,l=u}return t}function q(e,t,s,r,i,l,o,n,a,h){t.setBezier(s,r,i,l,n,e.readFloat(),e.readFloat()*h,e.readFloat(),e.readFloat()*h,o,a)}var Mi=0,Yi=1,Pi=2,Xi=3,Fi=4,Bi=5,Ei=6,Ri=7,Di=8,Li=9,Vi=10,Ni=0,Oi=1,_i=2,Ui=3,qi=4,Wi=5,zi=0,Gi=1,Hi=0,$i=1,ji=2,Ji=0,Ki=1,Qi=2,Zi=4,tr=5,er=6,sr=7,ir=8,ft=1,mt=2,os=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Tt(()=>E.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,l=e.slots,o=l.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof We){let c=h;s.push(c);let u=i.obtain();u.length!=c.worldVerticesLength&&(u=E.newFloatArray(c.worldVerticesLength)),r.push(u),c.computeWorldVertices(a,0,c.worldVerticesLength,u,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let l=0,o=i.length;l<o;l++){let n=i[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let u=a[h],d=a[h+1];e=Math.min(e,u),t=Math.min(t,d),s=Math.max(s,u),r=Math.max(r,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let i=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=l&&r<=l||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),h=a*(i-e)+t;if(h>l&&h<n||(h=a*(o-e)+t,h>l&&h<n))return!0;let c=(l-t)/a+e;return c>i&&c<o||(c=(n-t)/a+e,c>i&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,i=e.length,l=i-2,o=!1;for(let n=0;n<i;n+=2){let a=r[n+1],h=r[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=r[n];c+(s-a)/(h-a)*(r[l]-c)<t&&(o=!o)}l=n}return o}intersectsSegment(e,t,s,r){let i=this.polygons;for(let l=0,o=i.length;l<o;l++)if(this.intersectsSegmentPolygon(i[l],e,t,s,r))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(e,t,s,r,i){let l=e,o=e.length,n=t-r,a=s-i,h=t*i-s*r,c=l[o-2],u=l[o-1];for(let d=0;d<o;d+=2){let m=l[d],f=l[d+1],p=c*f-u*m,b=c-m,w=u-f,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=r||x>=r&&x<=t)){let y=(h*w-a*p)/g;if((y>=u&&y<=f||y>=f&&y<=u)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,u=f}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},zs=class rt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Tt(()=>new Array);polygonIndicesPool=new Tt(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n<r;n++)i[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=r;n<a;++n)l[n]=rt.isConcave(n,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let n=r-1,a=0,h=1;for(;;){t:if(!l[a]){let d=i[n]<<1,m=i[a]<<1,f=i[h]<<1,p=s[d],b=s[d+1],w=s[m],g=s[m+1],x=s[f],y=s[f+1];for(let v=(h+1)%r;v!=n;v=(v+1)%r){if(!l[v])continue;let C=i[v]<<1,S=s[C],k=s[C+1];if(rt.positiveArea(x,y,p,b,S,k)&&rt.positiveArea(p,b,w,g,S,k)&&rt.positiveArea(w,g,x,y,S,k))break t}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),l.splice(a,1),r--;let c=(r+a-1)%r,u=a==r?0:a;l[c]=rt.isConcave(c,r,s,i),l[u]=rt.isConcave(u,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(t,s){let r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=0;for(let c=0,u=s.length;c<u;c+=3){let d=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,p=r[d],b=r[d+1],w=r[m],g=r[m+1],x=r[f],y=r[f+1],v=!1;if(a==d){let C=n.length-4,S=rt.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=rt.winding(x,y,n[0],n[1],n[2],n[3]);S==h&&k==h&&(n.push(x),n.push(y),o.push(f),v=!0)}v||(n.length>0?(i.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(f),h=rt.winding(p,b,w,g,x,y),a=d)}n.length>0&&(i.push(n),l.push(o));for(let c=0,u=i.length;c<u;c++){if(o=l[c],o.length==0)continue;let d=o[0],m=o[o.length-1];n=i[c];let f=n.length-4,p=n[f],b=n[f+1],w=n[f+2],g=n[f+3],x=n[0],y=n[1],v=n[2],C=n[3],S=rt.winding(p,b,w,g,x,y);for(let k=0;k<u;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],X=T[2],F=i[k],I=F[F.length-2],P=F[F.length-1];if(Y!=d||M!=m)continue;let D=rt.winding(p,b,w,g,I,P),O=rt.winding(I,P,x,y,v,C);D==S&&O==S&&(F.length=0,T.length=0,n.push(I),n.push(P),o.push(X),p=w,b=g,w=I,g=P,k=0)}}for(let c=i.length-1;c>=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let l=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[l],r[l+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,l,o){return t*(o-i)+r*(s-o)+l*(i-s)>=0}static winding(t,s,r,i,l,o){let n=r-t,a=i-s;return l*a-o*n+n*s-t*a>=0?1:-1}},Qt=class ms{triangulator=new zs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=E.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let l=this.clippingPolygon;ms.makeClockwise(l);let o=this.clippingPolygons=this.triangulator.decompose(l,this.triangulator.triangulate(l));for(let n=0,a=o.length;n<a;n++){let h=o[n];ms.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,s,r,i,l,o,n,a){let h,c,u,d,m,f;typeof s=="number"?(h=r,c=i,u=l,d=o,m=n,f=a):(h=s,c=r,u=i,d=l,m=o,f=n),u&&d&&m&&typeof f=="boolean"?this.clipTrianglesRender(t,h,c,u,d,m,f):this.clipTrianglesNoRender(t,h,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<r;c+=3){let u=s[c]<<1,d=t[u],m=t[u+1];u=s[c+1]<<1;let f=t[u],p=t[u+1];u=s[c+2]<<1;let b=t[u],w=t[u+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(d,m,f,p,b,w,n[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,S=E.setArraySize(l,x+v*2);for(let T=0;T<y;T+=2,x+=2){let Y=C[T],M=C[T+1];S[x]=Y,S[x+1]=M}x=o.length;let k=E.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)k[x]=h,k[x+1]=h+T,k[x+2]=h+T+1;h+=v+1}else{let y=E.setArraySize(l,x+6);y[x]=d,y[x+1]=m,y[x+2]=f,y[x+3]=p,y[x+4]=b,y[x+5]=w,x=o.length;let v=E.setArraySize(o,x+3);v[x]=h,v[x+1]=h+1,v[x+2]=h+2,h+=3;break}}}}clipTrianglesRender(t,s,r,i,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,u=this.clippingPolygons,d=u.length,m=n?12:8,f=0;h.length=0,c.length=0;for(let p=0;p<r;p+=3){let b=s[p]<<1,w=t[b],g=t[b+1],x=i[b],y=i[b+1];b=s[p+1]<<1;let v=t[b],C=t[b+1],S=i[b],k=i[b+1];b=s[p+2]<<1;let T=t[b],Y=t[b+1],M=i[b],X=i[b+1];for(let F=0;F<d;F++){let I=h.length;if(this.clip(w,g,v,C,T,Y,u[F],a)){let P=a.length;if(P==0)continue;let D=C-Y,O=T-v,L=w-T,_=Y-g,H=1/(D*L+O*(g-Y)),z=P>>1,j=this.clipOutput,R=E.setArraySize(h,I+z*m);for(let G=0;G<P;G+=2,I+=m){let st=j[G],J=j[G+1];R[I]=st,R[I+1]=J,R[I+2]=l.r,R[I+3]=l.g,R[I+4]=l.b,R[I+5]=l.a;let Z=st-T,tt=J-Y,ht=(D*Z+O*tt)*H,Xt=(_*Z+L*tt)*H,Ut=1-ht-Xt;R[I+6]=x*ht+S*Xt+M*Ut,R[I+7]=y*ht+k*Xt+X*Ut,n&&(R[I+8]=o.r,R[I+9]=o.g,R[I+10]=o.b,R[I+11]=o.a)}I=c.length;let U=E.setArraySize(c,I+3*(z-2));z--;for(let G=1;G<z;G++,I+=3)U[I]=f,U[I+1]=f+G,U[I+2]=f+G+1;f+=z+1}else{let P=E.setArraySize(h,I+3*m);P[I]=w,P[I+1]=g,P[I+2]=l.r,P[I+3]=l.g,P[I+4]=l.b,P[I+5]=l.a,n?(P[I+6]=x,P[I+7]=y,P[I+8]=o.r,P[I+9]=o.g,P[I+10]=o.b,P[I+11]=o.a,P[I+12]=v,P[I+13]=C,P[I+14]=l.r,P[I+15]=l.g,P[I+16]=l.b,P[I+17]=l.a,P[I+18]=S,P[I+19]=k,P[I+20]=o.r,P[I+21]=o.g,P[I+22]=o.b,P[I+23]=o.a,P[I+24]=T,P[I+25]=Y,P[I+26]=l.r,P[I+27]=l.g,P[I+28]=l.b,P[I+29]=l.a,P[I+30]=M,P[I+31]=X,P[I+32]=o.r,P[I+33]=o.g,P[I+34]=o.b,P[I+35]=o.a):(P[I+6]=x,P[I+7]=y,P[I+8]=v,P[I+9]=C,P[I+10]=l.r,P[I+11]=l.g,P[I+12]=l.b,P[I+13]=l.a,P[I+14]=S,P[I+15]=k,P[I+16]=T,P[I+17]=Y,P[I+18]=l.r,P[I+19]=l.g,P[I+20]=l.b,P[I+21]=l.a,P[I+22]=M,P[I+23]=X),I=c.length;let D=E.setArraySize(c,I+3);D[I]=f,D[I+1]=f+1,D[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(t,s,r,i){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,u=0;o.length=0,n.length=0,a.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,f=t[m],p=t[m+1],b=i[m],w=i[m+1];m=s[d+1]<<1;let g=t[m],x=t[m+1],y=i[m],v=i[m+1];m=s[d+2]<<1;let C=t[m],S=t[m+1],k=i[m],T=i[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(f,p,g,x,C,S,h[Y],l)){let X=l.length;if(X==0)continue;let F=x-S,I=C-g,P=f-C,D=S-p,O=1/(F*P+I*(p-S)),L=X>>1,_=this.clipOutput,H=E.setArraySize(o,M+L*2),z=E.setArraySize(n,M+L*2);for(let R=0;R<X;R+=2,M+=2){let U=_[R],G=_[R+1];H[M]=U,H[M+1]=G;let st=U-C,J=G-S,Z=(F*st+I*J)*O,tt=(D*st+P*J)*O,ht=1-Z-tt;z[M]=b*Z+y*tt+k*ht,z[M+1]=w*Z+v*tt+T*ht}M=a.length;let j=E.setArraySize(a,M+3*(L-2));L--;for(let R=1;R<L;R++,M+=3)j[M]=u,j[M+1]=u+R,j[M+2]=u+R+1;u+=L+1}else{let X=E.setArraySize(o,M+6);X[M]=f,X[M+1]=p,X[M+2]=g,X[M+3]=x,X[M+4]=C,X[M+5]=S;let F=E.setArraySize(n,M+3*2);F[M]=b,F[M+1]=w,F[M+2]=y,F[M+3]=v,F[M+4]=k,F[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=u,I[M+1]=u+1,I[M+2]=u+2,u+=3;break}}}}clip(t,s,r,i,l,o,n,a){let h=a,c=!1,u;n.length%4>=2?(u=a,a=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(s),u.push(r),u.push(i),u.push(l),u.push(o),u.push(t),u.push(s),a.length=0;let d=n.length-4,m=n;for(let f=0;;f+=2){let p=m[f],b=m[f+1],w=p-m[f+2],g=b-m[f+3],x=a.length,y=u;for(let C=0,S=u.length-2;C<S;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],X=g*(p-Y)>w*(b-M),F=g*(p-k)-w*(b-T);if(F>0){if(X){a.push(Y),a.push(M);continue}let I=Y-k,P=M-T,D=F/(I*g-P*w);if(D>=0&&D<=1)a.push(k+I*D),a.push(T+P*D);else{a.push(Y),a.push(M);continue}}else if(X){let I=Y-k,P=M-T,D=F/(I*g-P*w);if(D>=0&&D<=1)a.push(k+I*D),a.push(T+P*D),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==d)break;let v=a;a=u,a.length=0,u=v}if(h!=a){h.length=0;for(let f=0,p=a.length-2;f<p;f++)h[f]=a[f]}else h.length=h.length-2;return c}static makeClockwise(t){let s=t,r=t.length,i=s[r-2]*s[1]-s[0]*s[r-1],l=0,o=0,n=0,a=0;for(let h=0,c=r-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],i+=l*a-n*o;if(!(i<0))for(let h=0,c=r-2,u=r>>1;h<u;h+=2){let d=s[h],m=s[h+1],f=c-h;s[h]=s[f],s[h+1]=s[f+1],s[f]=d,s[f+1]=m}}},Gs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Lt,r=typeof e=="string"?JSON.parse(e):e,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=A(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let l=0;l<r.bones.length;l++){let o=r.bones[l],n=null,a=A(o,"parent",null);a&&(n=s.findBone(a));let h=new He(s.bones.length,o.name,n);h.length=A(o,"length",0)*t,h.x=A(o,"x",0)*t,h.y=A(o,"y",0)*t,h.rotation=A(o,"rotation",0),h.scaleX=A(o,"scaleX",1),h.scaleY=A(o,"scaleY",1),h.shearX=A(o,"shearX",0),h.shearY=A(o,"shearY",0),h.inherit=E.enumValue(Kt,A(o,"inherit","Normal")),h.skinRequired=A(o,"skin",!1);let c=A(o,"color",null);c&&h.color.setFromString(c),s.bones.push(h)}if(r.slots)for(let l=0;l<r.slots.length;l++){let o=r.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new is(s.slots.length,n,a),c=A(o,"color",null);c&&h.color.setFromString(c);let u=A(o,"dark",null);u&&(h.darkColor=V.fromString(u)),h.attachmentName=A(o,"attachment",null),h.blendMode=E.enumValue(rs,A(o,"blend","normal")),h.visible=A(o,"visible",!0),s.slots.push(h)}if(r.ik)for(let l=0;l<r.ik.length;l++){let o=r.ik[l],n=new Ke(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let c=s.findBone(o.bones[h]);if(!c)throw new Error(`Couldn't find bone ${o.bones[h]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=A(o,"mix",1),n.softness=A(o,"softness",0)*t,n.bendDirection=A(o,"bendPositive",!0)?1:-1,n.compress=A(o,"compress",!1),n.stretch=A(o,"stretch",!1),n.uniform=A(o,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let l=0;l<r.transform.length;l++){let o=r.transform[l],n=new ns(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=o.bones[c],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${o.name}.`);n.bones.push(d)}let a=o.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=h,n.local=A(o,"local",!1),n.relative=A(o,"relative",!1),n.offsetRotation=A(o,"rotation",0),n.offsetX=A(o,"x",0)*t,n.offsetY=A(o,"y",0)*t,n.offsetScaleX=A(o,"scaleX",0),n.offsetScaleY=A(o,"scaleY",0),n.offsetShearY=A(o,"shearY",0),n.mixRotate=A(o,"mixRotate",1),n.mixX=A(o,"mixX",1),n.mixY=A(o,"mixY",n.mixX),n.mixScaleX=A(o,"mixScaleX",1),n.mixScaleY=A(o,"mixScaleY",n.mixScaleX),n.mixShearY=A(o,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let l=0;l<r.path.length;l++){let o=r.path[l],n=new Qe(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=o.bones[c],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${o.name}.`);n.bones.push(d)}let a=o.target,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=h,n.positionMode=E.enumValue(Ze,A(o,"positionMode","Percent")),n.spacingMode=E.enumValue(ts,A(o,"spacingMode","Length")),n.rotateMode=E.enumValue(es,A(o,"rotateMode","Tangent")),n.offsetRotation=A(o,"rotation",0),n.position=A(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=A(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=A(o,"mixRotate",1),n.mixX=A(o,"mixX",1),n.mixY=A(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let l=0;l<r.physics.length;l++){const o=r.physics[l],n=new Us(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);const a=o.bone,h=s.findBone(a);if(h==null)throw new Error("Physics bone not found: "+a);n.bone=h,n.x=A(o,"x",0),n.y=A(o,"y",0),n.rotate=A(o,"rotate",0),n.scaleX=A(o,"scaleX",0),n.shearX=A(o,"shearX",0),n.limit=A(o,"limit",5e3)*t,n.step=1/A(o,"fps",60),n.inertia=A(o,"inertia",1),n.strength=A(o,"strength",100),n.damping=A(o,"damping",1),n.massInverse=1/A(o,"mass",1),n.wind=A(o,"wind",0),n.gravity=A(o,"gravity",0),n.mix=A(o,"mix",1),n.inertiaGlobal=A(o,"inertiaGlobal",!1),n.strengthGlobal=A(o,"strengthGlobal",!1),n.dampingGlobal=A(o,"dampingGlobal",!1),n.massGlobal=A(o,"massGlobal",!1),n.windGlobal=A(o,"windGlobal",!1),n.gravityGlobal=A(o,"gravityGlobal",!1),n.mixGlobal=A(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let l=0;l<r.skins.length;l++){let o=r.skins[l],n=new Vt(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let u in c){let d=this.readAttachment(c[u],n,h.index,u,s);d&&n.setAttachment(h.index,u,d)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let l in r.events){let o=r.events[l],n=new Je(l);n.intValue=A(o,"int",0),n.floatValue=A(o,"float",0),n.stringValue=A(o,"string",""),n.audioPath=A(o,"audio",null),n.audioPath&&(n.volume=A(o,"volume",1),n.balance=A(o,"balance",0)),s.events.push(n)}if(r.animations)for(let l in r.animations){let o=r.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(e,t,s,r,i){let l=this.scale;switch(r=A(e,"name",r),A(e,"type","region")){case"region":{let o=A(e,"path",r),n=this.readSequence(A(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,r,o,n);if(!a)return null;a.path=o,a.x=A(e,"x",0)*l,a.y=A(e,"y",0)*l,a.scaleX=A(e,"scaleX",1),a.scaleY=A(e,"scaleY",1),a.rotation=A(e,"rotation",0),a.width=e.width*l,a.height=e.height*l,a.sequence=n;let h=A(e,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=A(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=A(e,"path",r),n=this.readSequence(A(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,r,o,n);if(!a)return null;a.path=o;let h=A(e,"color",null);h&&a.color.setFromString(h),a.width=A(e,"width",0)*l,a.height=A(e,"height",0)*l,a.sequence=n;let c=A(e,"parent",null);if(c)return this.linkedMeshes.push(new rr(a,A(e,"skin",null),s,c,A(e,"timelines",!0))),a;let u=e.uvs;return this.readVertices(e,a,u.length),a.triangles=e.triangles,a.regionUVs=u,a.region!=null&&a.updateRegion(),a.edges=A(e,"edges",null),a.hullLength=A(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=A(e,"closed",!1),o.constantSpeed=A(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*l;o.lengths=a;let h=A(e,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=A(e,"x",0)*l,o.y=A(e,"y",0)*l,o.rotation=A(e,"rotation",0);let n=A(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let n=A(e,"end",null);n&&(o.endSlot=i.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let h=A(e,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(e){if(e==null)return null;let t=new ws(A(e,"count",0));return t.start=A(e,"start",1),t.digits=A(e,"digits",0),t.setupIndex=A(e,"setup",0),t}readVertices(e,t,s){let r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let n=E.toFloatArray(i);if(r!=1)for(let a=0,h=i.length;a<h;a++)n[a]*=r;t.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=i.length;n<a;){let h=i[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(i[n]),l.push(i[n+1]*r),l.push(i[n+2]*r),l.push(i[n+3])}t.bones=o,t.vertices=E.toFloatArray(l)}readAnimation(e,t,s){let r=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let h=a.index;for(let c in n){let u=n[c];if(!u)continue;let d=u.length;if(c=="attachment"){let m=new Ct(d,h);for(let f=0;f<d;f++){let p=u[f];m.setFrame(f,A(p,"time",0),A(p,"name",null))}i.push(m)}else if(c=="rgba"){let m=new ye(d,d<<2,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=u[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=V.fromString(x.color),C=f.curve;C&&(g=W(C,m,g,w,0,p,y,b.r,v.r,1),g=W(C,m,g,w,1,p,y,b.g,v.g,1),g=W(C,m,g,w,2,p,y,b.b,v.b,1),g=W(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,f=x}i.push(m)}else if(c=="rgb"){let m=new ve(d,d*3,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=u[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=V.fromString(x.color),C=f.curve;C&&(g=W(C,m,g,w,0,p,y,b.r,v.r,1),g=W(C,m,g,w,1,p,y,b.g,v.g,1),g=W(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,f=x}i.push(m)}else if(c=="alpha")i.push(lt(u,new Ce(d,d,h),0,1));else if(c=="rgba2"){let m=new Se(d,d*7,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.light),w=V.fromString(f.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let y=u[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=V.fromString(y.light),S=V.fromString(y.dark),k=f.curve;k&&(x=W(k,m,x,g,0,p,v,b.r,C.r,1),x=W(k,m,x,g,1,p,v,b.g,C.g,1),x=W(k,m,x,g,2,p,v,b.b,C.b,1),x=W(k,m,x,g,3,p,v,b.a,C.a,1),x=W(k,m,x,g,4,p,v,w.r,S.r,1),x=W(k,m,x,g,5,p,v,w.g,S.g,1),x=W(k,m,x,g,6,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}i.push(m)}else if(c=="rgb2"){let m=new Ae(d,d*6,h),f=u[0],p=A(f,"time",0),b=V.fromString(f.light),w=V.fromString(f.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,w.r,w.g,w.b);let y=u[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=V.fromString(y.light),S=V.fromString(y.dark),k=f.curve;k&&(x=W(k,m,x,g,0,p,v,b.r,C.r,1),x=W(k,m,x,g,1,p,v,b.g,C.g,1),x=W(k,m,x,g,2,p,v,b.b,C.b,1),x=W(k,m,x,g,3,p,v,w.r,S.r,1),x=W(k,m,x,g,4,p,v,w.g,S.g,1),x=W(k,m,x,g,5,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}i.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let h=a.index;for(let c in n){let u=n[c],d=u.length;if(d!=0){if(c==="rotate")i.push(lt(u,new Rt(d,d,h),0,1));else if(c==="translate"){let m=new ce(d,d<<1,h);i.push(ls(u,m,"x","y",0,r))}else if(c==="translatex"){let m=new de(d,d,h);i.push(lt(u,m,0,r))}else if(c==="translatey"){let m=new ue(d,d,h);i.push(lt(u,m,0,r))}else if(c==="scale"){let m=new fe(d,d<<1,h);i.push(ls(u,m,"x","y",1,1))}else if(c==="scalex"){let m=new me(d,d,h);i.push(lt(u,m,1,1))}else if(c==="scaley"){let m=new ge(d,d,h);i.push(lt(u,m,1,1))}else if(c==="shear"){let m=new pe(d,d<<1,h);i.push(ls(u,m,"x","y",0,1))}else if(c==="shearx"){let m=new xe(d,d,h);i.push(lt(u,m,0,1))}else if(c==="sheary"){let m=new be(d,d,h);i.push(lt(u,m,0,1))}else if(c==="inherit"){let m=new we(d,a.index);for(let f=0;f<u.length;f++){let p=u[f];m.setFrame(f,A(p,"time",0),E.enumValue(Kt,A(p,"inherit","Normal")))}i.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let h=s.findIkConstraint(o);if(!h)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(h),u=new Te(n.length,n.length<<1,c),d=A(a,"time",0),m=A(a,"mix",1),f=A(a,"softness",0)*r;for(let p=0,b=0;;p++){u.setFrame(p,d,m,f,A(a,"bendPositive",!0)?1:-1,A(a,"compress",!1),A(a,"stretch",!1));let w=n[p+1];if(!w){u.shrink(b);break}let g=A(w,"time",0),x=A(w,"mix",1),y=A(w,"softness",0)*r,v=a.curve;v&&(b=W(v,u,b,p,0,d,g,m,x,1),b=W(v,u,b,p,1,d,g,f,y,r)),d=g,m=x,f=y,a=w}i.push(u)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let h=s.findTransformConstraint(o);if(!h)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(h),u=new Ie(n.length,n.length*6,c),d=A(a,"time",0),m=A(a,"mixRotate",1),f=A(a,"mixX",1),p=A(a,"mixY",f),b=A(a,"mixScaleX",1),w=A(a,"mixScaleY",b),g=A(a,"mixShearY",1);for(let x=0,y=0;;x++){u.setFrame(x,d,m,f,p,b,w,g);let v=n[x+1];if(!v){u.shrink(y);break}let C=A(v,"time",0),S=A(v,"mixRotate",1),k=A(v,"mixX",1),T=A(v,"mixY",k),Y=A(v,"mixScaleX",1),M=A(v,"mixScaleY",Y),X=A(v,"mixShearY",1),F=a.curve;F&&(y=W(F,u,y,x,0,d,C,m,S,1),y=W(F,u,y,x,1,d,C,f,k,1),y=W(F,u,y,x,2,d,C,p,T,1),y=W(F,u,y,x,3,d,C,b,Y,1),y=W(F,u,y,x,4,d,C,w,M,1),y=W(F,u,y,x,5,d,C,g,X,1)),d=C,m=S,f=k,p=T,b=Y,w=M,b=Y,a=v}i.push(u)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let h=s.pathConstraints.indexOf(a);for(let c in n){let u=n[c],d=u[0];if(!d)continue;let m=u.length;if(c==="position"){let f=new Me(m,m,h);i.push(lt(u,f,0,a.positionMode==0?r:1))}else if(c==="spacing"){let f=new Ye(m,m,h);i.push(lt(u,f,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(c==="mix"){let f=new Pe(m,m*3,h),p=A(d,"time",0),b=A(d,"mixRotate",1),w=A(d,"mixX",1),g=A(d,"mixY",w);for(let x=0,y=0;;x++){f.setFrame(x,p,b,w,g);let v=u[x+1];if(!v){f.shrink(y);break}let C=A(v,"time",0),S=A(v,"mixRotate",1),k=A(v,"mixX",1),T=A(v,"mixY",k),Y=d.curve;Y&&(y=W(Y,f,y,x,0,p,C,b,S,1),y=W(Y,f,y,x,1,p,C,w,k,1),y=W(Y,f,y,x,2,p,C,g,T,1)),p=C,b=S,w=k,g=T,d=v}i.push(f)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let h=s.findPhysicsConstraint(o);if(!h)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(h)}for(let h in n){let c=n[h],u=c[0];if(!u)continue;let d=c.length;if(h=="reset"){const f=new Ve(d,a);for(let p=0;u!=null;u=c[p+1],p++)f.setFrame(p,A(u,"time",0));i.push(f);continue}let m;if(h=="inertia")m=new Xe(d,d,a);else if(h=="strength")m=new Fe(d,d,a);else if(h=="damping")m=new Be(d,d,a);else if(h=="mass")m=new Ee(d,d,a);else if(h=="wind")m=new Re(d,d,a);else if(h=="gravity")m=new De(d,d,a);else if(h=="mix")m=new Le(d,d,a);else continue;i.push(lt(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],u=s.findSlot(h);if(!u)throw new Error("Slot not found: "+h);let d=u.index;for(let m in c){let f=c[m],p=a.getAttachment(d,m);for(let b in f){let w=f[b],g=w[0];if(g){if(b=="deform"){let x=p.bones,y=p.vertices,v=x?y.length/3*2:y.length,C=new ke(w.length,w.length,d,p),S=A(g,"time",0);for(let k=0,T=0;;k++){let Y,M=A(g,"vertices",null);if(!M)Y=x?E.newFloatArray(v):y;else{Y=E.newFloatArray(v);let P=A(g,"offset",0);if(E.arrayCopy(M,0,Y,P,M.length),r!=1)for(let D=P,O=D+M.length;D<O;D++)Y[D]*=r;if(!x)for(let D=0;D<v;D++)Y[D]+=y[D]}C.setFrame(k,S,Y);let X=w[k+1];if(!X){C.shrink(T);break}let F=A(X,"time",0),I=g.curve;I&&(T=W(I,C,T,k,0,S,F,0,1,1)),S=F,g=X}i.push(C)}else if(b=="sequence"){let x=new Ne(w.length,d,p),y=0;for(let v=0;v<w.length;v++){let C=A(g,"delay",y),S=A(g,"time",0),k=ys[A(g,"mode","hold")],T=A(g,"index",0);x.setFrame(v,S,k,T,C),y=C,g=w[v+1]}i.push(x)}}}}}}if(e.drawOrder){let o=new It(e.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<e.drawOrder.length;h++,a++){let c=e.drawOrder[h],u=null,d=A(c,"offsets",null);if(d){u=E.newArray(n,-1);let m=E.newArray(n-d.length,0),f=0,p=0;for(let b=0;b<d.length;b++){let w=d[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;f!=x;)m[p++]=f++;u[f+w.offset]=f++}for(;f<n;)m[p++]=f++;for(let b=n-1;b>=0;b--)u[b]==-1&&(u[b]=m[--p])}o.setFrame(a,A(c,"time",0),u)}i.push(o)}if(e.events){let o=new Gt(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let h=e.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let u=new je(E.toSinglePrecision(A(h,"time",0)),c);u.intValue=A(h,"int",c.intValue),u.floatValue=A(h,"float",c.floatValue),u.stringValue=A(h,"string",c.stringValue),u.data.audioPath&&(u.volume=A(h,"volume",1),u.balance=A(h,"balance",0)),o.setFrame(n,u)}i.push(o)}let l=0;for(let o=0,n=i.length;o<n;o++)l=Math.max(l,i[o].getDuration());s.animations.push(new Wt(t,i,l))}},rr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function lt(e,t,s,r){let i=e[0],l=A(i,"time",0),o=A(i,"value",s)*r,n=0;for(let a=0;;a++){t.setFrame(a,l,o);let h=e[a+1];if(!h)return t.shrink(n),t;let c=A(h,"time",0),u=A(h,"value",s)*r;i.curve&&(n=W(i.curve,t,n,a,0,l,c,o,u,r)),l=c,o=u,i=h}}function ls(e,t,s,r,i,l){let o=e[0],n=A(o,"time",0),a=A(o,s,i)*l,h=A(o,r,i)*l,c=0;for(let u=0;;u++){t.setFrame(u,n,a,h);let d=e[u+1];if(!d)return t.shrink(c),t;let m=A(d,"time",0),f=A(d,s,i)*l,p=A(d,r,i)*l,b=o.curve;b&&(c=W(b,t,c,u,0,n,m,a,f,l),c=W(b,t,c,u,1,n,m,h,p,l)),n=m,a=f,h=p,o=d}}function W(e,t,s,r,i,l,o,n,a,h){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,u=e[c],d=e[c+1]*h,m=e[c+2],f=e[c+3]*h;return t.setBezier(s,r,i,l,n,u,d,m,f,o,a),s+1}function A(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var Q=pt("pixi.js"),nr=pt("pixi.js"),hs=class xt extends ze{static textureMap=new Map;static from(t){return xt.textureMap.has(t)?xt.textureMap.get(t):new xt(t)}texture;constructor(t){super(t.resource),this.texture=nr.Texture.from(t)}setFilters(t,s){const r=this.texture.source.style;r.minFilter=xt.toPixiTextureFilter(t),r.magFilter=xt.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=xt.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,s){const r=this.texture.source.style;r.addressModeU=xt.toPixiTextureWrap(t),r.addressModeV=xt.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Nt="spineTextureAtlasLoader",ar={extension:Q.ExtensionType.Asset,resolver:{test:e=>(0,Q.checkExtension)(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(Q.Resolver.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{id:Nt,name:Nt,extension:{type:Q.ExtensionType.LoadParser,priority:Q.LoaderParserPriority.Normal,name:Nt},test(e){return(0,Q.checkExtension)(e,".atlas")},async load(e){return await(await Q.DOMAdapter.get().fetch(e)).text()},testParse(e,t){const s=(0,Q.checkExtension)(t.src,".atlas"),r=typeof e=="string",i=t.parser===Nt||t.loadParser===Nt;return Promise.resolve((s||i)&&r)},unload(e){e.dispose()},async parse(e,t,s){const r=t.data||{};let i=Q.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const l=new Jt(e);if(r.images instanceof Q.TextureSource||typeof r.images=="string"){const n=r.images;r.images={},r.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=r?.images?r.images[a]:void 0;if(h instanceof Q.TextureSource)n.setTexture(hs.from(h));else{const c=h??Q.path.normalize([...i.split(Q.path.sep),a].join(Q.path.sep)),u={src:(0,Q.copySearchParams)(c,t.src),data:{...r.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=s.load(u).then(m=>{n.setTexture(hs.from(m.source))});o.push(d)}}return await Promise.all(o),l}}};Q.extensions.add(ar);var wt=pt("pixi.js"),Ot="spineSkeletonLoader";function or(e){return Object.prototype.hasOwnProperty.call(e,"bones")}function lr(e){return e instanceof Uint8Array}var hr={extension:wt.ExtensionType.Asset,loader:{id:Ot,name:Ot,extension:{type:wt.ExtensionType.LoadParser,priority:wt.LoaderParserPriority.Normal,name:Ot},test(e){return(0,wt.checkExtension)(e,".skel")},async load(e){const t=await wt.DOMAdapter.get().fetch(e);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=(0,wt.checkExtension)(t.src,".json")&&or(e),r=(0,wt.checkExtension)(t.src,".skel")&&lr(e),i=t.parser===Ot||t.loadParser===Ot;return Promise.resolve(s||r||i)}}};wt.extensions.add(hr);var Zt=pt("pixi.js"),At=pt("pixi.js"),cr=new Float32Array(1),dr=new Uint32Array(1),ur=class extends At.Geometry{constructor(){const t=new At.Buffer({data:cr,label:"attribute-batch-buffer",usage:At.BufferUsage.VERTEX|At.BufferUsage.COPY_DST,shrinkToFit:!1}),s=new At.Buffer({data:dr,label:"index-batch-buffer",usage:At.BufferUsage.INDEX|At.BufferUsage.COPY_DST,shrinkToFit:!1}),r=7*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:r,offset:0},aUV:{buffer:t,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:r,offset:4*4},aDarkColor:{buffer:t,format:"unorm8x4",stride:r,offset:5*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:r,offset:6*4}},indexBuffer:s})}},gt=pt("pixi.js"),fr={name:"color-bit",vertex:{header:`
|
|
3
3
|
@in aDarkColor: vec4<f32>;
|
|
4
4
|
@out vDarkColor: vec4<f32>;
|
|
5
5
|
`,main:`
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
|
|
25
25
|
finalColor.a = outColor.a * vColor.a;
|
|
26
26
|
finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
|
|
27
|
-
`}},gr=class extends gt.Shader{constructor(e){const t=(0,gt.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[gt.colorBitGl,mr,(0,gt.generateTextureBatchBitGl)(e),gt.roundPixelsBitGl]}),s=(0,gt.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[gt.colorBit,fr,(0,gt.generateTextureBatchBit)(e),gt.roundPixelsBit]});super({glProgram:t,gpuProgram:s,resources:{batchSamplers:(0,gt.getBatchSamplersUniformGroup)(e)}})}},Hs=null,pr=class hi extends Kt.Batcher{static extension={type:[Kt.ExtensionType.Batcher],name:"darkTint"};geometry=new ur;shader=Hs||(Hs=new gr(this.maxTextures));name=hi.extension.name;vertexSize=7;packAttributes(t,s,r,i,l){const o=l<<16|t.roundPixels&65535,n=t.transform,a=n.a,h=n.b,c=n.c,u=n.d,d=n.tx,m=n.ty,{positions:f,uvs:p}=t,b=t.color,w=(b>>24&255)/255,g=Kt.Color.shared.setValue(t.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=t.attributeOffset,y=x+t.attributeSize;for(let v=x;v<y;v++){const C=v*2,S=f[C],k=f[C+1];s[i++]=a*S+c*k+d,s[i++]=u*k+h*S+m,s[i++]=p[C],s[i++]=p[C+1],r[i++]=b,r[i++]=g,r[i++]=o}}packQuadAttributes(t,s,r,i,l){const o=t.texture,n=t.transform,a=n.a,h=n.b,c=n.c,u=n.d,d=n.tx,m=n.ty,f=t.bounds,p=f.maxX,b=f.minX,w=f.maxY,g=f.minY,x=o.uvs,y=t.color,v=t.darkColor,C=l<<16|t.roundPixels&65535;s[i+0]=a*b+c*g+d,s[i+1]=u*g+h*b+m,s[i+2]=x.x0,s[i+3]=x.y0,r[i+4]=y,r[i+5]=v,r[i+6]=C,s[i+7]=a*p+c*g+d,s[i+8]=u*g+h*p+m,s[i+9]=x.x1,s[i+10]=x.y1,r[i+11]=y,r[i+12]=v,r[i+13]=C,s[i+14]=a*p+c*w+d,s[i+15]=u*w+h*p+m,s[i+16]=x.x2,s[i+17]=x.y2,r[i+18]=y,r[i+19]=v,r[i+20]=C,s[i+21]=a*b+c*w+d,s[i+22]=u*w+h*b+m,s[i+23]=x.x3,s[i+24]=x.y3,r[i+25]=y,r[i+26]=v,r[i+27]=C}};Kt.extensions.add(pr);var Nt=pt("pixi.js"),xr=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const e=this.data.color,t=this.renderable.groupColor,s=this.renderable.groupAlpha;let r;const i=e.a*s*255;if(t!==16777215){const l=t>>16&255,o=t>>8&255,n=t&255,a=e.r*n,h=e.g*o,c=e.b*l;r=i<<24|c<<16|h<<8|a}else r=i<<24|e.b*255<<16|e.g*255<<8|e.r*255;return r}get darkColor(){const e=this.data.darkColor;return e.b*255<<16|e.g*255<<8|e.r*255}get groupTransform(){return this.renderable.groupTransform}setData(e,t,s,r){if(this.renderable=e,this.transform=e.groupTransform,this.data=t,t.clipped){const i=t.clippedData;this.indexSize=i.indicesCount,this.attributeSize=i.vertexCount,this.positions=i.vertices,this.indices=i.indices,this.uvs=i.uvs}else this.indexSize=t.indices.length,this.attributeSize=t.vertices.length/2,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs;this.texture=t.texture,this.roundPixels=r,this.blendMode=s,this.batcherName=t.darkTint?"darkTint":"default"}},br={0:"normal",1:"add",2:"multiply",3:"screen"},$s=class{static extension={type:[Nt.ExtensionType.WebGLPipes,Nt.ExtensionType.WebGPUPipes,Nt.ExtensionType.CanvasPipes],name:"spine"};renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(e){this.renderer=e}validateRenderable(e){if(e._validateAndTransformAttachments(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let r=0,i=t.length;r<i;r++){const l=t[r],o=l.getAttachment();if(o instanceof ot||o instanceof ut){const n=e._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a.texture&&!a._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}addRenderable(e,t){const s=this._getSpineData(e),r=this.renderer.renderPipes.batch,i=e.skeleton.drawOrder,l=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let o=0,n=i.length;o<n;o++){const a=i[o],h=a.getAttachment(),c=br[a.data.blendMode];if(h instanceof ot||h instanceof ut){const d=e._getCachedData(a,h),m=s.slotBatches[d.id]||=new xr;m.setData(e,d,c,l),d.skipRender||r.addToBatch(m,t)}const u=e._slotsObject[a.data.name];if(u){const d=u.container;d.includeInBuild=!0,(0,Nt.collectAllRenderables)(d,t,this.renderer),d.includeInBuild=!1}}}updateRenderable(e){const t=this.gpuSpineData[e.uid];e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;const s=e.skeleton.drawOrder;for(let r=0,i=s.length;r<i;r++){const l=s[r],o=l.getAttachment();if((o instanceof ot||o instanceof ut)&&!e._getCachedData(l,o).skipRender){const a=t.slotBatches[e._getCachedData(l,o).id];a._batcher?.updateElement(a)}}}destroyRenderable(e){this.gpuSpineData[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(e){return this.gpuSpineData[e.uid]||this._initMeshData(e)}_initMeshData(e){return this.gpuSpineData[e.uid]={slotBatches:{}},e.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[e.uid]}};Nt.extensions.add($s);var it=pt("pixi.js"),Qt=new Et;Yt.yDown=!0;var Pt=new Jt,wr=class{constructor(e,t,s,r){this.x=e,this.y=t,this.width=s,this.height=r}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},yr=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new Yt(e.skeleton.data);t.setToSetupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new Jt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},vr=class{constructor(e,t=[],s=.05,r=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=r}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new Ve(e.state.data),s=new Yt(e.skeleton.data),r=this.clipping?new Jt:void 0,i=s.data;if(this.skins.length>0){let o=new Vt("custom-skin");for(const n of this.skins){const a=i.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?i.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(2);const o=s.getBoundsRect(r);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let d=0;d<c;d++){const m=d>0?this.timeStep:0;t.update(m),t.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(r);o=Math.min(o,f.x),n=Math.min(n,f.y),a=Math.max(a,f.x+f.width),h=Math.max(h,f.y+f.height)}const u={x:o,y:n,width:a-o,height:h-n};return u.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:u}}},js=new Tt(()=>new it.Graphics),Cr=class gs extends it.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!0;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t?it.Ticker.shared.add(this.internalUpdate,this):it.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=t}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Lt&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const s=t instanceof Lt?t:t.skeletonData;this.skeleton=new Yt(s),this.state=new Ve(new Ys(s)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(i=>!!i.data.darkColor):t?.darkTint;const r=this.skeleton.slots;for(let i=0;i<r.length;i++)this.attachmentCacheData[i]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(s??it.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,s){const r=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(r)} not found`);if(Qt.set(s.x,s.y),t.parent){const i=t.parent.worldToLocal(Qt);t.x=i.x,t.y=-i.y}else t.x=Qt.x,t.y=Qt.y}getBonePosition(t,s){const r=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(s||(s={x:0,y:0}),s.x=t.worldX,s.y=t.worldY,s):(console.error(`Cant set bone position! Bone ${String(r)} not found`),s)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,s=this._lastAttachments;let r=0,i=!1;for(let l=0;l<t.length;l++){const n=t[l].getAttachment();n&&(n!==s[r]&&(i=!0,s[r]=n),r++)}r!==s.length&&(i=!0,s.length=r),this.spineAttachmentsDirty||=i}currentClippingSlot;updateAndSetPixiMask(t,s){const r=t.attachment;if(r&&r instanceof St){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let i=this.currentClippingSlot,l=this._slotsObject[t.data.name];if(i&&l){let o=i.mask;if(o||(o=js.obtain(),i.mask=o,this.addChild(o)),!i.maskComputed){let n=i.slot,a=n.attachment;i.maskComputed=!0;const h=a.worldVerticesLength,c=i.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(i&&i.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof St)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),js.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const t=this.skeleton.drawOrder;for(let s=0;s<t.length;s++){const r=t[s];this.updateAndSetPixiMask(r,s===t.length-1);const i=r.getAttachment();if(i){if(i instanceof ut||i instanceof ot){const l=this._getCachedData(r,i);i instanceof ot?i.computeWorldVertices(r,l.vertices,0,2):i.computeWorldVertices(r,0,i.worldVerticesLength,l.vertices,0,2),l.uvs.length<i.uvs.length&&(l.uvs=new Float32Array(i.uvs.length)),(0,it.fastCopy)(i.uvs.buffer,l.uvs.buffer);const n=r.bone.skeleton.color,a=r.color,h=i.color;l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,n.a*a.a*h.a),r.darkColor&&l.darkColor.setFromColor(r.darkColor),l.skipRender=l.clipped=!1;const c=i.region?.texture.texture||it.Texture.EMPTY;l.texture!==c&&(l.texture=c,this.spineTexturesDirty=!0),Pt.isClipping()&&this.updateClippingData(l)}else if(i instanceof St){Pt.clipStart(r,i);continue}}Pt.clipEndWithSlot(r)}Pt.clipEnd()}updateClippingData(t){t.clipped=!0,Pt.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:s,clippedUVs:r,clippedTriangles:i}=Pt,l=s.length/2,o=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=t.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;t.skipRender=l===0,a&&(this.spineAttachmentsDirty=!0,n.vertexCount<l&&(n.vertices=new Float32Array(l*2),n.uvs=new Float32Array(l*2)),n.indices.length<o&&(n.indices=new Uint16Array(o)));const{vertices:h,uvs:c,indices:u}=n;for(let d=0;d<l;d++)h[d*2]=s[d*2],h[d*2+1]=s[d*2+1],c[d*2]=r[d*2],c[d*2+1]=r[d*2+1];n.vertexCount=l;for(let d=0;d<o;d++)u[d]!==i[d]&&(this.spineAttachmentsDirty=!0,u[d]=i[d]);n.indicesCount=o}updateSlotObjects(){for(const t in this._slotsObject){const s=this._slotsObject[t];s&&this.updateSlotObject(s)}}updateSlotObject(t){const{slot:s,container:r}=t,i=t.followAttachmentTimeline?!!s.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(s)&&i,r.visible){let l=s.bone;r.position.set(l.worldX,l.worldY),r.angle=l.getWorldRotationX();let o=1,n=1;for(;l;)o*=l.scaleX,n*=l.scaleY,l=l.parent;o<0&&(r.angle-=180),r.scale.set(s.bone.getWorldScaleX()*Math.sign(o),s.bone.getWorldScaleY()*Math.sign(n)),r.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,s){return this.attachmentCacheData[t.data.index][s.name]||this.initCachedData(t,s)}initCachedData(t,s){let r;return s instanceof ot?(r=new Float32Array(8),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:r,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(r=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:r,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[t.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,s,r){t=this.getSlotFromRef(t);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(t),s.includeInBuild=!1,this.addChild(s);const i={container:s,slot:t,followAttachmentTimeline:r?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){let s;if(t instanceof it.Container){for(const r in this._slotsObject)if(this._slotsObject[r]?.container===t){this._slotsObject[r]=null,s=t;break}}else{const r=this.getSlotFromRef(t);s=this._slotsObject[r.data.name]?.container,this._slotsObject[r.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([t,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[t]})}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new ns;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),r=this._bounds;r.clear(),r.x=s.x,r.y=s.y,r.width=s.width,r.height=s.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,r=this._bounds;r.clear();for(let i=0;i<s.length;i++){const l=s[i],o=l.getAttachment();if(o&&(o instanceof ot||o instanceof ut)){const n=this._getCachedData(l,o);r.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),it.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.worldToLocal(t):s.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:r=1,darkTint:i,autoUpdate:l=!0,boundsProvider:o}){const n=`${t}-${s}-${r}`;if(it.Cache.has(n))return new gs({skeletonData:it.Cache.get(n),darkTint:i,autoUpdate:l,boundsProvider:o});const a=it.Assets.get(t),h=it.Assets.get(s),c=new Es(h),u=a instanceof Uint8Array?new qs(c):new Gs(c);u.scale=r;const d=u.readSkeletonData(a);return it.Cache.set(n,d),new gs({skeletonData:d,darkTint:i,autoUpdate:l,boundsProvider:o})}},et=pt("pixi.js"),Sr=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new et.Container,bones:new et.Container,skeletonXY:new et.Graphics,regionAttachmentsShape:new et.Graphics,meshTrianglesLine:new et.Graphics,meshHullLine:new et.Graphics,clippingPolygon:new et.Graphics,boundingBoxesRect:new et.Graphics,boundingBoxesCircle:new et.Graphics,boundingBoxesPolygon:new et.Graphics,pathsCurve:new et.Graphics,pathsLine:new et.Graphics,eventText:new et.Container,eventCallback:{event:(s,r)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),l=new et.Text({text:r.data.name,style:{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(e.scale.x),l.anchor.set(.5),t.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let i=t.bones.children.length;i>0;i--)t.bones.children[i-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(e.scale.x||e.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,r,s),this.drawPaths&&this.drawPathsFunc(e,t,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,r),this.drawClipping&&this.drawClippingFunc(e,t,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,r),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,r){const i=e.skeleton,l=i.x,o=i.y,n=i.bones;t.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const u=n[h],d=u.data.length,m=l+u.worldX,f=o+u.worldY,p=l+d*u.a+u.worldX,b=o+d*u.b+u.worldY;if(u.data.name==="root"||u.data.parent===null)continue;const w=Math.abs(m-p),g=Math.abs(f-b),x=Math.pow(w,2),y=g,v=Math.pow(g,2),C=Math.sqrt(x+v),S=Math.pow(C,2),k=Math.PI/180,T=Math.acos((S+v-x)/(2*y*C))||0;if(C===0)continue;const Y=new et.Graphics;t.bones.addChild(Y);const M=C/50/r;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=f,Y.pivot.y=C;let X=0;m<p&&f<b?X=-T+180*k:m>p&&f<b?X=180*k+T:m>p&&f>b?X=-T:m<p&&f>b?X=T:f===b&&m<p?X=90*k:f===b&&m>p?X=-90*k:m===p&&f<b?X=180*k:m===p&&f>b&&(X=0),Y.rotation=X,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;t.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l],a=n.getAttachment();if(a===null||!(a instanceof ot))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),t.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}t.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof ut))continue;const h=a,c=new Float32Array(h.worldVerticesLength),u=h.triangles;let d=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,f=u.length;m<f;m+=3){const p=u[m]*2,b=u[m+1]*2,w=u[m+2]*2;t.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&d>0){d=(d>>1)*2;let m=c[d-2],f=c[d-1];for(let p=0,b=d;p<b;p+=2){const w=c[p],g=c[p+1];t.meshHullLine.context.moveTo(w,g).lineTo(m,f),m=w,f=g}}}t.meshHullLine.stroke({width:s,color:this.meshHullColor}),t.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof St))continue;const h=a,c=h.worldVerticesLength,u=new Float32Array(c);h.computeWorldVertices(n,0,c,u,0,2),t.clippingPolygon.poly(Array.from(u))}t.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(e,t,s){const r=new ns;r.update(e.skeleton,!0),r.minX!==1/0&&t.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const i=r.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let u=0,d=o.length;u<d;u+=2){const m=o[u],f=o[u+1];t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(m,f,c),t.boundingBoxesCircle.fill(0),t.boundingBoxesCircle.circle(m,f,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,f)}t.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=i.length;o<n;o++){const a=i[o];l(a,0,a.length)}}drawPathsFunc(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Mt))continue;const h=a;let c=h.worldVerticesLength;const u=new Float32Array(c);h.computeWorldVertices(n,0,c,u,0,2);let d=u[2],m=u[3],f=0,p=0;if(h.closed){const b=u[0],w=u[1],g=u[c-2],x=u[c-1];f=u[c-4],p=u[c-3],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(b,w,g,x,f,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(b,w),t.pathsLine.moveTo(f,p),t.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=u[b],g=u[b+1],x=u[b+2],y=u[b+3];f=u[b+4],p=u[b+5],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(w,g,x,y,f,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(w,g),t.pathsLine.moveTo(f,p),t.pathsLine.lineTo(x,y),d=f,m=p}}t.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),t.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};return gi(ps)})();
|
|
27
|
+
`}},gr=class extends gt.Shader{constructor(e){const t=(0,gt.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[gt.colorBitGl,mr,(0,gt.generateTextureBatchBitGl)(e),gt.roundPixelsBitGl]}),s=(0,gt.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[gt.colorBit,fr,(0,gt.generateTextureBatchBit)(e),gt.roundPixelsBit]});super({glProgram:t,gpuProgram:s,resources:{batchSamplers:(0,gt.getBatchSamplersUniformGroup)(e)}})}},Hs=null,pr=class hi extends Zt.Batcher{static extension={type:[Zt.ExtensionType.Batcher],name:"darkTint"};geometry=new ur;shader=Hs||(Hs=new gr(this.maxTextures));name=hi.extension.name;vertexSize=7;packAttributes(t,s,r,i,l){const o=l<<16|t.roundPixels&65535,n=t.transform,a=n.a,h=n.b,c=n.c,u=n.d,d=n.tx,m=n.ty,{positions:f,uvs:p}=t,b=t.color,w=(b>>24&255)/255,g=Zt.Color.shared.setValue(t.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=t.attributeOffset,y=x+t.attributeSize;for(let v=x;v<y;v++){const C=v*2,S=f[C],k=f[C+1];s[i++]=a*S+c*k+d,s[i++]=u*k+h*S+m,s[i++]=p[C],s[i++]=p[C+1],r[i++]=b,r[i++]=g,r[i++]=o}}packQuadAttributes(t,s,r,i,l){const o=t.texture,n=t.transform,a=n.a,h=n.b,c=n.c,u=n.d,d=n.tx,m=n.ty,f=t.bounds,p=f.maxX,b=f.minX,w=f.maxY,g=f.minY,x=o.uvs,y=t.color,v=t.darkColor,C=l<<16|t.roundPixels&65535;s[i+0]=a*b+c*g+d,s[i+1]=u*g+h*b+m,s[i+2]=x.x0,s[i+3]=x.y0,r[i+4]=y,r[i+5]=v,r[i+6]=C,s[i+7]=a*p+c*g+d,s[i+8]=u*g+h*p+m,s[i+9]=x.x1,s[i+10]=x.y1,r[i+11]=y,r[i+12]=v,r[i+13]=C,s[i+14]=a*p+c*w+d,s[i+15]=u*w+h*p+m,s[i+16]=x.x2,s[i+17]=x.y2,r[i+18]=y,r[i+19]=v,r[i+20]=C,s[i+21]=a*b+c*w+d,s[i+22]=u*w+h*b+m,s[i+23]=x.x3,s[i+24]=x.y3,r[i+25]=y,r[i+26]=v,r[i+27]=C}};Zt.extensions.add(pr);var _t=pt("pixi.js"),xr=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const e=this.data.color,t=this.renderable.groupColor,s=this.renderable.groupAlpha;let r;const i=e.a*s*255;if(t!==16777215){const l=t>>16&255,o=t>>8&255,n=t&255,a=e.r*n,h=e.g*o,c=e.b*l;r=i<<24|c<<16|h<<8|a}else r=i<<24|e.b*255<<16|e.g*255<<8|e.r*255;return r}get darkColor(){const e=this.data.darkColor;return e.b*255<<16|e.g*255<<8|e.r*255}get groupTransform(){return this.renderable.groupTransform}setData(e,t,s,r){if(this.renderable=e,this.transform=e.groupTransform,this.data=t,t.clipped){const i=t.clippedData;this.indexSize=i.indicesCount,this.attributeSize=i.vertexCount,this.positions=i.vertices,this.indices=i.indices,this.uvs=i.uvs}else this.indexSize=t.indices.length,this.attributeSize=t.vertices.length/2,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs;this.texture=t.texture,this.roundPixels=r,this.blendMode=s,this.batcherName=t.darkTint?"darkTint":"default"}},br={0:"normal",1:"add",2:"multiply",3:"screen"},$s=class{static extension={type:[_t.ExtensionType.WebGLPipes,_t.ExtensionType.WebGPUPipes,_t.ExtensionType.CanvasPipes],name:"spine"};renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(e){this.renderer=e}validateRenderable(e){if(e._validateAndTransformAttachments(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let r=0,i=t.length;r<i;r++){const l=t[r],o=l.getAttachment();if(o instanceof ot||o instanceof ut){const n=e._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a.texture&&!a._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}addRenderable(e,t){const s=this._getSpineData(e),r=this.renderer.renderPipes.batch,i=e.skeleton.drawOrder,l=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let o=0,n=i.length;o<n;o++){const a=i[o],h=a.getAttachment(),c=br[a.data.blendMode];if(h instanceof ot||h instanceof ut){const d=e._getCachedData(a,h),m=s.slotBatches[d.id]||=new xr;m.setData(e,d,c,l),d.skipRender||r.addToBatch(m,t)}const u=e._slotsObject[a.data.name];if(u){const d=u.container;d.includeInBuild=!0,(0,_t.collectAllRenderables)(d,t,this.renderer),d.includeInBuild=!1}}}updateRenderable(e){const t=this.gpuSpineData[e.uid];e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;const s=e.skeleton.drawOrder;for(let r=0,i=s.length;r<i;r++){const l=s[r],o=l.getAttachment();if((o instanceof ot||o instanceof ut)&&!e._getCachedData(l,o).skipRender){const a=t.slotBatches[e._getCachedData(l,o).id];a._batcher?.updateElement(a)}}}destroyRenderable(e){this.gpuSpineData[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(e){return this.gpuSpineData[e.uid]||this._initMeshData(e)}_initMeshData(e){return this.gpuSpineData[e.uid]={slotBatches:{}},e.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[e.uid]}};_t.extensions.add($s);var it=pt("pixi.js"),te=new Et;Yt.yDown=!0;var Pt=new Qt,wr=class{constructor(e,t,s,r){this.x=e,this.y=t,this.width=s,this.height=r}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},yr=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new Yt(e.skeleton.data);t.setToSetupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new Qt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},vr=class{constructor(e,t=[],s=.05,r=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=r}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new Oe(e.state.data),s=new Yt(e.skeleton.data),r=this.clipping?new Qt:void 0,i=s.data;if(this.skins.length>0){let o=new Vt("custom-skin");for(const n of this.skins){const a=i.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?i.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(2);const o=s.getBoundsRect(r);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let d=0;d<c;d++){const m=d>0?this.timeStep:0;t.update(m),t.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(r);o=Math.min(o,f.x),n=Math.min(n,f.y),a=Math.max(a,f.x+f.width),h=Math.max(h,f.y+f.height)}const u={x:o,y:n,width:a-o,height:h-n};return u.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:u}}},js=new Tt(()=>new it.Graphics),Cr=class gs extends it.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!1;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?it.Ticker.shared.add(this.internalUpdate,this):!t&&this._autoUpdate&&it.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=t}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Lt&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const s=t instanceof Lt?t:t.skeletonData;this.skeleton=new Yt(s),this.state=new Oe(new Ys(s)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(i=>!!i.data.darkColor):t?.darkTint;const r=this.skeleton.slots;for(let i=0;i<r.length;i++)this.attachmentCacheData[i]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(s??it.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,s){const r=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(r)} not found`);if(te.set(s.x,s.y),t.parent){const i=t.parent.worldToLocal(te);t.x=i.x,t.y=-i.y}else t.x=te.x,t.y=te.y}getBonePosition(t,s){const r=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(s||(s={x:0,y:0}),s.x=t.worldX,s.y=t.worldY,s):(console.error(`Cant set bone position! Bone ${String(r)} not found`),s)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,s=this._lastAttachments;let r=0,i=!1;for(let l=0;l<t.length;l++){const n=t[l].getAttachment();n&&(n!==s[r]&&(i=!0,s[r]=n),r++)}r!==s.length&&(i=!0,s.length=r),this.spineAttachmentsDirty||=i}currentClippingSlot;updateAndSetPixiMask(t,s){const r=t.attachment;if(r&&r instanceof St){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let i=this.currentClippingSlot,l=this._slotsObject[t.data.name];if(i&&l){let o=i.mask;if(o||(o=js.obtain(),i.mask=o,this.addChild(o)),!i.maskComputed){let n=i.slot,a=n.attachment;i.maskComputed=!0;const h=a.worldVerticesLength,c=i.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(i&&i.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof St)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),js.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const t=this.skeleton.drawOrder;for(let s=0;s<t.length;s++){const r=t[s];this.updateAndSetPixiMask(r,s===t.length-1);const i=r.getAttachment();if(i){if(i instanceof ut||i instanceof ot){const l=this._getCachedData(r,i);i instanceof ot?i.computeWorldVertices(r,l.vertices,0,2):i.computeWorldVertices(r,0,i.worldVerticesLength,l.vertices,0,2),l.uvs.length<i.uvs.length&&(l.uvs=new Float32Array(i.uvs.length)),(0,it.fastCopy)(i.uvs.buffer,l.uvs.buffer);const n=r.bone.skeleton.color,a=r.color,h=i.color;l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,n.a*a.a*h.a),r.darkColor&&l.darkColor.setFromColor(r.darkColor),l.skipRender=l.clipped=!1;const c=i.region?.texture.texture||it.Texture.EMPTY;l.texture!==c&&(l.texture=c,this.spineTexturesDirty=!0),Pt.isClipping()&&this.updateClippingData(l)}else if(i instanceof St){Pt.clipStart(r,i);continue}}Pt.clipEndWithSlot(r)}Pt.clipEnd()}updateClippingData(t){t.clipped=!0,Pt.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:s,clippedUVs:r,clippedTriangles:i}=Pt,l=s.length/2,o=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=t.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;t.skipRender=l===0,a&&(this.spineAttachmentsDirty=!0,n.vertexCount<l&&(n.vertices=new Float32Array(l*2),n.uvs=new Float32Array(l*2)),n.indices.length<o&&(n.indices=new Uint16Array(o)));const{vertices:h,uvs:c,indices:u}=n;for(let d=0;d<l;d++)h[d*2]=s[d*2],h[d*2+1]=s[d*2+1],c[d*2]=r[d*2],c[d*2+1]=r[d*2+1];n.vertexCount=l;for(let d=0;d<o;d++)u[d]!==i[d]&&(this.spineAttachmentsDirty=!0,u[d]=i[d]);n.indicesCount=o}updateSlotObjects(){for(const t in this._slotsObject){const s=this._slotsObject[t];s&&this.updateSlotObject(s)}}updateSlotObject(t){const{slot:s,container:r}=t,i=t.followAttachmentTimeline?!!s.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(s)&&i,r.visible){let l=s.bone;r.position.set(l.worldX,l.worldY),r.angle=l.getWorldRotationX();let o=1,n=1;for(;l;)o*=l.scaleX,n*=l.scaleY,l=l.parent;o<0&&(r.angle-=180),r.scale.set(s.bone.getWorldScaleX()*Math.sign(o),s.bone.getWorldScaleY()*Math.sign(n)),r.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,s){return this.attachmentCacheData[t.data.index][s.name]||this.initCachedData(t,s)}initCachedData(t,s){let r;return s instanceof ot?(r=new Float32Array(8),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:r,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(r=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[t.data.index][s.name]={id:`${t.data.index}-${s.name}`,vertices:r,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[t.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,s,r){t=this.getSlotFromRef(t);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(t),s.includeInBuild=!1,this.addChild(s);const i={container:s,slot:t,followAttachmentTimeline:r?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){let s;if(t instanceof it.Container){for(const r in this._slotsObject)if(this._slotsObject[r]?.container===t){this._slotsObject[r]=null,s=t;break}}else{const r=this.getSlotFromRef(t);s=this._slotsObject[r.data.name]?.container,this._slotsObject[r.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([t,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[t]})}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new os;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),r=this._bounds;r.clear(),r.x=s.x,r.y=s.y,r.width=s.width,r.height=s.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,r=this._bounds;r.clear();for(let i=0;i<s.length;i++){const l=s[i],o=l.getAttachment();if(o&&(o instanceof ot||o instanceof ut)){const n=this._getCachedData(l,o);r.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),it.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.worldToLocal(t):s.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:r=1,darkTint:i,autoUpdate:l=!0,boundsProvider:o}){const n=`${t}-${s}-${r}`;if(it.Cache.has(n))return new gs({skeletonData:it.Cache.get(n),darkTint:i,autoUpdate:l,boundsProvider:o});const a=it.Assets.get(t),h=it.Assets.get(s),c=new Es(h),u=a instanceof Uint8Array?new qs(c):new Gs(c);u.scale=r;const d=u.readSkeletonData(a);return it.Cache.set(n,d),new gs({skeletonData:d,darkTint:i,autoUpdate:l,boundsProvider:o})}},et=pt("pixi.js"),Sr=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new et.Container,bones:new et.Container,skeletonXY:new et.Graphics,regionAttachmentsShape:new et.Graphics,meshTrianglesLine:new et.Graphics,meshHullLine:new et.Graphics,clippingPolygon:new et.Graphics,boundingBoxesRect:new et.Graphics,boundingBoxesCircle:new et.Graphics,boundingBoxesPolygon:new et.Graphics,pathsCurve:new et.Graphics,pathsLine:new et.Graphics,eventText:new et.Container,eventCallback:{event:(s,r)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),l=new et.Text({text:r.data.name,style:{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(e.scale.x),l.anchor.set(.5),t.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let i=t.bones.children.length;i>0;i--)t.bones.children[i-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(e.scale.x||e.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,r,s),this.drawPaths&&this.drawPathsFunc(e,t,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,r),this.drawClipping&&this.drawClippingFunc(e,t,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,r),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,r){const i=e.skeleton,l=i.x,o=i.y,n=i.bones;t.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const u=n[h],d=u.data.length,m=l+u.worldX,f=o+u.worldY,p=l+d*u.a+u.worldX,b=o+d*u.b+u.worldY;if(u.data.name==="root"||u.data.parent===null)continue;const w=Math.abs(m-p),g=Math.abs(f-b),x=Math.pow(w,2),y=g,v=Math.pow(g,2),C=Math.sqrt(x+v),S=Math.pow(C,2),k=Math.PI/180,T=Math.acos((S+v-x)/(2*y*C))||0;if(C===0)continue;const Y=new et.Graphics;t.bones.addChild(Y);const M=C/50/r;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=f,Y.pivot.y=C;let X=0;m<p&&f<b?X=-T+180*k:m>p&&f<b?X=180*k+T:m>p&&f>b?X=-T:m<p&&f>b?X=T:f===b&&m<p?X=90*k:f===b&&m>p?X=-90*k:m===p&&f<b?X=180*k:m===p&&f>b&&(X=0),Y.rotation=X,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;t.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l],a=n.getAttachment();if(a===null||!(a instanceof ot))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),t.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}t.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof ut))continue;const h=a,c=new Float32Array(h.worldVerticesLength),u=h.triangles;let d=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,f=u.length;m<f;m+=3){const p=u[m]*2,b=u[m+1]*2,w=u[m+2]*2;t.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&d>0){d=(d>>1)*2;let m=c[d-2],f=c[d-1];for(let p=0,b=d;p<b;p+=2){const w=c[p],g=c[p+1];t.meshHullLine.context.moveTo(w,g).lineTo(m,f),m=w,f=g}}}t.meshHullLine.stroke({width:s,color:this.meshHullColor}),t.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof St))continue;const h=a,c=h.worldVerticesLength,u=new Float32Array(c);h.computeWorldVertices(n,0,c,u,0,2),t.clippingPolygon.poly(Array.from(u))}t.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(e,t,s){const r=new os;r.update(e.skeleton,!0),r.minX!==1/0&&t.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const i=r.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let u=0,d=o.length;u<d;u+=2){const m=o[u],f=o[u+1];t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(m,f,c),t.boundingBoxesCircle.fill(0),t.boundingBoxesCircle.circle(m,f,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,f)}t.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=i.length;o<n;o++){const a=i[o];l(a,0,a.length)}}drawPathsFunc(e,t,s){const i=e.skeleton.slots;for(let l=0,o=i.length;l<o;l++){const n=i[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Mt))continue;const h=a;let c=h.worldVerticesLength;const u=new Float32Array(c);h.computeWorldVertices(n,0,c,u,0,2);let d=u[2],m=u[3],f=0,p=0;if(h.closed){const b=u[0],w=u[1],g=u[c-2],x=u[c-1];f=u[c-4],p=u[c-3],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(b,w,g,x,f,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(b,w),t.pathsLine.moveTo(f,p),t.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=u[b],g=u[b+1],x=u[b+2],y=u[b+3];f=u[b+4],p=u[b+5],t.pathsCurve.moveTo(d,m),t.pathsCurve.bezierCurveTo(w,g,x,y,f,p),t.pathsLine.moveTo(d,m),t.pathsLine.lineTo(w,g),t.pathsLine.moveTo(f,p),t.pathsLine.lineTo(x,y),d=f,m=p}}t.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),t.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};return gi(ps)})();
|