@esotericsoftware/spine-pixi-v8 4.2.106 → 4.2.107
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/assets/atlasLoader.js +4 -3
- package/dist/assets/skeletonLoader.js +4 -3
- package/dist/esm/spine-pixi-v8.min.mjs +3 -3
- package/dist/esm/spine-pixi-v8.mjs +6 -4
- package/dist/esm/spine-pixi-v8.mjs.map +2 -2
- package/dist/iife/spine-pixi-v8.js +6 -4
- package/dist/iife/spine-pixi-v8.js.map +2 -2
- package/dist/iife/spine-pixi-v8.min.js +3 -3
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var spine=(()=>{var wt=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,fr=Object.getOwnPropertyNames,mr=Object.prototype.hasOwnProperty,Te=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),gr=(t,e)=>{for(var s in e)wt(t,s,{get:e[s],enumerable:!0})},pr=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of fr(e))!mr.call(t,r)&&r!==s&&wt(t,r,{get:()=>e[r],enumerable:!(i=ur(e,r))||i.enumerable});return t},xr=t=>pr(wt({},"__esModule",{value:!0}),t),As={};if(gr(As,{AABBRectangleBoundsProvider:()=>Si,AlphaTimeline:()=>Xt,Animation:()=>rt,AnimationState:()=>Qt,AnimationStateAdapter:()=>Sr,AnimationStateData:()=>Bs,AssetCache:()=>Vs,AssetManagerBase:()=>Tr,AtlasAttachmentLoader:()=>Ds,Attachment:()=>vt,AttachmentTimeline:()=>Ee,BinaryInput:()=>Gs,BlendMode:()=>Ie,Bone:()=>as,BoneData:()=>ns,BoundingBoxAttachment:()=>ss,CURRENT:()=>Fs,ClippingAttachment:()=>Le,Color:()=>N,ConstraintData:()=>Je,CurveTimeline:()=>ge,CurveTimeline1:()=>ue,CurveTimeline2:()=>it,DebugUtils:()=>yr,DeformTimeline:()=>Dt,Downloader:()=>Ns,DrawOrderTimeline:()=>_e,Event:()=>os,EventData:()=>ls,EventQueue:()=>Ps,EventTimeline:()=>nt,EventType:()=>le,FIRST:()=>Zt,FakeTexture:()=>Ar,HOLD_FIRST:()=>ot,HOLD_MIX:()=>Rs,HOLD_SUBSEQUENT:()=>es,IkConstraint:()=>Os,IkConstraintData:()=>hs,IkConstraintTimeline:()=>Vt,Inherit:()=>K,InheritTimeline:()=>Rt,IntSet:()=>br,Interpolation:()=>ks,MathUtils:()=>X,MeshAttachment:()=>pe,MixBlend:()=>R,MixDirection:()=>re,PathAttachment:()=>Ue,PathConstraint:()=>_s,PathConstraintData:()=>cs,PathConstraintMixTimeline:()=>Ut,PathConstraintPositionTimeline:()=>Ot,PathConstraintSpacingTimeline:()=>_t,Physics:()=>fe,PhysicsConstraintDampingTimeline:()=>zt,PhysicsConstraintGravityTimeline:()=>$t,PhysicsConstraintInertiaTimeline:()=>qt,PhysicsConstraintMassTimeline:()=>Gt,PhysicsConstraintMixTimeline:()=>jt,PhysicsConstraintResetTimeline:()=>Jt,PhysicsConstraintStrengthTimeline:()=>Wt,PhysicsConstraintTimeline:()=>Pe,PhysicsConstraintWindTimeline:()=>Ht,PointAttachment:()=>Ls,Pool:()=>Oe,PositionMode:()=>xe,Pow:()=>Ts,PowOut:()=>wr,RGB2Timeline:()=>Lt,RGBA2Timeline:()=>Et,RGBATimeline:()=>Ft,RGBTimeline:()=>Bt,RegionAttachment:()=>W,RotateMode:()=>Re,RotateTimeline:()=>je,SETUP:()=>ts,SUBSEQUENT:()=>at,ScaleTimeline:()=>kt,ScaleXTimeline:()=>Tt,ScaleYTimeline:()=>It,SequenceTimeline:()=>Kt,SetupPoseBoundsProvider:()=>Ai,ShearTimeline:()=>Mt,ShearXTimeline:()=>Yt,ShearYTimeline:()=>Pt,Skeleton:()=>qe,SkeletonBinary:()=>zs,SkeletonBounds:()=>gs,SkeletonClipping:()=>ht,SkeletonData:()=>Ke,SkeletonJson:()=>$s,Skin:()=>Qe,SkinEntry:()=>ds,SkinsAndAnimationBoundsProvider:()=>ki,Slot:()=>Us,SlotData:()=>us,SpacingMode:()=>ee,Spine:()=>Ti,SpineDebugRenderer:()=>Ii,SpinePipe:()=>Js,SpineTexture:()=>xs,StringSet:()=>yt,Texture:()=>rs,TextureAtlas:()=>lt,TextureAtlasPage:()=>Es,TextureAtlasRegion:()=>is,TextureFilter:()=>te,TextureRegion:()=>Xs,TextureWrap:()=>Ce,TimeKeeper:()=>vr,Timeline:()=>J,TrackEntry:()=>Ys,TransformConstraint:()=>qs,TransformConstraintData:()=>fs,TransformConstraintTimeline:()=>Nt,TranslateTimeline:()=>Ct,TranslateXTimeline:()=>St,TranslateYTimeline:()=>At,Triangulator:()=>Hs,Utils:()=>E,Vector2:()=>$e,VertexAttachment:()=>ve,WindowedMean:()=>Cr}),typeof window<"u"&&window.PIXI){const t=window.require;window.require=e=>{if(t)return t(e);if(e.startsWith("@pixi/")||e.startsWith("pixi.js"))return window.PIXI}}var br=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},yt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},N=class Ne{r;g;b;a;static WHITE=new Ne(1,1,1,1);static RED=new Ne(1,0,0,1);static GREEN=new Ne(0,1,0,1);static BLUE=new Ne(0,0,1,1);static MAGENTA=new Ne(1,0,1,1);constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new Ne){return s.setFromString(e)}},X=class ye{static PI=3.1415927;static PI2=ye.PI*2;static invPI2=1/ye.PI2;static radiansToDegrees=180/ye.PI;static radDeg=ye.radiansToDegrees;static degreesToRadians=ye.PI/180;static degRad=ye.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*ye.degRad)}static sinDeg(e){return Math.sin(e*ye.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ye.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ye.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),l=s-e;return r<=(i-e)/l?e+Math.sqrt(r*l*(i-e)):s-Math.sqrt((1-r)*l*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},ks=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ts=class extends ks{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},wr=class extends Ts{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},E=class He{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,l){for(let o=s,n=r;o<s+l;o++,n++)i[n]=e[o]}static arrayFill(e,s,i,r){for(let l=s;l<i;l++)e[l]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let l=r;l<s;l++)e[l]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:He.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(He.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(He.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return He.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return He.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},yr=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Oe=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},$e=class{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},vr=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Cr=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},vt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},ve=class sr extends vt{static nextID=0;id=sr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,l,o){i=l+(i>>1)*o;let n=e.bone.skeleton,a=e.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let f=e.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<i;v+=2,C+=o){let S=h[v],k=h[v+1];r[C]=S*w+k*g+p,r[C+1]=S*x+k*y+b}return}let d=0,u=0;for(let f=0;f<s;f+=2){let p=c[d];d+=p+1,u+=p}let m=n.bones;if(a.length==0)for(let f=l,p=u*3;f<i;f+=o){let b=0,w=0,g=c[d++];for(g+=d;d<g;d++,p+=3){let x=m[c[d]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}r[f]=b,r[f+1]=w}else{let f=a;for(let p=l,b=u*3,w=u<<1;p<i;p+=o){let g=0,x=0,y=c[d++];for(y+=d;d<y;d++,b+=3,w+=2){let v=m[c[d]],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}r[p]=g,r[p+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Is=class gt{static _nextID=0;id=gt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new gt(this.regions.length);return E.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let l=this.digits-r.length;l>0;l--)i+="0";return i+=r,i}static nextID(){return gt._nextID++}},se;(function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"})(se||(se={}));var Ms=[se.hold,se.once,se.loop,se.pingpong,se.onceReverse,se.loopReverse,se.pingpongReverse],rt=class{name;timelines=[];timelineIds=new yt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,l,o,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(t,e,s,r,l,o,n)}},R;(function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"})(R||(R={}));var re;(function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"})(re||(re={}));var O={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},J=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*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(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},ge=class extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-l*2+n)*.03,f=(r-o*2+a)*.03,p=((l-n)*3-i+h)*.006,b=((o-a)*3-r+c)*.006,w=m*2+p,g=f*2+b,x=(l-i)*.3+m+p*.16666667,y=(o-r)*.3+f+b*.16666667,v=i+x,C=r+y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],h=this.frames[e+s];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}let l=i+18;for(i+=2;i<l;i+=2)if(r[i]>=t){let a=r[i-2],h=r[i-1];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}e+=this.getFrameEntries();let o=r[l-2],n=r[l-1];return n+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-n)}},ue=class extends ge{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],l=e[s+1];return l+(t-r)/(e[s+2]-r)*(e[s+2+1]-l);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case R.setup:return r;case R.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);switch(s){case R.setup:return r+l*e;case R.first:case R.replace:l+=r-i}return i+l*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case R.setup:return r;case R.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);return s==R.setup?r+(l-r)*e:i+(l-i)*e}getAbsoluteValue2(t,e,s,i,r,l){if(t<this.frames[0]){switch(s){case R.setup:return r;case R.first:return i+(r-i)*e}return i}return s==R.setup?r+(l-r)*e:i+(l-i)*e}getScaleValue(t,e,s,i,r,l){const o=this.frames;if(t<o[0]){switch(s){case R.setup:return l;case R.first:return r+(l-r)*e}return r}let n=this.getCurveValue(t)*l;if(e==1)return s==R.add?r+n-l:n;if(i==re.mixOut)switch(s){case R.setup:return l+(Math.abs(n)*X.signum(l)-l)*e;case R.first:case R.replace:return r+(Math.abs(n)*X.signum(r)-r)*e}else{let a=0;switch(s){case R.setup:return a=Math.abs(l)*X.signum(n),a+(n-a)*e;case R.first:case R.replace:return a=Math.abs(r)*X.signum(n),a+(n-a)*e}}return r+(n-l)*e}},it=class extends ge{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},je=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,l,n.rotation,n.data.rotation))}},Ct=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.x=n.data.x,n.y=n.data.y;return;case R.first:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let h=0,c=0,d=J.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*f,c+=(a[d+3+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(l){case R.setup:n.x=n.data.x+h*r,n.y=n.data.y+c*r;break;case R.first:case R.replace:n.x+=(n.data.x+h-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case R.add:n.x+=h*r,n.y+=c*r}}},St=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,l,n.x,n.data.x))}},At=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,l,n.y,n.data.y))}},kt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case R.first:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let h,c,d=J.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*f,c+=(a[d+3+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,r==1)l==R.add?(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==re.mixOut)switch(l){case R.setup:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(h)*X.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*X.signum(f)-f)*r;break;case R.first:case R.replace:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(h)*X.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*X.signum(f)-f)*r;break;case R.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(l){case R.setup:m=Math.abs(n.data.scaleX)*X.signum(h),f=Math.abs(n.data.scaleY)*X.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=f+(c-f)*r;break;case R.first:case R.replace:m=Math.abs(n.scaleX)*X.signum(h),f=Math.abs(n.scaleY)*X.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=f+(c-f)*r;break;case R.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Tt=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,l,o,n.scaleX,n.data.scaleX))}},It=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,l,o,n.scaleY,n.data.scaleY))}},Mt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case R.first:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let h=0,c=0,d=J.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*f,c+=(a[d+3+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(l){case R.setup:n.shearX=n.data.shearX+h*r,n.shearY=n.data.shearY+c*r;break;case R.first:case R.replace:n.shearX+=(n.data.shearX+h-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case R.add:n.shearX+=h*r,n.shearY+=c*r}}},Yt=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,l,n.shearX,n.data.shearX))}},Pt=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,l,n.shearY,n.data.shearY))}},Rt=class extends J{boneIndex=0;constructor(t,e){super(t,[O.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;if(o==re.mixOut){l==R.setup&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==R.setup||l==R.first)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[J.search(a,s,2)+1]}},Ft=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,l){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:h.setFromColor(b);return;case R.first:h.add((b.r-h.r)*r,(b.g-h.g)*r,(b.b-h.b)*r,(b.a-h.a)*r)}return}let c=0,d=0,u=0,m=0,f=J.search(a,s,5),p=this.curves[f/5];switch(p){case 0:let b=a[f];c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];let w=(s-b)/(a[f+5]-b);c+=(a[f+5+1]-c)*w,d+=(a[f+5+2]-d)*w,u+=(a[f+5+3]-u)*w,m+=(a[f+5+4]-m)*w;break;case 1:c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+18*2-2),m=this.getBezierValue(s,f,4,p+18*3-2)}r==1?h.set(c,d,u,m):(l==R.setup&&h.setFromColor(n.data.color),h.add((c-h.r)*r,(d-h.g)*r,(u-h.b)*r,(m-h.a)*r))}},Bt=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:h.r=p.r,h.g=p.g,h.b=p.b;return;case R.first:h.r+=(p.r-h.r)*r,h.g+=(p.g-h.g)*r,h.b+=(p.b-h.b)*r}return}let c=0,d=0,u=0,m=J.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let p=a[m];c=a[m+1],d=a[m+2],u=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,d+=(a[m+4+2]-d)*b,u+=(a[m+4+3]-u)*b;break;case 1:c=a[m+1],d=a[m+2],u=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+18*2-2)}if(r==1)h.r=c,h.g=d,h.b=u;else{if(l==R.setup){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*r,h.g+=(d-h.g)*r,h.b+=(u-h.b)*r}}},Xt=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,O.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:a.a=c.a;return;case R.first:a.a+=(c.a-a.a)*r}return}let h=this.getCurveValue(s);r==1?a.a=h:(l==R.setup&&(a.a=n.data.color.a),a.a+=(h-a.a)*r)}},Et=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,l,o,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case R.first:h.add((y.r-h.r)*r,(y.g-h.g)*r,(y.b-h.b)*r,(y.a-h.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,u=0,m=0,f=0,p=0,b=0,w=0,g=J.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];d=a[g+1],u=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);d+=(a[g+8+1]-d)*v,u+=(a[g+8+2]-u)*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:d=a[g+1],u=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:d=this.getBezierValue(s,g,1,x-2),u=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(r==1)h.set(d,u,m,f),c.r=p,c.g=b,c.b=w;else{if(l==R.setup){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((d-h.r)*r,(u-h.g)*r,(m-h.b)*r,(f-h.a)*r),c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Lt=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.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 R.setup: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 R.first:h.r+=(y.r-h.r)*r,h.g+=(y.g-h.g)*r,h.b+=(y.b-h.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,u=0,m=0,f=0,p=0,b=0,w=0,g=J.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];d=a[g+1],u=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);d+=(a[g+7+1]-d)*v,u+=(a[g+7+2]-u)*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:d=a[g+1],u=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];break;default:d=this.getBezierValue(s,g,1,x-2),u=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)h.r=d,h.g=u,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==R.setup){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+=(d-h.r)*r,h.g+=(u-h.g)*r,h.b+=(m-h.b)*r,c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Ee=class extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[O.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(n.bone.active){if(o==re.mixOut){l==R.setup&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==R.setup||l==R.first)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Dt=class extends ge{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[O.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-l*2+n)*.03,f=a*.03-o*.06,p=((l-n)*3-i+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=f*2+b,x=(l-i)*.3+m+p*.16666667,y=o*.3+f+b*.16666667,v=i+x,C=y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let l=s[r-2],o=s[r-1];return o+(1-o)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof ve)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=R.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(l){case R.setup:h.length=0;return;case R.first:if(r==1){h.length=0;return}h.length=d;let g=a;if(g.bones){r=1-r;for(var m=0;m<d;m++)h[m]*=r}else{let x=g.vertices;for(var m=0;m<d;m++)h[m]+=(x[m]-h[m])*r}}return}if(h.length=d,s>=u[u.length-1]){let g=c[u.length-1];if(r==1)if(l==R.add){let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,d);else switch(l){case R.setup:{let y=a;if(y.bones)for(let v=0;v<d;v++)h[v]=g[v]*r;else{let v=y.vertices;for(let C=0;C<d;C++){let S=v[C];h[C]=S+(g[C]-S)*r}}break}case R.first:case R.replace:for(let y=0;y<d;y++)h[y]+=(g[y]-h[y])*r;break;case R.add:let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=(g[v]-y[v])*r}}return}let f=J.search1(u,s),p=this.getCurvePercent(s,f),b=c[f],w=c[f+1];if(r==1)if(l==R.add){let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<d;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case R.setup:{let x=a;if(x.bones)for(let y=0;y<d;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*r}else{let y=x.vertices;for(let v=0;v<d;v++){let C=b[v],S=y[v];h[v]=S+(C+(w[v]-C)*p-S)*r}}break}case R.first:case R.replace:for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*r}break;case R.add:let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*r}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*r}}}}},nt=class rr extends J{static propertyIds=[""+O.event];events;constructor(e){super(e,rr.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,l,o,n){if(!r)return;let a=this.frames,h=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,l,o,n),s=-1;else if(s>=a[h-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=J.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<h&&i>=a[c];c++)r.push(this.events[c])}},_e=class ir extends J{static propertyIds=[""+O.drawOrder];drawOrders;constructor(e){super(e,ir.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,l,o,n){if(n==re.mixOut){o==R.setup&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(o==R.setup||o==R.first)&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=J.search1(this.frames,i),h=this.drawOrders[a];if(!h)E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let u=0,m=h.length;u<m;u++)c[u]=d[h[u]]}}},Vt=class extends ge{constraintIndex=0;constructor(t,e,s){super(t,e,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,l,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,i,r,l,o){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup: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 R.first:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,d=J.search(a,s,6),u=this.curves[d/6];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+6]-m);h+=(a[d+6+1]-h)*f,c+=(a[d+6+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}l==R.setup?(n.mix=n.data.mix+(h-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==re.mixOut?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(h-n.mix)*r,n.softness+=(c-n.softness)*r,o==re.mixIn&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},Nt=class extends ge{constraintIndex=0;constructor(t,e,s){super(t,e,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=l,a[t+5]=o,a[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case R.setup: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 R.first:n.mixRotate+=(w.mixRotate-n.mixRotate)*r,n.mixX+=(w.mixX-n.mixX)*r,n.mixY+=(w.mixY-n.mixY)*r,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(w.mixShearY-n.mixShearY)*r}return}let h,c,d,u,m,f,p=J.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],d=a[p+3],u=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,d+=(a[p+7+3]-d)*g,u+=(a[p+7+4]-u)*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],d=a[p+3],u=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),d=this.getBezierValue(s,p,3,b+18*2-2),u=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==R.setup){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*r,n.mixX=w.mixX+(c-w.mixX)*r,n.mixY=w.mixY+(d-w.mixY)*r,n.mixScaleX=w.mixScaleX+(u-w.mixScaleX)*r,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*r,n.mixShearY=w.mixShearY+(f-w.mixShearY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(u-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(f-n.mixShearY)*r}},Ot=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,l,n.position,n.data.position))}},_t=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,l,n.spacing,n.data.spacing))}},Ut=class extends ge{constraintIndex=0;constructor(t,e,s){super(t,e,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let l=this.frames;t<<=2,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case R.first:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let h,c,d,u=J.search(a,s,4),m=this.curves[u>>2];switch(m){case 0:let f=a[u];h=a[u+1],c=a[u+2],d=a[u+3];let p=(s-f)/(a[u+4]-f);h+=(a[u+4+1]-h)*p,c+=(a[u+4+2]-c)*p,d+=(a[u+4+3]-d)*p;break;case 1:h=a[u+1],c=a[u+2],d=a[u+3];break;default:h=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(l==R.setup){let f=n.data;n.mixRotate=f.mixRotate+(h-f.mixRotate)*r,n.mixX=f.mixX+(c-f.mixX)*r,n.mixY=f.mixY+(d-f.mixY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Pe=class extends ue{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of t.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,r,l,this.get(h),this.setup(h),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,l,this.get(n),this.setup(n)))}},qt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Wt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},zt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},Gt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},Ht=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},$t=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},jt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},Jt=class nr extends J{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,nr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,l,o,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(i<h[0])&&(s<h[0]||i>=h[J.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},Kt=class Be extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[O.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Be.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,l){let o=this.frames;e*=Be.ENTRIES,o[e]=s,o[e+Be.MODE]=i|r<<4,o[e+Be.DELAY]=l}apply(e,s,i,r,l,o,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof ve)||h.timelineAttachment!=c))return;if(n==re.mixOut){o==R.setup&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==R.setup||o==R.first)&&(a.sequenceIndex=-1);return}let u=J.search(d,i,Be.ENTRIES),m=d[u],f=d[u+Be.MODE],p=d[u+Be.DELAY];if(!this.attachment.sequence)return;let b=f>>4,w=this.attachment.sequence.regions.length,g=Ms[f&15];if(g!=se.hold)switch(b+=(i-m)/p+1e-5|0,g){case se.once:b=Math.min(w-1,b);break;case se.loop:b%=w;break;case se.pingpong:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case se.onceReverse:b=Math.max(w-1-b,0);break;case se.loopReverse:b=w-1-b%w;break;case se.pingpongReverse:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Qt=class pt{static _emptyAnimation=new rt("<empty>",[],0);static emptyAnimation(){return pt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ps(this);propertyIDs=new yt;animationsChanged=!1;trackEntryPool=new Oe(()=>new Ys);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=e*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+e)*n.timeScale,l.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[i]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,e)){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(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let u=0,m=i.length;u<m;u++){let f=i[u];if(!f||f.delay>0)continue;r=!0;let p=u==0?R.first:f.mixBlend,b=f.alpha;f.mixingFrom?b*=this.applyMixingFrom(f,e,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(u==0&&b==1||p==R.add){u==0&&(w=!0);for(let k=0;k<S;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof Ee?this.applyAttachmentTimeline(l,e,y,p,w):l.apply(e,g,y,v,b,p,re.mixIn)}}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 F=C[M],B=k[M]==at?p:R.setup;!T&&F instanceof je?this.applyRotateTimeline(F,e,y,b,B,f.timelinesRotation,M<<1,Y):F instanceof Ee?this.applyAttachmentTimeline(F,e,y,p,w):(E.webkit602BugfixHelper(b,p),F.apply(e,g,y,v,b,B,re.mixIn))}}this.queueEvents(f,x),s.length=0,f.nextAnimationLast=x,f.nextTrackLast=f.trackTime}for(var o=this.unkeyedState+ts,n=e.slots,a=0,h=e.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let l=0;e.mixDuration==0?(l=1,i==R.first&&(i=R.setup)):(l=e.mixTime/e.mixDuration,l>1&&(l=1),i!=R.first&&(i=r.mixBlend));let o=l<r.mixAttachmentThreshold,n=l<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-l),u=r.animationLast,m=r.getAnimationTime(),f=m,p=null;if(r.reverse?f=r.animation.duration-f:l<r.eventThreshold&&(p=this.events),i==R.add)for(let b=0;b<h;b++)a[b].apply(s,u,f,p,d,i,re.mixOut);else{let b=r.timelineMode,w=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=re.mixOut,S,k=0;switch(b[y]){case at:if(!n&&v instanceof _e)continue;S=i,k=d;break;case Zt:S=R.setup,k=d;break;case es:S=i,k=c;break;case ot:S=R.setup,k=c;break;default:S=R.setup;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=k,!g&&v instanceof je?this.applyRotateTimeline(v,s,f,k,S,r.timelinesRotation,y<<1,x):v instanceof Ee?this.applyAttachmentTimeline(v,s,f,S,o&&k>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,i),n&&v instanceof _e&&S==R.setup&&(C=re.mixIn),v.apply(s,u,f,p,k,S,C))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,l}applyAttachmentTimeline(e,s,i,r,l){var o=s.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(r==R.setup||r==R.first)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,e.attachmentNames[J.search1(e.frames,i)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+ts))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Fs)}applyRotateTimeline(e,s,i,r,l,o,n,a){if(a&&(o[n]=0),r==1){e.apply(s,0,i,null,1,l,re.mixIn);return}let h=s.bones[e.boneIndex];if(!h.active)return;let c=e.frames,d=0,u=0;if(i<c[0])switch(l){case R.setup:h.rotation=h.data.rotation;default:return;case R.first:d=h.rotation,u=h.data.rotation}else d=l==R.setup?h.data.rotation:h.rotation,u=h.data.rotation+e.getCurveValue(i);let m=0,f=u-d;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&&X.signum(b)!=X.signum(f)&&(Math.abs(p-w)>180?(m+=360*X.signum(p),x=g):w!=0?m-=360*X.signum(p):x=g),x!=g&&(m+=360*X.signum(p)),o[n]=m}o[n+1]=f,h.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,l=r-i,o=e.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let d=n[a];if(d.time<o)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(l==0)c=!0;else{const d=Math.floor(e.trackTime/l);c=d>0&&d>Math.floor(e.trackLast/l)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<h;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,l=this.expandToIndex(e);l&&(l.nextTrackLast==-1?(this.tracks[e]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,r=!1):this.clearNext(l));let o=this.trackEntry(e,s,i,l);return this.setCurrent(e,o,r),this.queue.drain(),o}addAnimation(e,s,i=!1,r=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,l,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(e);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(e,s,i,l);return l?(l.next=o,o.previous=l,r<=0&&(r=Math.max(r+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,pt.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,pt.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let l=this.tracks[i];l&&this.setEmptyAnimation(l.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(E.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=e,l.animation=s,l.loop=i,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=r?this.data.getMix(r.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=R.replace,l}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=R.add)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,l=e.timelineMode;l.length=r;let o=e.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)l[a]=n.addAll(i[a].getPropertyIds())?ot:es;return}e:for(let a=0;a<r;a++){let h=i[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=at;else if(!s||h instanceof Ee||h instanceof _e||h instanceof nt||!s.animation.hasTimeline(c))l[a]=Zt;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){l[a]=Rs,o[a]=d;continue e}break}l[a]=ot}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ys=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(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=R.replace;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 t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Ps=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(le.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(le.interrupt),this.objects.push(t)}end(t){this.objects.push(le.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(le.dispose),this.objects.push(t)}complete(t){this.objects.push(le.complete),this.objects.push(t)}event(t,e){this.objects.push(le.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],r=t[s+1];switch(i){case le.start:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<e.length;o++){let n=e[o];n.start&&n.start(r)}break;case le.interrupt:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<e.length;o++){let n=e[o];n.interrupt&&n.interrupt(r)}break;case le.end:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<e.length;o++){let n=e[o];n.end&&n.end(r)}case le.dispose:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<e.length;o++){let n=e[o];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case le.complete:r.listener&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<e.length;o++){let n=e[o];n.complete&&n.complete(r)}break;case le.event:let l=t[s+++2];r.listener&&r.listener.event&&r.listener.event(r,l);for(let o=0;o<e.length;o++){let n=e[o];n.event&&n.event(r,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},le;(function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"})(le||(le={}));var Sr=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},at=0,Zt=1,es=2,ot=3,Rs=4,ts=1,Fs=2,Bs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},ss=class ar extends ve{color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new ar(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Le=class or extends ve{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new or(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},rs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},te;(function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"})(te||(te={}));var Ce;(function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"})(Ce||(Ce={}));var 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},Ar=class extends rs{setFilters(t,e){}setWraps(t,e){}dispose(){}},lt=class{pages=new Array;regions=new Array;constructor(t){let e=new kr(t),s=new Array(4),i={};i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.format=()=>{},i.filter=h=>{h.minFilter=E.enumValue(te,s[1]),h.magFilter=E.enumValue(te,s[2])},i.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=Ce.Repeat),s[1].indexOf("y")!=-1&&(h.vWrap=Ce.Repeat)},i.pma=h=>{h.pma=s[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},r.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},r.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},r.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},r.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},r.index=h=>{h.index=parseInt(s[1])};let l=e.readLine();for(;l&&l.trim().length==0;)l=e.readLine();for(;!(!l||l.trim().length==0||e.readEntry(s,l)==0);)l=e.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=e.readLine();else if(o){let h=new is(o,l);for(;;){let c=e.readEntry(s,l=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let u=[];for(let m=0;m<c;m++)u.push(parseInt(s[m+1]));a.push(u)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Es(l.trim());e.readEntry(s,l=e.readLine())!=0;){let h=i[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},kr=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let l=e.indexOf(",",r);if(l==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,l-r).trim(),r=l+1,i==4)return 4}}},Es=class{name;minFilter=te.Nearest;magFilter=te.Nearest;uWrap=Ce.ClampToEdge;vWrap=Ce.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},is=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(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},pe=class ys extends ve{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=E.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof is){let a=this.region,h=a.page,c=h.width,d=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+e[u+1]*o,s[u+1]=l+(1-e[u])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u])*o,s[u+1]=l+(1-e[u+1])*n;return;case 270:r-=a.offsetY/c,l-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u+1])*o,s[u+1]=l+e[u]*n;return}r-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-r,n=this.region.v2-l):(r=l=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*o,s[a+1]=l+e[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ys(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,l,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,l,o)}newLinkedMesh(){let e=new ys(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ue=class lr extends ve{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new lr(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ls=class hr extends ve{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*X.degRad,i=Math.cos(s),r=Math.sin(s),l=i*e.a+r*e.b,o=i*e.c+r*e.d;return X.atan2Deg(o,l)}copy(){let e=new hr(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},W=class cr extends vt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=l+this.region.width*i,a=o+this.region.height*r,h=this.rotation*X.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=l*c+u,p=l*d,b=o*c+m,w=o*d,g=n*c+u,x=n*d,y=a*c+m,v=a*d,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,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let l=e.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,d=l.c,u=l.d,m=0,f=0;m=o[0],f=o[1],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[2],f=o[3],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[4],f=o[5],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[6],f=o[7],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a}copy(){let e=new cr(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,E.arrayCopy(this.uvs,0,e.uvs,0,8),E.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Ds=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,l=i.length;r<l;r++){let o=s.getPath(e,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new W(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=l}return r}newMeshAttachment(t,e,s,i){let r=new pe(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=l}return r}newBoundingBoxAttachment(t,e){return new ss(e)}newPathAttachment(t,e){return new Ue(e)}newPointAttachment(t,e){return new Ls(e)}newClippingAttachment(t,e){return new Le(e)}},ns=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=K.Normal;skinRequired=!1;color=new N;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},K;(function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"})(K||(K={}));var as=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=K.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){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(t,e,s,i,r,l,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,p=(s+l)*X.degRad,b=(s+90+o)*X.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*f,this.d=Math.sin(b)*r*f,this.worldX=t*m+u.x,this.worldY=e*f+u.y;return}let a=n.a,h=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+h*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case K.Normal:{const u=(s+l)*X.degRad,m=(s+90+o)*X.degRad,f=Math.cos(u)*i,p=Math.cos(m)*r,b=Math.sin(u)*i,w=Math.sin(m)*r;this.a=a*f+h*b,this.b=a*p+h*w,this.c=c*f+d*b,this.d=c*p+d*w;return}case K.OnlyTranslation:{const u=(s+l)*X.degRad,m=(s+90+o)*X.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(m)*r,this.c=Math.sin(u)*i,this.d=Math.sin(m)*r;break}case K.NoRotationOrReflection:{let u=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=u,c*=m;let f=a*a+c*c,p=0;f>1e-4?(f=Math.abs(a*d*m-h*u*c)/f,h=c*f,d=a*f,p=Math.atan2(c,a)*X.radDeg):(a=0,c=0,p=90-Math.atan2(d,h)*X.radDeg);const b=(s+l-p)*X.degRad,w=(s+o-p+90)*X.degRad,g=Math.cos(b)*i,x=Math.cos(w)*r,y=Math.sin(b)*i,v=Math.sin(w)*r;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+d*y,this.d=c*x+d*v;break}case K.NoScale:case K.NoScaleOrReflection:{s*=X.degRad;const u=Math.cos(s),m=Math.sin(s);let f=(a*u+h*m)/this.skeleton.scaleX,p=(c*u+d*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==K.NoScale&&a*d-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*=X.degRad,o=(90+o)*X.degRad;const x=Math.cos(l)*i,y=Math.cos(o)*r,v=Math.sin(l)*i,C=Math.sin(o)*r;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 t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*X.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*X.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*o-d*n,this.ay=d*h-c*a;let u,m,f,p;if(this.inherit==K.OnlyTranslation)u=this.a,m=this.b,f=this.c,p=this.d;else{switch(this.inherit){case K.NoRotationOrReflection:{let y=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=e*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(e*r-s*i),o=r*l,n=s*l;break}case K.NoScale:case K.NoScaleOrReflection:let b=X.cosDeg(this.rotation),w=X.sinDeg(this.rotation);e=(e*b+s*w)/this.skeleton.scaleX,i=(i*b+r*w)/this.skeleton.scaleY;let g=Math.sqrt(e*e+i*i);g>1e-5&&(g=1/g),e*=g,i*=g,g=Math.sqrt(e*e+i*i),this.inherit==K.NoScale&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=X.PI/2+Math.atan2(i,e);s=Math.cos(x)*g,r=Math.sin(x)*g,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l}u=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(u*u+f*f),this.ascaleX>1e-4){let b=u*p-m*f;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(u*m+f*p,b)*X.radDeg,this.arotation=Math.atan2(f,u)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=X.sinDeg(t),s=X.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=X.sinDeg(t),s=X.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*X.radDeg}rotateWorld(t){t*=X.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},Je=class{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Tr=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ns,i=new Vs){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load binary ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load JSON ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(e,t,l),l)).catch(l=>this.error(s,t,l))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(t,n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(t,n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),l=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,n)=>{this.downloader.downloadText(t,a=>{try{const h=this.createTextureAtlas(t,a);let c=h.pages.length,d=!1;for(let u of h.pages)this.loadTexture(i?i[u.name]:l+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(e,t,h),o(h)))},(m,f)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),n(p)}d=!0})}catch(h){const c=`Couldn't parse texture atlas ${t}: ${h.message}`;this.error(s,t,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${h}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,o=>{try{const n=this.createTextureAtlas(t,o);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${t}: status ${o}, ${n}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
-
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.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(t){const e=this.cache.assets[t];if(e instanceof lt){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new lt(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},Vs=class xt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=xt.AVAILABLE_CACHES.get(e);if(s)return s;const i=new xt;return xt.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},Ns=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let l=()=>{this.finish(t,r.status,r.responseText)};r.onload=l,r.onerror=l,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let l=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):l()},r.onerror=l,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let l=r.length-1,o=i.length;l<o;l+=2)i[l].apply(null,r)}},os=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},ls=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Os=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,l,o){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,d=n.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case K.OnlyTranslation:m=(e-t.worldX)*X.signum(t.skeleton.scaleX),f=(s-t.worldY)*X.signum(t.skeleton.scaleY);break;case K.NoRotationOrReflection:let w=Math.abs(a*d-h*c)/Math.max(1e-4,a*a+c*c),g=a/t.skeleton.scaleX,x=c/t.skeleton.scaleY;h=-x*w*t.skeleton.scaleX,d=g*w*t.skeleton.scaleY,u+=Math.atan2(x,g)*X.radDeg;default:let y=e-n.worldX,v=s-n.worldY,C=a*d-h*c;Math.abs(C)<=1e-4?(m=0,f=0):(m=(y*d-v*h)/C-t.ax,f=(v*a-y*c)/C-t.ay)}u+=Math.atan2(f,m)*X.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,b=t.ascaleY;if(i||r){switch(t.inherit){case K.NoScale:case K.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const w=t.data.length*p;if(w>1e-4){const g=m*m+f*f;if(i&&g<w*w||r&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*o,p,b,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,l,o,n,a){if(t.inherit!=K.Normal||e.inherit!=K.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,b=0,w=0,g=0;d<0?(d=-d,b=180,g=-1):(b=0,g=1),u<0&&(u=-u,g=-g),p<0?(p=-p,w=180):w=0;let x=e.ax,y=0,v=0,C=0,S=t.a,k=t.b,T=t.c,Y=t.d,M=Math.abs(d-u)<=1e-4;!M||l?(y=0,v=S*x+t.worldX,C=T*x+t.worldY):(y=e.ay,v=S*x+k*y+t.worldX,C=T*x+Y*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,k=F.b,T=F.c,Y=F.d;let B=S*Y-k*T,I=v-F.worldX,P=C-F.worldY;B=Math.abs(B)<=1e-4?0:1/B;let L=(I*Y-P*k)*B-h,_=(P*S-I*T)*B-c,V=Math.sqrt(L*L+_*_),U=e.data.length*p,j,H;if(V<1e-4){this.apply1(t,s,i,!1,l,!1,a),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}I=s-F.worldX,P=i-F.worldY;let Q=(I*Y-P*k)*B-h,D=(P*S-I*T)*B-c,q=Q*Q+D*D;if(n!=0){n*=d*(p+1)*.5;let Z=Math.sqrt(q),ae=Z-V-U*d+n;if(ae>0){let oe=Math.min(1,ae/(n*2))-1;oe=(ae-n*(1-oe*oe))/Z,Q-=oe*Q,D-=oe*D,q=Q*Q+D*D}}e:if(M){U*=d;let Z=(q-V*V-U*U)/(2*V*U);Z<-1?(Z=-1,H=Math.PI*r):Z>1?(Z=1,H=0,l&&(S=(Math.sqrt(q)/(V+U)-1)*a+1,m*=S,o&&(f*=S))):H=Math.acos(Z)*r,S=V+U*Z,k=U*Math.sin(H),j=Math.atan2(D*S-Q*k,Q*S+D*k)}else{S=d*U,k=u*U;let Z=S*S,ae=k*k,oe=Math.atan2(D,Q);T=ae*V*V+Z*q-Z*ae;let we=-2*ae*V,ze=ae-Z;if(Y=we*we-4*ze*T,Y>=0){let Ge=Math.sqrt(Y);we<0&&(Ge=-Ge),Ge=-(we+Ge)*.5;let st=Ge/ze,tr=T/Ge,mt=Math.abs(st)<Math.abs(tr)?st:tr;if(st=q-mt*mt,st>=0){P=Math.sqrt(st)*r,j=oe-Math.atan2(P,mt),H=Math.atan2(P/u,(mt-V)/d);break e}}let tt=X.PI,ut=V-S,bs=ut*ut,Qs=0,Zs=0,ft=V+S,ws=ft*ft,er=0;T=-S*V/(Z-ae),T>=-1&&T<=1&&(T=Math.acos(T),I=S*Math.cos(T)+V,P=k*Math.sin(T),Y=I*I+P*P,Y<bs&&(tt=T,bs=Y,ut=I,Qs=P),Y>ws&&(Zs=T,ws=Y,ft=I,er=P)),q<=(bs+ws)*.5?(j=oe-Math.atan2(Qs*r,ut),H=tt*r):(j=oe-Math.atan2(er*r,ft),H=Zs*r)}let $=Math.atan2(y,x)*g,ce=t.arotation;j=(j-$)*X.radDeg+b-ce,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(h,c,ce+j*a,m,f,0,0),ce=e.arotation,H=((H+$)*X.radDeg-e.ashearX)*g+w-ce,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(x,y,ce+H*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},hs=class extends Je{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},cs=class extends Je{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=xe.Fixed;spacingMode=ee.Fixed;rotateMode=Re.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},xe;(function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"})(xe||(xe={}));var ee;(function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"})(ee||(ee={}));var Re;(function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"})(Re||(Re={}));var _s=class Xe{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(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,l=e.bones.length;r<l;r++){let o=s.findBone(e.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ue))return;let i=this.mixRotate,r=this.mixX,l=this.mixY;if(i==0&&r==0&&l==0)return;let o=this.data,n=o.rotateMode==Re.Tangent,a=o.rotateMode==Re.ChainScale,h=this.bones,c=h.length,d=n?c:c+1,u=E.setArraySize(this.spaces,d),m=a?this.lengths=E.setArraySize(this.lengths,c):[],f=this.spacing;switch(o.spacingMode){case ee.Percent:if(a)for(let C=0,S=d-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(u,1,d,f);break;case ee.Proportional:let y=0;for(let C=0,S=d-1;C<S;){let k=h[C],T=k.data.length;if(T<Xe.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),u[++C]=F,y+=F}}if(y>0){y=d/y*f;for(let C=1;C<d;C++)u[C]*=y}break;default:let v=o.spacingMode==ee.Length;for(let C=0,S=d-1;C<S;){let k=h[C],T=k.data.length;if(T<Xe.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),u[++C]=(v?T+f:f)*F/T}}}let p=this.computeWorldPositions(s,d,n),b=p[0],w=p[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==Re.Chain;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?X.degRad:-X.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*r,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 F=(Math.sqrt(T*T+Y*Y)/M-1)*i+1;C.a*=F,C.c*=F}}if(b=S,w=k,i>0){let M=C.a,F=C.b,B=C.c,I=C.d,P=0,L=0,_=0;if(n?P=p[v-1]:u[y+1]==0?P=p[v+2]:P=Math.atan2(Y,T),P-=Math.atan2(B,M),x){L=Math.cos(P),_=Math.sin(P);let V=C.data.length;b+=(V*(L*M-_*B)-T)*i,w+=(V*(_*M+L*B)-Y)*i}else P+=g;P>X.PI?P-=X.PI2:P<-X.PI&&(P+=X.PI2),P*=i,L=Math.cos(P),_=Math.sin(P),C.a=L*M-_*B,C.b=L*F-_*I,C.c=_*M+L*B,C.d=_*F+L*I}C.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=e.closed,c=e.worldVerticesLength,d=c/6,u=Xe.NONE;if(!e.constantSpeed){let V=e.lengths;d-=h?1:2;let U=V[d];this.data.positionMode==xe.Percent&&(l*=U);let j;switch(this.data.spacingMode){case ee.Percent:j=U;break;case ee.Proportional:j=U/s;break;default:j=1}a=E.setArraySize(this.world,8);for(let H=0,Q=0,D=0;H<s;H++,Q+=3){let q=o[H]*j;l+=q;let $=l;if(h)$%=U,$<0&&($+=U),D=0;else if($<0){u!=Xe.BEFORE&&(u=Xe.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition($,a,0,n,Q);continue}else if($>U){u!=Xe.AFTER&&(u=Xe.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition($-U,a,0,n,Q);continue}for(;;D++){let ce=V[D];if(!($>ce)){if(D==0)$/=ce;else{let Z=V[D-1];$=($-Z)/(ce-Z)}break}}D!=u&&(u=D,h&&D==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,D*6+2,8,a,0,2)),this.addCurvePosition($,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,Q,i||H>0&&q==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=E.setArraySize(this.curves,d),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,F=0,B=0,I=0;for(let V=0,U=2;V<d;V++,U+=6)w=a[U],g=a[U+1],x=a[U+2],y=a[U+3],v=a[U+4],C=a[U+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,F=k*2+Y,B=(w-p)*.75+S+T*.16666667,I=(g-b)*.75+k+Y*.16666667,f+=Math.sqrt(B*B+I*I),B+=M,I+=F,M+=T,F+=Y,f+=Math.sqrt(B*B+I*I),B+=M,I+=F,f+=Math.sqrt(B*B+I*I),B+=M+T,I+=F+Y,f+=Math.sqrt(B*B+I*I),m[V]=f,p=v,b=C;this.data.positionMode==xe.Percent&&(l*=f);let P;switch(this.data.spacingMode){case ee.Percent:P=f;break;case ee.Proportional:P=f/s;break;default:P=1}let L=this.segments,_=0;for(let V=0,U=0,j=0,H=0;V<s;V++,U+=3){let Q=o[V]*P;l+=Q;let D=l;if(h)D%=f,D<0&&(D+=f),j=0;else if(D<0){this.addBeforePosition(D,a,0,n,U);continue}else if(D>f){this.addAfterPosition(D-f,a,c-4,n,U);continue}for(;;j++){let q=m[j];if(!(D>q)){if(j==0)D/=q;else{let $=m[j-1];D=(D-$)/(q-$)}break}}if(j!=u){u=j;let q=j*6;for(p=a[q],b=a[q+1],w=a[q+2],g=a[q+3],x=a[q+4],y=a[q+5],v=a[q+6],C=a[q+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,F=k*2+Y,B=(w-p)*.3+S+T*.16666667,I=(g-b)*.3+k+Y*.16666667,_=Math.sqrt(B*B+I*I),L[0]=_,q=1;q<8;q++)B+=M,I+=F,M+=T,F+=Y,_+=Math.sqrt(B*B+I*I),L[q]=_;B+=M,I+=F,_+=Math.sqrt(B*B+I*I),L[8]=_,B+=M+T,I+=F+Y,_+=Math.sqrt(B*B+I*I),L[9]=_,H=0}for(D*=_;;H++){let q=L[H];if(!(D>q)){if(H==0)D/=q;else{let $=L[H-1];D=H+(D-$)/(q-$)}break}}this.addCurvePosition(D*.1,p,b,w,g,x,y,v,C,n,U,i||V>0&&Q==0)}return n}addBeforePosition(e,s,i,r,l){let o=s[i],n=s[i+1],a=s[i+2]-o,h=s[i+3]-n,c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addAfterPosition(e,s,i,r,l){let o=s[i+2],n=s[i+3],a=o-s[i],h=n-s[i+1],c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addCurvePosition(e,s,i,r,l,o,n,a,h,c,d,u){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(l-i,r-s);return}let m=e*e,f=m*e,p=1-e,b=p*p,w=b*p,g=p*e,x=g*3,y=p*x,v=x*e,C=s*w+r*y+o*v+a*f,S=i*w+l*y+n*v+h*f;c[d]=C,c[d+1]=S,u&&(e<.001?c[d+2]=Math.atan2(l-i,r-s):c[d+2]=Math.atan2(S-(i*b+l*g*2+n*m),C-(s*b+r*g*2+o*m)))}},Ir=class{data;_bone=null;set bone(t){this._bone=t}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(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.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 t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(t){case fe.none:return;case fe.reset:this.reset();case fe.update:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(i){const x=(this.uy-d)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=d}if(u>=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),i&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*f,this.yVelocity*=b),u-=f;while(u>=f)}s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r||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),r){C=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(k+this.ty,S+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*X.invPI2-.5)*X.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(u=this.remaining,u>=f){b==-1&&(b=Math.pow(this.damping,60*f));const T=this.massInverse*f,Y=this.strength,M=this.wind,F=qe.yDown?-this.gravity:this.gravity,B=n/p;for(;;)if(u-=f,l&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+F*y)*B+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=b,u<f)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(u<f)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case fe.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,h=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=a*this.data.rotate,h=Math.sin(u),c=Math.cos(u),d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d),u+=a*this.data.shearX,h=Math.sin(u),c=Math.cos(u),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c,d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d}if(l){const a=1+this.scaleOffset*e*this.data.scaleX;o.a*=a,o.c*=a}t!=fe.pose&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*X.degRad,r=Math.cos(i),l=Math.sin(i),o=this.cx-t,n=this.cy-e;this.translate(o*r-n*l-o,o*l+n*r-n)}},Us=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new N,this.darkColor=t.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof ve)||!(this.attachment instanceof ve)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,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}},qs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new $e;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){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 t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,u=a*d-h*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=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>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=t;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)*e,g.worldY+=(x.y-g.worldY)*s}if(i!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.c*=x}if(r!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+d*d)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(d,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.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 t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,u=a*d-h*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=0){let x=g.a,y=g.b,v=g.c,C=g.d,S=Math.atan2(c,a)+m;S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=t;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*e,g.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(d,h)-Math.atan2(c,a);x>X.PI?x-=X.PI2:x<-X.PI&&(x+=X.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-X.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 t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*t);let u=c.ax,m=c.ay;u+=(o.ax-u+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let f=c.ascaleX,p=c.ascaleY;i!=0&&f!=0&&(f=(f+(o.ascaleX-f+this.data.offsetScaleX)*i)/f),r!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(u,m,d,f,p,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation+(o.arotation+this.data.offsetRotation)*t,u=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,f=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(u,m,d,f,p,c.ashearX,b)}}},qe=class vs{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 vs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new as(i,this,null);else{let l=this.bones[i.parent.index];r=new as(i,this,l),l.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],l=new Us(i,r);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new Os(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new qs(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new _s(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new Ir(i,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let u=0,m=s.length;u<m;u++){let f=s[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let p=this.bones[u[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,r=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,h=l.length,c=this.physicsConstraints.length,d=n+a+h+c;e:for(let u=0;u<d;u++){for(let m=0;m<n;m++){let f=i[m];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let m=0;m<a;m++){let f=r[m];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let m=0;m<h;m++){let f=l[m];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let m=0;m<c;m++){const f=o[m];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,m=s.length;u<m;u++)this.sortBone(s[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let l=i[i.length-1];this.sortBone(l),this._updateCache.push(e),this.sortReset(r.children),l.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let l=s.getAttachment();l instanceof Ue&&this.sortPathConstraintAttachmentWith(l,r);let o=e.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let l=s[r];this.sortBone(l.parent),this.sortBone(l)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let l in r)this.sortPathConstraintAttachmentWith(r[l],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ue))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let l=0,o=i.length;l<o;){let n=i[l++];for(n+=l;l<n;)this.sortBone(r[i[l++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,l=s.length;r<l;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,l=i.length;r<l;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,w=i.length;b<w;b++){let g=i[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;r.worldX=l*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const h=(r.rotation+r.shearX)*X.degRad,c=(r.rotation+90+r.shearY)*X.degRad,d=Math.cos(h)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(l*d+o*m)*this.scaleX,r.b=(l*u+o*f)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*u+a*f)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=r&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;E.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i],o=l.data.attachmentName;if(o){let n=e.getAttachment(i,o);n&&l.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,l=i.length;r<l;r++){let o=i[r];if(o.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new $e,i=new $e;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)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,d=l.length;c<d;c++){let u=l[c];if(!u.bone.active)continue;let m=0,f=null,p=null,b=u.getAttachment();if(b instanceof W)m=8,f=E.setArraySize(i,m,0),b.computeWorldVertices(u,f,0,2),p=vs.quadTriangles;else if(b instanceof pe){let w=b;m=w.worldVerticesLength,f=E.setArraySize(i,m,0),w.computeWorldVertices(u,0,m,f,0,2),p=w.triangles}else if(b instanceof Le&&r!=null){r.clipStart(u,b);continue}if(f&&p){r!=null&&r.isClipping()&&(r.clipTriangles(f,p,p.length),f=r.clippedVertices,m=r.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)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(o,n),s.set(a-o,h-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,l=i.length;r<l;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let l=0,o=r.length;l<o;l++)r[l].rotate(e,s,i)}},fe;(function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"})(fe||(fe={}));var Ws=class extends Je{_bone=null;set bone(t){this._bone=t}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(t){super(t,0,!1)}},Ke=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(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},ds=class{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Qe=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof pe?(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(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new ds(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new ds(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],l=r.getAttachment();if(l&&s<e.attachments.length){let o=e.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&r.setAttachment(h);break}}}s++}}},us=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Ie.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Ie;(function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"})(Ie||(Ie={}));var fs=class extends Je{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},zs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ke;s.name="";let i=new Gs(t),r=i.readInt32(),l=i.readInt32();s.hash=l==0&&r==0?null:l.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=h==0?null:s.bones[i.readInt(!0)],u=new ns(h,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),o&&(N.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new us(h,c,d);N.rgba8888ToColor(u.color,i.readInt32());let m=i.readInt32();m!=-1&&N.rgb888ToColor(u.darkColor=new N,m),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),o&&(u.visible=i.readBoolean()),s.slots.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new hs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=(m&2)!=0?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,(m&32)!=0&&(u.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new fs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,(m&8)!=0&&(u.offsetRotation=i.readFloat()),(m&16)!=0&&(u.offsetX=i.readFloat()*e),(m&32)!=0&&(u.offsetY=i.readFloat()*e),(m&64)!=0&&(u.offsetScaleX=i.readFloat()),(m&128)!=0&&(u.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(u.offsetShearY=i.readFloat()),(m&2)!=0&&(u.mixRotate=i.readFloat()),(m&4)!=0&&(u.mixX=i.readFloat()),(m&8)!=0&&(u.mixY=i.readFloat()),(m&16)!=0&&(u.mixScaleX=i.readFloat()),(m&32)!=0&&(u.mixScaleY=i.readFloat()),(m&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new cs(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const m=i.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==xe.Fixed&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==ee.Length||u.spacingMode==ee.Fixed)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Ws(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,(m&2)!=0&&(u.x=i.readFloat()),(m&4)!=0&&(u.y=i.readFloat()),(m&8)!=0&&(u.rotate=i.readFloat()),(m&16)!=0&&(u.scaleX=i.readFloat()),(m&32)!=0&&(u.shearX=i.readFloat()),u.limit=((m&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(m&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(u.inertiaGlobal=!0),(m&2)!=0&&(u.strengthGlobal=!0),(m&4)!=0&&(u.dampingGlobal=!0),(m&8)!=0&&(u.massGlobal=!0),(m&16)!=0&&(u.windGlobal=!0),(m&32)!=0&&(u.gravityGlobal=!0),(m&64)!=0&&(u.mixGlobal=!0),u.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+i.readInt(!0));h<n;h++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new ls(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,l=0;if(s){if(l=t.readInt(!0),l==0)return null;r=new Qe("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");r=new Qe(o),i&&N.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);l=t.readInt(!0)}for(let o=0;o<l;o++){let n=t.readInt(!0);for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,l){let o=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case Me.Region:{let h=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let u=(n&128)!=0?t.readFloat():0,m=t.readFloat(),f=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,d);return x?(x.path=h,x.x=m*o,x.y=f*o,x.scaleX=p,x.scaleY=b,x.rotation=u,x.width=w*o,x.height=g*o,N.rgba8888ToColor(x.color,c),x.sequence=d,d==null&&x.updateRegion(),x):null}case Me.BoundingBox:{let h=this.readVertices(t,(n&16)!=0),c=l?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,l&&N.rgba8888ToColor(d.color,c),d):null}case Me.Mesh:{let h=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),f=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-u-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),g=t.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,d);return x?(x.path=h,N.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=f,d==null&&x.updateRegion(),x.hullLength=u<<1,x.sequence=d,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case Me.LinkedMesh:{const h=(n&16)!=0?t.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=(n&128)!=0,m=t.readInt(!0),f=t.readStringRef();let p=0,b=0;l&&(p=t.readFloat(),b=t.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,d);return w?(w.path=h,N.rgba8888ToColor(w.color,c),w.sequence=d,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Mr(w,m,i,f,u)),w):null}case Me.Path:{const h=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),u=E.newArray(d.length/6,0);for(let p=0,b=u.length;p<b;p++)u[p]=t.readFloat()*o;const m=l?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=h,f.constantSpeed=c,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,l&&N.rgba8888ToColor(f.color,m),f):null}case Me.Point:{const h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=l?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=d*o,m.rotation=h,l&&N.rgba8888ToColor(m.color,u),m):null}case Me.Clipping:{const h=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=l?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,a);return u?(u.endSlot=e.slots[h],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,l&&N.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new Is(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Yr;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let l=new Array,o=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(t.readInt(!0)),l.push(t.readFloat()*s),l.push(t.readFloat()*s),l.push(t.readFloat())}return r.vertices=E.toFloatArray(l),r.bones=o,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0),p=f-1;switch(m){case _r:{let b=new Ee(f,c);for(let w=0;w<f;w++)b.setFrame(w,t.readFloat(),t.readStringRef());i.push(b);break}case Ur:{let b=t.readInt(!0),w=new Ft(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let S=0,k=0;w.setFrame(S,g,x,y,v,C),S!=p;S++){let T=t.readFloat(),Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(S);break;case Ae:z(t,w,k++,S,0,g,T,x,Y,1),z(t,w,k++,S,1,g,T,y,M,1),z(t,w,k++,S,2,g,T,v,F,1),z(t,w,k++,S,3,g,T,C,B,1)}g=T,x=Y,y=M,v=F,C=B}i.push(w);break}case qr:{let b=t.readInt(!0),w=new Bt(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let C=0,S=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=t.readFloat(),T=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(C);break;case Ae:z(t,w,S++,C,0,g,k,x,T,1),z(t,w,S++,C,1,g,k,y,Y,1),z(t,w,S++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}i.push(w);break}case Wr:{let b=t.readInt(!0),w=new Et(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,S,k,T),Y!=p;Y++){let F=t.readFloat(),B=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(Y);break;case Ae:z(t,w,M++,Y,0,g,F,x,B,1),z(t,w,M++,Y,1,g,F,y,I,1),z(t,w,M++,Y,2,g,F,v,P,1),z(t,w,M++,Y,3,g,F,C,L,1),z(t,w,M++,Y,4,g,F,S,_,1),z(t,w,M++,Y,5,g,F,k,V,1),z(t,w,M++,Y,6,g,F,T,U,1)}g=F,x=B,y=I,v=P,C=L,S=_,k=V,T=U}i.push(w);break}case zr:{let b=t.readInt(!0),w=new Lt(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,S,k),T!=p;T++){let M=t.readFloat(),F=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(T);break;case Ae:z(t,w,Y++,T,0,g,M,x,F,1),z(t,w,Y++,T,1,g,M,y,B,1),z(t,w,Y++,T,2,g,M,v,I,1),z(t,w,Y++,T,3,g,M,C,P,1),z(t,w,Y++,T,4,g,M,S,L,1),z(t,w,Y++,T,5,g,M,k,_,1)}g=M,x=F,y=B,v=I,C=P,S=L,k=_}i.push(w);break}case Gr:{let b=new Xt(f,t.readInt(!0),c),w=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=t.readFloat(),C=t.readUnsignedByte()/255;switch(t.readByte()){case Se:b.setStepped(x);break;case Ae:z(t,b,y++,x,0,w,v,g,C,1)}w=v,g=C}i.push(b)}}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0);if(m==Or){let b=new Rt(f,c);for(let w=0;w<f;w++)b.setFrame(w,t.readFloat(),t.readByte());i.push(b);continue}let p=t.readInt(!0);switch(m){case Pr:i.push(ie(t,new je(f,p,c),1));break;case Rr:i.push(ms(t,new Ct(f,p,c),r));break;case Fr:i.push(ie(t,new St(f,p,c),r));break;case Br:i.push(ie(t,new At(f,p,c),r));break;case Xr:i.push(ms(t,new kt(f,p,c),1));break;case Er:i.push(ie(t,new Tt(f,p,c),1));break;case Lr:i.push(ie(t,new It(f,p,c),1));break;case Dr:i.push(ms(t,new Mt(f,p,c),1));break;case Vr:i.push(ie(t,new Yt(f,p,c),1));break;case Nr:i.push(ie(t,new Pt(f,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new Vt(d,t.readInt(!0),c),f=t.readByte(),p=t.readFloat(),b=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,w=(f&4)!=0?t.readFloat()*r: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!=u;g++){f=t.readByte();const y=t.readFloat(),v=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,C=(f&4)!=0?t.readFloat()*r:0;(f&64)!=0?m.setStepped(g):(f&128)!=0&&(z(t,m,x++,g,0,p,y,b,v,1),z(t,m,x++,g,1,p,y,w,C,r)),p=y,b=v,w=C}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new Nt(d,t.readInt(!0),c),f=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,C=0;m.setFrame(v,f,p,b,w,g,x,y),v!=u;v++){let S=t.readFloat(),k=t.readFloat(),T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),F=t.readFloat(),B=t.readFloat();switch(t.readByte()){case Se:m.setStepped(v);break;case Ae:z(t,m,C++,v,0,f,S,p,k,1),z(t,m,C++,v,1,f,S,b,T,1),z(t,m,C++,v,2,f,S,w,Y,1),z(t,m,C++,v,3,f,S,g,M,1),z(t,m,C++,v,4,f,S,x,F,1),z(t,m,C++,v,5,f,S,y,B,1)}f=S,p=k,b=T,w=Y,g=M,x=F,y=B}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,m=t.readInt(!0);u<m;u++){const f=t.readByte(),p=t.readInt(!0),b=t.readInt(!0);switch(f){case jr:i.push(ie(t,new Ot(p,b,c),d.positionMode==xe.Fixed?r:1));break;case Jr:i.push(ie(t,new _t(p,b,c),d.spacingMode==ee.Length||d.spacingMode==ee.Fixed?r:1));break;case Kr:let w=new Ut(p,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let C=0,S=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),F=t.readFloat();switch(t.readByte()){case Se:w.setStepped(C);break;case Ae:z(t,w,S++,C,0,g,T,x,Y,1),z(t,w,S++,C,1,g,T,y,M,1),z(t,w,S++,C,2,g,T,v,F,1)}g=T,x=Y,y=M,v=F}i.push(w)}}}for(let a=0,h=t.readInt(!0);a<h;a++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const m=t.readByte(),f=t.readInt(!0);if(m==ni){const b=new Jt(f,c);for(let w=0;w<f;w++)b.setFrame(w,t.readFloat());i.push(b);continue}const p=t.readInt(!0);switch(m){case Qr:i.push(ie(t,new qt(f,p,c),1));break;case Zr:i.push(ie(t,new Wt(f,p,c),1));break;case ei:i.push(ie(t,new zt(f,p,c),1));break;case ti:i.push(ie(t,new Gt(f,p,c),1));break;case si:i.push(ie(t,new Ht(f,p,c),1));break;case ri:i.push(ie(t,new $t(f,p,c),1));break;case ii:i.push(ie(t,new jt(f,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readInt(!0);for(let f=0,p=t.readInt(!0);f<p;f++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case Hr:{let v=w,C=v.bones,S=v.vertices,k=C?S.length/3*2:S.length,T=t.readInt(!0),Y=new Dt(x,T,m,v),M=t.readFloat();for(let F=0,B=0;;F++){let I,P=t.readInt(!0);if(P==0)I=C?E.newFloatArray(k):S;else{I=E.newFloatArray(k);let _=t.readInt(!0);if(P+=_,r==1)for(let V=_;V<P;V++)I[V]=t.readFloat();else for(let V=_;V<P;V++)I[V]=t.readFloat()*r;if(!C)for(let V=0,U=I.length;V<U;V++)I[V]+=S[V]}if(Y.setFrame(F,M,I),F==y)break;let L=t.readFloat();switch(t.readByte()){case Se:Y.setStepped(F);break;case Ae:z(t,Y,B++,F,0,M,L,0,1,1)}M=L}i.push(Y);break}case $r:{let v=new Kt(x,m,w);for(let C=0;C<x;C++){let S=t.readFloat(),k=t.readInt32();v.setFrame(C,S,Ms[k&15],k>>4,t.readFloat())}i.push(v);break}}}}}let l=t.readInt(!0);if(l>0){let a=new _e(l),h=s.slots.length;for(let c=0;c<l;c++){let d=t.readFloat(),u=t.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let f=E.newArray(h-u,0),p=0,b=0;for(let w=0;w<u;w++){let g=t.readInt(!0);for(;p!=g;)f[b++]=p++;m[p+t.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,d,m)}i.push(a)}let o=t.readInt(!0);if(o>0){let a=new nt(o);for(let h=0;h<o;h++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new os(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(h,u)}i.push(a)}let n=0;for(let a=0,h=i.length;a<h;a++)n=Math.max(n,i[a].getDuration());return new rt(e,i,n)}},Gs=class{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Mr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Yr=class{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},Me;(function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"})(Me||(Me={}));function ie(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let l=0,o=0,n=e.getFrameCount()-1;e.setFrame(l,i,r),l!=n;l++){let a=t.readFloat(),h=t.readFloat()*s;switch(t.readByte()){case Se:e.setStepped(l);break;case Ae:z(t,e,o++,l,0,i,a,r,h,s)}i=a,r=h}return e}function ms(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,l=t.readFloat()*s;for(let o=0,n=0,a=e.getFrameCount()-1;e.setFrame(o,i,r,l),o!=a;o++){let h=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case Se:e.setStepped(o);break;case Ae:z(t,e,n++,o,0,i,h,r,c,s),z(t,e,n++,o,1,i,h,l,d,s)}i=h,r=c,l=d}return e}function z(t,e,s,i,r,l,o,n,a,h){e.setBezier(s,i,r,l,n,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,o,a)}var Pr=0,Rr=1,Fr=2,Br=3,Xr=4,Er=5,Lr=6,Dr=7,Vr=8,Nr=9,Or=10,_r=0,Ur=1,qr=2,Wr=3,zr=4,Gr=5,Hr=0,$r=1,jr=0,Jr=1,Kr=2,Qr=0,Zr=1,ei=2,ti=4,si=5,ri=6,ii=7,ni=8,Se=1,Ae=2,gs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Oe(()=>E.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,l=t.slots,o=l.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof ss){let c=h;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=E.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let l=0,o=r.length;l<o;l++){let n=r[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let d=a[h],u=a[h+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=l&&i<=l||t>=o&&s>=o||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),h=a*(r-t)+e;if(h>l&&h<n||(h=a*(o-t)+e,h>l&&h<n))return!0;let c=(l-e)/a+t;return c>r&&c<o||(c=(n-e)/a+t,c>r&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,l=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],h=i[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=i[n];c+(s-a)/(h-a)*(i[l]-c)<e&&(o=!o)}l=n}return o}intersectsSegment(t,e,s,i){let r=this.polygons;for(let l=0,o=r.length;l<o;l++)if(this.intersectsSegmentPolygon(r[l],t,e,s,i))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(t,e,s,i,r){let l=t,o=t.length,n=e-i,a=s-r,h=e*r-s*i,c=l[o-2],d=l[o-1];for(let u=0;u<o;u+=2){let m=l[u],f=l[u+1],p=c*f-d*m,b=c-m,w=d-f,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(h*w-a*p)/g;if((y>=d&&y<=f||y>=f&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Hs=class de{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Oe(()=>new Array);polygonIndicesPool=new Oe(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=i;n<a;++n)l[n]=de.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,h=1;for(;;){e:if(!l[a]){let u=r[n]<<1,m=r[a]<<1,f=r[h]<<1,p=s[u],b=s[u+1],w=s[m],g=s[m+1],x=s[f],y=s[f+1];for(let v=(h+1)%i;v!=n;v=(v+1)%i){if(!l[v])continue;let C=r[v]<<1,S=s[C],k=s[C+1];if(de.positiveArea(x,y,p,b,S,k)&&de.positiveArea(p,b,w,g,S,k)&&de.positiveArea(w,g,x,y,S,k))break e}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),l.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;l[c]=de.isConcave(c,i,s,r),l[d]=de.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=0;for(let c=0,d=s.length;c<d;c+=3){let u=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,p=i[u],b=i[u+1],w=i[m],g=i[m+1],x=i[f],y=i[f+1],v=!1;if(a==u){let C=n.length-4,S=de.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=de.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?(r.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(u),o.push(m),o.push(f),h=de.winding(p,b,w,g,x,y),a=u)}n.length>0&&(r.push(n),l.push(o));for(let c=0,d=r.length;c<d;c++){if(o=l[c],o.length==0)continue;let u=o[0],m=o[o.length-1];n=r[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=de.winding(p,b,w,g,x,y);for(let k=0;k<d;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],F=T[2],B=r[k],I=B[B.length-2],P=B[B.length-1];if(Y!=u||M!=m)continue;let L=de.winding(p,b,w,g,I,P),_=de.winding(I,P,x,y,v,C);L==S&&_==S&&(B.length=0,T.length=0,n.push(I),n.push(P),o.push(F),p=w,b=g,w=I,g=P,k=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(e,s,i,r){let l=r[(s+e-1)%s]<<1,o=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[l],i[l+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(e,s,i,r,l,o){return e*(o-r)+i*(s-o)+l*(r-s)>=0}static winding(e,s,i,r,l,o){let n=i-e,a=r-s;return l*a-o*n+n*s-e*a>=0?1:-1}},ht=class Cs{triangulator=new Hs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let l=this.clippingPolygon;Cs.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];Cs.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,l,o,n,a){let h,c,d,u,m,f;typeof s=="number"?(h=i,c=r,d=l,u=o,m=n,f=a):(h=s,c=i,d=r,u=l,m=o,f=n),d&&u&&m&&typeof f=="boolean"?this.clipTrianglesRender(e,h,c,d,u,m,f):this.clipTrianglesNoRender(e,h,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,u=e[d],m=e[d+1];d=s[c+1]<<1;let f=e[d],p=e[d+1];d=s[c+2]<<1;let b=e[d],w=e[d+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(u,m,f,p,b,w,n[g],r)){let y=r.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]=u,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(e,s,i,r,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=n?12:8,f=0;h.length=0,c.length=0;for(let p=0;p<i;p+=3){let b=s[p]<<1,w=e[b],g=e[b+1],x=r[b],y=r[b+1];b=s[p+1]<<1;let v=e[b],C=e[b+1],S=r[b],k=r[b+1];b=s[p+2]<<1;let T=e[b],Y=e[b+1],M=r[b],F=r[b+1];for(let B=0;B<u;B++){let I=h.length;if(this.clip(w,g,v,C,T,Y,d[B],a)){let P=a.length;if(P==0)continue;let L=C-Y,_=T-v,V=w-T,U=Y-g,j=1/(L*V+_*(g-Y)),H=P>>1,Q=this.clipOutput,D=E.setArraySize(h,I+H*m);for(let $=0;$<P;$+=2,I+=m){let ce=Q[$],Z=Q[$+1];D[I]=ce,D[I+1]=Z,D[I+2]=l.r,D[I+3]=l.g,D[I+4]=l.b,D[I+5]=l.a;let ae=ce-T,oe=Z-Y,we=(L*ae+_*oe)*j,ze=(U*ae+V*oe)*j,tt=1-we-ze;D[I+6]=x*we+S*ze+M*tt,D[I+7]=y*we+k*ze+F*tt,n&&(D[I+8]=o.r,D[I+9]=o.g,D[I+10]=o.b,D[I+11]=o.a)}I=c.length;let q=E.setArraySize(c,I+3*(H-2));H--;for(let $=1;$<H;$++,I+=3)q[I]=f,q[I+1]=f+$,q[I+2]=f+$+1;f+=H+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]=F,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]=F),I=c.length;let L=E.setArraySize(c,I+3);L[I]=f,L[I+1]=f+1,L[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;o.length=0,n.length=0,a.length=0;for(let u=0;u<i;u+=3){let m=s[u]<<1,f=e[m],p=e[m+1],b=r[m],w=r[m+1];m=s[u+1]<<1;let g=e[m],x=e[m+1],y=r[m],v=r[m+1];m=s[u+2]<<1;let C=e[m],S=e[m+1],k=r[m],T=r[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 F=l.length;if(F==0)continue;let B=x-S,I=C-g,P=f-C,L=S-p,_=1/(B*P+I*(p-S)),V=F>>1,U=this.clipOutput,j=E.setArraySize(o,M+V*2),H=E.setArraySize(n,M+V*2);for(let D=0;D<F;D+=2,M+=2){let q=U[D],$=U[D+1];j[M]=q,j[M+1]=$;let ce=q-C,Z=$-S,ae=(B*ce+I*Z)*_,oe=(L*ce+P*Z)*_,we=1-ae-oe;H[M]=b*ae+y*oe+k*we,H[M+1]=w*ae+v*oe+T*we}M=a.length;let Q=E.setArraySize(a,M+3*(V-2));V--;for(let D=1;D<V;D++,M+=3)Q[M]=d,Q[M+1]=d+D,Q[M+2]=d+D+1;d+=V+1}else{let F=E.setArraySize(o,M+6);F[M]=f,F[M+1]=p,F[M+2]=g,F[M+3]=x,F[M+4]=C,F[M+5]=S;let B=E.setArraySize(n,M+3*2);B[M]=b,B[M+1]=w,B[M+2]=y,B[M+3]=v,B[M+4]=k,B[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=d,I[M+1]=d+1,I[M+2]=d+2,d+=3;break}}}}clip(e,s,i,r,l,o,n,a){let h=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(l),d.push(o),d.push(e),d.push(s),a.length=0;let u=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=d;for(let C=0,S=d.length-2;C<S;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],F=g*(p-Y)>w*(b-M),B=g*(p-k)-w*(b-T);if(B>0){if(F){a.push(Y),a.push(M);continue}let I=Y-k,P=M-T,L=B/(I*g-P*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+P*L);else{a.push(Y),a.push(M);continue}}else if(F){let I=Y-k,P=M-T,L=B/(I*g-P*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+P*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==u)break;let v=a;a=d,a.length=0,d=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(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],l=0,o=0,n=0,a=0;for(let h=0,c=i-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],r+=l*a-n*o;if(!(r<0))for(let h=0,c=i-2,d=i>>1;h<d;h+=2){let u=s[h],m=s[h+1],f=c-h;s[h]=s[f],s[h+1]=s[f+1],s[f]=u,s[f+1]=m}}},$s=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ke,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=A(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let l=0;l<i.bones.length;l++){let o=i.bones[l],n=null,a=A(o,"parent",null);a&&(n=s.findBone(a));let h=new ns(s.bones.length,o.name,n);h.length=A(o,"length",0)*e,h.x=A(o,"x",0)*e,h.y=A(o,"y",0)*e,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(K,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(i.slots)for(let l=0;l<i.slots.length;l++){let o=i.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new us(s.slots.length,n,a),c=A(o,"color",null);c&&h.color.setFromString(c);let d=A(o,"dark",null);d&&(h.darkColor=N.fromString(d)),h.attachmentName=A(o,"attachment",null),h.blendMode=E.enumValue(Ie,A(o,"blend","normal")),h.visible=A(o,"visible",!0),s.slots.push(h)}if(i.ik)for(let l=0;l<i.ik.length;l++){let o=i.ik[l],n=new hs(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)*e,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(i.transform)for(let l=0;l<i.transform.length;l++){let o=i.transform[l],n=new fs(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);n.bones.push(u)}let a=o.target,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)*e,n.offsetY=A(o,"y",0)*e,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(i.path)for(let l=0;l<i.path.length;l++){let o=i.path[l],n=new cs(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);n.bones.push(u)}let a=o.target,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(xe,A(o,"positionMode","Percent")),n.spacingMode=E.enumValue(ee,A(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Re,A(o,"rotateMode","Tangent")),n.offsetRotation=A(o,"rotation",0),n.position=A(o,"position",0),n.positionMode==xe.Fixed&&(n.position*=e),n.spacing=A(o,"spacing",0),(n.spacingMode==ee.Length||n.spacingMode==ee.Fixed)&&(n.spacing*=e),n.mixRotate=A(o,"mixRotate",1),n.mixX=A(o,"mixX",1),n.mixY=A(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let l=0;l<i.physics.length;l++){const o=i.physics[l],n=new Ws(o.name);n.order=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)*e,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(i.skins)for(let l=0;l<i.skins.length;l++){let o=i.skins[l],n=new Qe(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 d in c){let u=this.readAttachment(c[d],n,h.index,d,s);u&&n.setAttachment(h.index,d,u)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let l in i.events){let o=i.events[l],n=new ls(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(i.animations)for(let l in i.animations){let o=i.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(t,e,s,i,r){let l=this.scale;switch(i=A(t,"name",i),A(t,"type","region")){case"region":{let o=A(t,"path",i),n=this.readSequence(A(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,o,n);if(!a)return null;a.path=o,a.x=A(t,"x",0)*l,a.y=A(t,"y",0)*l,a.scaleX=A(t,"scaleX",1),a.scaleY=A(t,"scaleY",1),a.rotation=A(t,"rotation",0),a.width=t.width*l,a.height=t.height*l,a.sequence=n;let h=A(t,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let n=A(t,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=A(t,"path",i),n=this.readSequence(A(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,o,n);if(!a)return null;a.path=o;let h=A(t,"color",null);h&&a.color.setFromString(h),a.width=A(t,"width",0)*l,a.height=A(t,"height",0)*l,a.sequence=n;let c=A(t,"parent",null);if(c)return this.linkedMeshes.push(new ai(a,A(t,"skin",null),s,c,A(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=A(t,"edges",null),a.hullLength=A(t,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(e,i);if(!o)return null;o.closed=A(t,"closed",!1),o.constantSpeed=A(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*l;o.lengths=a;let h=A(t,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,i);if(!o)return null;o.x=A(t,"x",0)*l,o.y=A(t,"y",0)*l,o.rotation=A(t,"rotation",0);let n=A(t,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,i);if(!o)return null;let n=A(t,"end",null);n&&(o.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,o,a<<1);let h=A(t,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(t){if(t==null)return null;let e=new Is(A(t,"count",0));return e.start=A(t,"start",1),e.digits=A(t,"digits",0),e.setupIndex=A(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=E.toFloatArray(r);if(i!=1)for(let a=0,h=r.length;a<h;a++)n[a]*=i;e.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let h=r[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(r[n]),l.push(r[n+1]*i),l.push(r[n+2]*i),l.push(r[n+3])}e.bones=o,e.vertices=E.toFloatArray(l)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let o in t.slots){let n=t.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 d=n[c];if(!d)continue;let u=d.length;if(c=="attachment"){let m=new Ee(u,h);for(let f=0;f<u;f++){let p=d[f];m.setFrame(f,A(p,"time",0),A(p,"name",null))}r.push(m)}else if(c=="rgba"){let m=new Ft(u,u<<2,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=d[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=N.fromString(x.color),C=f.curve;C&&(g=G(C,m,g,w,0,p,y,b.r,v.r,1),g=G(C,m,g,w,1,p,y,b.g,v.g,1),g=G(C,m,g,w,2,p,y,b.b,v.b,1),g=G(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,f=x}r.push(m)}else if(c=="rgb"){let m=new Bt(u,u*3,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=d[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=N.fromString(x.color),C=f.curve;C&&(g=G(C,m,g,w,0,p,y,b.r,v.r,1),g=G(C,m,g,w,1,p,y,b.g,v.g,1),g=G(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,f=x}r.push(m)}else if(c=="alpha")r.push(be(d,new Xt(u,u,h),0,1));else if(c=="rgba2"){let m=new Et(u,u*7,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.light),w=N.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=d[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=N.fromString(y.light),S=N.fromString(y.dark),k=f.curve;k&&(x=G(k,m,x,g,0,p,v,b.r,C.r,1),x=G(k,m,x,g,1,p,v,b.g,C.g,1),x=G(k,m,x,g,2,p,v,b.b,C.b,1),x=G(k,m,x,g,3,p,v,b.a,C.a,1),x=G(k,m,x,g,4,p,v,w.r,S.r,1),x=G(k,m,x,g,5,p,v,w.g,S.g,1),x=G(k,m,x,g,6,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}r.push(m)}else if(c=="rgb2"){let m=new Lt(u,u*6,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.light),w=N.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=d[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=N.fromString(y.light),S=N.fromString(y.dark),k=f.curve;k&&(x=G(k,m,x,g,0,p,v,b.r,C.r,1),x=G(k,m,x,g,1,p,v,b.g,C.g,1),x=G(k,m,x,g,2,p,v,b.b,C.b,1),x=G(k,m,x,g,3,p,v,w.r,S.r,1),x=G(k,m,x,g,4,p,v,w.g,S.g,1),x=G(k,m,x,g,5,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}r.push(m)}}}if(t.bones)for(let o in t.bones){let n=t.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 d=n[c],u=d.length;if(u!=0){if(c==="rotate")r.push(be(d,new je(u,u,h),0,1));else if(c==="translate"){let m=new Ct(u,u<<1,h);r.push(ps(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new St(u,u,h);r.push(be(d,m,0,i))}else if(c==="translatey"){let m=new At(u,u,h);r.push(be(d,m,0,i))}else if(c==="scale"){let m=new kt(u,u<<1,h);r.push(ps(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Tt(u,u,h);r.push(be(d,m,1,1))}else if(c==="scaley"){let m=new It(u,u,h);r.push(be(d,m,1,1))}else if(c==="shear"){let m=new Mt(u,u<<1,h);r.push(ps(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Yt(u,u,h);r.push(be(d,m,0,1))}else if(c==="sheary"){let m=new Pt(u,u,h);r.push(be(d,m,0,1))}else if(c==="inherit"){let m=new Rt(u,a.index);for(let f=0;f<d.length;f++){let p=d[f];m.setFrame(f,A(p,"time",0),E.enumValue(K,A(p,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let o in t.ik){let n=t.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),d=new Vt(n.length,n.length<<1,c),u=A(a,"time",0),m=A(a,"mix",1),f=A(a,"softness",0)*i;for(let p=0,b=0;;p++){d.setFrame(p,u,m,f,A(a,"bendPositive",!0)?1:-1,A(a,"compress",!1),A(a,"stretch",!1));let w=n[p+1];if(!w){d.shrink(b);break}let g=A(w,"time",0),x=A(w,"mix",1),y=A(w,"softness",0)*i,v=a.curve;v&&(b=G(v,d,b,p,0,u,g,m,x,1),b=G(v,d,b,p,1,u,g,f,y,i)),u=g,m=x,f=y,a=w}r.push(d)}if(t.transform)for(let o in t.transform){let n=t.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),d=new Nt(n.length,n.length*6,c),u=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++){d.setFrame(x,u,m,f,p,b,w,g);let v=n[x+1];if(!v){d.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),F=A(v,"mixShearY",1),B=a.curve;B&&(y=G(B,d,y,x,0,u,C,m,S,1),y=G(B,d,y,x,1,u,C,f,k,1),y=G(B,d,y,x,2,u,C,p,T,1),y=G(B,d,y,x,3,u,C,b,Y,1),y=G(B,d,y,x,4,u,C,w,M,1),y=G(B,d,y,x,5,u,C,g,F,1)),u=C,m=S,f=k,p=T,b=Y,w=M,b=Y,a=v}r.push(d)}if(t.path)for(let o in t.path){let n=t.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 d=n[c],u=d[0];if(!u)continue;let m=d.length;if(c==="position"){let f=new Ot(m,m,h);r.push(be(d,f,0,a.positionMode==xe.Fixed?i:1))}else if(c==="spacing"){let f=new _t(m,m,h);r.push(be(d,f,0,a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?i:1))}else if(c==="mix"){let f=new Ut(m,m*3,h),p=A(u,"time",0),b=A(u,"mixRotate",1),w=A(u,"mixX",1),g=A(u,"mixY",w);for(let x=0,y=0;;x++){f.setFrame(x,p,b,w,g);let v=d[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=u.curve;Y&&(y=G(Y,f,y,x,0,p,C,b,S,1),y=G(Y,f,y,x,1,p,C,w,k,1),y=G(Y,f,y,x,2,p,C,g,T,1)),p=C,b=S,w=k,g=T,u=v}r.push(f)}}}if(t.physics)for(let o in t.physics){let n=t.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],d=c[0];if(!d)continue;let u=c.length;if(h=="reset"){const f=new Jt(u,a);for(let p=0;d!=null;d=c[p+1],p++)f.setFrame(p,A(d,"time",0));r.push(f);continue}let m;if(h=="inertia")m=new qt(u,u,a);else if(h=="strength")m=new Wt(u,u,a);else if(h=="damping")m=new zt(u,u,a);else if(h=="mass")m=new Gt(u,u,a);else if(h=="wind")m=new Ht(u,u,a);else if(h=="gravity")m=new $t(u,u,a);else if(h=="mix")m=new jt(u,u,a);else continue;r.push(be(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let n=t.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],d=s.findSlot(h);if(!d)throw new Error("Slot not found: "+h);let u=d.index;for(let m in c){let f=c[m],p=a.getAttachment(u,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 Dt(w.length,w.length,u,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),i!=1)for(let L=P,_=L+M.length;L<_;L++)Y[L]*=i;if(!x)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(k,S,Y);let F=w[k+1];if(!F){C.shrink(T);break}let B=A(F,"time",0),I=g.curve;I&&(T=G(I,C,T,k,0,S,B,0,1,1)),S=B,g=F}r.push(C)}else if(b=="sequence"){let x=new Kt(w.length,u,p),y=0;for(let v=0;v<w.length;v++){let C=A(g,"delay",y),S=A(g,"time",0),k=se[A(g,"mode","hold")],T=A(g,"index",0);x.setFrame(v,S,k,T,C),y=C,g=w[v+1]}r.push(x)}}}}}}if(t.drawOrder){let o=new _e(t.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<t.drawOrder.length;h++,a++){let c=t.drawOrder[h],d=null,u=A(c,"offsets",null);if(u){d=E.newArray(n,-1);let m=E.newArray(n-u.length,0),f=0,p=0;for(let b=0;b<u.length;b++){let w=u[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++;d[f+w.offset]=f++}for(;f<n;)m[p++]=f++;for(let b=n-1;b>=0;b--)d[b]==-1&&(d[b]=m[--p])}o.setFrame(a,A(c,"time",0),d)}r.push(o)}if(t.events){let o=new nt(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let h=t.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let d=new os(E.toSinglePrecision(A(h,"time",0)),c);d.intValue=A(h,"int",c.intValue),d.floatValue=A(h,"float",c.floatValue),d.stringValue=A(h,"string",c.stringValue),d.data.audioPath&&(d.volume=A(h,"volume",1),d.balance=A(h,"balance",0)),o.setFrame(n,d)}r.push(o)}let l=0;for(let o=0,n=r.length;o<n;o++)l=Math.max(l,r[o].getDuration());s.animations.push(new rt(e,r,l))}},ai=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function be(t,e,s,i){let r=t[0],l=A(r,"time",0),o=A(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,l,o);let h=t[a+1];if(!h)return e.shrink(n),e;let c=A(h,"time",0),d=A(h,"value",s)*i;r.curve&&(n=G(r.curve,e,n,a,0,l,c,o,d,i)),l=c,o=d,r=h}}function ps(t,e,s,i,r,l){let o=t[0],n=A(o,"time",0),a=A(o,s,r)*l,h=A(o,i,r)*l,c=0;for(let d=0;;d++){e.setFrame(d,n,a,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=A(u,"time",0),f=A(u,s,r)*l,p=A(u,i,r)*l,b=o.curve;b&&(c=G(b,e,c,d,0,n,m,a,f,l),c=G(b,e,c,d,1,n,m,h,p,l)),n=m,a=f,h=p,o=u}}function G(t,e,s,i,r,l,o,n,a,h){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,r,l,n,d,u,m,f,o,a),s+1}function A(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var ne=Te("pixi.js"),oi=Te("pixi.js"),xs=class Ye extends rs{static textureMap=new Map;static from(e){return Ye.textureMap.has(e)?Ye.textureMap.get(e):new Ye(e)}texture;constructor(e){super(e.resource),this.texture=oi.Texture.from(e)}setFilters(e,s){const i=this.texture.source.style;i.minFilter=Ye.toPixiTextureFilter(e),i.magFilter=Ye.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=Ye.toPixiMipMap(e),this.texture.source.updateMipmaps()}setWraps(e,s){const i=this.texture.source.style;i.addressModeU=Ye.toPixiTextureWrap(e),i.addressModeV=Ye.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(e){switch(e){case te.Nearest:case te.Linear:return!1;case te.MipMapNearestLinear:case te.MipMapNearestNearest:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureFilter(e){switch(e){case te.Nearest:case te.MipMapNearestLinear:case te.MipMapNearestNearest:return"nearest";case te.Linear:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureWrap(e){switch(e){case Ce.ClampToEdge:return"clamp-to-edge";case Ce.MirroredRepeat:return"mirror-repeat";case Ce.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(e)}`)}}static toPixiBlending(e){switch(e){case Ie.Normal:return"normal";case Ie.Additive:return"add";case Ie.Multiply:return"multiply";case Ie.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(e)}`)}}},Ze="spineTextureAtlasLoader",li={extension:ne.ExtensionType.Asset,resolver:{test:t=>(0,ne.checkExtension)(t,".atlas"),parse:t=>{const e=t.split(".");return{resolution:parseFloat(ne.Resolver.RETINA_PREFIX?.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{id:Ze,name:Ze,extension:{type:ne.ExtensionType.LoadParser,priority:ne.LoaderParserPriority.Normal,name:Ze},test(t){return(0,ne.checkExtension)(t,".atlas")},async load(t){return await(await ne.DOMAdapter.get().fetch(t)).text()},testParse(t,e){const s=(0,ne.checkExtension)(e.src,".atlas"),i=typeof t=="string",r=e.parser===Ze||e.loadParser===Ze;return Promise.resolve((s||r)&&i)},unload(t){t.dispose()},async parse(t,e,s){const i=e.data||{};let r=ne.path.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const l=new lt(t);if(i.images instanceof ne.TextureSource||typeof i.images=="string"){const n=i.images;i.images={},i.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=i?.images?i.images[a]:void 0;if(h instanceof ne.TextureSource)n.setTexture(xs.from(h));else{const c=h??ne.path.normalize([...r.split(ne.path.sep),a].join(ne.path.sep)),d={src:(0,ne.copySearchParams)(c,e.src),data:{...i.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},u=s.load(d).then(m=>{n.setTexture(xs.from(m.source))});o.push(u)}}return await Promise.all(o),l}}};ne.extensions.add(li);var Fe=Te("pixi.js"),et="spineSkeletonLoader";function hi(t){return Object.prototype.hasOwnProperty.call(t,"bones")}function ci(t){return t instanceof Uint8Array}var di={extension:Fe.ExtensionType.Asset,loader:{id:et,name:et,extension:{type:Fe.ExtensionType.LoadParser,priority:Fe.LoaderParserPriority.Normal,name:et},test(t){return(0,Fe.checkExtension)(t,".skel")},async load(t){const e=await Fe.DOMAdapter.get().fetch(t);return new Uint8Array(await e.arrayBuffer())},testParse(t,e){const s=(0,Fe.checkExtension)(e.src,".json")&&hi(t),i=(0,Fe.checkExtension)(e.src,".skel")&&ci(t),r=e.parser===et||e.loadParser===et;return Promise.resolve(s||i||r)}}};Fe.extensions.add(di);var ct=Te("pixi.js"),De=Te("pixi.js"),ui=new Float32Array(1),fi=new Uint32Array(1),mi=class extends De.Geometry{constructor(){const e=new De.Buffer({data:ui,label:"attribute-batch-buffer",usage:De.BufferUsage.VERTEX|De.BufferUsage.COPY_DST,shrinkToFit:!1}),s=new De.Buffer({data:fi,label:"index-batch-buffer",usage:De.BufferUsage.INDEX|De.BufferUsage.COPY_DST,shrinkToFit:!1}),i=7*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:5*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:6*4}},indexBuffer:s})}},ke=Te("pixi.js"),gi={name:"color-bit",vertex:{header:`
|
|
1
|
+
"use strict";var spine=(()=>{var wt=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,fr=Object.getOwnPropertyNames,mr=Object.prototype.hasOwnProperty,Te=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),gr=(t,e)=>{for(var s in e)wt(t,s,{get:e[s],enumerable:!0})},pr=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of fr(e))!mr.call(t,r)&&r!==s&&wt(t,r,{get:()=>e[r],enumerable:!(i=ur(e,r))||i.enumerable});return t},xr=t=>pr(wt({},"__esModule",{value:!0}),t),As={};if(gr(As,{AABBRectangleBoundsProvider:()=>Si,AlphaTimeline:()=>Xt,Animation:()=>rt,AnimationState:()=>Qt,AnimationStateAdapter:()=>Sr,AnimationStateData:()=>Bs,AssetCache:()=>Vs,AssetManagerBase:()=>Tr,AtlasAttachmentLoader:()=>Ds,Attachment:()=>vt,AttachmentTimeline:()=>Ee,BinaryInput:()=>Gs,BlendMode:()=>Ie,Bone:()=>as,BoneData:()=>ns,BoundingBoxAttachment:()=>ss,CURRENT:()=>Fs,ClippingAttachment:()=>Le,Color:()=>N,ConstraintData:()=>Qe,CurveTimeline:()=>ge,CurveTimeline1:()=>ue,CurveTimeline2:()=>it,DebugUtils:()=>yr,DeformTimeline:()=>Dt,Downloader:()=>Ns,DrawOrderTimeline:()=>_e,Event:()=>os,EventData:()=>ls,EventQueue:()=>Ps,EventTimeline:()=>nt,EventType:()=>le,FIRST:()=>Zt,FakeTexture:()=>Ar,HOLD_FIRST:()=>ot,HOLD_MIX:()=>Rs,HOLD_SUBSEQUENT:()=>es,IkConstraint:()=>Os,IkConstraintData:()=>hs,IkConstraintTimeline:()=>Vt,Inherit:()=>K,InheritTimeline:()=>Rt,IntSet:()=>br,Interpolation:()=>ks,MathUtils:()=>X,MeshAttachment:()=>pe,MixBlend:()=>R,MixDirection:()=>re,PathAttachment:()=>Ue,PathConstraint:()=>_s,PathConstraintData:()=>cs,PathConstraintMixTimeline:()=>Ut,PathConstraintPositionTimeline:()=>Ot,PathConstraintSpacingTimeline:()=>_t,Physics:()=>fe,PhysicsConstraintDampingTimeline:()=>zt,PhysicsConstraintGravityTimeline:()=>Ht,PhysicsConstraintInertiaTimeline:()=>qt,PhysicsConstraintMassTimeline:()=>Gt,PhysicsConstraintMixTimeline:()=>jt,PhysicsConstraintResetTimeline:()=>Jt,PhysicsConstraintStrengthTimeline:()=>Wt,PhysicsConstraintTimeline:()=>Pe,PhysicsConstraintWindTimeline:()=>$t,PointAttachment:()=>Ls,Pool:()=>Oe,PositionMode:()=>xe,Pow:()=>Ts,PowOut:()=>wr,RGB2Timeline:()=>Lt,RGBA2Timeline:()=>Et,RGBATimeline:()=>Ft,RGBTimeline:()=>Bt,RegionAttachment:()=>W,RotateMode:()=>Re,RotateTimeline:()=>Ke,SETUP:()=>ts,SUBSEQUENT:()=>at,ScaleTimeline:()=>kt,ScaleXTimeline:()=>Tt,ScaleYTimeline:()=>It,SequenceTimeline:()=>Kt,SetupPoseBoundsProvider:()=>Ai,ShearTimeline:()=>Mt,ShearXTimeline:()=>Yt,ShearYTimeline:()=>Pt,Skeleton:()=>qe,SkeletonBinary:()=>zs,SkeletonBounds:()=>gs,SkeletonClipping:()=>ht,SkeletonData:()=>Ze,SkeletonJson:()=>Hs,Skin:()=>et,SkinEntry:()=>ds,SkinsAndAnimationBoundsProvider:()=>ki,Slot:()=>Us,SlotData:()=>us,SpacingMode:()=>ee,Spine:()=>Ti,SpineDebugRenderer:()=>Ii,SpinePipe:()=>Js,SpineTexture:()=>xs,StringSet:()=>yt,Texture:()=>rs,TextureAtlas:()=>lt,TextureAtlasPage:()=>Es,TextureAtlasRegion:()=>is,TextureFilter:()=>te,TextureRegion:()=>Xs,TextureWrap:()=>Ce,TimeKeeper:()=>vr,Timeline:()=>J,TrackEntry:()=>Ys,TransformConstraint:()=>qs,TransformConstraintData:()=>fs,TransformConstraintTimeline:()=>Nt,TranslateTimeline:()=>Ct,TranslateXTimeline:()=>St,TranslateYTimeline:()=>At,Triangulator:()=>$s,Utils:()=>E,Vector2:()=>Je,VertexAttachment:()=>ve,WindowedMean:()=>Cr}),typeof window<"u"&&window.PIXI){const t=window.require;window.require=e=>{if(t)return t(e);if(e.startsWith("@pixi/")||e.startsWith("pixi.js"))return window.PIXI}}var br=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},yt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},N=class Ne{r;g;b;a;static WHITE=new Ne(1,1,1,1);static RED=new Ne(1,0,0,1);static GREEN=new Ne(0,1,0,1);static BLUE=new Ne(0,0,1,1);static MAGENTA=new Ne(1,0,1,1);constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new Ne){return s.setFromString(e)}},X=class ye{static PI=3.1415927;static PI2=ye.PI*2;static invPI2=1/ye.PI2;static radiansToDegrees=180/ye.PI;static radDeg=ye.radiansToDegrees;static degreesToRadians=ye.PI/180;static degRad=ye.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*ye.degRad)}static sinDeg(e){return Math.sin(e*ye.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ye.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ye.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),l=s-e;return r<=(i-e)/l?e+Math.sqrt(r*l*(i-e)):s-Math.sqrt((1-r)*l*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},ks=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ts=class extends ks{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},wr=class extends Ts{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},E=class je{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,l){for(let o=s,n=r;o<s+l;o++,n++)i[n]=e[o]}static arrayFill(e,s,i,r){for(let l=s;l<i;l++)e[l]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let l=r;l<s;l++)e[l]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:je.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(je.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(je.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return je.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return je.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},yr=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Oe=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Je=class{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},vr=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Cr=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},vt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},ve=class sr extends vt{static nextID=0;id=sr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,l,o){i=l+(i>>1)*o;let n=e.bone.skeleton,a=e.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let f=e.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<i;v+=2,C+=o){let S=h[v],k=h[v+1];r[C]=S*w+k*g+p,r[C+1]=S*x+k*y+b}return}let d=0,u=0;for(let f=0;f<s;f+=2){let p=c[d];d+=p+1,u+=p}let m=n.bones;if(a.length==0)for(let f=l,p=u*3;f<i;f+=o){let b=0,w=0,g=c[d++];for(g+=d;d<g;d++,p+=3){let x=m[c[d]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}r[f]=b,r[f+1]=w}else{let f=a;for(let p=l,b=u*3,w=u<<1;p<i;p+=o){let g=0,x=0,y=c[d++];for(y+=d;d<y;d++,b+=3,w+=2){let v=m[c[d]],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}r[p]=g,r[p+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Is=class gt{static _nextID=0;id=gt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new gt(this.regions.length);return E.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let l=this.digits-r.length;l>0;l--)i+="0";return i+=r,i}static nextID(){return gt._nextID++}},se;(function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"})(se||(se={}));var Ms=[se.hold,se.once,se.loop,se.pingpong,se.onceReverse,se.loopReverse,se.pingpongReverse],rt=class{name;timelines=[];timelineIds=new yt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,l,o,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(t,e,s,r,l,o,n)}},R;(function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"})(R||(R={}));var re;(function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"})(re||(re={}));var O={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},J=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*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(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},ge=class extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-l*2+n)*.03,f=(r-o*2+a)*.03,p=((l-n)*3-i+h)*.006,b=((o-a)*3-r+c)*.006,w=m*2+p,g=f*2+b,x=(l-i)*.3+m+p*.16666667,y=(o-r)*.3+f+b*.16666667,v=i+x,C=r+y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],h=this.frames[e+s];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}let l=i+18;for(i+=2;i<l;i+=2)if(r[i]>=t){let a=r[i-2],h=r[i-1];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}e+=this.getFrameEntries();let o=r[l-2],n=r[l-1];return n+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-n)}},ue=class extends ge{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],l=e[s+1];return l+(t-r)/(e[s+2]-r)*(e[s+2+1]-l);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case R.setup:return r;case R.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);switch(s){case R.setup:return r+l*e;case R.first:case R.replace:l+=r-i}return i+l*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case R.setup:return r;case R.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);return s==R.setup?r+(l-r)*e:i+(l-i)*e}getAbsoluteValue2(t,e,s,i,r,l){if(t<this.frames[0]){switch(s){case R.setup:return r;case R.first:return i+(r-i)*e}return i}return s==R.setup?r+(l-r)*e:i+(l-i)*e}getScaleValue(t,e,s,i,r,l){const o=this.frames;if(t<o[0]){switch(s){case R.setup:return l;case R.first:return r+(l-r)*e}return r}let n=this.getCurveValue(t)*l;if(e==1)return s==R.add?r+n-l:n;if(i==re.mixOut)switch(s){case R.setup:return l+(Math.abs(n)*X.signum(l)-l)*e;case R.first:case R.replace:return r+(Math.abs(n)*X.signum(r)-r)*e}else{let a=0;switch(s){case R.setup:return a=Math.abs(l)*X.signum(n),a+(n-a)*e;case R.first:case R.replace:return a=Math.abs(r)*X.signum(n),a+(n-a)*e}}return r+(n-l)*e}},it=class extends ge{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},Ke=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,l,n.rotation,n.data.rotation))}},Ct=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.x=n.data.x,n.y=n.data.y;return;case R.first:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let h=0,c=0,d=J.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*f,c+=(a[d+3+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(l){case R.setup:n.x=n.data.x+h*r,n.y=n.data.y+c*r;break;case R.first:case R.replace:n.x+=(n.data.x+h-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case R.add:n.x+=h*r,n.y+=c*r}}},St=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,l,n.x,n.data.x))}},At=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,l,n.y,n.data.y))}},kt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case R.first:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let h,c,d=J.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*f,c+=(a[d+3+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,r==1)l==R.add?(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==re.mixOut)switch(l){case R.setup:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(h)*X.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*X.signum(f)-f)*r;break;case R.first:case R.replace:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(h)*X.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*X.signum(f)-f)*r;break;case R.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(l){case R.setup:m=Math.abs(n.data.scaleX)*X.signum(h),f=Math.abs(n.data.scaleY)*X.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=f+(c-f)*r;break;case R.first:case R.replace:m=Math.abs(n.scaleX)*X.signum(h),f=Math.abs(n.scaleY)*X.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=f+(c-f)*r;break;case R.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Tt=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,l,o,n.scaleX,n.data.scaleX))}},It=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,l,o,n.scaleY,n.data.scaleY))}},Mt=class extends it{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case R.first:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let h=0,c=0,d=J.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*f,c+=(a[d+3+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(l){case R.setup:n.shearX=n.data.shearX+h*r,n.shearY=n.data.shearY+c*r;break;case R.first:case R.replace:n.shearX+=(n.data.shearX+h-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case R.add:n.shearX+=h*r,n.shearY+=c*r}}},Yt=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,l,n.shearX,n.data.shearX))}},Pt=class extends ue{boneIndex=0;constructor(t,e,s){super(t,e,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,l,n.shearY,n.data.shearY))}},Rt=class extends J{boneIndex=0;constructor(t,e){super(t,[O.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;if(o==re.mixOut){l==R.setup&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==R.setup||l==R.first)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[J.search(a,s,2)+1]}},Ft=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,l){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:h.setFromColor(b);return;case R.first:h.add((b.r-h.r)*r,(b.g-h.g)*r,(b.b-h.b)*r,(b.a-h.a)*r)}return}let c=0,d=0,u=0,m=0,f=J.search(a,s,5),p=this.curves[f/5];switch(p){case 0:let b=a[f];c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];let w=(s-b)/(a[f+5]-b);c+=(a[f+5+1]-c)*w,d+=(a[f+5+2]-d)*w,u+=(a[f+5+3]-u)*w,m+=(a[f+5+4]-m)*w;break;case 1:c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+18*2-2),m=this.getBezierValue(s,f,4,p+18*3-2)}r==1?h.set(c,d,u,m):(l==R.setup&&h.setFromColor(n.data.color),h.add((c-h.r)*r,(d-h.g)*r,(u-h.b)*r,(m-h.a)*r))}},Bt=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:h.r=p.r,h.g=p.g,h.b=p.b;return;case R.first:h.r+=(p.r-h.r)*r,h.g+=(p.g-h.g)*r,h.b+=(p.b-h.b)*r}return}let c=0,d=0,u=0,m=J.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let p=a[m];c=a[m+1],d=a[m+2],u=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,d+=(a[m+4+2]-d)*b,u+=(a[m+4+3]-u)*b;break;case 1:c=a[m+1],d=a[m+2],u=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+18*2-2)}if(r==1)h.r=c,h.g=d,h.b=u;else{if(l==R.setup){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*r,h.g+=(d-h.g)*r,h.b+=(u-h.b)*r}}},Xt=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,O.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:a.a=c.a;return;case R.first:a.a+=(c.a-a.a)*r}return}let h=this.getCurveValue(s);r==1?a.a=h:(l==R.setup&&(a.a=n.data.color.a),a.a+=(h-a.a)*r)}},Et=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,l,o,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,l,o){let n=t.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 R.setup:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case R.first:h.add((y.r-h.r)*r,(y.g-h.g)*r,(y.b-h.b)*r,(y.a-h.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,u=0,m=0,f=0,p=0,b=0,w=0,g=J.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];d=a[g+1],u=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);d+=(a[g+8+1]-d)*v,u+=(a[g+8+2]-u)*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:d=a[g+1],u=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:d=this.getBezierValue(s,g,1,x-2),u=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(r==1)h.set(d,u,m,f),c.r=p,c.g=b,c.b=w;else{if(l==R.setup){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((d-h.r)*r,(u-h.g)*r,(m-h.b)*r,(f-h.a)*r),c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Lt=class extends ge{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.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 R.setup: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 R.first:h.r+=(y.r-h.r)*r,h.g+=(y.g-h.g)*r,h.b+=(y.b-h.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,u=0,m=0,f=0,p=0,b=0,w=0,g=J.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];d=a[g+1],u=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);d+=(a[g+7+1]-d)*v,u+=(a[g+7+2]-u)*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:d=a[g+1],u=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];break;default:d=this.getBezierValue(s,g,1,x-2),u=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)h.r=d,h.g=u,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==R.setup){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+=(d-h.r)*r,h.g+=(u-h.g)*r,h.b+=(m-h.b)*r,c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Ee=class extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[O.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(n.bone.active){if(o==re.mixOut){l==R.setup&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==R.setup||l==R.first)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Dt=class extends ge{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[O.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-l*2+n)*.03,f=a*.03-o*.06,p=((l-n)*3-i+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=f*2+b,x=(l-i)*.3+m+p*.16666667,y=o*.3+f+b*.16666667,v=i+x,C=y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let l=s[r-2],o=s[r-1];return o+(1-o)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof ve)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=R.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(l){case R.setup:h.length=0;return;case R.first:if(r==1){h.length=0;return}h.length=d;let g=a;if(g.bones){r=1-r;for(var m=0;m<d;m++)h[m]*=r}else{let x=g.vertices;for(var m=0;m<d;m++)h[m]+=(x[m]-h[m])*r}}return}if(h.length=d,s>=u[u.length-1]){let g=c[u.length-1];if(r==1)if(l==R.add){let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,d);else switch(l){case R.setup:{let y=a;if(y.bones)for(let v=0;v<d;v++)h[v]=g[v]*r;else{let v=y.vertices;for(let C=0;C<d;C++){let S=v[C];h[C]=S+(g[C]-S)*r}}break}case R.first:case R.replace:for(let y=0;y<d;y++)h[y]+=(g[y]-h[y])*r;break;case R.add:let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=(g[v]-y[v])*r}}return}let f=J.search1(u,s),p=this.getCurvePercent(s,f),b=c[f],w=c[f+1];if(r==1)if(l==R.add){let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<d;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case R.setup:{let x=a;if(x.bones)for(let y=0;y<d;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*r}else{let y=x.vertices;for(let v=0;v<d;v++){let C=b[v],S=y[v];h[v]=S+(C+(w[v]-C)*p-S)*r}}break}case R.first:case R.replace:for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*r}break;case R.add:let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*r}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*r}}}}},nt=class rr extends J{static propertyIds=[""+O.event];events;constructor(e){super(e,rr.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,l,o,n){if(!r)return;let a=this.frames,h=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,l,o,n),s=-1;else if(s>=a[h-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=J.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<h&&i>=a[c];c++)r.push(this.events[c])}},_e=class ir extends J{static propertyIds=[""+O.drawOrder];drawOrders;constructor(e){super(e,ir.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,l,o,n){if(n==re.mixOut){o==R.setup&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(o==R.setup||o==R.first)&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=J.search1(this.frames,i),h=this.drawOrders[a];if(!h)E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let u=0,m=h.length;u<m;u++)c[u]=d[h[u]]}}},Vt=class extends ge{constraintIndex=0;constructor(t,e,s){super(t,e,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,l,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,i,r,l,o){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup: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 R.first:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,d=J.search(a,s,6),u=this.curves[d/6];switch(u){case 0:let m=a[d];h=a[d+1],c=a[d+2];let f=(s-m)/(a[d+6]-m);h+=(a[d+6+1]-h)*f,c+=(a[d+6+2]-c)*f;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}l==R.setup?(n.mix=n.data.mix+(h-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==re.mixOut?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(h-n.mix)*r,n.softness+=(c-n.softness)*r,o==re.mixIn&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},Nt=class extends ge{constraintIndex=0;constructor(t,e,s){super(t,e,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=l,a[t+5]=o,a[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case R.setup: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 R.first:n.mixRotate+=(w.mixRotate-n.mixRotate)*r,n.mixX+=(w.mixX-n.mixX)*r,n.mixY+=(w.mixY-n.mixY)*r,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(w.mixShearY-n.mixShearY)*r}return}let h,c,d,u,m,f,p=J.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],d=a[p+3],u=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,d+=(a[p+7+3]-d)*g,u+=(a[p+7+4]-u)*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],d=a[p+3],u=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),d=this.getBezierValue(s,p,3,b+18*2-2),u=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==R.setup){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*r,n.mixX=w.mixX+(c-w.mixX)*r,n.mixY=w.mixY+(d-w.mixY)*r,n.mixScaleX=w.mixScaleX+(u-w.mixScaleX)*r,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*r,n.mixShearY=w.mixShearY+(f-w.mixShearY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(u-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(f-n.mixShearY)*r}},Ot=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,l,n.position,n.data.position))}},_t=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,l,n.spacing,n.data.spacing))}},Ut=class extends ge{constraintIndex=0;constructor(t,e,s){super(t,e,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let l=this.frames;t<<=2,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case R.setup:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case R.first:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let h,c,d,u=J.search(a,s,4),m=this.curves[u>>2];switch(m){case 0:let f=a[u];h=a[u+1],c=a[u+2],d=a[u+3];let p=(s-f)/(a[u+4]-f);h+=(a[u+4+1]-h)*p,c+=(a[u+4+2]-c)*p,d+=(a[u+4+3]-d)*p;break;case 1:h=a[u+1],c=a[u+2],d=a[u+3];break;default:h=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(l==R.setup){let f=n.data;n.mixRotate=f.mixRotate+(h-f.mixRotate)*r,n.mixX=f.mixX+(c-f.mixX)*r,n.mixY=f.mixY+(d-f.mixY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Pe=class extends ue{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of t.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,r,l,this.get(h),this.setup(h),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,l,this.get(n),this.setup(n)))}},qt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Wt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},zt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},Gt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},$t=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},Ht=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},jt=class extends Pe{constructor(t,e,s){super(t,e,s,O.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},Jt=class nr extends J{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,nr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,l,o,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(i<h[0])&&(s<h[0]||i>=h[J.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},Kt=class Be extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[O.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Be.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,l){let o=this.frames;e*=Be.ENTRIES,o[e]=s,o[e+Be.MODE]=i|r<<4,o[e+Be.DELAY]=l}apply(e,s,i,r,l,o,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof ve)||h.timelineAttachment!=c))return;if(n==re.mixOut){o==R.setup&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==R.setup||o==R.first)&&(a.sequenceIndex=-1);return}let u=J.search(d,i,Be.ENTRIES),m=d[u],f=d[u+Be.MODE],p=d[u+Be.DELAY];if(!this.attachment.sequence)return;let b=f>>4,w=this.attachment.sequence.regions.length,g=Ms[f&15];if(g!=se.hold)switch(b+=(i-m)/p+1e-5|0,g){case se.once:b=Math.min(w-1,b);break;case se.loop:b%=w;break;case se.pingpong:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case se.onceReverse:b=Math.max(w-1-b,0);break;case se.loopReverse:b=w-1-b%w;break;case se.pingpongReverse:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Qt=class pt{static _emptyAnimation=new rt("<empty>",[],0);static emptyAnimation(){return pt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ps(this);propertyIDs=new yt;animationsChanged=!1;trackEntryPool=new Oe(()=>new Ys);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=e*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+e)*n.timeScale,l.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[i]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,e)){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(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let u=0,m=i.length;u<m;u++){let f=i[u];if(!f||f.delay>0)continue;r=!0;let p=u==0?R.first:f.mixBlend,b=f.alpha;f.mixingFrom?b*=this.applyMixingFrom(f,e,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(u==0&&b==1||p==R.add){u==0&&(w=!0);for(let k=0;k<S;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof Ee?this.applyAttachmentTimeline(l,e,y,p,w):l.apply(e,g,y,v,b,p,re.mixIn)}}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 F=C[M],B=k[M]==at?p:R.setup;!T&&F instanceof Ke?this.applyRotateTimeline(F,e,y,b,B,f.timelinesRotation,M<<1,Y):F instanceof Ee?this.applyAttachmentTimeline(F,e,y,p,w):(E.webkit602BugfixHelper(b,p),F.apply(e,g,y,v,b,B,re.mixIn))}}this.queueEvents(f,x),s.length=0,f.nextAnimationLast=x,f.nextTrackLast=f.trackTime}for(var o=this.unkeyedState+ts,n=e.slots,a=0,h=e.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let l=0;e.mixDuration==0?(l=1,i==R.first&&(i=R.setup)):(l=e.mixTime/e.mixDuration,l>1&&(l=1),i!=R.first&&(i=r.mixBlend));let o=l<r.mixAttachmentThreshold,n=l<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-l),u=r.animationLast,m=r.getAnimationTime(),f=m,p=null;if(r.reverse?f=r.animation.duration-f:l<r.eventThreshold&&(p=this.events),i==R.add)for(let b=0;b<h;b++)a[b].apply(s,u,f,p,d,i,re.mixOut);else{let b=r.timelineMode,w=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=re.mixOut,S,k=0;switch(b[y]){case at:if(!n&&v instanceof _e)continue;S=i,k=d;break;case Zt:S=R.setup,k=d;break;case es:S=i,k=c;break;case ot:S=R.setup,k=c;break;default:S=R.setup;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=k,!g&&v instanceof Ke?this.applyRotateTimeline(v,s,f,k,S,r.timelinesRotation,y<<1,x):v instanceof Ee?this.applyAttachmentTimeline(v,s,f,S,o&&k>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,i),n&&v instanceof _e&&S==R.setup&&(C=re.mixIn),v.apply(s,u,f,p,k,S,C))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,l}applyAttachmentTimeline(e,s,i,r,l){var o=s.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(r==R.setup||r==R.first)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,e.attachmentNames[J.search1(e.frames,i)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+ts))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Fs)}applyRotateTimeline(e,s,i,r,l,o,n,a){if(a&&(o[n]=0),r==1){e.apply(s,0,i,null,1,l,re.mixIn);return}let h=s.bones[e.boneIndex];if(!h.active)return;let c=e.frames,d=0,u=0;if(i<c[0])switch(l){case R.setup:h.rotation=h.data.rotation;default:return;case R.first:d=h.rotation,u=h.data.rotation}else d=l==R.setup?h.data.rotation:h.rotation,u=h.data.rotation+e.getCurveValue(i);let m=0,f=u-d;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&&X.signum(b)!=X.signum(f)&&(Math.abs(p-w)>180?(m+=360*X.signum(p),x=g):w!=0?m-=360*X.signum(p):x=g),x!=g&&(m+=360*X.signum(p)),o[n]=m}o[n+1]=f,h.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,l=r-i,o=e.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let d=n[a];if(d.time<o)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(l==0)c=!0;else{const d=Math.floor(e.trackTime/l);c=d>0&&d>Math.floor(e.trackLast/l)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<h;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,l=this.expandToIndex(e);l&&(l.nextTrackLast==-1?(this.tracks[e]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,r=!1):this.clearNext(l));let o=this.trackEntry(e,s,i,l);return this.setCurrent(e,o,r),this.queue.drain(),o}addAnimation(e,s,i=!1,r=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,l,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(e);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(e,s,i,l);return l?(l.next=o,o.previous=l,r<=0&&(r=Math.max(r+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,pt.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,pt.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let l=this.tracks[i];l&&this.setEmptyAnimation(l.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(E.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=e,l.animation=s,l.loop=i,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=r?this.data.getMix(r.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=R.replace,l}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=R.add)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,l=e.timelineMode;l.length=r;let o=e.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)l[a]=n.addAll(i[a].getPropertyIds())?ot:es;return}e:for(let a=0;a<r;a++){let h=i[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=at;else if(!s||h instanceof Ee||h instanceof _e||h instanceof nt||!s.animation.hasTimeline(c))l[a]=Zt;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){l[a]=Rs,o[a]=d;continue e}break}l[a]=ot}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ys=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(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=R.replace;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 t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Ps=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(le.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(le.interrupt),this.objects.push(t)}end(t){this.objects.push(le.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(le.dispose),this.objects.push(t)}complete(t){this.objects.push(le.complete),this.objects.push(t)}event(t,e){this.objects.push(le.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],r=t[s+1];switch(i){case le.start:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<e.length;o++){let n=e[o];n.start&&n.start(r)}break;case le.interrupt:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<e.length;o++){let n=e[o];n.interrupt&&n.interrupt(r)}break;case le.end:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<e.length;o++){let n=e[o];n.end&&n.end(r)}case le.dispose:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<e.length;o++){let n=e[o];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case le.complete:r.listener&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<e.length;o++){let n=e[o];n.complete&&n.complete(r)}break;case le.event:let l=t[s+++2];r.listener&&r.listener.event&&r.listener.event(r,l);for(let o=0;o<e.length;o++){let n=e[o];n.event&&n.event(r,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},le;(function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"})(le||(le={}));var Sr=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},at=0,Zt=1,es=2,ot=3,Rs=4,ts=1,Fs=2,Bs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},ss=class ar extends ve{color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new ar(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Le=class or extends ve{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new or(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},rs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},te;(function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"})(te||(te={}));var Ce;(function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"})(Ce||(Ce={}));var 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},Ar=class extends rs{setFilters(t,e){}setWraps(t,e){}dispose(){}},lt=class{pages=new Array;regions=new Array;constructor(t){let e=new kr(t),s=new Array(4),i={};i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.format=()=>{},i.filter=h=>{h.minFilter=E.enumValue(te,s[1]),h.magFilter=E.enumValue(te,s[2])},i.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=Ce.Repeat),s[1].indexOf("y")!=-1&&(h.vWrap=Ce.Repeat)},i.pma=h=>{h.pma=s[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},r.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},r.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},r.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},r.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},r.index=h=>{h.index=parseInt(s[1])};let l=e.readLine();for(;l&&l.trim().length==0;)l=e.readLine();for(;!(!l||l.trim().length==0||e.readEntry(s,l)==0);)l=e.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=e.readLine();else if(o){let h=new is(o,l);for(;;){let c=e.readEntry(s,l=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let u=[];for(let m=0;m<c;m++)u.push(parseInt(s[m+1]));a.push(u)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Es(l.trim());e.readEntry(s,l=e.readLine())!=0;){let h=i[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},kr=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let l=e.indexOf(",",r);if(l==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,l-r).trim(),r=l+1,i==4)return 4}}},Es=class{name;minFilter=te.Nearest;magFilter=te.Nearest;uWrap=Ce.ClampToEdge;vWrap=Ce.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},is=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(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},pe=class ys extends ve{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=E.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof is){let a=this.region,h=a.page,c=h.width,d=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+e[u+1]*o,s[u+1]=l+(1-e[u])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u])*o,s[u+1]=l+(1-e[u+1])*n;return;case 270:r-=a.offsetY/c,l-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u+1])*o,s[u+1]=l+e[u]*n;return}r-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-r,n=this.region.v2-l):(r=l=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*o,s[a+1]=l+e[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ys(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,l,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,l,o)}newLinkedMesh(){let e=new ys(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ue=class lr extends ve{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new lr(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ls=class hr extends ve{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*X.degRad,i=Math.cos(s),r=Math.sin(s),l=i*e.a+r*e.b,o=i*e.c+r*e.d;return X.atan2Deg(o,l)}copy(){let e=new hr(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},W=class cr extends vt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=l+this.region.width*i,a=o+this.region.height*r,h=this.rotation*X.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=l*c+u,p=l*d,b=o*c+m,w=o*d,g=n*c+u,x=n*d,y=a*c+m,v=a*d,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,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let l=e.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,d=l.c,u=l.d,m=0,f=0;m=o[0],f=o[1],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[2],f=o[3],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[4],f=o[5],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[6],f=o[7],s[i]=m*h+f*c+n,s[i+1]=m*d+f*u+a}copy(){let e=new cr(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,E.arrayCopy(this.uvs,0,e.uvs,0,8),E.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Ds=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,l=i.length;r<l;r++){let o=s.getPath(e,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new W(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=l}return r}newMeshAttachment(t,e,s,i){let r=new pe(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=l}return r}newBoundingBoxAttachment(t,e){return new ss(e)}newPathAttachment(t,e){return new Ue(e)}newPointAttachment(t,e){return new Ls(e)}newClippingAttachment(t,e){return new Le(e)}},ns=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=K.Normal;skinRequired=!1;color=new N;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},K;(function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"})(K||(K={}));var as=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=K.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){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(t,e,s,i,r,l,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,p=(s+l)*X.degRad,b=(s+90+o)*X.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*f,this.d=Math.sin(b)*r*f,this.worldX=t*m+u.x,this.worldY=e*f+u.y;return}let a=n.a,h=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+h*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case K.Normal:{const u=(s+l)*X.degRad,m=(s+90+o)*X.degRad,f=Math.cos(u)*i,p=Math.cos(m)*r,b=Math.sin(u)*i,w=Math.sin(m)*r;this.a=a*f+h*b,this.b=a*p+h*w,this.c=c*f+d*b,this.d=c*p+d*w;return}case K.OnlyTranslation:{const u=(s+l)*X.degRad,m=(s+90+o)*X.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(m)*r,this.c=Math.sin(u)*i,this.d=Math.sin(m)*r;break}case K.NoRotationOrReflection:{let u=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=u,c*=m;let f=a*a+c*c,p=0;f>1e-4?(f=Math.abs(a*d*m-h*u*c)/f,h=c*f,d=a*f,p=Math.atan2(c,a)*X.radDeg):(a=0,c=0,p=90-Math.atan2(d,h)*X.radDeg);const b=(s+l-p)*X.degRad,w=(s+o-p+90)*X.degRad,g=Math.cos(b)*i,x=Math.cos(w)*r,y=Math.sin(b)*i,v=Math.sin(w)*r;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+d*y,this.d=c*x+d*v;break}case K.NoScale:case K.NoScaleOrReflection:{s*=X.degRad;const u=Math.cos(s),m=Math.sin(s);let f=(a*u+h*m)/this.skeleton.scaleX,p=(c*u+d*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==K.NoScale&&a*d-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*=X.degRad,o=(90+o)*X.degRad;const x=Math.cos(l)*i,y=Math.cos(o)*r,v=Math.sin(l)*i,C=Math.sin(o)*r;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 t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*X.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*X.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*o-d*n,this.ay=d*h-c*a;let u,m,f,p;if(this.inherit==K.OnlyTranslation)u=this.a,m=this.b,f=this.c,p=this.d;else{switch(this.inherit){case K.NoRotationOrReflection:{let y=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=e*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(e*r-s*i),o=r*l,n=s*l;break}case K.NoScale:case K.NoScaleOrReflection:let b=X.cosDeg(this.rotation),w=X.sinDeg(this.rotation);e=(e*b+s*w)/this.skeleton.scaleX,i=(i*b+r*w)/this.skeleton.scaleY;let g=Math.sqrt(e*e+i*i);g>1e-5&&(g=1/g),e*=g,i*=g,g=Math.sqrt(e*e+i*i),this.inherit==K.NoScale&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=X.PI/2+Math.atan2(i,e);s=Math.cos(x)*g,r=Math.sin(x)*g,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l}u=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(u*u+f*f),this.ascaleX>1e-4){let b=u*p-m*f;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(u*m+f*p,b)*X.radDeg,this.arotation=Math.atan2(f,u)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=X.sinDeg(t),s=X.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=X.sinDeg(t),s=X.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*X.radDeg}rotateWorld(t){t*=X.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},Qe=class{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Tr=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ns,i=new Vs){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load binary ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load JSON ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(e,t,l),l)).catch(l=>this.error(s,t,l))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(t,n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(t,n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),l=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,n)=>{this.downloader.downloadText(t,a=>{try{const h=this.createTextureAtlas(t,a);let c=h.pages.length,d=!1;for(let u of h.pages)this.loadTexture(i?i[u.name]:l+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(e,t,h),o(h)))},(m,f)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),n(p)}d=!0})}catch(h){const c=`Couldn't parse texture atlas ${t}: ${h.message}`;this.error(s,t,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${h}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,o=>{try{const n=this.createTextureAtlas(t,o);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${t}: status ${o}, ${n}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
+
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.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(t){const e=this.cache.assets[t];if(e instanceof lt){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new lt(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},Vs=class xt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=xt.AVAILABLE_CACHES.get(e);if(s)return s;const i=new xt;return xt.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},Ns=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let l=()=>{this.finish(t,r.status,r.responseText)};r.onload=l,r.onerror=l,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let l=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):l()},r.onerror=l,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let l=r.length-1,o=i.length;l<o;l+=2)i[l].apply(null,r)}},os=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},ls=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Os=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,l,o){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,d=n.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case K.OnlyTranslation:m=(e-t.worldX)*X.signum(t.skeleton.scaleX),f=(s-t.worldY)*X.signum(t.skeleton.scaleY);break;case K.NoRotationOrReflection:let w=Math.abs(a*d-h*c)/Math.max(1e-4,a*a+c*c),g=a/t.skeleton.scaleX,x=c/t.skeleton.scaleY;h=-x*w*t.skeleton.scaleX,d=g*w*t.skeleton.scaleY,u+=Math.atan2(x,g)*X.radDeg;default:let y=e-n.worldX,v=s-n.worldY,C=a*d-h*c;Math.abs(C)<=1e-4?(m=0,f=0):(m=(y*d-v*h)/C-t.ax,f=(v*a-y*c)/C-t.ay)}u+=Math.atan2(f,m)*X.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,b=t.ascaleY;if(i||r){switch(t.inherit){case K.NoScale:case K.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const w=t.data.length*p;if(w>1e-4){const g=m*m+f*f;if(i&&g<w*w||r&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*o,p,b,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,l,o,n,a){if(t.inherit!=K.Normal||e.inherit!=K.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,b=0,w=0,g=0;d<0?(d=-d,b=180,g=-1):(b=0,g=1),u<0&&(u=-u,g=-g),p<0?(p=-p,w=180):w=0;let x=e.ax,y=0,v=0,C=0,S=t.a,k=t.b,T=t.c,Y=t.d,M=Math.abs(d-u)<=1e-4;!M||l?(y=0,v=S*x+t.worldX,C=T*x+t.worldY):(y=e.ay,v=S*x+k*y+t.worldX,C=T*x+Y*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,k=F.b,T=F.c,Y=F.d;let B=S*Y-k*T,I=v-F.worldX,P=C-F.worldY;B=Math.abs(B)<=1e-4?0:1/B;let L=(I*Y-P*k)*B-h,_=(P*S-I*T)*B-c,V=Math.sqrt(L*L+_*_),U=e.data.length*p,j,$;if(V<1e-4){this.apply1(t,s,i,!1,l,!1,a),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}I=s-F.worldX,P=i-F.worldY;let Q=(I*Y-P*k)*B-h,D=(P*S-I*T)*B-c,q=Q*Q+D*D;if(n!=0){n*=d*(p+1)*.5;let Z=Math.sqrt(q),ae=Z-V-U*d+n;if(ae>0){let oe=Math.min(1,ae/(n*2))-1;oe=(ae-n*(1-oe*oe))/Z,Q-=oe*Q,D-=oe*D,q=Q*Q+D*D}}e:if(M){U*=d;let Z=(q-V*V-U*U)/(2*V*U);Z<-1?(Z=-1,$=Math.PI*r):Z>1?(Z=1,$=0,l&&(S=(Math.sqrt(q)/(V+U)-1)*a+1,m*=S,o&&(f*=S))):$=Math.acos(Z)*r,S=V+U*Z,k=U*Math.sin($),j=Math.atan2(D*S-Q*k,Q*S+D*k)}else{S=d*U,k=u*U;let Z=S*S,ae=k*k,oe=Math.atan2(D,Q);T=ae*V*V+Z*q-Z*ae;let we=-2*ae*V,$e=ae-Z;if(Y=we*we-4*$e*T,Y>=0){let He=Math.sqrt(Y);we<0&&(He=-He),He=-(we+He)*.5;let st=He/$e,tr=T/He,mt=Math.abs(st)<Math.abs(tr)?st:tr;if(st=q-mt*mt,st>=0){P=Math.sqrt(st)*r,j=oe-Math.atan2(P,mt),$=Math.atan2(P/u,(mt-V)/d);break e}}let tt=X.PI,ut=V-S,bs=ut*ut,Qs=0,Zs=0,ft=V+S,ws=ft*ft,er=0;T=-S*V/(Z-ae),T>=-1&&T<=1&&(T=Math.acos(T),I=S*Math.cos(T)+V,P=k*Math.sin(T),Y=I*I+P*P,Y<bs&&(tt=T,bs=Y,ut=I,Qs=P),Y>ws&&(Zs=T,ws=Y,ft=I,er=P)),q<=(bs+ws)*.5?(j=oe-Math.atan2(Qs*r,ut),$=tt*r):(j=oe-Math.atan2(er*r,ft),$=Zs*r)}let H=Math.atan2(y,x)*g,ce=t.arotation;j=(j-H)*X.radDeg+b-ce,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(h,c,ce+j*a,m,f,0,0),ce=e.arotation,$=(($+H)*X.radDeg-e.ashearX)*g+w-ce,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(x,y,ce+$*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},hs=class extends Qe{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},cs=class extends Qe{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=xe.Fixed;spacingMode=ee.Fixed;rotateMode=Re.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},xe;(function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"})(xe||(xe={}));var ee;(function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"})(ee||(ee={}));var Re;(function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"})(Re||(Re={}));var _s=class Xe{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(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,l=e.bones.length;r<l;r++){let o=s.findBone(e.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ue))return;let i=this.mixRotate,r=this.mixX,l=this.mixY;if(i==0&&r==0&&l==0)return;let o=this.data,n=o.rotateMode==Re.Tangent,a=o.rotateMode==Re.ChainScale,h=this.bones,c=h.length,d=n?c:c+1,u=E.setArraySize(this.spaces,d),m=a?this.lengths=E.setArraySize(this.lengths,c):[],f=this.spacing;switch(o.spacingMode){case ee.Percent:if(a)for(let C=0,S=d-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(u,1,d,f);break;case ee.Proportional:let y=0;for(let C=0,S=d-1;C<S;){let k=h[C],T=k.data.length;if(T<Xe.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),u[++C]=F,y+=F}}if(y>0){y=d/y*f;for(let C=1;C<d;C++)u[C]*=y}break;default:let v=o.spacingMode==ee.Length;for(let C=0,S=d-1;C<S;){let k=h[C],T=k.data.length;if(T<Xe.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=T*k.a,M=T*k.c,F=Math.sqrt(Y*Y+M*M);a&&(m[C]=F),u[++C]=(v?T+f:f)*F/T}}}let p=this.computeWorldPositions(s,d,n),b=p[0],w=p[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==Re.Chain;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?X.degRad:-X.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*r,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 F=(Math.sqrt(T*T+Y*Y)/M-1)*i+1;C.a*=F,C.c*=F}}if(b=S,w=k,i>0){let M=C.a,F=C.b,B=C.c,I=C.d,P=0,L=0,_=0;if(n?P=p[v-1]:u[y+1]==0?P=p[v+2]:P=Math.atan2(Y,T),P-=Math.atan2(B,M),x){L=Math.cos(P),_=Math.sin(P);let V=C.data.length;b+=(V*(L*M-_*B)-T)*i,w+=(V*(_*M+L*B)-Y)*i}else P+=g;P>X.PI?P-=X.PI2:P<-X.PI&&(P+=X.PI2),P*=i,L=Math.cos(P),_=Math.sin(P),C.a=L*M-_*B,C.b=L*F-_*I,C.c=_*M+L*B,C.d=_*F+L*I}C.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=e.closed,c=e.worldVerticesLength,d=c/6,u=Xe.NONE;if(!e.constantSpeed){let V=e.lengths;d-=h?1:2;let U=V[d];this.data.positionMode==xe.Percent&&(l*=U);let j;switch(this.data.spacingMode){case ee.Percent:j=U;break;case ee.Proportional:j=U/s;break;default:j=1}a=E.setArraySize(this.world,8);for(let $=0,Q=0,D=0;$<s;$++,Q+=3){let q=o[$]*j;l+=q;let H=l;if(h)H%=U,H<0&&(H+=U),D=0;else if(H<0){u!=Xe.BEFORE&&(u=Xe.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(H,a,0,n,Q);continue}else if(H>U){u!=Xe.AFTER&&(u=Xe.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(H-U,a,0,n,Q);continue}for(;;D++){let ce=V[D];if(!(H>ce)){if(D==0)H/=ce;else{let Z=V[D-1];H=(H-Z)/(ce-Z)}break}}D!=u&&(u=D,h&&D==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,D*6+2,8,a,0,2)),this.addCurvePosition(H,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,Q,i||$>0&&q==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=E.setArraySize(this.curves,d),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,F=0,B=0,I=0;for(let V=0,U=2;V<d;V++,U+=6)w=a[U],g=a[U+1],x=a[U+2],y=a[U+3],v=a[U+4],C=a[U+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,F=k*2+Y,B=(w-p)*.75+S+T*.16666667,I=(g-b)*.75+k+Y*.16666667,f+=Math.sqrt(B*B+I*I),B+=M,I+=F,M+=T,F+=Y,f+=Math.sqrt(B*B+I*I),B+=M,I+=F,f+=Math.sqrt(B*B+I*I),B+=M+T,I+=F+Y,f+=Math.sqrt(B*B+I*I),m[V]=f,p=v,b=C;this.data.positionMode==xe.Percent&&(l*=f);let P;switch(this.data.spacingMode){case ee.Percent:P=f;break;case ee.Proportional:P=f/s;break;default:P=1}let L=this.segments,_=0;for(let V=0,U=0,j=0,$=0;V<s;V++,U+=3){let Q=o[V]*P;l+=Q;let D=l;if(h)D%=f,D<0&&(D+=f),j=0;else if(D<0){this.addBeforePosition(D,a,0,n,U);continue}else if(D>f){this.addAfterPosition(D-f,a,c-4,n,U);continue}for(;;j++){let q=m[j];if(!(D>q)){if(j==0)D/=q;else{let H=m[j-1];D=(D-H)/(q-H)}break}}if(j!=u){u=j;let q=j*6;for(p=a[q],b=a[q+1],w=a[q+2],g=a[q+3],x=a[q+4],y=a[q+5],v=a[q+6],C=a[q+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,F=k*2+Y,B=(w-p)*.3+S+T*.16666667,I=(g-b)*.3+k+Y*.16666667,_=Math.sqrt(B*B+I*I),L[0]=_,q=1;q<8;q++)B+=M,I+=F,M+=T,F+=Y,_+=Math.sqrt(B*B+I*I),L[q]=_;B+=M,I+=F,_+=Math.sqrt(B*B+I*I),L[8]=_,B+=M+T,I+=F+Y,_+=Math.sqrt(B*B+I*I),L[9]=_,$=0}for(D*=_;;$++){let q=L[$];if(!(D>q)){if($==0)D/=q;else{let H=L[$-1];D=$+(D-H)/(q-H)}break}}this.addCurvePosition(D*.1,p,b,w,g,x,y,v,C,n,U,i||V>0&&Q==0)}return n}addBeforePosition(e,s,i,r,l){let o=s[i],n=s[i+1],a=s[i+2]-o,h=s[i+3]-n,c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addAfterPosition(e,s,i,r,l){let o=s[i+2],n=s[i+3],a=o-s[i],h=n-s[i+1],c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addCurvePosition(e,s,i,r,l,o,n,a,h,c,d,u){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(l-i,r-s);return}let m=e*e,f=m*e,p=1-e,b=p*p,w=b*p,g=p*e,x=g*3,y=p*x,v=x*e,C=s*w+r*y+o*v+a*f,S=i*w+l*y+n*v+h*f;c[d]=C,c[d+1]=S,u&&(e<.001?c[d+2]=Math.atan2(l-i,r-s):c[d+2]=Math.atan2(S-(i*b+l*g*2+n*m),C-(s*b+r*g*2+o*m)))}},Ir=class{data;_bone=null;set bone(t){this._bone=t}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(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.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 t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(t){case fe.none:return;case fe.reset:this.reset();case fe.update:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(i){const x=(this.uy-d)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=d}if(u>=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),i&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*f,this.yVelocity*=b),u-=f;while(u>=f)}s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r||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),r){C=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(k+this.ty,S+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*X.invPI2-.5)*X.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(u=this.remaining,u>=f){b==-1&&(b=Math.pow(this.damping,60*f));const T=this.massInverse*f,Y=this.strength,M=this.wind,F=qe.yDown?-this.gravity:this.gravity,B=n/p;for(;;)if(u-=f,l&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+F*y)*B+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=b,u<f)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(u<f)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case fe.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,h=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=a*this.data.rotate,h=Math.sin(u),c=Math.cos(u),d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d),u+=a*this.data.shearX,h=Math.sin(u),c=Math.cos(u),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c,d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d}if(l){const a=1+this.scaleOffset*e*this.data.scaleX;o.a*=a,o.c*=a}t!=fe.pose&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*X.degRad,r=Math.cos(i),l=Math.sin(i),o=this.cx-t,n=this.cy-e;this.translate(o*r-n*l-o,o*l+n*r-n)}},Us=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new N,this.darkColor=t.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof ve)||!(this.attachment instanceof ve)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,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}},qs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Je;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){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 t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,u=a*d-h*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=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>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=t;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)*e,g.worldY+=(x.y-g.worldY)*s}if(i!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.c*=x}if(r!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+d*d)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(d,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.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 t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,u=a*d-h*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=0){let x=g.a,y=g.b,v=g.c,C=g.d,S=Math.atan2(c,a)+m;S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=t;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*e,g.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(d,h)-Math.atan2(c,a);x>X.PI?x-=X.PI2:x<-X.PI&&(x+=X.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-X.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 t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*t);let u=c.ax,m=c.ay;u+=(o.ax-u+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let f=c.ascaleX,p=c.ascaleY;i!=0&&f!=0&&(f=(f+(o.ascaleX-f+this.data.offsetScaleX)*i)/f),r!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(u,m,d,f,p,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation+(o.arotation+this.data.offsetRotation)*t,u=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,f=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(u,m,d,f,p,c.ashearX,b)}}},qe=class vs{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 vs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new as(i,this,null);else{let l=this.bones[i.parent.index];r=new as(i,this,l),l.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],l=new Us(i,r);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new Os(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new qs(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new _s(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new Ir(i,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let u=0,m=s.length;u<m;u++){let f=s[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let p=this.bones[u[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,r=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,h=l.length,c=this.physicsConstraints.length,d=n+a+h+c;e:for(let u=0;u<d;u++){for(let m=0;m<n;m++){let f=i[m];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let m=0;m<a;m++){let f=r[m];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let m=0;m<h;m++){let f=l[m];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let m=0;m<c;m++){const f=o[m];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,m=s.length;u<m;u++)this.sortBone(s[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let l=i[i.length-1];this.sortBone(l),this._updateCache.push(e),this.sortReset(r.children),l.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let l=s.getAttachment();l instanceof Ue&&this.sortPathConstraintAttachmentWith(l,r);let o=e.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let l=s[r];this.sortBone(l.parent),this.sortBone(l)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let l in r)this.sortPathConstraintAttachmentWith(r[l],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ue))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let l=0,o=i.length;l<o;){let n=i[l++];for(n+=l;l<n;)this.sortBone(r[i[l++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,l=s.length;r<l;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,l=i.length;r<l;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,w=i.length;b<w;b++){let g=i[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;r.worldX=l*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const h=(r.rotation+r.shearX)*X.degRad,c=(r.rotation+90+r.shearY)*X.degRad,d=Math.cos(h)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(l*d+o*m)*this.scaleX,r.b=(l*u+o*f)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*u+a*f)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=r&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;E.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i],o=l.data.attachmentName;if(o){let n=e.getAttachment(i,o);n&&l.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,l=i.length;r<l;r++){let o=i[r];if(o.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Je,i=new Je;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)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,d=l.length;c<d;c++){let u=l[c];if(!u.bone.active)continue;let m=0,f=null,p=null,b=u.getAttachment();if(b instanceof W)m=8,f=E.setArraySize(i,m,0),b.computeWorldVertices(u,f,0,2),p=vs.quadTriangles;else if(b instanceof pe){let w=b;m=w.worldVerticesLength,f=E.setArraySize(i,m,0),w.computeWorldVertices(u,0,m,f,0,2),p=w.triangles}else if(b instanceof Le&&r!=null){r.clipStart(u,b);continue}if(f&&p){r!=null&&r.isClipping()&&(r.clipTriangles(f,p,p.length),f=r.clippedVertices,m=r.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)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(o,n),s.set(a-o,h-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,l=i.length;r<l;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let l=0,o=r.length;l<o;l++)r[l].rotate(e,s,i)}},fe;(function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"})(fe||(fe={}));var Ws=class extends Qe{_bone=null;set bone(t){this._bone=t}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(t){super(t,0,!1)}},Ze=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(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},ds=class{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},et=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof pe?(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(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new ds(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new ds(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],l=r.getAttachment();if(l&&s<e.attachments.length){let o=e.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&r.setAttachment(h);break}}}s++}}},us=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Ie.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Ie;(function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"})(Ie||(Ie={}));var fs=class extends Qe{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},zs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ze;s.name="";let i=new Gs(t),r=i.readInt32(),l=i.readInt32();s.hash=l==0&&r==0?null:l.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=h==0?null:s.bones[i.readInt(!0)],u=new ns(h,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),o&&(N.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new us(h,c,d);N.rgba8888ToColor(u.color,i.readInt32());let m=i.readInt32();m!=-1&&N.rgb888ToColor(u.darkColor=new N,m),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),o&&(u.visible=i.readBoolean()),s.slots.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new hs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=(m&2)!=0?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,(m&32)!=0&&(u.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new fs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,(m&8)!=0&&(u.offsetRotation=i.readFloat()),(m&16)!=0&&(u.offsetX=i.readFloat()*e),(m&32)!=0&&(u.offsetY=i.readFloat()*e),(m&64)!=0&&(u.offsetScaleX=i.readFloat()),(m&128)!=0&&(u.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(u.offsetShearY=i.readFloat()),(m&2)!=0&&(u.mixRotate=i.readFloat()),(m&4)!=0&&(u.mixX=i.readFloat()),(m&8)!=0&&(u.mixY=i.readFloat()),(m&16)!=0&&(u.mixScaleX=i.readFloat()),(m&32)!=0&&(u.mixScaleY=i.readFloat()),(m&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new cs(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const m=i.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==xe.Fixed&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==ee.Length||u.spacingMode==ee.Fixed)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}n=i.readInt(!0);for(let h=0,c;h<n;h++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Ws(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,(m&2)!=0&&(u.x=i.readFloat()),(m&4)!=0&&(u.y=i.readFloat()),(m&8)!=0&&(u.rotate=i.readFloat()),(m&16)!=0&&(u.scaleX=i.readFloat()),(m&32)!=0&&(u.shearX=i.readFloat()),u.limit=((m&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(m&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(u.inertiaGlobal=!0),(m&2)!=0&&(u.strengthGlobal=!0),(m&4)!=0&&(u.dampingGlobal=!0),(m&8)!=0&&(u.massGlobal=!0),(m&16)!=0&&(u.windGlobal=!0),(m&32)!=0&&(u.gravityGlobal=!0),(m&64)!=0&&(u.mixGlobal=!0),u.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+i.readInt(!0));h<n;h++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new ls(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,l=0;if(s){if(l=t.readInt(!0),l==0)return null;r=new et("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");r=new et(o),i&&N.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);l=t.readInt(!0)}for(let o=0;o<l;o++){let n=t.readInt(!0);for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,l){let o=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case Me.Region:{let h=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let u=(n&128)!=0?t.readFloat():0,m=t.readFloat(),f=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,d);return x?(x.path=h,x.x=m*o,x.y=f*o,x.scaleX=p,x.scaleY=b,x.rotation=u,x.width=w*o,x.height=g*o,N.rgba8888ToColor(x.color,c),x.sequence=d,d==null&&x.updateRegion(),x):null}case Me.BoundingBox:{let h=this.readVertices(t,(n&16)!=0),c=l?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,l&&N.rgba8888ToColor(d.color,c),d):null}case Me.Mesh:{let h=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),f=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-u-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),g=t.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,d);return x?(x.path=h,N.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=f,d==null&&x.updateRegion(),x.hullLength=u<<1,x.sequence=d,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case Me.LinkedMesh:{const h=(n&16)!=0?t.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=(n&128)!=0,m=t.readInt(!0),f=t.readStringRef();let p=0,b=0;l&&(p=t.readFloat(),b=t.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,d);return w?(w.path=h,N.rgba8888ToColor(w.color,c),w.sequence=d,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Mr(w,m,i,f,u)),w):null}case Me.Path:{const h=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),u=E.newArray(d.length/6,0);for(let p=0,b=u.length;p<b;p++)u[p]=t.readFloat()*o;const m=l?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=h,f.constantSpeed=c,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,l&&N.rgba8888ToColor(f.color,m),f):null}case Me.Point:{const h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=l?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=d*o,m.rotation=h,l&&N.rgba8888ToColor(m.color,u),m):null}case Me.Clipping:{const h=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=l?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,a);return u?(u.endSlot=e.slots[h],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,l&&N.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new Is(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Yr;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let l=new Array,o=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(t.readInt(!0)),l.push(t.readFloat()*s),l.push(t.readFloat()*s),l.push(t.readFloat())}return r.vertices=E.toFloatArray(l),r.bones=o,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0),p=f-1;switch(m){case _r:{let b=new Ee(f,c);for(let w=0;w<f;w++)b.setFrame(w,t.readFloat(),t.readStringRef());i.push(b);break}case Ur:{let b=t.readInt(!0),w=new Ft(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let S=0,k=0;w.setFrame(S,g,x,y,v,C),S!=p;S++){let T=t.readFloat(),Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(S);break;case Ae:z(t,w,k++,S,0,g,T,x,Y,1),z(t,w,k++,S,1,g,T,y,M,1),z(t,w,k++,S,2,g,T,v,F,1),z(t,w,k++,S,3,g,T,C,B,1)}g=T,x=Y,y=M,v=F,C=B}i.push(w);break}case qr:{let b=t.readInt(!0),w=new Bt(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let C=0,S=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=t.readFloat(),T=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(C);break;case Ae:z(t,w,S++,C,0,g,k,x,T,1),z(t,w,S++,C,1,g,k,y,Y,1),z(t,w,S++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}i.push(w);break}case Wr:{let b=t.readInt(!0),w=new Et(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,S,k,T),Y!=p;Y++){let F=t.readFloat(),B=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(Y);break;case Ae:z(t,w,M++,Y,0,g,F,x,B,1),z(t,w,M++,Y,1,g,F,y,I,1),z(t,w,M++,Y,2,g,F,v,P,1),z(t,w,M++,Y,3,g,F,C,L,1),z(t,w,M++,Y,4,g,F,S,_,1),z(t,w,M++,Y,5,g,F,k,V,1),z(t,w,M++,Y,6,g,F,T,U,1)}g=F,x=B,y=I,v=P,C=L,S=_,k=V,T=U}i.push(w);break}case zr:{let b=t.readInt(!0),w=new Lt(f,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,S,k),T!=p;T++){let M=t.readFloat(),F=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255;switch(t.readByte()){case Se:w.setStepped(T);break;case Ae:z(t,w,Y++,T,0,g,M,x,F,1),z(t,w,Y++,T,1,g,M,y,B,1),z(t,w,Y++,T,2,g,M,v,I,1),z(t,w,Y++,T,3,g,M,C,P,1),z(t,w,Y++,T,4,g,M,S,L,1),z(t,w,Y++,T,5,g,M,k,_,1)}g=M,x=F,y=B,v=I,C=P,S=L,k=_}i.push(w);break}case Gr:{let b=new Xt(f,t.readInt(!0),c),w=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=t.readFloat(),C=t.readUnsignedByte()/255;switch(t.readByte()){case Se:b.setStepped(x);break;case Ae:z(t,b,y++,x,0,w,v,g,C,1)}w=v,g=C}i.push(b)}}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0);if(m==Or){let b=new Rt(f,c);for(let w=0;w<f;w++)b.setFrame(w,t.readFloat(),t.readByte());i.push(b);continue}let p=t.readInt(!0);switch(m){case Pr:i.push(ie(t,new Ke(f,p,c),1));break;case Rr:i.push(ms(t,new Ct(f,p,c),r));break;case Fr:i.push(ie(t,new St(f,p,c),r));break;case Br:i.push(ie(t,new At(f,p,c),r));break;case Xr:i.push(ms(t,new kt(f,p,c),1));break;case Er:i.push(ie(t,new Tt(f,p,c),1));break;case Lr:i.push(ie(t,new It(f,p,c),1));break;case Dr:i.push(ms(t,new Mt(f,p,c),1));break;case Vr:i.push(ie(t,new Yt(f,p,c),1));break;case Nr:i.push(ie(t,new Pt(f,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new Vt(d,t.readInt(!0),c),f=t.readByte(),p=t.readFloat(),b=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,w=(f&4)!=0?t.readFloat()*r: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!=u;g++){f=t.readByte();const y=t.readFloat(),v=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,C=(f&4)!=0?t.readFloat()*r:0;(f&64)!=0?m.setStepped(g):(f&128)!=0&&(z(t,m,x++,g,0,p,y,b,v,1),z(t,m,x++,g,1,p,y,w,C,r)),p=y,b=v,w=C}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new Nt(d,t.readInt(!0),c),f=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,C=0;m.setFrame(v,f,p,b,w,g,x,y),v!=u;v++){let S=t.readFloat(),k=t.readFloat(),T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),F=t.readFloat(),B=t.readFloat();switch(t.readByte()){case Se:m.setStepped(v);break;case Ae:z(t,m,C++,v,0,f,S,p,k,1),z(t,m,C++,v,1,f,S,b,T,1),z(t,m,C++,v,2,f,S,w,Y,1),z(t,m,C++,v,3,f,S,g,M,1),z(t,m,C++,v,4,f,S,x,F,1),z(t,m,C++,v,5,f,S,y,B,1)}f=S,p=k,b=T,w=Y,g=M,x=F,y=B}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,m=t.readInt(!0);u<m;u++){const f=t.readByte(),p=t.readInt(!0),b=t.readInt(!0);switch(f){case jr:i.push(ie(t,new Ot(p,b,c),d.positionMode==xe.Fixed?r:1));break;case Jr:i.push(ie(t,new _t(p,b,c),d.spacingMode==ee.Length||d.spacingMode==ee.Fixed?r:1));break;case Kr:let w=new Ut(p,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let C=0,S=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),F=t.readFloat();switch(t.readByte()){case Se:w.setStepped(C);break;case Ae:z(t,w,S++,C,0,g,T,x,Y,1),z(t,w,S++,C,1,g,T,y,M,1),z(t,w,S++,C,2,g,T,v,F,1)}g=T,x=Y,y=M,v=F}i.push(w)}}}for(let a=0,h=t.readInt(!0);a<h;a++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const m=t.readByte(),f=t.readInt(!0);if(m==ni){const b=new Jt(f,c);for(let w=0;w<f;w++)b.setFrame(w,t.readFloat());i.push(b);continue}const p=t.readInt(!0);switch(m){case Qr:i.push(ie(t,new qt(f,p,c),1));break;case Zr:i.push(ie(t,new Wt(f,p,c),1));break;case ei:i.push(ie(t,new zt(f,p,c),1));break;case ti:i.push(ie(t,new Gt(f,p,c),1));break;case si:i.push(ie(t,new $t(f,p,c),1));break;case ri:i.push(ie(t,new Ht(f,p,c),1));break;case ii:i.push(ie(t,new jt(f,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readInt(!0);for(let f=0,p=t.readInt(!0);f<p;f++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case $r:{let v=w,C=v.bones,S=v.vertices,k=C?S.length/3*2:S.length,T=t.readInt(!0),Y=new Dt(x,T,m,v),M=t.readFloat();for(let F=0,B=0;;F++){let I,P=t.readInt(!0);if(P==0)I=C?E.newFloatArray(k):S;else{I=E.newFloatArray(k);let _=t.readInt(!0);if(P+=_,r==1)for(let V=_;V<P;V++)I[V]=t.readFloat();else for(let V=_;V<P;V++)I[V]=t.readFloat()*r;if(!C)for(let V=0,U=I.length;V<U;V++)I[V]+=S[V]}if(Y.setFrame(F,M,I),F==y)break;let L=t.readFloat();switch(t.readByte()){case Se:Y.setStepped(F);break;case Ae:z(t,Y,B++,F,0,M,L,0,1,1)}M=L}i.push(Y);break}case Hr:{let v=new Kt(x,m,w);for(let C=0;C<x;C++){let S=t.readFloat(),k=t.readInt32();v.setFrame(C,S,Ms[k&15],k>>4,t.readFloat())}i.push(v);break}}}}}let l=t.readInt(!0);if(l>0){let a=new _e(l),h=s.slots.length;for(let c=0;c<l;c++){let d=t.readFloat(),u=t.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let f=E.newArray(h-u,0),p=0,b=0;for(let w=0;w<u;w++){let g=t.readInt(!0);for(;p!=g;)f[b++]=p++;m[p+t.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,d,m)}i.push(a)}let o=t.readInt(!0);if(o>0){let a=new nt(o);for(let h=0;h<o;h++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new os(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(h,u)}i.push(a)}let n=0;for(let a=0,h=i.length;a<h;a++)n=Math.max(n,i[a].getDuration());return new rt(e,i,n)}},Gs=class{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Mr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Yr=class{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},Me;(function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"})(Me||(Me={}));function ie(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let l=0,o=0,n=e.getFrameCount()-1;e.setFrame(l,i,r),l!=n;l++){let a=t.readFloat(),h=t.readFloat()*s;switch(t.readByte()){case Se:e.setStepped(l);break;case Ae:z(t,e,o++,l,0,i,a,r,h,s)}i=a,r=h}return e}function ms(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,l=t.readFloat()*s;for(let o=0,n=0,a=e.getFrameCount()-1;e.setFrame(o,i,r,l),o!=a;o++){let h=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case Se:e.setStepped(o);break;case Ae:z(t,e,n++,o,0,i,h,r,c,s),z(t,e,n++,o,1,i,h,l,d,s)}i=h,r=c,l=d}return e}function z(t,e,s,i,r,l,o,n,a,h){e.setBezier(s,i,r,l,n,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,o,a)}var Pr=0,Rr=1,Fr=2,Br=3,Xr=4,Er=5,Lr=6,Dr=7,Vr=8,Nr=9,Or=10,_r=0,Ur=1,qr=2,Wr=3,zr=4,Gr=5,$r=0,Hr=1,jr=0,Jr=1,Kr=2,Qr=0,Zr=1,ei=2,ti=4,si=5,ri=6,ii=7,ni=8,Se=1,Ae=2,gs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Oe(()=>E.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,l=t.slots,o=l.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof ss){let c=h;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=E.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let l=0,o=r.length;l<o;l++){let n=r[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let d=a[h],u=a[h+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=l&&i<=l||t>=o&&s>=o||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),h=a*(r-t)+e;if(h>l&&h<n||(h=a*(o-t)+e,h>l&&h<n))return!0;let c=(l-e)/a+t;return c>r&&c<o||(c=(n-e)/a+t,c>r&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,l=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],h=i[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=i[n];c+(s-a)/(h-a)*(i[l]-c)<e&&(o=!o)}l=n}return o}intersectsSegment(t,e,s,i){let r=this.polygons;for(let l=0,o=r.length;l<o;l++)if(this.intersectsSegmentPolygon(r[l],t,e,s,i))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(t,e,s,i,r){let l=t,o=t.length,n=e-i,a=s-r,h=e*r-s*i,c=l[o-2],d=l[o-1];for(let u=0;u<o;u+=2){let m=l[u],f=l[u+1],p=c*f-d*m,b=c-m,w=d-f,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(h*w-a*p)/g;if((y>=d&&y<=f||y>=f&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},$s=class de{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Oe(()=>new Array);polygonIndicesPool=new Oe(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=i;n<a;++n)l[n]=de.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,h=1;for(;;){e:if(!l[a]){let u=r[n]<<1,m=r[a]<<1,f=r[h]<<1,p=s[u],b=s[u+1],w=s[m],g=s[m+1],x=s[f],y=s[f+1];for(let v=(h+1)%i;v!=n;v=(v+1)%i){if(!l[v])continue;let C=r[v]<<1,S=s[C],k=s[C+1];if(de.positiveArea(x,y,p,b,S,k)&&de.positiveArea(p,b,w,g,S,k)&&de.positiveArea(w,g,x,y,S,k))break e}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),l.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;l[c]=de.isConcave(c,i,s,r),l[d]=de.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=0;for(let c=0,d=s.length;c<d;c+=3){let u=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,p=i[u],b=i[u+1],w=i[m],g=i[m+1],x=i[f],y=i[f+1],v=!1;if(a==u){let C=n.length-4,S=de.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=de.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?(r.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(u),o.push(m),o.push(f),h=de.winding(p,b,w,g,x,y),a=u)}n.length>0&&(r.push(n),l.push(o));for(let c=0,d=r.length;c<d;c++){if(o=l[c],o.length==0)continue;let u=o[0],m=o[o.length-1];n=r[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=de.winding(p,b,w,g,x,y);for(let k=0;k<d;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],F=T[2],B=r[k],I=B[B.length-2],P=B[B.length-1];if(Y!=u||M!=m)continue;let L=de.winding(p,b,w,g,I,P),_=de.winding(I,P,x,y,v,C);L==S&&_==S&&(B.length=0,T.length=0,n.push(I),n.push(P),o.push(F),p=w,b=g,w=I,g=P,k=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(e,s,i,r){let l=r[(s+e-1)%s]<<1,o=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[l],i[l+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(e,s,i,r,l,o){return e*(o-r)+i*(s-o)+l*(r-s)>=0}static winding(e,s,i,r,l,o){let n=i-e,a=r-s;return l*a-o*n+n*s-e*a>=0?1:-1}},ht=class Cs{triangulator=new $s;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let l=this.clippingPolygon;Cs.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];Cs.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,l,o,n,a){let h,c,d,u,m,f;typeof s=="number"?(h=i,c=r,d=l,u=o,m=n,f=a):(h=s,c=i,d=r,u=l,m=o,f=n),d&&u&&m&&typeof f=="boolean"?this.clipTrianglesRender(e,h,c,d,u,m,f):this.clipTrianglesNoRender(e,h,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,u=e[d],m=e[d+1];d=s[c+1]<<1;let f=e[d],p=e[d+1];d=s[c+2]<<1;let b=e[d],w=e[d+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(u,m,f,p,b,w,n[g],r)){let y=r.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]=u,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(e,s,i,r,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=n?12:8,f=0;h.length=0,c.length=0;for(let p=0;p<i;p+=3){let b=s[p]<<1,w=e[b],g=e[b+1],x=r[b],y=r[b+1];b=s[p+1]<<1;let v=e[b],C=e[b+1],S=r[b],k=r[b+1];b=s[p+2]<<1;let T=e[b],Y=e[b+1],M=r[b],F=r[b+1];for(let B=0;B<u;B++){let I=h.length;if(this.clip(w,g,v,C,T,Y,d[B],a)){let P=a.length;if(P==0)continue;let L=C-Y,_=T-v,V=w-T,U=Y-g,j=1/(L*V+_*(g-Y)),$=P>>1,Q=this.clipOutput,D=E.setArraySize(h,I+$*m);for(let H=0;H<P;H+=2,I+=m){let ce=Q[H],Z=Q[H+1];D[I]=ce,D[I+1]=Z,D[I+2]=l.r,D[I+3]=l.g,D[I+4]=l.b,D[I+5]=l.a;let ae=ce-T,oe=Z-Y,we=(L*ae+_*oe)*j,$e=(U*ae+V*oe)*j,tt=1-we-$e;D[I+6]=x*we+S*$e+M*tt,D[I+7]=y*we+k*$e+F*tt,n&&(D[I+8]=o.r,D[I+9]=o.g,D[I+10]=o.b,D[I+11]=o.a)}I=c.length;let q=E.setArraySize(c,I+3*($-2));$--;for(let H=1;H<$;H++,I+=3)q[I]=f,q[I+1]=f+H,q[I+2]=f+H+1;f+=$+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]=F,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]=F),I=c.length;let L=E.setArraySize(c,I+3);L[I]=f,L[I+1]=f+1,L[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;o.length=0,n.length=0,a.length=0;for(let u=0;u<i;u+=3){let m=s[u]<<1,f=e[m],p=e[m+1],b=r[m],w=r[m+1];m=s[u+1]<<1;let g=e[m],x=e[m+1],y=r[m],v=r[m+1];m=s[u+2]<<1;let C=e[m],S=e[m+1],k=r[m],T=r[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 F=l.length;if(F==0)continue;let B=x-S,I=C-g,P=f-C,L=S-p,_=1/(B*P+I*(p-S)),V=F>>1,U=this.clipOutput,j=E.setArraySize(o,M+V*2),$=E.setArraySize(n,M+V*2);for(let D=0;D<F;D+=2,M+=2){let q=U[D],H=U[D+1];j[M]=q,j[M+1]=H;let ce=q-C,Z=H-S,ae=(B*ce+I*Z)*_,oe=(L*ce+P*Z)*_,we=1-ae-oe;$[M]=b*ae+y*oe+k*we,$[M+1]=w*ae+v*oe+T*we}M=a.length;let Q=E.setArraySize(a,M+3*(V-2));V--;for(let D=1;D<V;D++,M+=3)Q[M]=d,Q[M+1]=d+D,Q[M+2]=d+D+1;d+=V+1}else{let F=E.setArraySize(o,M+6);F[M]=f,F[M+1]=p,F[M+2]=g,F[M+3]=x,F[M+4]=C,F[M+5]=S;let B=E.setArraySize(n,M+3*2);B[M]=b,B[M+1]=w,B[M+2]=y,B[M+3]=v,B[M+4]=k,B[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=d,I[M+1]=d+1,I[M+2]=d+2,d+=3;break}}}}clip(e,s,i,r,l,o,n,a){let h=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(l),d.push(o),d.push(e),d.push(s),a.length=0;let u=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=d;for(let C=0,S=d.length-2;C<S;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],F=g*(p-Y)>w*(b-M),B=g*(p-k)-w*(b-T);if(B>0){if(F){a.push(Y),a.push(M);continue}let I=Y-k,P=M-T,L=B/(I*g-P*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+P*L);else{a.push(Y),a.push(M);continue}}else if(F){let I=Y-k,P=M-T,L=B/(I*g-P*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+P*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==u)break;let v=a;a=d,a.length=0,d=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(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],l=0,o=0,n=0,a=0;for(let h=0,c=i-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],r+=l*a-n*o;if(!(r<0))for(let h=0,c=i-2,d=i>>1;h<d;h+=2){let u=s[h],m=s[h+1],f=c-h;s[h]=s[f],s[h+1]=s[f+1],s[f]=u,s[f+1]=m}}},Hs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ze,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=A(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let l=0;l<i.bones.length;l++){let o=i.bones[l],n=null,a=A(o,"parent",null);a&&(n=s.findBone(a));let h=new ns(s.bones.length,o.name,n);h.length=A(o,"length",0)*e,h.x=A(o,"x",0)*e,h.y=A(o,"y",0)*e,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(K,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(i.slots)for(let l=0;l<i.slots.length;l++){let o=i.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new us(s.slots.length,n,a),c=A(o,"color",null);c&&h.color.setFromString(c);let d=A(o,"dark",null);d&&(h.darkColor=N.fromString(d)),h.attachmentName=A(o,"attachment",null),h.blendMode=E.enumValue(Ie,A(o,"blend","normal")),h.visible=A(o,"visible",!0),s.slots.push(h)}if(i.ik)for(let l=0;l<i.ik.length;l++){let o=i.ik[l],n=new hs(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)*e,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(i.transform)for(let l=0;l<i.transform.length;l++){let o=i.transform[l],n=new fs(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);n.bones.push(u)}let a=o.target,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)*e,n.offsetY=A(o,"y",0)*e,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(i.path)for(let l=0;l<i.path.length;l++){let o=i.path[l],n=new cs(o.name);n.order=A(o,"order",0),n.skinRequired=A(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);n.bones.push(u)}let a=o.target,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(xe,A(o,"positionMode","Percent")),n.spacingMode=E.enumValue(ee,A(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Re,A(o,"rotateMode","Tangent")),n.offsetRotation=A(o,"rotation",0),n.position=A(o,"position",0),n.positionMode==xe.Fixed&&(n.position*=e),n.spacing=A(o,"spacing",0),(n.spacingMode==ee.Length||n.spacingMode==ee.Fixed)&&(n.spacing*=e),n.mixRotate=A(o,"mixRotate",1),n.mixX=A(o,"mixX",1),n.mixY=A(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let l=0;l<i.physics.length;l++){const o=i.physics[l],n=new Ws(o.name);n.order=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)*e,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(i.skins)for(let l=0;l<i.skins.length;l++){let o=i.skins[l],n=new et(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let d in c){let u=this.readAttachment(c[d],n,h.index,d,s);u&&n.setAttachment(h.index,d,u)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let l in i.events){let o=i.events[l],n=new ls(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(i.animations)for(let l in i.animations){let o=i.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(t,e,s,i,r){let l=this.scale;switch(i=A(t,"name",i),A(t,"type","region")){case"region":{let o=A(t,"path",i),n=this.readSequence(A(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,o,n);if(!a)return null;a.path=o,a.x=A(t,"x",0)*l,a.y=A(t,"y",0)*l,a.scaleX=A(t,"scaleX",1),a.scaleY=A(t,"scaleY",1),a.rotation=A(t,"rotation",0),a.width=t.width*l,a.height=t.height*l,a.sequence=n;let h=A(t,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let n=A(t,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=A(t,"path",i),n=this.readSequence(A(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,o,n);if(!a)return null;a.path=o;let h=A(t,"color",null);h&&a.color.setFromString(h),a.width=A(t,"width",0)*l,a.height=A(t,"height",0)*l,a.sequence=n;let c=A(t,"parent",null);if(c)return this.linkedMeshes.push(new ai(a,A(t,"skin",null),s,c,A(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=A(t,"edges",null),a.hullLength=A(t,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(e,i);if(!o)return null;o.closed=A(t,"closed",!1),o.constantSpeed=A(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*l;o.lengths=a;let h=A(t,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,i);if(!o)return null;o.x=A(t,"x",0)*l,o.y=A(t,"y",0)*l,o.rotation=A(t,"rotation",0);let n=A(t,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,i);if(!o)return null;let n=A(t,"end",null);n&&(o.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,o,a<<1);let h=A(t,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(t){if(t==null)return null;let e=new Is(A(t,"count",0));return e.start=A(t,"start",1),e.digits=A(t,"digits",0),e.setupIndex=A(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=E.toFloatArray(r);if(i!=1)for(let a=0,h=r.length;a<h;a++)n[a]*=i;e.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let h=r[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(r[n]),l.push(r[n+1]*i),l.push(r[n+2]*i),l.push(r[n+3])}e.bones=o,e.vertices=E.toFloatArray(l)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let o in t.slots){let n=t.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 d=n[c];if(!d)continue;let u=d.length;if(c=="attachment"){let m=new Ee(u,h);for(let f=0;f<u;f++){let p=d[f];m.setFrame(f,A(p,"time",0),A(p,"name",null))}r.push(m)}else if(c=="rgba"){let m=new Ft(u,u<<2,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=d[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=N.fromString(x.color),C=f.curve;C&&(g=G(C,m,g,w,0,p,y,b.r,v.r,1),g=G(C,m,g,w,1,p,y,b.g,v.g,1),g=G(C,m,g,w,2,p,y,b.b,v.b,1),g=G(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,f=x}r.push(m)}else if(c=="rgb"){let m=new Bt(u,u*3,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=d[w+1];if(!x){m.shrink(g);break}let y=A(x,"time",0),v=N.fromString(x.color),C=f.curve;C&&(g=G(C,m,g,w,0,p,y,b.r,v.r,1),g=G(C,m,g,w,1,p,y,b.g,v.g,1),g=G(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,f=x}r.push(m)}else if(c=="alpha")r.push(be(d,new Xt(u,u,h),0,1));else if(c=="rgba2"){let m=new Et(u,u*7,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.light),w=N.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=d[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=N.fromString(y.light),S=N.fromString(y.dark),k=f.curve;k&&(x=G(k,m,x,g,0,p,v,b.r,C.r,1),x=G(k,m,x,g,1,p,v,b.g,C.g,1),x=G(k,m,x,g,2,p,v,b.b,C.b,1),x=G(k,m,x,g,3,p,v,b.a,C.a,1),x=G(k,m,x,g,4,p,v,w.r,S.r,1),x=G(k,m,x,g,5,p,v,w.g,S.g,1),x=G(k,m,x,g,6,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}r.push(m)}else if(c=="rgb2"){let m=new Lt(u,u*6,h),f=d[0],p=A(f,"time",0),b=N.fromString(f.light),w=N.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=d[g+1];if(!y){m.shrink(x);break}let v=A(y,"time",0),C=N.fromString(y.light),S=N.fromString(y.dark),k=f.curve;k&&(x=G(k,m,x,g,0,p,v,b.r,C.r,1),x=G(k,m,x,g,1,p,v,b.g,C.g,1),x=G(k,m,x,g,2,p,v,b.b,C.b,1),x=G(k,m,x,g,3,p,v,w.r,S.r,1),x=G(k,m,x,g,4,p,v,w.g,S.g,1),x=G(k,m,x,g,5,p,v,w.b,S.b,1)),p=v,b=C,w=S,f=y}r.push(m)}}}if(t.bones)for(let o in t.bones){let n=t.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 d=n[c],u=d.length;if(u!=0){if(c==="rotate")r.push(be(d,new Ke(u,u,h),0,1));else if(c==="translate"){let m=new Ct(u,u<<1,h);r.push(ps(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new St(u,u,h);r.push(be(d,m,0,i))}else if(c==="translatey"){let m=new At(u,u,h);r.push(be(d,m,0,i))}else if(c==="scale"){let m=new kt(u,u<<1,h);r.push(ps(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Tt(u,u,h);r.push(be(d,m,1,1))}else if(c==="scaley"){let m=new It(u,u,h);r.push(be(d,m,1,1))}else if(c==="shear"){let m=new Mt(u,u<<1,h);r.push(ps(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Yt(u,u,h);r.push(be(d,m,0,1))}else if(c==="sheary"){let m=new Pt(u,u,h);r.push(be(d,m,0,1))}else if(c==="inherit"){let m=new Rt(u,a.index);for(let f=0;f<d.length;f++){let p=d[f];m.setFrame(f,A(p,"time",0),E.enumValue(K,A(p,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let o in t.ik){let n=t.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),d=new Vt(n.length,n.length<<1,c),u=A(a,"time",0),m=A(a,"mix",1),f=A(a,"softness",0)*i;for(let p=0,b=0;;p++){d.setFrame(p,u,m,f,A(a,"bendPositive",!0)?1:-1,A(a,"compress",!1),A(a,"stretch",!1));let w=n[p+1];if(!w){d.shrink(b);break}let g=A(w,"time",0),x=A(w,"mix",1),y=A(w,"softness",0)*i,v=a.curve;v&&(b=G(v,d,b,p,0,u,g,m,x,1),b=G(v,d,b,p,1,u,g,f,y,i)),u=g,m=x,f=y,a=w}r.push(d)}if(t.transform)for(let o in t.transform){let n=t.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),d=new Nt(n.length,n.length*6,c),u=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++){d.setFrame(x,u,m,f,p,b,w,g);let v=n[x+1];if(!v){d.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),F=A(v,"mixShearY",1),B=a.curve;B&&(y=G(B,d,y,x,0,u,C,m,S,1),y=G(B,d,y,x,1,u,C,f,k,1),y=G(B,d,y,x,2,u,C,p,T,1),y=G(B,d,y,x,3,u,C,b,Y,1),y=G(B,d,y,x,4,u,C,w,M,1),y=G(B,d,y,x,5,u,C,g,F,1)),u=C,m=S,f=k,p=T,b=Y,w=M,b=Y,a=v}r.push(d)}if(t.path)for(let o in t.path){let n=t.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 d=n[c],u=d[0];if(!u)continue;let m=d.length;if(c==="position"){let f=new Ot(m,m,h);r.push(be(d,f,0,a.positionMode==xe.Fixed?i:1))}else if(c==="spacing"){let f=new _t(m,m,h);r.push(be(d,f,0,a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?i:1))}else if(c==="mix"){let f=new Ut(m,m*3,h),p=A(u,"time",0),b=A(u,"mixRotate",1),w=A(u,"mixX",1),g=A(u,"mixY",w);for(let x=0,y=0;;x++){f.setFrame(x,p,b,w,g);let v=d[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=u.curve;Y&&(y=G(Y,f,y,x,0,p,C,b,S,1),y=G(Y,f,y,x,1,p,C,w,k,1),y=G(Y,f,y,x,2,p,C,g,T,1)),p=C,b=S,w=k,g=T,u=v}r.push(f)}}}if(t.physics)for(let o in t.physics){let n=t.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],d=c[0];if(!d)continue;let u=c.length;if(h=="reset"){const f=new Jt(u,a);for(let p=0;d!=null;d=c[p+1],p++)f.setFrame(p,A(d,"time",0));r.push(f);continue}let m;if(h=="inertia")m=new qt(u,u,a);else if(h=="strength")m=new Wt(u,u,a);else if(h=="damping")m=new zt(u,u,a);else if(h=="mass")m=new Gt(u,u,a);else if(h=="wind")m=new $t(u,u,a);else if(h=="gravity")m=new Ht(u,u,a);else if(h=="mix")m=new jt(u,u,a);else continue;r.push(be(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let n=t.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],d=s.findSlot(h);if(!d)throw new Error("Slot not found: "+h);let u=d.index;for(let m in c){let f=c[m],p=a.getAttachment(u,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 Dt(w.length,w.length,u,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),i!=1)for(let L=P,_=L+M.length;L<_;L++)Y[L]*=i;if(!x)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(k,S,Y);let F=w[k+1];if(!F){C.shrink(T);break}let B=A(F,"time",0),I=g.curve;I&&(T=G(I,C,T,k,0,S,B,0,1,1)),S=B,g=F}r.push(C)}else if(b=="sequence"){let x=new Kt(w.length,u,p),y=0;for(let v=0;v<w.length;v++){let C=A(g,"delay",y),S=A(g,"time",0),k=se[A(g,"mode","hold")],T=A(g,"index",0);x.setFrame(v,S,k,T,C),y=C,g=w[v+1]}r.push(x)}}}}}}if(t.drawOrder){let o=new _e(t.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<t.drawOrder.length;h++,a++){let c=t.drawOrder[h],d=null,u=A(c,"offsets",null);if(u){d=E.newArray(n,-1);let m=E.newArray(n-u.length,0),f=0,p=0;for(let b=0;b<u.length;b++){let w=u[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++;d[f+w.offset]=f++}for(;f<n;)m[p++]=f++;for(let b=n-1;b>=0;b--)d[b]==-1&&(d[b]=m[--p])}o.setFrame(a,A(c,"time",0),d)}r.push(o)}if(t.events){let o=new nt(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let h=t.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let d=new os(E.toSinglePrecision(A(h,"time",0)),c);d.intValue=A(h,"int",c.intValue),d.floatValue=A(h,"float",c.floatValue),d.stringValue=A(h,"string",c.stringValue),d.data.audioPath&&(d.volume=A(h,"volume",1),d.balance=A(h,"balance",0)),o.setFrame(n,d)}r.push(o)}let l=0;for(let o=0,n=r.length;o<n;o++)l=Math.max(l,r[o].getDuration());s.animations.push(new rt(e,r,l))}},ai=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function be(t,e,s,i){let r=t[0],l=A(r,"time",0),o=A(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,l,o);let h=t[a+1];if(!h)return e.shrink(n),e;let c=A(h,"time",0),d=A(h,"value",s)*i;r.curve&&(n=G(r.curve,e,n,a,0,l,c,o,d,i)),l=c,o=d,r=h}}function ps(t,e,s,i,r,l){let o=t[0],n=A(o,"time",0),a=A(o,s,r)*l,h=A(o,i,r)*l,c=0;for(let d=0;;d++){e.setFrame(d,n,a,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=A(u,"time",0),f=A(u,s,r)*l,p=A(u,i,r)*l,b=o.curve;b&&(c=G(b,e,c,d,0,n,m,a,f,l),c=G(b,e,c,d,1,n,m,h,p,l)),n=m,a=f,h=p,o=u}}function G(t,e,s,i,r,l,o,n,a,h){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,r,l,n,d,u,m,f,o,a),s+1}function A(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var ne=Te("pixi.js"),oi=Te("pixi.js"),xs=class Ye extends rs{static textureMap=new Map;static from(e){return Ye.textureMap.has(e)?Ye.textureMap.get(e):new Ye(e)}texture;constructor(e){super(e.resource),this.texture=oi.Texture.from(e)}setFilters(e,s){const i=this.texture.source.style;i.minFilter=Ye.toPixiTextureFilter(e),i.magFilter=Ye.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=Ye.toPixiMipMap(e),this.texture.source.updateMipmaps()}setWraps(e,s){const i=this.texture.source.style;i.addressModeU=Ye.toPixiTextureWrap(e),i.addressModeV=Ye.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(e){switch(e){case te.Nearest:case te.Linear:return!1;case te.MipMapNearestLinear:case te.MipMapNearestNearest:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureFilter(e){switch(e){case te.Nearest:case te.MipMapNearestLinear:case te.MipMapNearestNearest:return"nearest";case te.Linear:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureWrap(e){switch(e){case Ce.ClampToEdge:return"clamp-to-edge";case Ce.MirroredRepeat:return"mirror-repeat";case Ce.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(e)}`)}}static toPixiBlending(e){switch(e){case Ie.Normal:return"normal";case Ie.Additive:return"add";case Ie.Multiply:return"multiply";case Ie.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(e)}`)}}},We="spineTextureAtlasLoader",li={extension:ne.ExtensionType.Asset,resolver:{test:t=>(0,ne.checkExtension)(t,".atlas"),parse:t=>{const e=t.split(".");return{resolution:parseFloat(ne.Resolver.RETINA_PREFIX?.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{id:We,name:We,extension:{type:ne.ExtensionType.LoadParser,priority:ne.LoaderParserPriority.Normal,name:We},test(t){return(0,ne.checkExtension)(t,".atlas")},async load(t){const e=await ne.DOMAdapter.get().fetch(t);if(!e.ok)throw new Error(`[${We}] Failed to fetch ${t}: ${e.status} ${e.statusText}`);return await e.text()},testParse(t,e){const s=(0,ne.checkExtension)(e.src,".atlas"),i=typeof t=="string",r=e.parser===We||e.loadParser===We;return Promise.resolve((s||r)&&i)},unload(t){t.dispose()},async parse(t,e,s){const i=e.data||{};let r=ne.path.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const l=new lt(t);if(i.images instanceof ne.TextureSource||typeof i.images=="string"){const n=i.images;i.images={},i.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=i?.images?i.images[a]:void 0;if(h instanceof ne.TextureSource)n.setTexture(xs.from(h));else{const c=h??ne.path.normalize([...r.split(ne.path.sep),a].join(ne.path.sep)),d={src:(0,ne.copySearchParams)(c,e.src),data:{...i.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},u=s.load(d).then(m=>{n.setTexture(xs.from(m.source))});o.push(u)}}return await Promise.all(o),l}}};ne.extensions.add(li);var Fe=Te("pixi.js"),ze="spineSkeletonLoader";function hi(t){return Object.prototype.hasOwnProperty.call(t,"bones")}function ci(t){return t instanceof Uint8Array}var di={extension:Fe.ExtensionType.Asset,loader:{id:ze,name:ze,extension:{type:Fe.ExtensionType.LoadParser,priority:Fe.LoaderParserPriority.Normal,name:ze},test(t){return(0,Fe.checkExtension)(t,".skel")},async load(t){const e=await Fe.DOMAdapter.get().fetch(t);if(!e.ok)throw new Error(`[${ze}] Failed to fetch ${t}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(t,e){const s=(0,Fe.checkExtension)(e.src,".json")&&hi(t),i=(0,Fe.checkExtension)(e.src,".skel")&&ci(t),r=e.parser===ze||e.loadParser===ze;return Promise.resolve(s||i||r)}}};Fe.extensions.add(di);var ct=Te("pixi.js"),De=Te("pixi.js"),ui=new Float32Array(1),fi=new Uint32Array(1),mi=class extends De.Geometry{constructor(){const e=new De.Buffer({data:ui,label:"attribute-batch-buffer",usage:De.BufferUsage.VERTEX|De.BufferUsage.COPY_DST,shrinkToFit:!1}),s=new De.Buffer({data:fi,label:"index-batch-buffer",usage:De.BufferUsage.INDEX|De.BufferUsage.COPY_DST,shrinkToFit:!1}),i=7*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:5*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:6*4}},indexBuffer:s})}},ke=Te("pixi.js"),gi={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
|
-
`}},xi=class extends ke.Shader{constructor(t){const e=(0,ke.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[ke.colorBitGl,pi,(0,ke.generateTextureBatchBitGl)(t),ke.roundPixelsBitGl]}),s=(0,ke.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[ke.colorBit,gi,(0,ke.generateTextureBatchBit)(t),ke.roundPixelsBit]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:(0,ke.getBatchSamplersUniformGroup)(t)}})}},js=null,bi=class dr extends ct.Batcher{static extension={type:[ct.ExtensionType.Batcher],name:"darkTint"};geometry=new mi;shader=js||(js=new xi(this.maxTextures));name=dr.extension.name;vertexSize=7;packAttributes(e,s,i,r,l){const o=l<<16|e.roundPixels&65535,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,u=n.tx,m=n.ty,{positions:f,uvs:p}=e,b=e.color,w=(b>>24&255)/255,g=ct.Color.shared.setValue(e.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=e.attributeOffset,y=x+e.attributeSize;for(let v=x;v<y;v++){const C=v*2,S=f[C],k=f[C+1];s[r++]=a*S+c*k+u,s[r++]=d*k+h*S+m,s[r++]=p[C],s[r++]=p[C+1],i[r++]=b,i[r++]=g,i[r++]=o}}packQuadAttributes(e,s,i,r,l){const o=e.texture,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,u=n.tx,m=n.ty,f=e.bounds,p=f.maxX,b=f.minX,w=f.maxY,g=f.minY,x=o.uvs,y=e.color,v=e.darkColor,C=l<<16|e.roundPixels&65535;s[r+0]=a*b+c*g+u,s[r+1]=d*g+h*b+m,s[r+2]=x.x0,s[r+3]=x.y0,i[r+4]=y,i[r+5]=v,i[r+6]=C,s[r+7]=a*p+c*g+u,s[r+8]=d*g+h*p+m,s[r+9]=x.x1,s[r+10]=x.y1,i[r+11]=y,i[r+12]=v,i[r+13]=C,s[r+14]=a*p+c*w+u,s[r+15]=d*w+h*p+m,s[r+16]=x.x2,s[r+17]=x.y2,i[r+18]=y,i[r+19]=v,i[r+20]=C,s[r+21]=a*b+c*w+u,s[r+22]=d*w+h*b+m,s[r+23]=x.x3,s[r+24]=x.y3,i[r+25]=y,i[r+26]=v,i[r+27]=C}};ct.extensions.add(bi);var wi=E.newFloatArray(8),yi=class bt{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=E.newFloatArray(8*1024);tempColor=new N;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,n=l.length;o<n;o++){let a=l[o],h=a.bone;if(!h.active)continue;let c=a.getAttachment();if(!(c instanceof W))continue;c.computeWorldVertices(a,wi,0,2);let d=c.region,u=d.texture.getImage(),m=a.color,f=c.color;i.set(r.r*m.r*f.r,r.g*m.g*f.g,r.b*m.b*f.b,r.a*m.a*f.a),s.save(),s.transform(h.a,h.c,h.b,h.d,h.worldX,h.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let p=c.width/d.originalWidth;s.scale(p*c.scaleX,p*c.scaleY);let b=d.width,w=d.height;if(s.translate(b/2,w/2),c.region.degrees==90){let g=b;b=w,w=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-b/2,-w/2),s.globalAlpha=i.a,s.drawImage(u,u.width*d.u,u.height*d.v,b,w,0,0,b,w),this.debugRendering&&s.strokeRect(0,0,b,w),s.restore()}}drawTriangles(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder,o=null,n=this.vertices,a=null;for(let c=0,d=l.length;c<d;c++){let u=l[c],m=u.getAttachment(),f,p;if(m instanceof W){let b=m;n=this.computeRegionVertices(u,b,!1),a=bt.QUAD_TRIANGLES,f=b.region.texture.getImage()}else if(m instanceof pe){let b=m;n=this.computeMeshVertices(u,b,!1),a=b.triangles,f=b.region.texture.getImage()}else continue;if(f){u.data.blendMode!=o&&(o=u.data.blendMode);let b=u.color,w=m.color;i.set(r.r*b.r*w.r,r.g*b.g*w.g,r.b*b.b*w.b,r.a*b.a*w.a),s.globalAlpha=i.a;for(var h=0;h<a.length;h+=3){let g=a[h]*8,x=a[h+1]*8,y=a[h+2]*8,v=n[g],C=n[g+1],S=n[g+6],k=n[g+7],T=n[x],Y=n[x+1],M=n[x+6],F=n[x+7],B=n[y],I=n[y+1],P=n[y+6],L=n[y+7];this.drawTriangle(f,v,C,S,k,T,Y,M,F,B,I,P,L),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,C),s.lineTo(T,Y),s.lineTo(B,I),s.lineTo(v,C),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,i,r,l,o,n,a,h,c,d,u,m){let f=this.ctx;const p=e.width-1,b=e.height-1;r*=p,l*=b,a*=p,h*=b,u*=p,m*=b,f.beginPath(),f.moveTo(s,i),f.lineTo(o,n),f.lineTo(c,d),f.closePath(),o-=s,n-=i,c-=s,d-=i,a-=r,h-=l,u-=r,m-=l;let w=a*m-u*h;if(w==0)return;w=1/w;const g=(m*o-h*c)*w,x=(m*n-h*d)*w,y=(a*c-u*o)*w,v=(a*d-u*n)*w,C=s-g*r-y*l,S=i-x*r-v*l;f.save(),f.transform(g,x,y,v,C,S),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n),s.computeWorldVertices(e,this.vertices,0,bt.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[W.C1R]=h.r,c[W.C1G]=h.g,c[W.C1B]=h.b,c[W.C1A]=h.a,c[W.U1]=d[0],c[W.V1]=d[1],c[W.C2R]=h.r,c[W.C2G]=h.g,c[W.C2B]=h.b,c[W.C2A]=h.a,c[W.U2]=d[2],c[W.V2]=d[3],c[W.C3R]=h.r,c[W.C3G]=h.g,c[W.C3B]=h.b,c[W.C3A]=h.a,c[W.U3]=d[4],c[W.V3]=d[5],c[W.C4R]=h.r,c[W.C4G]=h.g,c[W.C4B]=h.b,c[W.C4A]=h.a,c[W.U4]=d[6],c[W.V4]=d[7],c}computeMeshVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=E.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,bt.VERTEX_SIZE);let u=s.uvs;for(let m=0,f=0,p=2;m<c;m++)d[p++]=h.r,d[p++]=h.g,d[p++]=h.b,d[p++]=h.a,d[p++]=u[f++],d[p++]=u[f++],p+=2;return d}},Ve=Te("pixi.js"),vi=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const r=t.a*s*255;if(e!==16777215){const l=e>>16&255,o=e>>8&255,n=e&255,a=t.r*n,h=t.g*o,c=t.b*l;i=r<<24|c<<16|h<<8|a}else i=r<<24|t.b*255<<16|t.g*255<<8|t.r*255;return i}get darkColor(){const t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const r=e.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Ci={0:"normal",1:"add",2:"multiply",3:"screen"},Js=class{static extension={type:[Ve.ExtensionType.WebGLPipes,Ve.ExtensionType.WebGPUPipes,Ve.ExtensionType.CanvasPipes],name:"spine"};renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(this.renderer.type===Ve.RendererType.CANVAS||(t._validateAndTransformAttachments(),t.spineAttachmentsDirty))return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,r=e.length;i<r;i++){const l=e[i],o=l.getAttachment();if(o instanceof W||o instanceof pe){const n=t._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a?.texture&&!a?._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}execute(t){if(this.renderer.type===Ve.RendererType.CANVAS){const e=this.renderer,s=(t.groupColorAlpha>>>24&255)/255,i=e.canvasContext,r=i.activeContext;r.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new yi(r),this.canvasSkeletonRenderer.triangleRendering=!0),i.setContextTransform(t.groupTransform,(e._roundPixels|t._roundPixels)===1);const l=t.skeleton.color.a;t.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(t.skeleton),t.skeleton.color.a=l,r.restore()}}addRenderable(t,e){if(this.renderer.type===Ve.RendererType.CANVAS){this.renderer.renderPipes.batch.break(e),e.add(t);return}const s=this._getSpineData(t),i=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder,l=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let o=0,n=r.length;o<n;o++){const a=r[o],h=a.getAttachment(),c=Ci[a.data.blendMode];let d=!1;if(h instanceof W||h instanceof pe){const m=t._getCachedData(a,h),f=s.slotBatches[m.id]||=new vi;f.setData(t,m,c,l),d=m.skipRender,d||i.addToBatch(f,e)}const u=t._slotsObject[a.data.name];if(u){const m=u.container;d||(m.includeInBuild=!0,m.collectRenderables(e,this.renderer,null)),m.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder;for(let i=0,r=s.length;i<r;i++){const l=s[i],o=l.getAttachment();if(o instanceof W||o instanceof pe){const n=t._getCachedData(l,o);if(!n.skipRender){const a=e.slotBatches[n.id];a?._batcher?.updateElement(a)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null,this.canvasSkeletonRenderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};Ve.extensions.add(Js);var me=Te("pixi.js"),dt=new $e;qe.yDown=!0;var We=new ht,Si=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Ai=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new qe(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(fe.update);const s=e.getBoundsRect(this.clipping?new ht:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},ki=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Qt(t.state.data),s=new qe(t.skeleton.data),i=this.clipping?new ht:void 0,r=s.data;if(this.skins.length>0){let o=new Qe("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?r.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(fe.update);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let u=0;u<c;u++){const m=u>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(fe.update);const f=s.getBoundsRect(i);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 d={x:o,y:n,width:a-o,height:h-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},Ks=new Oe(()=>new me.Graphics),Ti=class Ss extends me.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(e){let s;if(typeof e=="number"?s=this.skeleton.slots[e]:typeof e=="string"?s=this.skeleton.findSlot(e):s=e,!s)throw new Error(`No slot found with the given slot reference: ${e}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}_autoUpdate=!1;_ticker=me.Ticker.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!e&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=e}get ticker(){return this._ticker}set ticker(e){e=e??me.Ticker.shared,this._ticker!==e&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),e.add(this.internalUpdate,this)),this._ticker=e)}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(e){this._boundsProvider=e,e&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(e){e instanceof Ke&&(e={skeletonData:e}),super({}),this.allowChildren=!0;const s=e instanceof Ke?e:e.skeletonData;this.skeleton=new qe(s),this.state=new Qt(new Bs(s)),e?.ticker&&(this._ticker=e.ticker),this.autoUpdate=e?.autoUpdate??!0,this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):e?.darkTint;const i=this.skeleton.slots;for(let r=0;r<i.length;r++)this.attachmentCacheData[r]=Object.create(null);this._boundsProvider=e.boundsProvider}update(e){this.internalUpdate(0,e)}internalUpdate(e,s){this._updateAndApplyState(s??this._ticker.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,s){const i=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(i)} not found`);if(dt.set(s.x,s.y),e.parent){const r=e.parent.worldToLocal(dt);e.x=r.x,e.y=-r.y}else e.x=dt.x,e.y=dt.y}getBonePosition(e,s){const i=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(s||(s={x:0,y:0}),s.x=e.worldX,s.y=e.worldY,s):(console.error(`Cant set bone position! Bone ${String(i)} not found`),s)}_updateAndApplyState(e){this.hasNeverUpdated=!1,this.state.update(e),this.skeleton.update(e);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(fe.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const e=this.skeleton.drawOrder,s=this._lastAttachments;let i=0,r=!1;for(let l=0;l<e.length;l++){const n=e[l].getAttachment();n&&(n!==s[i]&&(r=!0,s[i]=n),i++)}i!==s.length&&(r=!0,s.length=i),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(e,s){const i=e.attachment;if(i&&i instanceof Le){const o=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot,l=this._slotsObject[e.data.name];if(r&&l){let o=r.mask;if(o||(o=Ks.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const h=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof Le)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),Ks.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const i=e[s];this.updateAndSetPixiMask(i,s===e.length-1);const r=i.getAttachment();if(r){if(r instanceof pe||r instanceof W){const l=this._getCachedData(i,r);r instanceof W?r.computeWorldVertices(i,l.vertices,0,2):r.computeWorldVertices(i,0,r.worldVerticesLength,l.vertices,0,2),l.uvs.length<r.uvs.length&&(l.uvs=new Float32Array(r.uvs.length)),(0,me.fastCopy)(r.uvs.buffer,l.uvs.buffer);const n=i.bone.skeleton.color,a=i.color,h=r.color,c=n.a*a.a*h.a;if(l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,c),this.alpha===0||c===0)l.skipRender||(this.spineAttachmentsDirty=!0),l.skipRender=!0;else{l.skipRender&&(this.spineAttachmentsDirty=!0),l.skipRender=l.clipped=!1,i.darkColor&&l.darkColor.setFromColor(i.darkColor);const d=r.region?.texture.texture||me.Texture.EMPTY;l.texture!==d&&(l.texture=d,this.spineTexturesDirty=!0),We.isClipping()&&this.updateClippingData(l)}}else if(r instanceof Le){We.clipStart(i,r);continue}}We.clipEndWithSlot(i)}We.clipEnd()}updateClippingData(e){e.clipped=!0,We.clipTrianglesUnpacked(e.vertices,e.indices,e.indices.length,e.uvs);const{clippedVertices:s,clippedUVs:i,clippedTriangles:r}=We,l=s.length/2,o=r.length;e.clippedData||(e.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=e.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;e.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:d}=n;for(let u=0;u<l;u++)h[u*2]=s[u*2],h[u*2+1]=s[u*2+1],c[u*2]=i[u*2],c[u*2+1]=i[u*2+1];n.vertexCount=l;for(let u=0;u<o;u++)d[u]!==r[u]&&(this.spineAttachmentsDirty=!0,d[u]=r[u]);n.indicesCount=o}updateSlotObjects(){for(const e in this._slotsObject){const s=this._slotsObject[e];s&&this.updateSlotObject(s)}}updateSlotObject(e){const{slot:s,container:i}=e,r=e.followAttachmentTimeline?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&r,i.visible){let l=s.bone;const o=i.localTransform;o.a=l.a,o.b=l.c,o.c=-l.b,o.d=-l.d,o.tx=l.worldX,o.ty=l.worldY,i.setFromMatrix(o),i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(e,s){return this.attachmentCacheData[e.data.index][s.name]||this.initCachedData(e,s)}initCachedData(e,s){let i;return s instanceof W?(i=new Float32Array(8),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(i=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[e.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,s,i){e=this.getSlotFromRef(e);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(e),s.includeInBuild=!1,this.addChild(s);const r={container:s,slot:e,followAttachmentTimeline:i?.followAttachmentTimeline||!1};this._slotsObject[e.data.name]=r,this.updateSlotObject(r)}removeSlotObject(e){let s;if(e instanceof me.Container){for(const i in this._slotsObject)if(this._slotsObject[i]?.container===e){this._slotsObject[i]=null,s=e;break}}else{const i=this.getSlotFromRef(e);s=this._slotsObject[i.data.name]?.container,this._slotsObject[i.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([e,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[e]})}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new gs;const e=this.skeletonBounds;if(e.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),i=this._bounds;i.clear(),i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height}else if(e.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,i=this._bounds;i.clear();for(let r=0;r<s.length;r++){const l=s[r],o=l.getAttachment();if(o&&(o instanceof W||o instanceof pe)){const n=this._getCachedData(l,o);i.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),this._ticker.remove(this.internalUpdate,this),this._ticker=null,this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,s){this.pixiWorldCoordinatesToSkeleton(e),s.parent?s.parent.worldToLocal(e):s.worldToLocal(e)}static from({skeleton:e,atlas:s,scale:i=1,darkTint:r,autoUpdate:l=!0,boundsProvider:o,ticker:n}){const a=`${e}-${s}-${i}`;if(me.Cache.has(a))return new Ss({skeletonData:me.Cache.get(a),darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n});const h=me.Assets.get(e),c=me.Assets.get(s),d=new Ds(c),u=h instanceof Uint8Array?new zs(d):new $s(d);u.scale=i;const m=u.readSkeletonData(h);return me.Cache.set(a,m),new Ss({skeletonData:m,darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n})}},he=Te("pixi.js"),Ii=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(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}const e={parentDebugContainer:new he.Container,bones:new he.Container,skeletonXY:new he.Graphics,regionAttachmentsShape:new he.Graphics,meshTrianglesLine:new he.Graphics,meshHullLine:new he.Graphics,clippingPolygon:new he.Graphics,boundingBoxesRect:new he.Graphics,boundingBoxesCircle:new he.Graphics,boundingBoxesPolygon:new he.Graphics,pathsCurve:new he.Graphics,pathsLine:new he.Graphics,eventText:new he.Container,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(t.scale.x||t.scale.y||1),l=new he.Text({text:i.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(t.scale.x),l.anchor.set(.5),e.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let r=e.bones.children.length;r>0;r--)e.bones.children[r-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const r of e.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(t,e,s,i){const r=t.skeleton,l=r.x,o=r.y,n=r.bones;e.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const d=n[h],u=d.data.length,m=l+d.worldX,f=o+d.worldY,p=l+u*d.a+d.worldX,b=o+u*d.b+d.worldY;if(d.data.name==="root"||d.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 he.Graphics;e.bones.addChild(Y);const M=C/50/i;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=f,Y.pivot.y=C;let F=0;m<p&&f<b?F=-T+180*k:m>p&&f<b?F=180*k+T:m>p&&f>b?F=-T:m<p&&f>b?F=T:f===b&&m<p?F=90*k:f===b&&m>p?F=-90*k:m===p&&f<b?F=180*k:m===p&&f>b&&(F=0),Y.rotation=F,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;e.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l],a=n.getAttachment();if(a===null||!(a instanceof W))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),e.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof pe))continue;const h=a,c=new Float32Array(h.worldVerticesLength),d=h.triangles;let u=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,f=d.length;m<f;m+=3){const p=d[m]*2,b=d[m+1]*2,w=d[m+2]*2;e.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&u>0){u=(u>>1)*2;let m=c[u-2],f=c[u-1];for(let p=0,b=u;p<b;p+=2){const w=c[p],g=c[p+1];e.meshHullLine.context.moveTo(w,g).lineTo(m,f),m=w,f=g}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Le))continue;const h=a,c=h.worldVerticesLength,d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2),e.clippingPolygon.poly(Array.from(d))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new gs;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const r=i.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let d=0,u=o.length;d<u;d+=2){const m=o[d],f=o[d+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(m,f,c),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(m,f,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,f)}e.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=r.length;o<n;o++){const a=r[o];l(a,0,a.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Ue))continue;const h=a;let c=h.worldVerticesLength;const d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2);let u=d[2],m=d[3],f=0,p=0;if(h.closed){const b=d[0],w=d[1],g=d[c-2],x=d[c-1];f=d[c-4],p=d[c-3],e.pathsCurve.moveTo(u,m),e.pathsCurve.bezierCurveTo(b,w,g,x,f,p),e.pathsLine.moveTo(u,m),e.pathsLine.lineTo(b,w),e.pathsLine.moveTo(f,p),e.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=d[b],g=d[b+1],x=d[b+2],y=d[b+3];f=d[b+4],p=d[b+5],e.pathsCurve.moveTo(u,m),e.pathsCurve.bezierCurveTo(w,g,x,y,f,p),e.pathsLine.moveTo(u,m),e.pathsLine.lineTo(w,g),e.pathsLine.moveTo(f,p),e.pathsLine.lineTo(x,y),u=f,m=p}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}};return xr(As)})();
|
|
27
|
+
`}},xi=class extends ke.Shader{constructor(t){const e=(0,ke.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[ke.colorBitGl,pi,(0,ke.generateTextureBatchBitGl)(t),ke.roundPixelsBitGl]}),s=(0,ke.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[ke.colorBit,gi,(0,ke.generateTextureBatchBit)(t),ke.roundPixelsBit]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:(0,ke.getBatchSamplersUniformGroup)(t)}})}},js=null,bi=class dr extends ct.Batcher{static extension={type:[ct.ExtensionType.Batcher],name:"darkTint"};geometry=new mi;shader=js||(js=new xi(this.maxTextures));name=dr.extension.name;vertexSize=7;packAttributes(e,s,i,r,l){const o=l<<16|e.roundPixels&65535,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,u=n.tx,m=n.ty,{positions:f,uvs:p}=e,b=e.color,w=(b>>24&255)/255,g=ct.Color.shared.setValue(e.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=e.attributeOffset,y=x+e.attributeSize;for(let v=x;v<y;v++){const C=v*2,S=f[C],k=f[C+1];s[r++]=a*S+c*k+u,s[r++]=d*k+h*S+m,s[r++]=p[C],s[r++]=p[C+1],i[r++]=b,i[r++]=g,i[r++]=o}}packQuadAttributes(e,s,i,r,l){const o=e.texture,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,u=n.tx,m=n.ty,f=e.bounds,p=f.maxX,b=f.minX,w=f.maxY,g=f.minY,x=o.uvs,y=e.color,v=e.darkColor,C=l<<16|e.roundPixels&65535;s[r+0]=a*b+c*g+u,s[r+1]=d*g+h*b+m,s[r+2]=x.x0,s[r+3]=x.y0,i[r+4]=y,i[r+5]=v,i[r+6]=C,s[r+7]=a*p+c*g+u,s[r+8]=d*g+h*p+m,s[r+9]=x.x1,s[r+10]=x.y1,i[r+11]=y,i[r+12]=v,i[r+13]=C,s[r+14]=a*p+c*w+u,s[r+15]=d*w+h*p+m,s[r+16]=x.x2,s[r+17]=x.y2,i[r+18]=y,i[r+19]=v,i[r+20]=C,s[r+21]=a*b+c*w+u,s[r+22]=d*w+h*b+m,s[r+23]=x.x3,s[r+24]=x.y3,i[r+25]=y,i[r+26]=v,i[r+27]=C}};ct.extensions.add(bi);var wi=E.newFloatArray(8),yi=class bt{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=E.newFloatArray(8*1024);tempColor=new N;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,n=l.length;o<n;o++){let a=l[o],h=a.bone;if(!h.active)continue;let c=a.getAttachment();if(!(c instanceof W))continue;c.computeWorldVertices(a,wi,0,2);let d=c.region,u=d.texture.getImage(),m=a.color,f=c.color;i.set(r.r*m.r*f.r,r.g*m.g*f.g,r.b*m.b*f.b,r.a*m.a*f.a),s.save(),s.transform(h.a,h.c,h.b,h.d,h.worldX,h.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let p=c.width/d.originalWidth;s.scale(p*c.scaleX,p*c.scaleY);let b=d.width,w=d.height;if(s.translate(b/2,w/2),c.region.degrees==90){let g=b;b=w,w=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-b/2,-w/2),s.globalAlpha=i.a,s.drawImage(u,u.width*d.u,u.height*d.v,b,w,0,0,b,w),this.debugRendering&&s.strokeRect(0,0,b,w),s.restore()}}drawTriangles(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder,o=null,n=this.vertices,a=null;for(let c=0,d=l.length;c<d;c++){let u=l[c],m=u.getAttachment(),f,p;if(m instanceof W){let b=m;n=this.computeRegionVertices(u,b,!1),a=bt.QUAD_TRIANGLES,f=b.region.texture.getImage()}else if(m instanceof pe){let b=m;n=this.computeMeshVertices(u,b,!1),a=b.triangles,f=b.region.texture.getImage()}else continue;if(f){u.data.blendMode!=o&&(o=u.data.blendMode);let b=u.color,w=m.color;i.set(r.r*b.r*w.r,r.g*b.g*w.g,r.b*b.b*w.b,r.a*b.a*w.a),s.globalAlpha=i.a;for(var h=0;h<a.length;h+=3){let g=a[h]*8,x=a[h+1]*8,y=a[h+2]*8,v=n[g],C=n[g+1],S=n[g+6],k=n[g+7],T=n[x],Y=n[x+1],M=n[x+6],F=n[x+7],B=n[y],I=n[y+1],P=n[y+6],L=n[y+7];this.drawTriangle(f,v,C,S,k,T,Y,M,F,B,I,P,L),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,C),s.lineTo(T,Y),s.lineTo(B,I),s.lineTo(v,C),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,i,r,l,o,n,a,h,c,d,u,m){let f=this.ctx;const p=e.width-1,b=e.height-1;r*=p,l*=b,a*=p,h*=b,u*=p,m*=b,f.beginPath(),f.moveTo(s,i),f.lineTo(o,n),f.lineTo(c,d),f.closePath(),o-=s,n-=i,c-=s,d-=i,a-=r,h-=l,u-=r,m-=l;let w=a*m-u*h;if(w==0)return;w=1/w;const g=(m*o-h*c)*w,x=(m*n-h*d)*w,y=(a*c-u*o)*w,v=(a*d-u*n)*w,C=s-g*r-y*l,S=i-x*r-v*l;f.save(),f.transform(g,x,y,v,C,S),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n),s.computeWorldVertices(e,this.vertices,0,bt.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[W.C1R]=h.r,c[W.C1G]=h.g,c[W.C1B]=h.b,c[W.C1A]=h.a,c[W.U1]=d[0],c[W.V1]=d[1],c[W.C2R]=h.r,c[W.C2G]=h.g,c[W.C2B]=h.b,c[W.C2A]=h.a,c[W.U2]=d[2],c[W.V2]=d[3],c[W.C3R]=h.r,c[W.C3G]=h.g,c[W.C3B]=h.b,c[W.C3A]=h.a,c[W.U3]=d[4],c[W.V3]=d[5],c[W.C4R]=h.r,c[W.C4G]=h.g,c[W.C4B]=h.b,c[W.C4A]=h.a,c[W.U4]=d[6],c[W.V4]=d[7],c}computeMeshVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=E.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,bt.VERTEX_SIZE);let u=s.uvs;for(let m=0,f=0,p=2;m<c;m++)d[p++]=h.r,d[p++]=h.g,d[p++]=h.b,d[p++]=h.a,d[p++]=u[f++],d[p++]=u[f++],p+=2;return d}},Ve=Te("pixi.js"),vi=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const r=t.a*s*255;if(e!==16777215){const l=e>>16&255,o=e>>8&255,n=e&255,a=t.r*n,h=t.g*o,c=t.b*l;i=r<<24|c<<16|h<<8|a}else i=r<<24|t.b*255<<16|t.g*255<<8|t.r*255;return i}get darkColor(){const t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const r=e.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Ci={0:"normal",1:"add",2:"multiply",3:"screen"},Js=class{static extension={type:[Ve.ExtensionType.WebGLPipes,Ve.ExtensionType.WebGPUPipes,Ve.ExtensionType.CanvasPipes],name:"spine"};renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(this.renderer.type===Ve.RendererType.CANVAS||(t._validateAndTransformAttachments(),t.spineAttachmentsDirty))return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,r=e.length;i<r;i++){const l=e[i],o=l.getAttachment();if(o instanceof W||o instanceof pe){const n=t._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a?.texture&&!a?._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}execute(t){if(this.renderer.type===Ve.RendererType.CANVAS){const e=this.renderer,s=(t.groupColorAlpha>>>24&255)/255,i=e.canvasContext,r=i.activeContext;r.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new yi(r),this.canvasSkeletonRenderer.triangleRendering=!0),i.setContextTransform(t.groupTransform,(e._roundPixels|t._roundPixels)===1);const l=t.skeleton.color.a;t.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(t.skeleton),t.skeleton.color.a=l,r.restore()}}addRenderable(t,e){if(this.renderer.type===Ve.RendererType.CANVAS){this.renderer.renderPipes.batch.break(e),e.add(t);return}const s=this._getSpineData(t),i=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder,l=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let o=0,n=r.length;o<n;o++){const a=r[o],h=a.getAttachment(),c=Ci[a.data.blendMode];let d=!1;if(h instanceof W||h instanceof pe){const m=t._getCachedData(a,h),f=s.slotBatches[m.id]||=new vi;f.setData(t,m,c,l),d=m.skipRender,d||i.addToBatch(f,e)}const u=t._slotsObject[a.data.name];if(u){const m=u.container;d||(m.includeInBuild=!0,m.collectRenderables(e,this.renderer,null)),m.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder;for(let i=0,r=s.length;i<r;i++){const l=s[i],o=l.getAttachment();if(o instanceof W||o instanceof pe){const n=t._getCachedData(l,o);if(!n.skipRender){const a=e.slotBatches[n.id];a?._batcher?.updateElement(a)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null,this.canvasSkeletonRenderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};Ve.extensions.add(Js);var me=Te("pixi.js"),dt=new Je;qe.yDown=!0;var Ge=new ht,Si=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Ai=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new qe(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(fe.update);const s=e.getBoundsRect(this.clipping?new ht:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},ki=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Qt(t.state.data),s=new qe(t.skeleton.data),i=this.clipping?new ht:void 0,r=s.data;if(this.skins.length>0){let o=new et("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?r.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(fe.update);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let u=0;u<c;u++){const m=u>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(fe.update);const f=s.getBoundsRect(i);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 d={x:o,y:n,width:a-o,height:h-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},Ks=new Oe(()=>new me.Graphics),Ti=class Ss extends me.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(e){let s;if(typeof e=="number"?s=this.skeleton.slots[e]:typeof e=="string"?s=this.skeleton.findSlot(e):s=e,!s)throw new Error(`No slot found with the given slot reference: ${e}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}_autoUpdate=!1;_ticker=me.Ticker.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!e&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=e}get ticker(){return this._ticker}set ticker(e){e=e??me.Ticker.shared,this._ticker!==e&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),e.add(this.internalUpdate,this)),this._ticker=e)}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(e){this._boundsProvider=e,e&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(e){e instanceof Ze&&(e={skeletonData:e}),super({}),this.allowChildren=!0;const s=e instanceof Ze?e:e.skeletonData;this.skeleton=new qe(s),this.state=new Qt(new Bs(s)),e?.ticker&&(this._ticker=e.ticker),this.autoUpdate=e?.autoUpdate??!0,this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):e?.darkTint;const i=this.skeleton.slots;for(let r=0;r<i.length;r++)this.attachmentCacheData[r]=Object.create(null);this._boundsProvider=e.boundsProvider}update(e){this.internalUpdate(0,e)}internalUpdate(e,s){this._updateAndApplyState(s??this._ticker.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,s){const i=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(i)} not found`);if(dt.set(s.x,s.y),e.parent){const r=e.parent.worldToLocal(dt);e.x=r.x,e.y=-r.y}else e.x=dt.x,e.y=dt.y}getBonePosition(e,s){const i=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(s||(s={x:0,y:0}),s.x=e.worldX,s.y=e.worldY,s):(console.error(`Cant set bone position! Bone ${String(i)} not found`),s)}_updateAndApplyState(e){this.hasNeverUpdated=!1,this.state.update(e),this.skeleton.update(e);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(fe.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const e=this.skeleton.drawOrder,s=this._lastAttachments;let i=0,r=!1;for(let l=0;l<e.length;l++){const n=e[l].getAttachment();n&&(n!==s[i]&&(r=!0,s[i]=n),i++)}i!==s.length&&(r=!0,s.length=i),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(e,s){const i=e.attachment;if(i&&i instanceof Le){const o=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot,l=this._slotsObject[e.data.name];if(r&&l){let o=r.mask;if(o||(o=Ks.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const h=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof Le)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),Ks.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const i=e[s];this.updateAndSetPixiMask(i,s===e.length-1);const r=i.getAttachment();if(r){if(r instanceof pe||r instanceof W){const l=this._getCachedData(i,r);r instanceof W?r.computeWorldVertices(i,l.vertices,0,2):r.computeWorldVertices(i,0,r.worldVerticesLength,l.vertices,0,2),l.uvs.length<r.uvs.length&&(l.uvs=new Float32Array(r.uvs.length)),(0,me.fastCopy)(r.uvs.buffer,l.uvs.buffer);const n=i.bone.skeleton.color,a=i.color,h=r.color,c=n.a*a.a*h.a;if(l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,c),this.alpha===0||c===0)l.skipRender||(this.spineAttachmentsDirty=!0),l.skipRender=!0;else{l.skipRender&&(this.spineAttachmentsDirty=!0),l.skipRender=l.clipped=!1,i.darkColor&&l.darkColor.setFromColor(i.darkColor);const d=r.region?.texture.texture||me.Texture.EMPTY;l.texture!==d&&(l.texture=d,this.spineTexturesDirty=!0),Ge.isClipping()&&this.updateClippingData(l)}}else if(r instanceof Le){Ge.clipStart(i,r);continue}}Ge.clipEndWithSlot(i)}Ge.clipEnd()}updateClippingData(e){e.clipped=!0,Ge.clipTrianglesUnpacked(e.vertices,e.indices,e.indices.length,e.uvs);const{clippedVertices:s,clippedUVs:i,clippedTriangles:r}=Ge,l=s.length/2,o=r.length;e.clippedData||(e.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=e.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;e.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:d}=n;for(let u=0;u<l;u++)h[u*2]=s[u*2],h[u*2+1]=s[u*2+1],c[u*2]=i[u*2],c[u*2+1]=i[u*2+1];n.vertexCount=l;for(let u=0;u<o;u++)d[u]!==r[u]&&(this.spineAttachmentsDirty=!0,d[u]=r[u]);n.indicesCount=o}updateSlotObjects(){for(const e in this._slotsObject){const s=this._slotsObject[e];s&&this.updateSlotObject(s)}}updateSlotObject(e){const{slot:s,container:i}=e,r=e.followAttachmentTimeline?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&r,i.visible){let l=s.bone;const o=i.localTransform;o.a=l.a,o.b=l.c,o.c=-l.b,o.d=-l.d,o.tx=l.worldX,o.ty=l.worldY,i.setFromMatrix(o),i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(e,s){return this.attachmentCacheData[e.data.index][s.name]||this.initCachedData(e,s)}initCachedData(e,s){let i;return s instanceof W?(i=new Float32Array(8),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(i=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[e.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,s,i){e=this.getSlotFromRef(e);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(e),s.includeInBuild=!1,this.addChild(s);const r={container:s,slot:e,followAttachmentTimeline:i?.followAttachmentTimeline||!1};this._slotsObject[e.data.name]=r,this.updateSlotObject(r)}removeSlotObject(e){let s;if(e instanceof me.Container){for(const i in this._slotsObject)if(this._slotsObject[i]?.container===e){this._slotsObject[i]=null,s=e;break}}else{const i=this.getSlotFromRef(e);s=this._slotsObject[i.data.name]?.container,this._slotsObject[i.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([e,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[e]})}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new gs;const e=this.skeletonBounds;if(e.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),i=this._bounds;i.clear(),i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height}else if(e.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,i=this._bounds;i.clear();for(let r=0;r<s.length;r++){const l=s[r],o=l.getAttachment();if(o&&(o instanceof W||o instanceof pe)){const n=this._getCachedData(l,o);i.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),this._ticker.remove(this.internalUpdate,this),this._ticker=null,this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,s){this.pixiWorldCoordinatesToSkeleton(e),s.parent?s.parent.worldToLocal(e):s.worldToLocal(e)}static from({skeleton:e,atlas:s,scale:i=1,darkTint:r,autoUpdate:l=!0,boundsProvider:o,ticker:n}){const a=`${e}-${s}-${i}`;if(me.Cache.has(a))return new Ss({skeletonData:me.Cache.get(a),darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n});const h=me.Assets.get(e),c=me.Assets.get(s),d=new Ds(c),u=h instanceof Uint8Array?new zs(d):new Hs(d);u.scale=i;const m=u.readSkeletonData(h);return me.Cache.set(a,m),new Ss({skeletonData:m,darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n})}},he=Te("pixi.js"),Ii=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(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}const e={parentDebugContainer:new he.Container,bones:new he.Container,skeletonXY:new he.Graphics,regionAttachmentsShape:new he.Graphics,meshTrianglesLine:new he.Graphics,meshHullLine:new he.Graphics,clippingPolygon:new he.Graphics,boundingBoxesRect:new he.Graphics,boundingBoxesCircle:new he.Graphics,boundingBoxesPolygon:new he.Graphics,pathsCurve:new he.Graphics,pathsLine:new he.Graphics,eventText:new he.Container,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(t.scale.x||t.scale.y||1),l=new he.Text({text:i.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(t.scale.x),l.anchor.set(.5),e.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let r=e.bones.children.length;r>0;r--)e.bones.children[r-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const r of e.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(t,e,s,i){const r=t.skeleton,l=r.x,o=r.y,n=r.bones;e.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const d=n[h],u=d.data.length,m=l+d.worldX,f=o+d.worldY,p=l+u*d.a+d.worldX,b=o+u*d.b+d.worldY;if(d.data.name==="root"||d.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 he.Graphics;e.bones.addChild(Y);const M=C/50/i;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=f,Y.pivot.y=C;let F=0;m<p&&f<b?F=-T+180*k:m>p&&f<b?F=180*k+T:m>p&&f>b?F=-T:m<p&&f>b?F=T:f===b&&m<p?F=90*k:f===b&&m>p?F=-90*k:m===p&&f<b?F=180*k:m===p&&f>b&&(F=0),Y.rotation=F,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;e.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l],a=n.getAttachment();if(a===null||!(a instanceof W))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),e.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof pe))continue;const h=a,c=new Float32Array(h.worldVerticesLength),d=h.triangles;let u=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,f=d.length;m<f;m+=3){const p=d[m]*2,b=d[m+1]*2,w=d[m+2]*2;e.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&u>0){u=(u>>1)*2;let m=c[u-2],f=c[u-1];for(let p=0,b=u;p<b;p+=2){const w=c[p],g=c[p+1];e.meshHullLine.context.moveTo(w,g).lineTo(m,f),m=w,f=g}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Le))continue;const h=a,c=h.worldVerticesLength,d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2),e.clippingPolygon.poly(Array.from(d))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new gs;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const r=i.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let d=0,u=o.length;d<u;d+=2){const m=o[d],f=o[d+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(m,f,c),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(m,f,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,f)}e.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=r.length;o<n;o++){const a=r[o];l(a,0,a.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Ue))continue;const h=a;let c=h.worldVerticesLength;const d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2);let u=d[2],m=d[3],f=0,p=0;if(h.closed){const b=d[0],w=d[1],g=d[c-2],x=d[c-1];f=d[c-4],p=d[c-3],e.pathsCurve.moveTo(u,m),e.pathsCurve.bezierCurveTo(b,w,g,x,f,p),e.pathsLine.moveTo(u,m),e.pathsLine.lineTo(b,w),e.pathsLine.moveTo(f,p),e.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=d[b],g=d[b+1],x=d[b+2],y=d[b+3];f=d[b+4],p=d[b+5],e.pathsCurve.moveTo(u,m),e.pathsCurve.bezierCurveTo(w,g,x,y,f,p),e.pathsLine.moveTo(u,m),e.pathsLine.lineTo(w,g),e.pathsLine.moveTo(f,p),e.pathsLine.lineTo(x,y),u=f,m=p}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}};return xr(As)})();
|