@esotericsoftware/spine-core 4.2.116 → 4.3.0
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/Animation.d.ts +426 -274
- package/dist/Animation.js +1174 -1210
- package/dist/AnimationState.d.ts +246 -201
- package/dist/AnimationState.js +508 -471
- package/dist/AnimationStateData.d.ts +12 -10
- package/dist/AnimationStateData.js +19 -20
- package/dist/AssetManagerBase.d.ts +27 -21
- package/dist/AssetManagerBase.js +67 -43
- package/dist/AtlasAttachmentLoader.d.ts +18 -12
- package/dist/AtlasAttachmentLoader.js +28 -39
- package/dist/Bone.d.ts +15 -109
- package/dist/Bone.js +22 -362
- package/dist/BoneData.d.ts +13 -28
- package/dist/BoneData.js +20 -29
- package/dist/BonePose.d.ts +130 -0
- package/dist/BonePose.js +426 -0
- package/dist/Constraint.d.ts +41 -0
- package/dist/Constraint.js +38 -0
- package/dist/ConstraintData.d.ts +7 -5
- package/dist/ConstraintData.js +5 -9
- package/dist/DrawOrder.d.ts +48 -0
- package/dist/DrawOrder.js +64 -0
- package/dist/Event.d.ts +11 -6
- package/dist/Event.js +10 -5
- package/dist/EventData.d.ts +10 -6
- package/dist/EventData.js +18 -7
- package/dist/IkConstraint.d.ts +22 -28
- package/dist/IkConstraint.js +115 -117
- package/dist/IkConstraintData.d.ts +23 -18
- package/dist/IkConstraintData.js +32 -22
- package/dist/IkConstraintPose.d.ts +49 -0
- package/dist/IkConstraintPose.js +55 -0
- package/dist/PathConstraint.d.ts +18 -22
- package/dist/PathConstraint.js +160 -136
- package/dist/PathConstraintData.d.ts +11 -14
- package/dist/PathConstraintData.js +14 -16
- package/dist/PathConstraintPose.d.ts +43 -0
- package/dist/PathConstraintPose.js +49 -0
- package/dist/Physics.d.ts +39 -0
- package/dist/Physics.js +41 -0
- package/dist/PhysicsConstraint.d.ts +26 -30
- package/dist/PhysicsConstraint.js +102 -94
- package/dist/PhysicsConstraintData.d.ts +22 -12
- package/dist/PhysicsConstraintData.js +23 -12
- package/dist/PhysicsConstraintPose.d.ts +47 -0
- package/dist/PhysicsConstraintPose.js +55 -0
- package/dist/Pose.d.ts +33 -0
- package/dist/Pose.js +30 -0
- package/dist/Posed.d.ts +58 -0
- package/dist/Posed.js +78 -0
- package/dist/PosedActive.d.ts +41 -0
- package/dist/{attachments/HasTextureRegion.js → PosedActive.js} +17 -2
- package/dist/PosedData.d.ts +40 -0
- package/dist/PosedData.js +45 -0
- package/dist/Skeleton.d.ts +110 -99
- package/dist/Skeleton.js +271 -449
- package/dist/SkeletonBinary.d.ts +1 -1
- package/dist/SkeletonBinary.js +644 -466
- package/dist/SkeletonBounds.d.ts +4 -4
- package/dist/SkeletonBounds.js +45 -46
- package/dist/SkeletonClipping.d.ts +26 -22
- package/dist/SkeletonClipping.js +654 -340
- package/dist/SkeletonData.d.ts +18 -35
- package/dist/SkeletonData.js +57 -97
- package/dist/SkeletonJson.d.ts +8 -6
- package/dist/SkeletonJson.js +892 -641
- package/dist/SkeletonRendererCore.d.ts +58 -0
- package/dist/SkeletonRendererCore.js +310 -0
- package/dist/Skin.d.ts +20 -16
- package/dist/Skin.js +58 -53
- package/dist/Slider.d.ts +46 -0
- package/dist/Slider.js +115 -0
- package/dist/SliderData.d.ts +58 -0
- package/dist/SliderData.js +59 -0
- package/dist/SliderPose.d.ts +37 -0
- package/dist/SliderPose.js +40 -0
- package/dist/Slot.d.ts +16 -38
- package/dist/Slot.js +37 -60
- package/dist/SlotData.d.ts +5 -12
- package/dist/SlotData.js +7 -15
- package/dist/SlotPose.d.ts +59 -0
- package/dist/SlotPose.js +81 -0
- package/dist/Texture.d.ts +1 -0
- package/dist/Texture.js +2 -1
- package/dist/TextureAtlas.d.ts +3 -3
- package/dist/TextureAtlas.js +49 -49
- package/dist/TransformConstraint.d.ts +16 -28
- package/dist/TransformConstraint.js +72 -209
- package/dist/TransformConstraintData.d.ts +108 -20
- package/dist/TransformConstraintData.js +274 -24
- package/dist/TransformConstraintPose.d.ts +45 -0
- package/dist/TransformConstraintPose.js +52 -0
- package/dist/Triangulator.d.ts +1 -1
- package/dist/Triangulator.js +91 -107
- package/dist/{Updatable.d.ts → Update.d.ts} +5 -12
- package/dist/Update.js +30 -0
- package/dist/Utils.d.ts +12 -3
- package/dist/Utils.js +78 -37
- package/dist/attachments/Attachment.d.ts +27 -19
- package/dist/attachments/Attachment.js +59 -35
- package/dist/attachments/AttachmentLoader.d.ts +14 -14
- package/dist/attachments/AttachmentLoader.js +1 -1
- package/dist/attachments/BoundingBoxAttachment.d.ts +1 -1
- package/dist/attachments/BoundingBoxAttachment.js +2 -2
- package/dist/attachments/ClippingAttachment.d.ts +10 -3
- package/dist/attachments/ClippingAttachment.js +12 -3
- package/dist/attachments/{HasTextureRegion.d.ts → HasSequence.d.ts} +11 -14
- package/dist/attachments/HasSequence.js +30 -0
- package/dist/attachments/MeshAttachment.d.ts +28 -35
- package/dist/attachments/MeshAttachment.js +85 -97
- package/dist/attachments/PathAttachment.d.ts +3 -3
- package/dist/attachments/PathAttachment.js +6 -6
- package/dist/attachments/PointAttachment.d.ts +11 -6
- package/dist/attachments/PointAttachment.js +8 -3
- package/dist/attachments/RegionAttachment.d.ts +25 -27
- package/dist/attachments/RegionAttachment.js +101 -113
- package/dist/attachments/Sequence.d.ts +31 -6
- package/dist/attachments/Sequence.js +79 -13
- package/dist/esm/spine-core.min.mjs +2 -2
- package/dist/esm/spine-core.mjs +7651 -6090
- package/dist/esm/spine-core.mjs.map +4 -4
- package/dist/iife/spine-core.js +7651 -6090
- package/dist/iife/spine-core.js.map +4 -4
- package/dist/iife/spine-core.min.js +2 -2
- package/dist/index.d.ts +32 -11
- package/dist/index.js +33 -12
- package/dist/polyfills.js +4 -5
- package/package.json +1 -1
- package/dist/Updatable.js +0 -30
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Bs=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}},zt=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}},q=class mt{constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}static WHITE=new mt(1,1,1,1);static RED=new mt(1,0,0,1);static GREEN=new mt(0,1,0,1);static BLUE=new mt(0,0,1,1);static MAGENTA=new mt(1,0,1,1);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 mt){return s.setFromString(e)}},R=class nt{static PI=3.1415927;static PI2=nt.PI*2;static invPI2=1/nt.PI2;static radiansToDegrees=180/nt.PI;static radDeg=nt.radiansToDegrees;static degreesToRadians=nt.PI/180;static degRad=nt.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*nt.degRad)}static sinDeg(e){return Math.sin(e*nt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*nt.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 nt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),h=s-e;return r<=(i-e)/h?e+Math.sqrt(r*h*(i-e)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Qe=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ze=class extends Qe{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}},Vs=class extends Ze{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},P=class bt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,h){for(let o=s,a=r;o<s+h;o++,a++)i[a]=e[o]}static arrayFill(e,s,i,r){for(let h=s;h<i;h++)e[h]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let h=r;h<s;h++)e[h]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:bt.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(bt.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(bt.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 bt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return bt.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)]}},Ls=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)}}},vt=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}},Yt=class{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}},Ns=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)}},Ds=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}},Ut=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},lt=class ks extends Ut{static nextID=0;id=ks.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,h,o){i=h+(i>>1)*o;let a=e.bone.skeleton,n=e.deform,l=this.vertices,c=this.bones;if(!c){n.length>0&&(l=n);let u=e.bone,w=u.worldX,b=u.worldY,p=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,A=h;A<i;v+=2,A+=o){let I=l[v],C=l[v+1];r[A]=I*p+C*g+w,r[A+1]=I*x+C*y+b}return}let f=0,d=0;for(let u=0;u<s;u+=2){let w=c[f];f+=w+1,d+=w}let m=a.bones;if(n.length==0)for(let u=h,w=d*3;u<i;u+=o){let b=0,p=0,g=c[f++];for(g+=f;f<g;f++,w+=3){let x=m[c[f]],y=l[w],v=l[w+1],A=l[w+2];b+=(y*x.a+v*x.b+x.worldX)*A,p+=(y*x.c+v*x.d+x.worldY)*A}r[u]=b,r[u+1]=p}else{let u=n;for(let w=h,b=d*3,p=d<<1;w<i;w+=o){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,b+=3,p+=2){let v=m[c[f]],A=l[b]+u[p],I=l[b+1]+u[p+1],C=l[b+2];g+=(A*v.a+I*v.b+v.worldX)*C,x+=(A*v.c+I*v.d+v.worldY)*C}r[w]=g,r[w+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ts=class Nt{static _nextID=0;id=Nt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Nt(this.regions.length);return P.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 h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return Nt._nextID++}},es=(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",t))(es||{}),ss=[0,1,2,3,4,5,6],Mt=class{name;timelines=[];timelineIds=new zt;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,h,o,a){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let n=this.timelines;for(let l=0,c=n.length;l<c;l++)n[l].apply(t,e,s,r,h,o,a)}},is=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(is||{}),rs=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(rs||{}),O={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},H=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=P.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}},rt=class extends H{curves;constructor(t,e,s){super(t,s),this.curves=P.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=P.newFloatArray(e);P.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,h,o,a,n,l,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(i-h*2+a)*.03,u=(r-o*2+n)*.03,w=((h-a)*3-i+l)*.006,b=((o-n)*3-r+c)*.006,p=m*2+w,g=u*2+b,x=(h-i)*.3+m+w*.16666667,y=(o-r)*.3+u+b*.16666667,v=i+x,A=r+y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let n=this.frames[e],l=this.frames[e+s];return l+(t-n)/(r[i]-n)*(r[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=t){let n=r[i-2],l=r[i-1];return l+(t-n)/(r[i]-n)*(r[i+1]-l)}e+=this.getFrameEntries();let o=r[h-2],a=r[h-1];return a+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-a)}},st=class extends rt{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],h=e[s+1];return h+(t-r)/(e[s+2]-r)*(e[s+2+1]-h);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 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);switch(s){case 0:return r+h*e;case 1:case 2:h+=r-i}return i+h*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);return s==0?r+(h-r)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,r,h){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}return s==0?r+(h-r)*e:i+(h-i)*e}getScaleValue(t,e,s,i,r,h){const o=this.frames;if(t<o[0]){switch(s){case 0:return h;case 1:return r+(h-r)*e}return r}let a=this.getCurveValue(t)*h;if(e==1)return s==3?r+a-h:a;if(i==1)switch(s){case 0:return h+(Math.abs(a)*R.signum(h)-h)*e;case 1:case 2:return r+(Math.abs(a)*R.signum(r)-r)*e}else{let n=0;switch(s){case 0:return n=Math.abs(h)*R.signum(a),n+(a-n)*e;case 1:case 2:return n=Math.abs(r)*R.signum(a),n+(a-n)*e}}return r+(a-h)*e}},Xt=class extends rt{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}},At=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,r,h,a.rotation,a.data.rotation))}},_t=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*r,a.y+=(a.data.y-a.y)*r}return}let l=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.x=a.data.x+l*r,a.y=a.data.y+c*r;break;case 1:case 2:a.x+=(a.data.x+l-a.x)*r,a.y+=(a.data.y+c-a.y)*r;break;case 3:a.x+=l*r,a.y+=c*r}}},Gt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,r,h,a.x,a.data.x))}},$t=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,r,h,a.y,a.data.y))}},Ht=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*r,a.scaleY+=(a.data.scaleY-a.scaleY)*r}return}let l,c,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(l*=a.data.scaleX,c*=a.data.scaleY,r==1)h==3?(a.scaleX+=l-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=l,a.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*r,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*r;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*r,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*r;break;case 3:a.scaleX+=(l-a.data.scaleX)*r,a.scaleY+=(c-a.data.scaleY)*r}else switch(h){case 0:m=Math.abs(a.data.scaleX)*R.signum(l),u=Math.abs(a.data.scaleY)*R.signum(c),a.scaleX=m+(l-m)*r,a.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(a.scaleX)*R.signum(l),u=Math.abs(a.scaleY)*R.signum(c),a.scaleX=m+(l-m)*r,a.scaleY=u+(c-u)*r;break;case 3:a.scaleX+=(l-a.data.scaleX)*r,a.scaleY+=(c-a.data.scaleY)*r}}}},jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,r,h,o,a.scaleX,a.data.scaleX))}},Jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,r,h,o,a.scaleY,a.data.scaleY))}},Kt=class extends Xt{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*r,a.shearY+=(a.data.shearY-a.shearY)*r}return}let l=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.shearX=a.data.shearX+l*r,a.shearY=a.data.shearY+c*r;break;case 1:case 2:a.shearX+=(a.data.shearX+l-a.shearX)*r,a.shearY+=(a.data.shearY+c-a.shearY)*r;break;case 3:a.shearX+=l*r,a.shearY+=c*r}}},Qt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,r,h,a.shearX,a.data.shearX))}},Zt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,r,h,a.shearY,a.data.shearY))}},te=class extends H{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,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;if(o==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[H.search(n,s,2)+1]}},ee=class extends rt{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,h){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]=h}apply(t,e,s,i,r,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let b=a.data.color;switch(h){case 0:l.setFromColor(b);return;case 1:l.add((b.r-l.r)*r,(b.g-l.g)*r,(b.b-l.b)*r,(b.a-l.a)*r)}return}let c=0,f=0,d=0,m=0,u=H.search(n,s,5),w=this.curves[u/5];switch(w){case 0:let b=n[u];c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];let p=(s-b)/(n[u+5]-b);c+=(n[u+5+1]-c)*p,f+=(n[u+5+2]-f)*p,d+=(n[u+5+3]-d)*p,m+=(n[u+5+4]-m)*p;break;case 1:c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,w-2),f=this.getBezierValue(s,u,2,w+18-2),d=this.getBezierValue(s,u,3,w+18*2-2),m=this.getBezierValue(s,u,4,w+18*3-2)}r==1?l.set(c,f,d,m):(h==0&&l.setFromColor(a.data.color),l.add((c-l.r)*r,(f-l.g)*r,(d-l.b)*r,(m-l.a)*r))}},se=class extends rt{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,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let w=a.data.color;switch(h){case 0:l.r=w.r,l.g=w.g,l.b=w.b;return;case 1:l.r+=(w.r-l.r)*r,l.g+=(w.g-l.g)*r,l.b+=(w.b-l.b)*r}return}let c=0,f=0,d=0,m=H.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let w=n[m];c=n[m+1],f=n[m+2],d=n[m+3];let b=(s-w)/(n[m+4]-w);c+=(n[m+4+1]-c)*b,f+=(n[m+4+2]-f)*b,d+=(n[m+4+3]-d)*b;break;case 1:c=n[m+1],f=n[m+2],d=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2),d=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)l.r=c,l.g=f,l.b=d;else{if(h==0){let w=a.data.color;l.r=w.r,l.g=w.g,l.b=w.b}l.r+=(c-l.r)*r,l.g+=(f-l.g)*r,l.b+=(d-l.b)*r}}},ie=class extends st{slotIndex=0;constructor(t,e,s){super(t,e,O.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*r}return}let l=this.getCurveValue(s);r==1?n.a=l:(h==0&&(n.a=a.data.color.a),n.a+=(l-n.a)*r)}},re=class extends rt{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,h,o,a,n){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]=h,this.frames[t+5]=o,this.frames[t+6]=a,this.frames[t+7]=n}apply(t,e,s,i,r,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*r,(y.g-l.g)*r,(y.b-l.b)*r,(y.a-l.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 f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,8),x=this.curves[g>>3];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];let v=(s-y)/(n[g+8]-y);f+=(n[g+8+1]-f)*v,d+=(n[g+8+2]-d)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,w+=(n[g+8+5]-w)*v,b+=(n[g+8+6]-b)*v,p+=(n[g+8+7]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),w=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),p=this.getBezierValue(s,g,7,x+18*6-2)}if(r==1)l.set(f,d,m,u),c.r=w,c.g=b,c.b=p;else{if(h==0){l.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((f-l.r)*r,(d-l.g)*r,(m-l.b)*r,(u-l.a)*r),c.r+=(w-c.r)*r,c.g+=(b-c.g)*r,c.b+=(p-c.b)*r}}},ae=class extends rt{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,h,o,a){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]=h,this.frames[t+5]=o,this.frames[t+6]=a}apply(t,e,s,i,r,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*r,l.g+=(y.g-l.g)*r,l.b+=(y.b-l.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 f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,7),x=this.curves[g/7];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];let v=(s-y)/(n[g+7]-y);f+=(n[g+7+1]-f)*v,d+=(n[g+7+2]-d)*v,m+=(n[g+7+3]-m)*v,w+=(n[g+7+4]-w)*v,b+=(n[g+7+5]-b)*v,p+=(n[g+7+6]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),w=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),p=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)l.r=f,l.g=d,l.b=m,c.r=w,c.g=b,c.b=p;else{if(h==0){let y=a.data.color,v=a.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(f-l.r)*r,l.g+=(d-l.g)*r,l.b+=(m-l.b)*r,c.r+=(w-c.r)*r,c.g+=(b-c.g)*r,c.b+=(p-c.b)*r}}},ut=class extends H{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,h,o){let a=t.slots[this.slotIndex];if(a.bone.active){if(o==1){h==0&&this.setAttachment(t,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,a,a.data.attachmentName);return}this.setAttachment(t,a,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},ne=class extends rt{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,h,o,a,n,l,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(i-h*2+a)*.03,u=n*.03-o*.06,w=((h-a)*3-i+l)*.006,b=(o-n+.33333333)*.018,p=m*2+w,g=u*2+b,x=(h-i)*.3+m+w*.16666667,y=o*.3+u+b*.16666667,v=i+x,A=y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let a=this.frames[e];return(t-a)/(this.frames[e+this.getFrameEntries()]-a);case 1:return 0}if(i-=2,s[i]>t){let a=this.frames[e];return s[i+1]*(t-a)/(s[i]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let a=s[i-2],n=s[i-1];return n+(t-a)/(s[i]-a)*(s[i+1]-n)}let h=s[r-2],o=s[r-1];return o+(1-o)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,r,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof lt)||n.timelineAttachment!=this.attachment)return;let l=a.deform;l.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:l.length=0;return;case 1:if(r==1){l.length=0;return}l.length=f;let g=n;if(g.bones){r=1-r;for(var m=0;m<f;m++)l[m]*=r}else{let x=g.vertices;for(var m=0;m<f;m++)l[m]+=(x[m]-l[m])*r}}return}if(l.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(r==1)if(h==3){let x=n;if(x.bones)for(let y=0;y<f;y++)l[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)l[v]+=g[v]-y[v]}}else P.arrayCopy(g,0,l,0,f);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<f;v++)l[v]=g[v]*r;else{let v=y.vertices;for(let A=0;A<f;A++){let I=v[A];l[A]=I+(g[A]-I)*r}}break}case 1:case 2:for(let y=0;y<f;y++)l[y]+=(g[y]-l[y])*r;break;case 3:let x=n;if(x.bones)for(let y=0;y<f;y++)l[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<f;v++)l[v]+=(g[v]-y[v])*r}}return}let u=H.search1(d,s),w=this.getCurvePercent(s,u),b=c[u],p=c[u+1];if(r==1)if(h==3){let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];l[x]+=y+(p[x]-y)*w}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];l[y]+=v+(p[y]-v)*w-x[y]}}}else for(let g=0;g<f;g++){let x=b[g];l[g]=x+(p[g]-x)*w}else switch(h){case 0:{let x=n;if(x.bones)for(let y=0;y<f;y++){let v=b[y];l[y]=(v+(p[y]-v)*w)*r}else{let y=x.vertices;for(let v=0;v<f;v++){let A=b[v],I=y[v];l[v]=I+(A+(p[v]-A)*w-I)*r}}break}case 1:case 2:for(let x=0;x<f;x++){let y=b[x];l[x]+=(y+(p[x]-y)*w-l[x])*r}break;case 3:let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];l[x]+=(y+(p[x]-y)*w)*r}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];l[y]+=(v+(p[y]-v)*w-x[y])*r}}}}},Ft=class Ts extends H{static propertyIds=[""+O.event];events;constructor(e){super(e,Ts.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,h,o,a){if(!r)return;let n=this.frames,l=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,h,o,a),s=-1;else if(s>=n[l-1])return;if(i<n[0])return;let c=0;if(s<n[0])c=0;else{c=H.search1(n,s)+1;let f=n[c];for(;c>0&&n[c-1]==f;)c--}for(;c<l&&i>=n[c];c++)r.push(this.events[c])}},wt=class Ys extends H{static propertyIds=[""+O.drawOrder];drawOrders;constructor(e){super(e,Ys.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,h,o,a){if(a==1){o==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(o==0||o==1)&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let n=H.search1(this.frames,i),l=this.drawOrders[n];if(!l)P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,f=e.slots;for(let d=0,m=l.length;d<m;d++)c[d]=f[l[d]]}}},le=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,h,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]=h?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,i,r,h,o){let a=t.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*r,a.softness+=(a.data.softness-a.softness)*r,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let l=0,c=0,f=H.search(n,s,6),d=this.curves[f/6];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+6]-m);l+=(n[f+6+1]-l)*u,c+=(n[f+6+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(a.mix=a.data.mix+(l-a.data.mix)*r,a.softness=a.data.softness+(c-a.data.softness)*r,o==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0)):(a.mix+=(l-a.mix)*r,a.softness+=(c-a.softness)*r,o==0&&(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0))}},oe=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,o,a){let n=this.frames;t*=7,n[t]=e,n[t+1]=s,n[t+2]=i,n[t+3]=r,n[t+4]=h,n[t+5]=o,n[t+6]=a}apply(t,e,s,i,r,h,o){let a=t.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let p=a.data;switch(h){case 0:a.mixRotate=p.mixRotate,a.mixX=p.mixX,a.mixY=p.mixY,a.mixScaleX=p.mixScaleX,a.mixScaleY=p.mixScaleY,a.mixShearY=p.mixShearY;return;case 1:a.mixRotate+=(p.mixRotate-a.mixRotate)*r,a.mixX+=(p.mixX-a.mixX)*r,a.mixY+=(p.mixY-a.mixY)*r,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*r,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*r,a.mixShearY+=(p.mixShearY-a.mixShearY)*r}return}let l,c,f,d,m,u,w=H.search(n,s,7),b=this.curves[w/7];switch(b){case 0:let p=n[w];l=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];let g=(s-p)/(n[w+7]-p);l+=(n[w+7+1]-l)*g,c+=(n[w+7+2]-c)*g,f+=(n[w+7+3]-f)*g,d+=(n[w+7+4]-d)*g,m+=(n[w+7+5]-m)*g,u+=(n[w+7+6]-u)*g;break;case 1:l=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];break;default:l=this.getBezierValue(s,w,1,b-2),c=this.getBezierValue(s,w,2,b+18-2),f=this.getBezierValue(s,w,3,b+18*2-2),d=this.getBezierValue(s,w,4,b+18*3-2),m=this.getBezierValue(s,w,5,b+18*4-2),u=this.getBezierValue(s,w,6,b+18*5-2)}if(h==0){let p=a.data;a.mixRotate=p.mixRotate+(l-p.mixRotate)*r,a.mixX=p.mixX+(c-p.mixX)*r,a.mixY=p.mixY+(f-p.mixY)*r,a.mixScaleX=p.mixScaleX+(d-p.mixScaleX)*r,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*r,a.mixShearY=p.mixShearY+(u-p.mixShearY)*r}else a.mixRotate+=(l-a.mixRotate)*r,a.mixX+=(c-a.mixX)*r,a.mixY+=(f-a.mixY)*r,a.mixScaleX+=(d-a.mixScaleX)*r,a.mixScaleY+=(m-a.mixScaleY)*r,a.mixShearY+=(u-a.mixShearY)*r}},he=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,r,h,a.position,a.data.position))}},ce=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,r,h,a.spacing,a.data.spacing))}},de=class extends rt{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 h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=r}apply(t,e,s,i,r,h,o){let a=t.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*r,a.mixX+=(a.data.mixX-a.mixX)*r,a.mixY+=(a.data.mixY-a.mixY)*r}return}let l,c,f,d=H.search(n,s,4),m=this.curves[d>>2];switch(m){case 0:let u=n[d];l=n[d+1],c=n[d+2],f=n[d+3];let w=(s-u)/(n[d+4]-u);l+=(n[d+4+1]-l)*w,c+=(n[d+4+2]-c)*w,f+=(n[d+4+3]-f)*w;break;case 1:l=n[d+1],c=n[d+2],f=n[d+3];break;default:l=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),f=this.getBezierValue(s,d,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(l-u.mixRotate)*r,a.mixX=u.mixX+(c-u.mixX)*r,a.mixY=u.mixY+(f-u.mixY)*r}else a.mixRotate+=(l-a.mixRotate)*r,a.mixX+=(c-a.mixX)*r,a.mixY+=(f-a.mixY)*r}},ct=class extends st{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,o){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,r,h,this.get(l),this.setup(l),n))}else a=t.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,r,h,this.get(a),this.setup(a)))}},fe=class extends ct{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}},ue=class extends ct{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}},me=class extends ct{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}},ge=class extends ct{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}},xe=class extends ct{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}},we=class extends ct{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}},be=class extends ct{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}},pe=class Ms extends H{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,Ms.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,h,o,a){let n;if(this.constraintIndex!=-1&&(n=e.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],h,o,a),s=-1;else if(s>=l[l.length-1])return;if(!(i<l[0])&&(s<l[0]||i>=l[H.search1(l,s)+1]))if(n!=null)n.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},ye=class dt extends H{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 dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,h){let o=this.frames;e*=dt.ENTRIES,o[e]=s,o[e+dt.MODE]=i|r<<4,o[e+dt.DELAY]=h}apply(e,s,i,r,h,o,a){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,c=this.attachment;if(l!=c&&(!(l instanceof lt)||l.timelineAttachment!=c))return;if(a==1){o==0&&(n.sequenceIndex=-1);return}let f=this.frames;if(i<f[0]){(o==0||o==1)&&(n.sequenceIndex=-1);return}let d=H.search(f,i,dt.ENTRIES),m=f[d],u=f[d+dt.MODE],w=f[d+dt.DELAY];if(!this.attachment.sequence)return;let b=u>>4,p=this.attachment.sequence.regions.length,g=ss[u&15];if(g!=0)switch(b+=(i-m)/w+1e-5|0,g){case 1:b=Math.min(p-1,b);break;case 2:b%=p;break;case 3:{let x=(p<<1)-2;b=x==0?0:b%x,b>=p&&(b=x-b);break}case 4:b=Math.max(p-1-b,0);break;case 5:b=p-1-b%p;break;case 6:{let x=(p<<1)-2;b=x==0?0:(b+p-1)%x,b>=p&&(b=x-b)}}n.sequenceIndex=b}},Os=class Dt{static _emptyAnimation=new Mt("<empty>",[],0);static emptyAnimation(){return Dt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ns(this);propertyIDs=new zt;animationsChanged=!1;trackEntryPool=new vt(()=>new as);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 h=s[i];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=e*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+e)*a.timeScale,h.trackTime+=o,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.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 d=0,m=i.length;d<m;d++){let u=i[d];if(!u||u.delay>0)continue;r=!0;let w=d==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,e,w):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let p=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,I=A.length;if(d==0&&b==1||w==3){d==0&&(p=!0);for(let C=0;C<I;C++){P.webkit602BugfixHelper(b,w);var h=A[C];h instanceof ut?this.applyAttachmentTimeline(h,e,y,w,p):h.apply(e,g,y,v,b,w,0)}}else{let C=u.timelineMode,T=u.shortestRotation,M=!T&&u.timelinesRotation.length!=I<<1;M&&(u.timelinesRotation.length=I<<1);for(let Y=0;Y<I;Y++){let F=A[Y],E=C[Y]==Et?w:0;!T&&F instanceof At?this.applyRotateTimeline(F,e,y,b,E,u.timelinesRotation,Y<<1,M):F instanceof ut?this.applyAttachmentTimeline(F,e,y,w,p):(P.webkit602BugfixHelper(b,w),F.apply(e,g,y,v,b,E,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Se,a=e.slots,n=0,l=e.slots.length;n<l;n++){var c=a[n];if(c.attachmentState==o){var f=c.data.attachmentName;c.setAttachment(f?e.getAttachment(c.data.index,f):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 h=0;e.mixDuration==0?(h=1,i==1&&(i=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let o=h<r.mixAttachmentThreshold,a=h<r.mixDrawOrderThreshold,n=r.animation.timelines,l=n.length,c=r.alpha*e.interruptAlpha,f=c*(1-h),d=r.animationLast,m=r.getAnimationTime(),u=m,w=null;if(r.reverse?u=r.animation.duration-u:h<r.eventThreshold&&(w=this.events),i==3)for(let b=0;b<l;b++)n[b].apply(s,d,u,w,f,i,1);else{let b=r.timelineMode,p=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=l<<1;x&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let y=0;y<l;y++){let v=n[y],A=1,I,C=0;switch(b[y]){case Et:if(!a&&v instanceof wt)continue;I=i,C=f;break;case ve:I=0,C=f;break;case Ae:I=i,C=c;break;case Rt:I=0,C=c;break;default:I=0;let T=p[y];C=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=C,!g&&v instanceof At?this.applyRotateTimeline(v,s,u,C,I,r.timelinesRotation,y<<1,x):v instanceof ut?this.applyAttachmentTimeline(v,s,u,I,o&&C>=r.alphaAttachmentThreshold):(P.webkit602BugfixHelper(C,i),a&&v instanceof wt&&I==0&&(A=0),v.apply(s,d,u,w,C,I,A))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(e,s,i,r,h){var o=s.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(r==0||r==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,e.attachmentNames[H.search1(e.frames,i)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Se))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,s,i,r,h,o,a,n){if(n&&(o[a]=0),r==1){e.apply(s,0,i,null,1,h,0);return}let l=s.bones[e.boneIndex];if(!l.active)return;let c=e.frames,f=0,d=0;if(i<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:f=l.rotation,d=l.data.rotation}else f=h==0?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(i);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[a];else{let w=0,b=0;n?(w=0,b=u):(w=o[a],b=o[a+1]);let p=w-w%360;m=u+p;let g=u>=0,x=w>=0;Math.abs(b)<=90&&R.signum(b)!=R.signum(u)&&(Math.abs(w-p)>180?(m+=360*R.signum(w),x=g):p!=0?m-=360*R.signum(w):x=g),x!=g&&(m+=360*R.signum(w)),o[a]=m}o[a+1]=u,l.rotation=f+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,h=r-i,o=e.trackLast%h,a=this.events,n=0,l=a.length;for(;n<l;n++){let f=a[n];if(f.time<o)break;f.time>r||this.queue.event(e,f)}let c=!1;if(e.loop)if(h==0)c=!0;else{const f=Math.floor(e.trackTime/h);c=f>0&&f>Math.floor(e.trackLast/h)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);n<l;n++){let f=a[n];f.time<i||this.queue.event(e,f)}}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,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let o=this.trackEntry(e,s,i,h);return this.setCurrent(e,o,r),this.queue.drain(),o}addAnimation(e,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(e,s,i,h);return h?(h.next=o,o.previous=h,r<=0&&(r=Math.max(r+h.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,Dt.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,Dt.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 h=this.tracks[i];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(P.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=i,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=r?this.data.getMix(r.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}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!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,h=e.timelineMode;h.length=r;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<r;n++)h[n]=a.addAll(i[n].getPropertyIds())?Rt:Ae;return}t:for(let n=0;n<r;n++){let l=i[n],c=l.getPropertyIds();if(!a.addAll(c))h[n]=Et;else if(!s||l instanceof ut||l instanceof wt||l instanceof Ft||!s.animation.hasTimeline(c))h[n]=ve;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(e.mixDuration>0){h[n]=os,o[n]=f;continue t}break}h[n]=Rt}}}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()}},as=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(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=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let 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}},ns=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects;for(let e=0;e<t.length;e+=2){let s=t[e],i=t[e+1],r=this.animState.listeners.slice();switch(s){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<r.length;o++){let a=r[o];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<r.length;o++){let a=r[o];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<r.length;o++){let a=r[o];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<r.length;o++){let a=r[o];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<r.length;o++){let a=r[o];a.complete&&a.complete(i)}break;case 5:let h=t[e+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<r.length;o++){let a=r[o];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ls=(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",t))(ls||{}),qs=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Et=0,ve=1,Ae=2,Rt=3,os=4,Se=1,hs=2,Ws=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}},Ie=class Xs extends lt{color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Xs(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ce=class Fs extends lt{endSlot=null;color=new q(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Fs(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},cs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Pt=(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",t))(Pt||{}),ds=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(ds||{}),fs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},zs=class extends cs{setFilters(t,e){}setWraps(t,e){}dispose(){}},ke=class{pages=new Array;regions=new Array;constructor(t){let e=new Us(t),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=P.enumValue(Pt,s[1]),l.magFilter=P.enumValue(Pt,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},i.pma=l=>{l.pma=s[1]=="true"};var r={};r.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},r.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},r.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},r.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},r.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},r.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let o=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)o=null,h=e.readLine();else if(o){let l=new Te(o,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let f=r[s[0]];if(f)f(l);else{a||(a=[]),n||(n=[]),a.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));n.push(d)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),a&&a.length>0&&n&&n.length>0&&(l.names=a,l.values=n,a=null,n=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new us(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=i[s[0]];l&&l(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()}},Us=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 h=e.indexOf(",",r);if(h==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},us=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;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}},Te=class extends fs{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)}},Bt=class _e extends lt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new q(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new q(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=P.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,o=0,a=0;if(this.region instanceof Te){let n=this.region,l=n.page,c=l.width,f=l.height;switch(n.degrees){case 90:r-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/f,o=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<i;d+=2)s[d]=r+e[d+1]*o,s[d+1]=h+(1-e[d])*a;return;case 180:r-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/f,o=n.originalWidth/c,a=n.originalHeight/f;for(let d=0;d<i;d+=2)s[d]=r+(1-e[d])*o,s[d+1]=h+(1-e[d+1])*a;return;case 270:r-=n.offsetY/c,h-=n.offsetX/f,o=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<i;d+=2)s[d]=r+(1-e[d+1])*o,s[d+1]=h+e[d]*a;return}r-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/f,o=n.originalWidth/c,a=n.originalHeight/f}else this.region?(o=this.region.u2-r,a=this.region.v2-h):(r=h=0,o=a=1);for(let n=0;n<i;n+=2)s[n]=r+e[n]*o,s[n+1]=h+e[n+1]*a}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 _e(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),P.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),P.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,h,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,h,o)}newLinkedMesh(){let e=new _e(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}},St=class Es extends lt{lengths=[];closed=!1;constantSpeed=!1;color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Es(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},ms=class Rs extends lt{x=0;y=0;rotation=0;color=new q(.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*R.degRad,i=Math.cos(s),r=Math.sin(s),h=i*e.a+r*e.b,o=i*e.c+r*e.d;return R.atan2Deg(o,h)}copy(){let e=new Rs(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Ye=class Ps extends Ut{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new q(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new q(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,h=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,a=h+this.region.width*i,n=o+this.region.height*r,l=this.rotation*R.degRad,c=Math.cos(l),f=Math.sin(l),d=this.x,m=this.y,u=h*c+d,w=h*f,b=o*c+m,p=o*f,g=a*c+d,x=a*f,y=n*c+m,v=n*f,A=this.offset;A[0]=u-p,A[1]=b+w,A[2]=u-v,A[3]=y+w,A[4]=g-v,A[5]=y+x,A[6]=g-p,A[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 h=e.bone,o=this.offset,a=h.worldX,n=h.worldY,l=h.a,c=h.b,f=h.c,d=h.d,m=0,u=0;m=o[0],u=o[1],s[i]=m*l+u*c+a,s[i+1]=m*f+u*d+n,i+=r,m=o[2],u=o[3],s[i]=m*l+u*c+a,s[i+1]=m*f+u*d+n,i+=r,m=o[4],u=o[5],s[i]=m*l+u*c+a,s[i+1]=m*f+u*d+n,i+=r,m=o[6],u=o[7],s[i]=m*l+u*c+a,s[i+1]=m*f+u*d+n}copy(){let e=new Ps(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,P.arrayCopy(this.uvs,0,e.uvs,0,8),P.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},_s=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let o=s.getPath(e,r),a=this.atlas.findRegion(o);if(a==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");i[r]=a}}newRegionAttachment(t,e,s,i){let r=new Ye(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=h}return r}newMeshAttachment(t,e,s,i){let r=new Bt(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=h}return r}newBoundingBoxAttachment(t,e){return new Ie(e)}newPathAttachment(t,e){return new St(e)}newPointAttachment(t,e){return new ms(e)}newClippingAttachment(t,e){return new Ce(e)}},Me=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new q;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}},Vt=(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",t))(Vt||{}),Xe=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(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,h,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=o;let a=this.parent;if(!a){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,w=(s+h)*R.degRad,b=(s+90+o)*R.degRad;this.a=Math.cos(w)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(w)*i*u,this.d=Math.sin(b)*r*u,this.worldX=t*m+d.x,this.worldY=e*u+d.y;return}let n=a.a,l=a.b,c=a.c,f=a.d;switch(this.worldX=n*t+l*e+a.worldX,this.worldY=c*t+f*e+a.worldY,this.inherit){case 0:{const d=(s+h)*R.degRad,m=(s+90+o)*R.degRad,u=Math.cos(d)*i,w=Math.cos(m)*r,b=Math.sin(d)*i,p=Math.sin(m)*r;this.a=n*u+l*b,this.b=n*w+l*p,this.c=c*u+f*b,this.d=c*w+f*p;return}case 1:{const d=(s+h)*R.degRad,m=(s+90+o)*R.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(m)*r,this.c=Math.sin(d)*i,this.d=Math.sin(m)*r;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=d,c*=m;let u=n*n+c*c,w=0;u>1e-4?(u=Math.abs(n*f*m-l*d*c)/u,l=c*u,f=n*u,w=Math.atan2(c,n)*R.radDeg):(n=0,c=0,w=90-Math.atan2(f,l)*R.radDeg);const b=(s+h-w)*R.degRad,p=(s+o-w+90)*R.degRad,g=Math.cos(b)*i,x=Math.cos(p)*r,y=Math.sin(b)*i,v=Math.sin(p)*r;this.a=n*g-l*y,this.b=n*x-l*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=R.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(n*d+l*m)/this.skeleton.scaleX,w=(c*d+f*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+w*w);b>1e-5&&(b=1/b),u*=b,w*=b,b=Math.sqrt(u*u+w*w),this.inherit==3&&n*f-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(w,u);const p=Math.cos(s)*b,g=Math.sin(s)*b;h*=R.degRad,o=(90+o)*R.degRad;const x=Math.cos(h)*i,y=Math.cos(o)*r,v=Math.sin(h)*i,A=Math.sin(o)*r;this.a=u*x+p*v,this.b=u*y+p*A,this.c=w*x+g*v,this.d=w*y+g*A;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)*R.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)*R.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,h=1/(e*r-s*i),o=r*h,a=s*h,n=i*h,l=e*h,c=this.worldX-t.worldX,f=this.worldY-t.worldY;this.ax=c*o-f*a,this.ay=f*l-c*n;let d,m,u,w;if(this.inherit==1)d=this.a,m=this.b,u=this.c,w=this.d;else{switch(this.inherit){case 2:{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,h=1/(e*r-s*i),o=r*h,a=s*h;break}case 3:case 4:let b=R.cosDeg(this.rotation),p=R.sinDeg(this.rotation);e=(e*b+s*p)/this.skeleton.scaleX,i=(i*b+r*p)/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==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=R.PI/2+Math.atan2(i,e);s=Math.cos(x)*g,r=Math.sin(x)*g,h=1/(e*r-s*i),o=r*h,a=s*h,n=i*h,l=e*h}d=o*this.a-a*this.c,m=o*this.b-a*this.d,u=l*this.c-n*this.a,w=l*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let b=d*w-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*w,b)*R.radDeg,this.arotation=Math.atan2(u,d)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+w*w),this.ashearY=0,this.arotation=90-Math.atan2(w,m)*R.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*R.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=R.sinDeg(t),s=R.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*R.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=R.sinDeg(t),s=R.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*R.radDeg}rotateWorld(t){t*=R.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}},It=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Gs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new xs,i=new gs){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,h=>{this.success(e,t,h),i(h)},(h,o)=>{const a=`Couldn't load binary ${t}: status ${h}, ${o}`;this.error(s,t,a),r(a)})}))}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,h=>{this.success(e,t,h),i(h)},(h,o)=>{const a=`Couldn't load JSON ${t}: status ${h}, ${o}`;this.error(s,t,a),r(a)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),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(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.createTexture(t,a);this.success(e,t,n),i(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.createTexture(t,a);this.success(e,t,n),i(n)},a.onerror=()=>{const n=`Couldn't load image: ${t}`;this.error(s,t,n),r(n)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),h=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,a)=>{this.downloader.downloadText(t,n=>{try{const l=this.createTextureAtlas(t,n);let c=l.pages.length,f=!1;if(c===0){this.success(e,t,l),o(l);return}for(let d of l.pages)this.loadTexture(i?i[d.name]:h+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(e,t,l),o(l)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,w),a(w)}f=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),a(c)}},(n,l)=>{const c=`Couldn't load texture atlas ${t}: status ${n}, ${l}`;this.error(s,t,c),a(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,h)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(t,o);this.success(e,t,a),r(a)}catch(a){const n=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,n),h(n)}},(o,a)=>{const n=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,n),h(n)})}))}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 ke){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 ke(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}},gs=class Ot{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Ot.AVAILABLE_CACHES.get(e);if(s)return s;const i=new Ot;return Ot.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},xs=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 h=()=>{this.finish(t,r.status,r.responseText)};r.onload=h,r.onerror=h,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 h=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):h()},r.onerror=h,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 h=r.length-1,o=i.length;h<o;h+=2)i[h].apply(null,r)}},Fe=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}},Ee=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},ws=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,h,o){let a=t.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,l=a.b,c=a.c,f=a.d,d=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case 1:m=(e-t.worldX)*R.signum(t.skeleton.scaleX),u=(s-t.worldY)*R.signum(t.skeleton.scaleY);break;case 2:let p=Math.abs(n*f-l*c)/Math.max(1e-4,n*n+c*c),g=n/t.skeleton.scaleX,x=c/t.skeleton.scaleY;l=-x*p*t.skeleton.scaleX,f=g*p*t.skeleton.scaleY,d+=Math.atan2(x,g)*R.radDeg;default:let y=e-a.worldX,v=s-a.worldY,A=n*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*l)/A-t.ax,u=(v*n-y*c)/A-t.ay)}d+=Math.atan2(u,m)*R.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=t.ascaleX,b=t.ascaleY;if(i||r){switch(t.inherit){case 3:case 4:m=e-t.worldX,u=s-t.worldY}const p=t.data.length*w;if(p>1e-4){const g=m*m+u*u;if(i&&g<p*p||r&&g>p*p){const x=(Math.sqrt(g)/p-1)*o+1;w*=x,h&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*o,w,b,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,h,o,a,n){if(t.inherit!=0||e.inherit!=0)return;let l=t.ax,c=t.ay,f=t.ascaleX,d=t.ascaleY,m=f,u=d,w=e.ascaleX,b=0,p=0,g=0;f<0?(f=-f,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),w<0?(w=-w,p=180):p=0;let x=e.ax,y=0,v=0,A=0,I=t.a,C=t.b,T=t.c,M=t.d,Y=Math.abs(f-d)<=1e-4;!Y||h?(y=0,v=I*x+t.worldX,A=T*x+t.worldY):(y=e.ay,v=I*x+C*y+t.worldX,A=T*x+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");I=F.a,C=F.b,T=F.c,M=F.d;let E=I*M-C*T,k=v-F.worldX,X=A-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let V=(k*M-X*C)*E-l,N=(X*I-k*T)*E-c,L=Math.sqrt(V*V+N*N),D=e.data.length*w,$,U;if(L<1e-4){this.apply1(t,s,i,!1,h,!1,n),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}k=s-F.worldX,X=i-F.worldY;let j=(k*M-X*C)*E-l,B=(X*I-k*T)*E-c,W=j*j+B*B;if(a!=0){a*=f*(w+1)*.5;let J=Math.sqrt(W),K=J-L-D*f+a;if(K>0){let Q=Math.min(1,K/(a*2))-1;Q=(K-a*(1-Q*Q))/J,j-=Q*j,B-=Q*B,W=j*j+B*B}}t:if(Y){D*=f;let J=(W-L*L-D*D)/(2*L*D);J<-1?(J=-1,U=Math.PI*r):J>1?(J=1,U=0,h&&(I=(Math.sqrt(W)/(L+D)-1)*n+1,m*=I,o&&(u*=I))):U=Math.acos(J)*r,I=L+D*J,C=D*Math.sin(U),$=Math.atan2(B*I-j*C,j*I+B*C)}else{I=f*D,C=d*D;let J=I*I,K=C*C,Q=Math.atan2(B,j);T=K*L*L+J*W-J*K;let it=-2*K*L,gt=K-J;if(M=it*it-4*gt*T,M>=0){let xt=Math.sqrt(M);it<0&&(xt=-xt),xt=-(it+xt)*.5;let yt=xt/gt,Ke=T/xt,Tt=Math.abs(yt)<Math.abs(Ke)?yt:Ke;if(yt=W-Tt*Tt,yt>=0){X=Math.sqrt(yt)*r,$=Q-Math.atan2(X,Tt),U=Math.atan2(X/d,(Tt-L)/f);break t}}let pt=R.PI,Ct=L-I,qt=Ct*Ct,He=0,je=0,kt=L+I,Wt=kt*kt,Je=0;T=-I*L/(J-K),T>=-1&&T<=1&&(T=Math.acos(T),k=I*Math.cos(T)+L,X=C*Math.sin(T),M=k*k+X*X,M<qt&&(pt=T,qt=M,Ct=k,He=X),M>Wt&&(je=T,Wt=M,kt=k,Je=X)),W<=(qt+Wt)*.5?($=Q-Math.atan2(He*r,Ct),U=pt*r):($=Q-Math.atan2(Je*r,kt),U=je*r)}let G=Math.atan2(y,x)*g,tt=t.arotation;$=($-G)*R.radDeg+b-tt,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(l,c,tt+$*n,m,u,0,0),tt=e.arotation,U=((U+G)*R.radDeg-e.ashearX)*g+p-tt,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(x,y,tt+U*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Re=class extends It{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)}},Pe=class extends It{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=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Be=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Be||{}),Ve=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ve||{}),Le=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Le||{}),bs=class ft{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,h=e.bones.length;r<h;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 St))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==0&&h==0)return;let o=this.data,a=o.rotateMode==0,n=o.rotateMode==2,l=this.bones,c=l.length,f=a?c:c+1,d=P.setArraySize(this.spaces,f),m=n?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(n)for(let A=0,I=f-1;A<I;A++){let C=l[A],T=C.data.length,M=T*C.a,Y=T*C.c;m[A]=Math.sqrt(M*M+Y*Y)}P.arrayFill(d,1,f,u);break;case 3:let y=0;for(let A=0,I=f-1;A<I;){let C=l[A],T=C.data.length;if(T<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=T*C.a,Y=T*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=F,y+=F}}if(y>0){y=f/y*u;for(let A=1;A<f;A++)d[A]*=y}break;default:let v=o.spacingMode==0;for(let A=0,I=f-1;A<I;){let C=l[A],T=C.data.length;if(T<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=T*C.a,Y=T*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=(v?T+u:u)*F/T}}}let w=this.computeWorldPositions(s,f,a),b=w[0],p=w[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?R.degRad:-R.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(b-A.worldX)*r,A.worldY+=(p-A.worldY)*h;let I=w[v],C=w[v+1],T=I-b,M=C-p;if(n){let Y=m[y];if(Y!=0){let F=(Math.sqrt(T*T+M*M)/Y-1)*i+1;A.a*=F,A.c*=F}}if(b=I,p=C,i>0){let Y=A.a,F=A.b,E=A.c,k=A.d,X=0,V=0,N=0;if(a?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(M,T),X-=Math.atan2(E,Y),x){V=Math.cos(X),N=Math.sin(X);let L=A.data.length;b+=(L*(V*Y-N*E)-T)*i,p+=(L*(N*Y+V*E)-M)*i}else X+=g;X>R.PI?X-=R.PI2:X<-R.PI&&(X+=R.PI2),X*=i,V=Math.cos(X),N=Math.sin(X),A.a=V*Y-N*E,A.b=V*F-N*k,A.c=N*Y+V*E,A.d=N*F+V*k}A.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,h=this.position,o=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,l=e.closed,c=e.worldVerticesLength,f=c/6,d=ft.NONE;if(!e.constantSpeed){let L=e.lengths;f-=l?1:2;let D=L[f];this.data.positionMode==1&&(h*=D);let $;switch(this.data.spacingMode){case 2:$=D;break;case 3:$=D/s;break;default:$=1}n=P.setArraySize(this.world,8);for(let U=0,j=0,B=0;U<s;U++,j+=3){let W=o[U]*$;h+=W;let G=h;if(l)G%=D,G<0&&(G+=D),B=0;else if(G<0){d!=ft.BEFORE&&(d=ft.BEFORE,e.computeWorldVertices(r,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>D){d!=ft.AFTER&&(d=ft.AFTER,e.computeWorldVertices(r,c-6,4,n,0,2)),this.addAfterPosition(G-D,n,0,a,j);continue}for(;;B++){let tt=L[B];if(!(G>tt)){if(B==0)G/=tt;else{let J=L[B-1];G=(G-J)/(tt-J)}break}}B!=d&&(d=B,l&&B==f?(e.computeWorldVertices(r,c-4,4,n,0,2),e.computeWorldVertices(r,0,4,n,4,2)):e.computeWorldVertices(r,B*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,j,i||U>0&&W==0)}return a}l?(c+=2,n=P.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,n,0,2),e.computeWorldVertices(r,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(f--,c-=4,n=P.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,n,0,2));let m=P.setArraySize(this.curves,f),u=0,w=n[0],b=n[1],p=0,g=0,x=0,y=0,v=0,A=0,I=0,C=0,T=0,M=0,Y=0,F=0,E=0,k=0;for(let L=0,D=2;L<f;L++,D+=6)p=n[D],g=n[D+1],x=n[D+2],y=n[D+3],v=n[D+4],A=n[D+5],I=(w-p*2+x)*.1875,C=(b-g*2+y)*.1875,T=((p-x)*3-w+v)*.09375,M=((g-y)*3-b+A)*.09375,Y=I*2+T,F=C*2+M,E=(p-w)*.75+I+T*.16666667,k=(g-b)*.75+C+M*.16666667,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(E*E+k*k),E+=Y,k+=F,u+=Math.sqrt(E*E+k*k),E+=Y+T,k+=F+M,u+=Math.sqrt(E*E+k*k),m[L]=u,w=v,b=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let V=this.segments,N=0;for(let L=0,D=0,$=0,U=0;L<s;L++,D+=3){let j=o[L]*X;h+=j;let B=h;if(l)B%=u,B<0&&(B+=u),$=0;else if(B<0){this.addBeforePosition(B,n,0,a,D);continue}else if(B>u){this.addAfterPosition(B-u,n,c-4,a,D);continue}for(;;$++){let W=m[$];if(!(B>W)){if($==0)B/=W;else{let G=m[$-1];B=(B-G)/(W-G)}break}}if($!=d){d=$;let W=$*6;for(w=n[W],b=n[W+1],p=n[W+2],g=n[W+3],x=n[W+4],y=n[W+5],v=n[W+6],A=n[W+7],I=(w-p*2+x)*.03,C=(b-g*2+y)*.03,T=((p-x)*3-w+v)*.006,M=((g-y)*3-b+A)*.006,Y=I*2+T,F=C*2+M,E=(p-w)*.3+I+T*.16666667,k=(g-b)*.3+C+M*.16666667,N=Math.sqrt(E*E+k*k),V[0]=N,W=1;W<8;W++)E+=Y,k+=F,Y+=T,F+=M,N+=Math.sqrt(E*E+k*k),V[W]=N;E+=Y,k+=F,N+=Math.sqrt(E*E+k*k),V[8]=N,E+=Y+T,k+=F+M,N+=Math.sqrt(E*E+k*k),V[9]=N,U=0}for(B*=N;;U++){let W=V[U];if(!(B>W)){if(U==0)B/=W;else{let G=V[U-1];B=U+(B-G)/(W-G)}break}}this.addCurvePosition(B*.1,w,b,p,g,x,y,v,A,a,D,i||L>0&&j==0)}return a}addBeforePosition(e,s,i,r,h){let o=s[i],a=s[i+1],n=s[i+2]-o,l=s[i+3]-a,c=Math.atan2(l,n);r[h]=o+e*Math.cos(c),r[h+1]=a+e*Math.sin(c),r[h+2]=c}addAfterPosition(e,s,i,r,h){let o=s[i+2],a=s[i+3],n=o-s[i],l=a-s[i+1],c=Math.atan2(l,n);r[h]=o+e*Math.cos(c),r[h+1]=a+e*Math.sin(c),r[h+2]=c}addCurvePosition(e,s,i,r,h,o,a,n,l,c,f,d){if(e==0||isNaN(e)){c[f]=s,c[f+1]=i,c[f+2]=Math.atan2(h-i,r-s);return}let m=e*e,u=m*e,w=1-e,b=w*w,p=b*w,g=w*e,x=g*3,y=w*x,v=x*e,A=s*p+r*y+o*v+n*u,I=i*p+h*y+a*v+l*u;c[f]=A,c[f+1]=I,d&&(e<.001?c[f+2]=Math.atan2(h-i,r-s):c[f+2]=Math.atan2(I-(i*b+h*g*2+a*m),A-(s*b+r*g*2+o*m)))}},$s=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,h=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=n.time;const c=o.worldX,f=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=f;else{let d=this.remaining,m=this.inertia,u=this.data.step,w=this.skeleton.data.referenceScale,b=-1,p=this.data.limit*l,g=p*Math.abs(n.scaleY);if(p*=Math.abs(n.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>p?p:x<-p?-p:x,this.ux=c}if(i){const x=(this.uy-f)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=f}if(d>=u){b=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*w*n.scaleX,A=this.gravity*w*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),i&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),d-=u;while(d>=u)}s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r||h){let x=Math.atan2(o.c,o.a),y=0,v=0,A=0,I=this.cx-o.worldX,C=this.cy-o.worldY;if(I>p?I=p:I<-p&&(I=-p),C>g?C=g:C<-g&&(C=-g),r){A=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(C+this.ty,I+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*R.invPI2-.5)*R.PI2)*m,T=this.rotateOffset*A+x,y=Math.cos(T),v=Math.sin(T),h&&(T=a*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(I*y+C*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=a*o.getWorldScaleX();T>0&&(this.scaleOffset+=(I*y+C*v)*m/T)}if(d=this.remaining,d>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,M=this.strength,Y=this.wind,F=vs.yDown?-this.gravity:this.gravity,E=a/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((Y*v+F*y)*E+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,d<u)break;const k=this.rotateOffset*A+x;y=Math.cos(k),v=Math.sin(k)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r){let n=this.rotateOffset*e,l=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=n*this.data.rotate,l=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-l*o.d,o.d=l*f+c*o.d),d+=n*this.data.shearX,l=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-l*o.c,o.c=l*f+c*o.c}else n*=this.data.rotate,l=Math.sin(n),c=Math.cos(n),f=o.a,o.a=c*f-l*o.c,o.c=l*f+c*o.c,f=o.b,o.b=c*f-l*o.d,o.d=l*f+c*o.d}if(h){const n=1+this.scaleOffset*e*this.data.scaleX;o.a*=n,o.c*=n}t!=3&&(this.tx=a*o.a,this.ty=a*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*R.degRad,r=Math.cos(i),h=Math.sin(i),o=this.cx-t,a=this.cy-e;this.translate(o*r-a*h-o,o*h+a*r-a)}},ps=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 q,this.darkColor=t.darkColor?new q:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof lt)||!(this.attachment instanceof lt)||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}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Yt;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,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,f=a.d,d=n*f-l*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)-Math.atan2(v,x)+m;I>R.PI?I-=R.PI2:I<-R.PI&&(I+=R.PI2),I*=t;let C=Math.cos(I),T=Math.sin(I);g.a=C*x-T*v,g.b=C*y-T*A,g.c=T*x+C*v,g.d=T*y+C*A}if(o){let x=this.temp;a.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(n*n+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(l*l+f*f)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(h>0){let x=g.b,y=g.d,v=Math.atan2(y,x),A=Math.atan2(f,l)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>R.PI?A-=R.PI2:A<-R.PI&&(A+=R.PI2),A=v+(A+u)*h;let I=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*I,g.d=Math.sin(A)*I}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,f=a.d,d=n*f-l*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)+m;I>R.PI?I-=R.PI2:I<-R.PI&&(I+=R.PI2),I*=t;let C=Math.cos(I),T=Math.sin(I);g.a=C*x-T*v,g.b=C*y-T*A,g.c=T*x+C*v,g.d=T*y+C*A}if(o){let x=this.temp;a.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(n*n+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(l*l+f*f)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(h>0){let x=Math.atan2(f,l)-Math.atan2(c,n);x>R.PI?x-=R.PI2:x<-R.PI&&(x+=R.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-R.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*A,g.d=Math.sin(x)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],f=c.arotation;t!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*t);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,w=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&w!=0&&(w=(w+(o.ascaleY-w+this.data.offsetScaleY)*r)/w);let b=c.ashearY;h!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],f=c.arotation+(o.arotation+this.data.offsetRotation)*t,d=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),w=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}},vs=class Ge{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 Ge.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 Xe(i,this,null);else{let h=this.bones[i.parent.index];r=new Xe(i,this,h),h.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],h=new ps(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new ws(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new ys(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new bs(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new $s(i,this))}this.color=new q(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let u=s[d];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let w=this.bones[d[m].index];do w.sorted=!1,w.active=!0,w=w.parent;while(w)}}let i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,a=i.length,n=r.length,l=h.length,c=this.physicsConstraints.length,f=a+n+l+c;t:for(let d=0;d<f;d++){for(let m=0;m<a;m++){let u=i[m];if(u.data.order==d){this.sortIkConstraint(u);continue t}}for(let m=0;m<n;m++){let u=r[m];if(u.data.order==d){this.sortTransformConstraint(u);continue t}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==d){this.sortPhysicsConstraint(u);continue t}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.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 h=i[i.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&P.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 n=0,l=this.data.skins.length;n<l;n++)this.sortPathConstraintAttachment(this.data.skins[n],i,r);let h=s.getAttachment();h instanceof St&&this.sortPathConstraintAttachmentWith(h,r);let o=e.bones,a=o.length;for(let n=0;n<a;n++)this.sortBone(o[n]);this._updateCache.push(e);for(let n=0;n<a;n++)this.sortReset(o[n].children);for(let n=0;n<a;n++)o[n].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.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 h=s[r];this.sortBone(h.parent),this.sortBone(h)}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 h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof St))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,o=i.length;h<o;){let a=i[h++];for(a+=h;h<a;)this.sortBone(r[i[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&P.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,h=s.length;r<h;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,h=i.length;r<h;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,p=i.length;b<p;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 h=s.a,o=s.b,a=s.c,n=s.d;r.worldX=h*this.x+o*this.y+s.worldX,r.worldY=a*this.x+n*this.y+s.worldY;const l=(r.rotation+r.shearX)*R.degRad,c=(r.rotation+90+r.shearY)*R.degRad,f=Math.cos(l)*r.scaleX,d=Math.cos(c)*r.scaleY,m=Math.sin(l)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(h*f+o*m)*this.scaleX,r.b=(h*d+o*u)*this.scaleX,r.c=(a*f+n*m)*this.scaleY,r.d=(a*d+n*u)*this.scaleY;let w=this._updateCache;for(let b=0,p=w.length;b<p;b++){let g=w[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;P.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 h=s[i];if(h.data.name==e)return h}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 h=s[i];if(h.data.name==e)return h}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 h=s[i],o=h.data.attachmentName;if(o){let a=e.getAttachment(i,o);a&&h.setAttachment(a)}}}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,h=i.length;r<h;r++){let o=i[r];if(o.data.name==e){let a=null;if(s&&(a=this.getAttachment(r,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(a);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 Yt,i=new Yt;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 h=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,f=h.length;c<f;c++){let d=h[c];if(!d.bone.active)continue;let m=0,u=null,w=null,b=d.getAttachment();if(b instanceof Ye)m=8,u=P.setArraySize(i,m,0),b.computeWorldVertices(d,u,0,2),w=Ge.quadTriangles;else if(b instanceof Bt){let p=b;m=p.worldVerticesLength,u=P.setArraySize(i,m,0),p.computeWorldVertices(d,0,m,u,0,2),w=p.triangles}else if(b instanceof Ce&&r!=null){r.clipStart(d,b);continue}if(u&&w){r!=null&&r.isClipping()&&(r.clipTriangles(u,w,w.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let x=u[p],y=u[p+1];o=Math.min(o,x),a=Math.min(a,y),n=Math.max(n,x),l=Math.max(l,y)}}r?.clipEndWithSlot(d)}r?.clipEnd(),e.set(o,a),s.set(n-o,l-a)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let h=0,o=r.length;h<o;h++)r[h].rotate(e,s,i)}},As=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(As||{}),Ss=class extends It{_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)}},Ne=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}},De=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Lt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new q(.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],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||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],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||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 Bt?(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 De(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 De(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],h=r.getAttachment();if(h&&s<e.attachments.length){let o=e.attachments[s];for(let a in o){let n=o[a];if(h==n){let l=this.getAttachment(s,a);l&&r.setAttachment(l);break}}}s++}}},Oe=class{index=0;name;boneData;color=new q(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;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}},qe=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(qe||{}),We=class extends It{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)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ne;s.name="";let i=new Is(t),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.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 a=0;a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let f=l==0?null:s.bones[i.readInt(!0)],d=new Me(l,c,f);d.rotation=i.readFloat(),d.x=i.readFloat()*e,d.y=i.readFloat()*e,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*e,d.inherit=i.readByte(),d.skinRequired=i.readBoolean(),o&&(q.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new Oe(l,c,f);q.rgba8888ToColor(d.color,i.readInt32());let m=i.readInt32();m!=-1&&q.rgb888ToColor(d.darkColor=new q,m),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Re(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(d.softness=i.readFloat()*e),s.ikConstraints.push(d)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new We(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=i.readFloat()),(m&16)!=0&&(d.offsetX=i.readFloat()*e),(m&32)!=0&&(d.offsetY=i.readFloat()*e),(m&64)!=0&&(d.offsetScaleX=i.readFloat()),(m&128)!=0&&(d.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(d.offsetShearY=i.readFloat()),(m&2)!=0&&(d.mixRotate=i.readFloat()),(m&4)!=0&&(d.mixX=i.readFloat()),(m&8)!=0&&(d.mixY=i.readFloat()),(m&16)!=0&&(d.mixScaleX=i.readFloat()),(m&32)!=0&&(d.mixScaleY=i.readFloat()),(m&64)!=0&&(d.mixShearY=i.readFloat()),s.transformConstraints.push(d)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Pe(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)];const m=i.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=i.readFloat()),d.position=i.readFloat(),d.positionMode==0&&(d.position*=e),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=e),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}a=i.readInt(!0);for(let l=0,c;l<a;l++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ss(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let m=i.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=i.readFloat()),(m&4)!=0&&(d.y=i.readFloat()),(m&8)!=0&&(d.rotate=i.readFloat()),(m&16)!=0&&(d.scaleX=i.readFloat()),(m&32)!=0&&(d.shearX=i.readFloat()),d.limit=((m&64)!=0?i.readFloat():5e3)*e,d.step=1/i.readUnsignedByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=(m&128)!=0?i.readFloat():1,d.wind=i.readFloat(),d.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(d)}let n=this.readSkin(i,s,!0,o);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(P.setArraySize(s.skins,a=l+i.readInt(!0));l<a;l++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}a=this.linkedMeshes.length;for(let l=0;l<a;l++){let c=this.linkedMeshes[l];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let f=new Ee(c);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}a=i.readInt(!0);for(let l=0;l<a;l++){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,h=0;if(s){if(h=t.readInt(!0),h==0)return null;r=new Lt("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");r=new Lt(o),i&&q.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let a=0,n=r.bones.length;a<n;a++)r.bones[a]=e.bones[t.readInt(!0)];for(let a=0,n=t.readInt(!0);a<n;a++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let o=0;o<h;o++){let a=t.readInt(!0);for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(t,e,r,a,c,i);f&&r.setAttachment(a,c,f)}}return r}readAttachment(t,e,s,i,r,h){let o=this.scale,a=t.readByte();const n=(a&8)!=0?t.readStringRef():r;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let l=(a&16)!=0?t.readStringRef():null;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null;let d=(a&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),g=t.readFloat();l||(l=n);let x=this.attachmentLoader.newRegionAttachment(s,n,l,f);return x?(x.path=l,x.x=m*o,x.y=u*o,x.scaleX=w,x.scaleY=b,x.rotation=d,x.width=p*o,x.height=g*o,q.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let l=this.readVertices(t,(a&16)!=0),c=h?t.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,n);return f?(f.worldVerticesLength=l.length,f.vertices=l.vertices,f.bones=l.bones,h&&q.rgba8888ToColor(f.color,c),f):null}case 2:{let l=(a&16)!=0?t.readStringRef():n;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=t.readInt(!0),m=this.readVertices(t,(a&128)!=0),u=this.readFloatArray(t,m.length,1),w=this.readShortArray(t,(m.length-d-2)*3);let b=[],p=0,g=0;h&&(b=this.readShortArray(t,t.readInt(!0)),p=t.readFloat(),g=t.readFloat()),l||(l=n);let x=this.attachmentLoader.newMeshAttachment(s,n,l,f);return x?(x.path=l,q.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=w,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,h&&(x.edges=b,x.width=p*o,x.height=g*o),x):null}case 3:{const l=(a&16)!=0?t.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=(a&128)!=0,m=t.readInt(!0),u=t.readStringRef();let w=0,b=0;h&&(w=t.readFloat(),b=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,n,l,f);return p?(p.path=l,q.rgba8888ToColor(p.color,c),p.sequence=f,h&&(p.width=w*o,p.height=b*o),this.linkedMeshes.push(new js(p,m,i,u,d)),p):null}case 4:{const l=(a&16)!=0,c=(a&32)!=0,f=this.readVertices(t,(a&64)!=0),d=P.newArray(f.length/6,0);for(let w=0,b=d.length;w<b;w++)d[w]=t.readFloat()*o;const m=h?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=l,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,h&&q.rgba8888ToColor(u.color,m),u):null}case 5:{const l=t.readFloat(),c=t.readFloat(),f=t.readFloat(),d=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*o,m.y=f*o,m.rotation=l,h&&q.rgba8888ToColor(m.color,d),m):null}case 6:{const l=t.readInt(!0),c=this.readVertices(t,(a&16)!=0);let f=h?t.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,n);return d?(d.endSlot=e.slots[l],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&q.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(t){let e=new ts(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 Js;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let h=new Array,o=new Array;for(let a=0;a<i;a++){let n=t.readInt(!0);o.push(n);for(let l=0;l<n;l++)o.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return r.vertices=P.toFloatArray(h),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 n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0),w=u-1;switch(m){case oi:{let b=new ut(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat(),t.readStringRef());i.push(b);break}case hi:{let b=t.readInt(!0),p=new ee(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,C=0;p.setFrame(I,g,x,y,v,A),I!=w;I++){let T=t.readFloat(),M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(I);break;case ht:z(t,p,C++,I,0,g,T,x,M,1),z(t,p,C++,I,1,g,T,y,Y,1),z(t,p,C++,I,2,g,T,v,F,1),z(t,p,C++,I,3,g,T,A,E,1)}g=T,x=M,y=Y,v=F,A=E}i.push(p);break}case ci:{let b=t.readInt(!0),p=new se(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,I=0;p.setFrame(A,g,x,y,v),A!=w;A++){let C=t.readFloat(),T=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(A);break;case ht:z(t,p,I++,A,0,g,C,x,T,1),z(t,p,I++,A,1,g,C,y,M,1),z(t,p,I++,A,2,g,C,v,Y,1)}g=C,x=T,y=M,v=Y}i.push(p);break}case di:{let b=t.readInt(!0),p=new re(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let M=0,Y=0;p.setFrame(M,g,x,y,v,A,I,C,T),M!=w;M++){let F=t.readFloat(),E=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(M);break;case ht:z(t,p,Y++,M,0,g,F,x,E,1),z(t,p,Y++,M,1,g,F,y,k,1),z(t,p,Y++,M,2,g,F,v,X,1),z(t,p,Y++,M,3,g,F,A,V,1),z(t,p,Y++,M,4,g,F,I,N,1),z(t,p,Y++,M,5,g,F,C,L,1),z(t,p,Y++,M,6,g,F,T,D,1)}g=F,x=E,y=k,v=X,A=V,I=N,C=L,T=D}i.push(p);break}case fi:{let b=t.readInt(!0),p=new ae(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let T=0,M=0;p.setFrame(T,g,x,y,v,A,I,C),T!=w;T++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(T);break;case ht:z(t,p,M++,T,0,g,Y,x,F,1),z(t,p,M++,T,1,g,Y,y,E,1),z(t,p,M++,T,2,g,Y,v,k,1),z(t,p,M++,T,3,g,Y,A,X,1),z(t,p,M++,T,4,g,Y,I,V,1),z(t,p,M++,T,5,g,Y,C,N,1)}g=Y,x=F,y=E,v=k,A=X,I=V,C=N}i.push(p);break}case ui:{let b=new ie(u,t.readInt(!0),c),p=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,p,g),x!=w;x++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(x);break;case ht:z(t,b,y++,x,0,p,v,g,A,1)}p=v,g=A}i.push(b)}}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0);if(m==li){let b=new te(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat(),t.readByte());i.push(b);continue}let w=t.readInt(!0);switch(m){case Ks:i.push(Z(t,new At(u,w,c),1));break;case Qs:i.push(ze(t,new _t(u,w,c),r));break;case Zs:i.push(Z(t,new Gt(u,w,c),r));break;case ti:i.push(Z(t,new $t(u,w,c),r));break;case ei:i.push(ze(t,new Ht(u,w,c),1));break;case si:i.push(Z(t,new jt(u,w,c),1));break;case ii:i.push(Z(t,new Jt(u,w,c),1));break;case ri:i.push(ze(t,new Kt(u,w,c),1));break;case ai:i.push(Z(t,new Qt(u,w,c),1));break;case ni:i.push(Z(t,new Zt(u,w,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new le(f,t.readInt(!0),c),u=t.readByte(),w=t.readFloat(),b=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,p=(u&4)!=0?t.readFloat()*r:0;for(let g=0,x=0;m.setFrame(g,w,b,p,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,A=(u&4)!=0?t.readFloat()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(z(t,m,x++,g,0,w,y,b,v,1),z(t,m,x++,g,1,w,y,p,A,r)),w=y,b=v,p=A}i.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new oe(f,t.readInt(!0),c),u=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,b,p,g,x,y),v!=d;v++){let I=t.readFloat(),C=t.readFloat(),T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),E=t.readFloat();switch(t.readByte()){case ot:m.setStepped(v);break;case ht:z(t,m,A++,v,0,u,I,w,C,1),z(t,m,A++,v,1,u,I,b,T,1),z(t,m,A++,v,2,u,I,p,M,1),z(t,m,A++,v,3,u,I,g,Y,1),z(t,m,A++,v,4,u,I,x,F,1),z(t,m,A++,v,5,u,I,y,E,1)}u=I,w=C,b=T,p=M,g=Y,x=F,y=E}i.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=t.readInt(!0);d<m;d++){const u=t.readByte(),w=t.readInt(!0),b=t.readInt(!0);switch(u){case xi:i.push(Z(t,new he(w,b,c),f.positionMode==0?r:1));break;case wi:i.push(Z(t,new ce(w,b,c),f.spacingMode==0||f.spacingMode==1?r:1));break;case bi:let p=new de(w,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,I=0,C=p.getFrameCount()-1;p.setFrame(A,g,x,y,v),A!=C;A++){let T=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case ot:p.setStepped(A);break;case ht:z(t,p,I++,A,0,g,T,x,M,1),z(t,p,I++,A,1,g,T,y,Y,1),z(t,p,I++,A,2,g,T,v,F,1)}g=T,x=M,y=Y,v=F}i.push(p)}}}for(let n=0,l=t.readInt(!0);n<l;n++){const c=t.readInt(!0)-1;for(let f=0,d=t.readInt(!0);f<d;f++){const m=t.readByte(),u=t.readInt(!0);if(m==ki){const b=new pe(u,c);for(let p=0;p<u;p++)b.setFrame(p,t.readFloat());i.push(b);continue}const w=t.readInt(!0);switch(m){case pi:i.push(Z(t,new fe(u,w,c),1));break;case yi:i.push(Z(t,new ue(u,w,c),1));break;case vi:i.push(Z(t,new me(u,w,c),1));break;case Ai:i.push(Z(t,new ge(u,w,c),1));break;case Si:i.push(Z(t,new xe(u,w,c),1));break;case Ii:i.push(Z(t,new we(u,w,c),1));break;case Ci:i.push(Z(t,new be(u,w,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=s.skins[t.readInt(!0)];for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readInt(!0);for(let u=0,w=t.readInt(!0);u<w;u++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case mi:{let v=p,A=v.bones,I=v.vertices,C=A?I.length/3*2:I.length,T=t.readInt(!0),M=new ne(x,T,m,v),Y=t.readFloat();for(let F=0,E=0;;F++){let k,X=t.readInt(!0);if(X==0)k=A?P.newFloatArray(C):I;else{k=P.newFloatArray(C);let N=t.readInt(!0);if(X+=N,r==1)for(let L=N;L<X;L++)k[L]=t.readFloat();else for(let L=N;L<X;L++)k[L]=t.readFloat()*r;if(!A)for(let L=0,D=k.length;L<D;L++)k[L]+=I[L]}if(M.setFrame(F,Y,k),F==y)break;let V=t.readFloat();switch(t.readByte()){case ot:M.setStepped(F);break;case ht:z(t,M,E++,F,0,Y,V,0,1,1)}Y=V}i.push(M);break}case gi:{let v=new ye(x,m,p);for(let A=0;A<x;A++){let I=t.readFloat(),C=t.readInt32();v.setFrame(A,I,ss[C&15],C>>4,t.readFloat())}i.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let n=new wt(h),l=s.slots.length;for(let c=0;c<h;c++){let f=t.readFloat(),d=t.readInt(!0),m=P.newArray(l,0);for(let p=l-1;p>=0;p--)m[p]=-1;let u=P.newArray(l-d,0),w=0,b=0;for(let p=0;p<d;p++){let g=t.readInt(!0);for(;w!=g;)u[b++]=w++;m[w+t.readInt(!0)]=w++}for(;w<l;)u[b++]=w++;for(let p=l-1;p>=0;p--)m[p]==-1&&(m[p]=u[--b]);n.setFrame(c,f,m)}i.push(n)}let o=t.readInt(!0);if(o>0){let n=new Ft(o);for(let l=0;l<o;l++){let c=t.readFloat(),f=s.events[t.readInt(!0)],d=new Fe(c,f);d.intValue=t.readInt(!1),d.floatValue=t.readFloat(),d.stringValue=t.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=t.readFloat(),d.balance=t.readFloat()),n.setFrame(l,d)}i.push(n)}let a=0;for(let n=0,l=i.length;n<l;n++)a=Math.max(a,i[n].getDuration());return new Mt(e,i,a)}},Is=class{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}},js=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}},Js=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let h=0,o=0,a=e.getFrameCount()-1;e.setFrame(h,i,r),h!=a;h++){let n=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(h);break;case ht:z(t,e,o++,h,0,i,n,r,l,s)}i=n,r=l}return e}function ze(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,h=t.readFloat()*s;for(let o=0,a=0,n=e.getFrameCount()-1;e.setFrame(o,i,r,h),o!=n;o++){let l=t.readFloat(),c=t.readFloat()*s,f=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(o);break;case ht:z(t,e,a++,o,0,i,l,r,c,s),z(t,e,a++,o,1,i,l,h,f,s)}i=l,r=c,h=f}return e}function z(t,e,s,i,r,h,o,a,n,l){e.setBezier(s,i,r,h,a,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,o,n)}var Ks=0,Qs=1,Zs=2,ti=3,ei=4,si=5,ii=6,ri=7,ai=8,ni=9,li=10,oi=0,hi=1,ci=2,di=3,fi=4,ui=5,mi=0,gi=1,xi=0,wi=1,bi=2,pi=0,yi=1,vi=2,Ai=4,Si=5,Ii=6,Ci=7,ki=8,ot=1,ht=2,Ti=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new vt(()=>P.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=t.slots,o=h.length;s.length=0,r.freeAll(i),i.length=0;for(let a=0;a<o;a++){let n=h[a];if(!n.bone.active)continue;let l=n.getAttachment();if(l instanceof Ie){let c=l;s.push(c);let f=r.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),i.push(f),c.computeWorldVertices(n,0,c.worldVerticesLength,f,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 h=0,o=r.length;h<o;h++){let a=r[h],n=a;for(let l=0,c=a.length;l<c;l+=2){let f=n[l],d=n[l+1];t=Math.min(t,f),e=Math.min(e,d),s=Math.max(s,f),i=Math.max(i,d)}}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,h=this.minY,o=this.maxX,a=this.maxY;if(t<=r&&s<=r||e<=h&&i<=h||t>=o&&s>=o||e>=a&&i>=a)return!1;let n=(i-e)/(s-t),l=n*(r-t)+e;if(l>h&&l<a||(l=n*(o-t)+e,l>h&&l<a))return!0;let c=(h-e)/n+t;return c>r&&c<o||(c=(a-e)/n+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,h=r-2,o=!1;for(let a=0;a<r;a+=2){let n=i[a+1],l=i[h+1];if(n<s&&l>=s||l<s&&n>=s){let c=i[a];c+(s-n)/(l-n)*(i[h]-c)<e&&(o=!o)}h=a}return o}intersectsSegment(t,e,s,i){let r=this.polygons;for(let h=0,o=r.length;h<o;h++)if(this.intersectsSegmentPolygon(r[h],t,e,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,i,r){let h=t,o=t.length,a=e-i,n=s-r,l=e*r-s*i,c=h[o-2],f=h[o-1];for(let d=0;d<o;d+=2){let m=h[d],u=h[d+1],w=c*u-f*m,b=c-m,p=f-u,g=a*p-n*b,x=(l*b-a*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(l*p-n*w)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,f=u}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}},Cs=class et{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new vt(()=>new Array);polygonIndicesPool=new vt(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let a=0;a<i;a++)r[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=i;a<n;++a)h[a]=et.isConcave(a,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let a=i-1,n=0,l=1;for(;;){t:if(!h[n]){let d=r[a]<<1,m=r[n]<<1,u=r[l]<<1,w=s[d],b=s[d+1],p=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(l+1)%i;v!=a;v=(v+1)%i){if(!h[v])continue;let A=r[v]<<1,I=s[A],C=s[A+1];if(et.positiveArea(x,y,w,b,I,C)&&et.positiveArea(w,b,p,g,I,C)&&et.positiveArea(p,g,x,y,I,C))break t}break}if(l==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=l,l=(l+1)%i}o.push(r[(i+n-1)%i]),o.push(r[n]),o.push(r[(n+1)%i]),r.splice(n,1),h.splice(n,1),i--;let c=(i+n-1)%i,f=n==i?0:n;h[c]=et.isConcave(c,i,s,r),h[f]=et.isConcave(f,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 h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,l=0;for(let c=0,f=s.length;c<f;c+=3){let d=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,w=i[d],b=i[d+1],p=i[m],g=i[m+1],x=i[u],y=i[u+1],v=!1;if(n==d){let A=a.length-4,I=et.winding(a[A],a[A+1],a[A+2],a[A+3],x,y),C=et.winding(x,y,a[0],a[1],a[2],a[3]);I==l&&C==l&&(a.push(x),a.push(y),o.push(u),v=!0)}v||(a.length>0?(r.push(a),h.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(w),a.push(b),a.push(p),a.push(g),a.push(x),a.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),l=et.winding(w,b,p,g,x,y),n=d)}a.length>0&&(r.push(a),h.push(o));for(let c=0,f=r.length;c<f;c++){if(o=h[c],o.length==0)continue;let d=o[0],m=o[o.length-1];a=r[c];let u=a.length-4,w=a[u],b=a[u+1],p=a[u+2],g=a[u+3],x=a[0],y=a[1],v=a[2],A=a[3],I=et.winding(w,b,p,g,x,y);for(let C=0;C<f;C++){if(C==c)continue;let T=h[C];if(T.length!=3)continue;let M=T[0],Y=T[1],F=T[2],E=r[C],k=E[E.length-2],X=E[E.length-1];if(M!=d||Y!=m)continue;let V=et.winding(w,b,p,g,k,X),N=et.winding(k,X,x,y,v,A);V==I&&N==I&&(E.length=0,T.length=0,a.push(k),a.push(X),o.push(F),w=p,b=g,p=k,g=X,C=0)}}for(let c=r.length-1;c>=0;c--)a=r[c],a.length==0&&(r.splice(c,1),this.polygonPool.free(a),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(e,s,i,r){let h=r[(s+e-1)%s]<<1,o=r[e]<<1,a=r[(e+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[o],i[o+1],i[a],i[a+1])}static positiveArea(e,s,i,r,h,o){return e*(o-r)+i*(s-o)+h*(r-s)>=0}static winding(e,s,i,r,h,o){let a=i-e,n=r-s;return h*n-o*a+a*s-e*n>=0?1:-1}},Yi=class $e{triangulator=new Cs;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=P.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let h=this.clippingPolygon;$e.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=o.length;a<n;a++){let l=o[a];$e.makeClockwise(l),l.push(l[0]),l.push(l[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,h,o,a,n){let l,c,f,d,m,u;typeof s=="number"?(l=i,c=r,f=h,d=o,m=a,u=n):(l=s,c=i,f=r,d=h,m=o,u=a),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,l,c,f,d,m,u):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,n=a.length,l=0;h.length=0,o.length=0;for(let c=0;c<i;c+=3){let f=s[c]<<1,d=e[f],m=e[f+1];f=s[c+1]<<1;let u=e[f],w=e[f+1];f=s[c+2]<<1;let b=e[f],p=e[f+1];for(let g=0;g<n;g++){let x=h.length;if(this.clip(d,m,u,w,b,p,a[g],r)){let y=r.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,I=P.setArraySize(h,x+v*2);for(let T=0;T<y;T+=2,x+=2){let M=A[T],Y=A[T+1];I[x]=M,I[x+1]=Y}x=o.length;let C=P.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)C[x]=l,C[x+1]=l+T,C[x+2]=l+T+1;l+=v+1}else{let y=P.setArraySize(h,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=w,y[x+4]=b,y[x+5]=p,x=o.length;let v=P.setArraySize(o,x+3);v[x]=l,v[x+1]=l+1,v[x+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,s,i,r,h,o,a){let n=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=a?12:8,u=0;l.length=0,c.length=0;for(let w=0;w<i;w+=3){let b=s[w]<<1,p=e[b],g=e[b+1],x=r[b],y=r[b+1];b=s[w+1]<<1;let v=e[b],A=e[b+1],I=r[b],C=r[b+1];b=s[w+2]<<1;let T=e[b],M=e[b+1],Y=r[b],F=r[b+1];for(let E=0;E<d;E++){let k=l.length;if(this.clip(p,g,v,A,T,M,f[E],n)){let X=n.length;if(X==0)continue;let V=A-M,N=T-v,L=p-T,D=M-g,$=1/(V*L+N*(g-M)),U=X>>1,j=this.clipOutput,B=P.setArraySize(l,k+U*m);for(let G=0;G<X;G+=2,k+=m){let tt=j[G],J=j[G+1];B[k]=tt,B[k+1]=J,B[k+2]=h.r,B[k+3]=h.g,B[k+4]=h.b,B[k+5]=h.a;let K=tt-T,Q=J-M,it=(V*K+N*Q)*$,gt=(D*K+L*Q)*$,pt=1-it-gt;B[k+6]=x*it+I*gt+Y*pt,B[k+7]=y*it+C*gt+F*pt,a&&(B[k+8]=o.r,B[k+9]=o.g,B[k+10]=o.b,B[k+11]=o.a)}k=c.length;let W=P.setArraySize(c,k+3*(U-2));U--;for(let G=1;G<U;G++,k+=3)W[k]=u,W[k+1]=u+G,W[k+2]=u+G+1;u+=U+1}else{let X=P.setArraySize(l,k+3*m);X[k]=p,X[k+1]=g,X[k+2]=h.r,X[k+3]=h.g,X[k+4]=h.b,X[k+5]=h.a,a?(X[k+6]=x,X[k+7]=y,X[k+8]=o.r,X[k+9]=o.g,X[k+10]=o.b,X[k+11]=o.a,X[k+12]=v,X[k+13]=A,X[k+14]=h.r,X[k+15]=h.g,X[k+16]=h.b,X[k+17]=h.a,X[k+18]=I,X[k+19]=C,X[k+20]=o.r,X[k+21]=o.g,X[k+22]=o.b,X[k+23]=o.a,X[k+24]=T,X[k+25]=M,X[k+26]=h.r,X[k+27]=h.g,X[k+28]=h.b,X[k+29]=h.a,X[k+30]=Y,X[k+31]=F,X[k+32]=o.r,X[k+33]=o.g,X[k+34]=o.b,X[k+35]=o.a):(X[k+6]=x,X[k+7]=y,X[k+8]=v,X[k+9]=A,X[k+10]=h.r,X[k+11]=h.g,X[k+12]=h.b,X[k+13]=h.a,X[k+14]=I,X[k+15]=C,X[k+16]=T,X[k+17]=M,X[k+18]=h.r,X[k+19]=h.g,X[k+20]=h.b,X[k+21]=h.a,X[k+22]=Y,X[k+23]=F),k=c.length;let V=P.setArraySize(c,k+3);V[k]=u,V[k+1]=u+1,V[k+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let h=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,l=this.clippingPolygons,c=l.length,f=0;o.length=0,a.length=0,n.length=0;for(let d=0;d<i;d+=3){let m=s[d]<<1,u=e[m],w=e[m+1],b=r[m],p=r[m+1];m=s[d+1]<<1;let g=e[m],x=e[m+1],y=r[m],v=r[m+1];m=s[d+2]<<1;let A=e[m],I=e[m+1],C=r[m],T=r[m+1];for(let M=0;M<c;M++){let Y=o.length;if(this.clip(u,w,g,x,A,I,l[M],h)){let F=h.length;if(F==0)continue;let E=x-I,k=A-g,X=u-A,V=I-w,N=1/(E*X+k*(w-I)),L=F>>1,D=this.clipOutput,$=P.setArraySize(o,Y+L*2),U=P.setArraySize(a,Y+L*2);for(let B=0;B<F;B+=2,Y+=2){let W=D[B],G=D[B+1];$[Y]=W,$[Y+1]=G;let tt=W-A,J=G-I,K=(E*tt+k*J)*N,Q=(V*tt+X*J)*N,it=1-K-Q;U[Y]=b*K+y*Q+C*it,U[Y+1]=p*K+v*Q+T*it}Y=n.length;let j=P.setArraySize(n,Y+3*(L-2));L--;for(let B=1;B<L;B++,Y+=3)j[Y]=f,j[Y+1]=f+B,j[Y+2]=f+B+1;f+=L+1}else{let F=P.setArraySize(o,Y+6);F[Y]=u,F[Y+1]=w,F[Y+2]=g,F[Y+3]=x,F[Y+4]=A,F[Y+5]=I;let E=P.setArraySize(a,Y+3*2);E[Y]=b,E[Y+1]=p,E[Y+2]=y,E[Y+3]=v,E[Y+4]=C,E[Y+5]=T,Y=n.length;let k=P.setArraySize(n,Y+3);k[Y]=f,k[Y+1]=f+1,k[Y+2]=f+2,f+=3;break}}}}clip(e,s,i,r,h,o,a,n){let l=n,c=!1,f;a.length%4>=2?(f=n,n=this.scratch):f=this.scratch,f.length=0,f.push(e),f.push(s),f.push(i),f.push(r),f.push(h),f.push(o),f.push(e),f.push(s),n.length=0;let d=a.length-4,m=a;for(let u=0;;u+=2){let w=m[u],b=m[u+1],p=w-m[u+2],g=b-m[u+3],x=n.length,y=f;for(let A=0,I=f.length-2;A<I;){let C=y[A],T=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(w-M)>p*(b-Y),E=g*(w-C)-p*(b-T);if(E>0){if(F){n.push(M),n.push(Y);continue}let k=M-C,X=Y-T,V=E/(k*g-X*p);if(V>=0&&V<=1)n.push(C+k*V),n.push(T+X*V);else{n.push(M),n.push(Y);continue}}else if(F){let k=M-C,X=Y-T,V=E/(k*g-X*p);if(V>=0&&V<=1)n.push(C+k*V),n.push(T+X*V),n.push(M),n.push(Y);else{n.push(M),n.push(Y);continue}}c=!0}if(x==n.length)return l.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==d)break;let v=n;n=f,n.length=0,f=v}if(l!=n){l.length=0;for(let u=0,w=n.length-2;u<w;u++)l[u]=n[u]}else l.length=l.length-2;return c}static makeClockwise(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,o=0,a=0,n=0;for(let l=0,c=i-3;l<c;l+=2)h=s[l],o=s[l+1],a=s[l+2],n=s[l+3],r+=h*n-a*o;if(!(r<0))for(let l=0,c=i-2,f=i>>1;l<f;l+=2){let d=s[l],m=s[l+1],u=c-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=d,s[u+1]=m}}},Mi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ne,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=S(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let o=i.bones[h],a=null,n=S(o,"parent",null);n&&(a=s.findBone(n));let l=new Me(s.bones.length,o.name,a);l.length=S(o,"length",0)*e,l.x=S(o,"x",0)*e,l.y=S(o,"y",0)*e,l.rotation=S(o,"rotation",0),l.scaleX=S(o,"scaleX",1),l.scaleY=S(o,"scaleY",1),l.shearX=S(o,"shearX",0),l.shearY=S(o,"shearY",0),l.inherit=P.enumValue(Vt,S(o,"inherit","Normal")),l.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(i.slots)for(let h=0;h<i.slots.length;h++){let o=i.slots[h],a=o.name,n=s.findBone(o.bone);if(!n)throw new Error(`Couldn't find bone ${o.bone} for slot ${a}`);let l=new Oe(s.slots.length,a,n),c=S(o,"color",null);c&&l.color.setFromString(c);let f=S(o,"dark",null);f&&(l.darkColor=q.fromString(f)),l.attachmentName=S(o,"attachment",null),l.blendMode=P.enumValue(qe,S(o,"blend","normal")),l.visible=S(o,"visible",!0),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let o=i.ik[h],a=new Re(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);a.bones.push(c)}let n=s.findBone(o.target);if(!n)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);a.target=n,a.mix=S(o,"mix",1),a.softness=S(o,"softness",0)*e,a.bendDirection=S(o,"bendPositive",!0)?1:-1,a.compress=S(o,"compress",!1),a.stretch=S(o,"stretch",!1),a.uniform=S(o,"uniform",!1),s.ikConstraints.push(a)}if(i.transform)for(let h=0;h<i.transform.length;h++){let o=i.transform[h],a=new We(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${o.name}.`);a.bones.push(d)}let n=o.target,l=s.findBone(n);if(!l)throw new Error(`Couldn't find target bone ${n} for transform constraint ${o.name}.`);a.target=l,a.local=S(o,"local",!1),a.relative=S(o,"relative",!1),a.offsetRotation=S(o,"rotation",0),a.offsetX=S(o,"x",0)*e,a.offsetY=S(o,"y",0)*e,a.offsetScaleX=S(o,"scaleX",0),a.offsetScaleY=S(o,"scaleY",0),a.offsetShearY=S(o,"shearY",0),a.mixRotate=S(o,"mixRotate",1),a.mixX=S(o,"mixX",1),a.mixY=S(o,"mixY",a.mixX),a.mixScaleX=S(o,"mixScaleX",1),a.mixScaleY=S(o,"mixScaleY",a.mixScaleX),a.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(a)}if(i.path)for(let h=0;h<i.path.length;h++){let o=i.path[h],a=new Pe(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${o.name}.`);a.bones.push(d)}let n=o.target,l=s.findSlot(n);if(!l)throw new Error(`Couldn't find target slot ${n} for path constraint ${o.name}.`);a.target=l,a.positionMode=P.enumValue(Be,S(o,"positionMode","Percent")),a.spacingMode=P.enumValue(Ve,S(o,"spacingMode","Length")),a.rotateMode=P.enumValue(Le,S(o,"rotateMode","Tangent")),a.offsetRotation=S(o,"rotation",0),a.position=S(o,"position",0),a.positionMode==0&&(a.position*=e),a.spacing=S(o,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=e),a.mixRotate=S(o,"mixRotate",1),a.mixX=S(o,"mixX",1),a.mixY=S(o,"mixY",a.mixX),s.pathConstraints.push(a)}if(i.physics)for(let h=0;h<i.physics.length;h++){const o=i.physics[h],a=new Ss(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);const n=o.bone,l=s.findBone(n);if(l==null)throw new Error("Physics bone not found: "+n);a.bone=l,a.x=S(o,"x",0),a.y=S(o,"y",0),a.rotate=S(o,"rotate",0),a.scaleX=S(o,"scaleX",0),a.shearX=S(o,"shearX",0),a.limit=S(o,"limit",5e3)*e,a.step=1/S(o,"fps",60),a.inertia=S(o,"inertia",1),a.strength=S(o,"strength",100),a.damping=S(o,"damping",1),a.massInverse=1/S(o,"mass",1),a.wind=S(o,"wind",0),a.gravity=S(o,"gravity",0),a.mix=S(o,"mix",1),a.inertiaGlobal=S(o,"inertiaGlobal",!1),a.strengthGlobal=S(o,"strengthGlobal",!1),a.dampingGlobal=S(o,"dampingGlobal",!1),a.massGlobal=S(o,"massGlobal",!1),a.windGlobal=S(o,"windGlobal",!1),a.gravityGlobal=S(o,"gravityGlobal",!1),a.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(a)}if(i.skins)for(let h=0;h<i.skins.length;h++){let o=i.skins[h],a=new Lt(o.name);if(o.bones)for(let n=0;n<o.bones.length;n++){let l=o.bones[n],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);a.bones.push(c)}if(o.ik)for(let n=0;n<o.ik.length;n++){let l=o.ik[n],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.transform)for(let n=0;n<o.transform.length;n++){let l=o.transform[n],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.path)for(let n=0;n<o.path.length;n++){let l=o.path[n],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.physics)for(let n=0;n<o.physics.length;n++){let l=o.physics[n],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}for(let n in o.attachments){let l=s.findSlot(n);if(!l)throw new Error(`Couldn't find slot ${n} for skin ${o.name}.`);let c=o.attachments[n];for(let f in c){let d=this.readAttachment(c[f],a,l.index,f,s);d&&a.setAttachment(l.index,f,d)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let l=n.getAttachment(a.slotIndex,a.parent);if(!l)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?l:a.mesh,a.mesh.setParentMesh(l),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let o=i.events[h],a=new Ee(h);a.intValue=S(o,"int",0),a.floatValue=S(o,"float",0),a.stringValue=S(o,"string",""),a.audioPath=S(o,"audio",null),a.audioPath&&(a.volume=S(o,"volume",1),a.balance=S(o,"balance",0)),s.events.push(a)}if(i.animations)for(let h in i.animations){let o=i.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(t,e,s,i,r){let h=this.scale;switch(i=S(t,"name",i),S(t,"type","region")){case"region":{let o=S(t,"path",i),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(e,i,o,a);if(!n)return null;n.path=o,n.x=S(t,"x",0)*h,n.y=S(t,"y",0)*h,n.scaleX=S(t,"scaleX",1),n.scaleY=S(t,"scaleY",1),n.rotation=S(t,"rotation",0),n.width=t.width*h,n.height=t.height*h,n.sequence=a;let l=S(t,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let a=S(t,"color",null);return a&&o.color.setFromString(a),o}case"mesh":case"linkedmesh":{let o=S(t,"path",i),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(e,i,o,a);if(!n)return null;n.path=o;let l=S(t,"color",null);l&&n.color.setFromString(l),n.width=S(t,"width",0)*h,n.height=S(t,"height",0)*h,n.sequence=a;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new Xi(n,S(t,"skin",null),s,c,S(t,"timelines",!0))),n;let f=t.uvs;return this.readVertices(t,n,f.length),n.triangles=t.triangles,n.regionUVs=f,n.region!=null&&n.updateRegion(),n.edges=S(t,"edges",null),n.hullLength=S(t,"hull",0)*2,n}case"path":{let o=this.attachmentLoader.newPathAttachment(e,i);if(!o)return null;o.closed=S(t,"closed",!1),o.constantSpeed=S(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,o,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<t.lengths.length;c++)n[c]=t.lengths[c]*h;o.lengths=n;let l=S(t,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,i);if(!o)return null;o.x=S(t,"x",0)*h,o.y=S(t,"y",0)*h,o.rotation=S(t,"rotation",0);let a=S(t,"color",null);return a&&o.color.setFromString(a),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,i);if(!o)return null;let a=S(t,"end",null);a&&(o.endSlot=r.findSlot(a));let n=t.vertexCount;this.readVertices(t,o,n<<1);let l=S(t,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(t){if(t==null)return null;let e=new ts(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let a=P.toFloatArray(r);if(i!=1)for(let n=0,l=r.length;n<l;n++)a[n]*=i;e.vertices=a;return}let h=new Array,o=new Array;for(let a=0,n=r.length;a<n;){let l=r[a++];o.push(l);for(let c=a+l*4;a<c;a+=4)o.push(r[a]),h.push(r[a+1]*i),h.push(r[a+2]*i),h.push(r[a+3])}e.bones=o,e.vertices=P.toFloatArray(h)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let o in t.slots){let a=t.slots[o],n=s.findSlot(o);if(!n)throw new Error("Slot not found: "+o);let l=n.index;for(let c in a){let f=a[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ut(d,l);for(let u=0;u<d;u++){let w=f[u];m.setFrame(u,S(w,"time",0),S(w,"name",null))}r.push(m)}else if(c=="rgba"){let m=new ee(d,d<<2,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b,b.a);let x=f[p+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1),g=_(A,m,g,p,3,w,y,b.a,v.a,1)),w=y,b=v,u=x}r.push(m)}else if(c=="rgb"){let m=new se(d,d*3,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b);let x=f[p+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1)),w=y,b=v,u=x}r.push(m)}else if(c=="alpha")r.push(at(f,new ie(d,d,l),0,1));else if(c=="rgba2"){let m=new re(d,d*7,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.light),p=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,b.a,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,b.a,A.a,1),x=_(C,m,x,g,4,w,v,p.r,I.r,1),x=_(C,m,x,g,5,w,v,p.g,I.g,1),x=_(C,m,x,g,6,w,v,p.b,I.b,1)),w=v,b=A,p=I,u=y}r.push(m)}else if(c=="rgb2"){let m=new ae(d,d*6,l),u=f[0],w=S(u,"time",0),b=q.fromString(u.light),p=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,p.r,I.r,1),x=_(C,m,x,g,4,w,v,p.g,I.g,1),x=_(C,m,x,g,5,w,v,p.b,I.b,1)),w=v,b=A,p=I,u=y}r.push(m)}}}if(t.bones)for(let o in t.bones){let a=t.bones[o],n=s.findBone(o);if(!n)throw new Error("Bone not found: "+o);let l=n.index;for(let c in a){let f=a[c],d=f.length;if(d!=0){if(c==="rotate")r.push(at(f,new At(d,d,l),0,1));else if(c==="translate"){let m=new _t(d,d<<1,l);r.push(Ue(f,m,"x","y",0,i))}else if(c==="translatex"){let m=new Gt(d,d,l);r.push(at(f,m,0,i))}else if(c==="translatey"){let m=new $t(d,d,l);r.push(at(f,m,0,i))}else if(c==="scale"){let m=new Ht(d,d<<1,l);r.push(Ue(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new jt(d,d,l);r.push(at(f,m,1,1))}else if(c==="scaley"){let m=new Jt(d,d,l);r.push(at(f,m,1,1))}else if(c==="shear"){let m=new Kt(d,d<<1,l);r.push(Ue(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new Qt(d,d,l);r.push(at(f,m,0,1))}else if(c==="sheary"){let m=new Zt(d,d,l);r.push(at(f,m,0,1))}else if(c==="inherit"){let m=new te(d,n.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,S(w,"time",0),P.enumValue(Vt,S(w,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let o in t.ik){let a=t.ik[o],n=a[0];if(!n)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),f=new le(a.length,a.length<<1,c),d=S(n,"time",0),m=S(n,"mix",1),u=S(n,"softness",0)*i;for(let w=0,b=0;;w++){f.setFrame(w,d,m,u,S(n,"bendPositive",!0)?1:-1,S(n,"compress",!1),S(n,"stretch",!1));let p=a[w+1];if(!p){f.shrink(b);break}let g=S(p,"time",0),x=S(p,"mix",1),y=S(p,"softness",0)*i,v=n.curve;v&&(b=_(v,f,b,w,0,d,g,m,x,1),b=_(v,f,b,w,1,d,g,u,y,i)),d=g,m=x,u=y,n=p}r.push(f)}if(t.transform)for(let o in t.transform){let a=t.transform[o],n=a[0];if(!n)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),f=new oe(a.length,a.length*6,c),d=S(n,"time",0),m=S(n,"mixRotate",1),u=S(n,"mixX",1),w=S(n,"mixY",u),b=S(n,"mixScaleX",1),p=S(n,"mixScaleY",b),g=S(n,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,b,p,g);let v=a[x+1];if(!v){f.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),T=S(v,"mixY",C),M=S(v,"mixScaleX",1),Y=S(v,"mixScaleY",M),F=S(v,"mixShearY",1),E=n.curve;E&&(y=_(E,f,y,x,0,d,A,m,I,1),y=_(E,f,y,x,1,d,A,u,C,1),y=_(E,f,y,x,2,d,A,w,T,1),y=_(E,f,y,x,3,d,A,b,M,1),y=_(E,f,y,x,4,d,A,p,Y,1),y=_(E,f,y,x,5,d,A,g,F,1)),d=A,m=I,u=C,w=T,b=M,p=Y,b=M,n=v}r.push(f)}if(t.path)for(let o in t.path){let a=t.path[o],n=s.findPathConstraint(o);if(!n)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(n);for(let c in a){let f=a[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new he(m,m,l);r.push(at(f,u,0,n.positionMode==0?i:1))}else if(c==="spacing"){let u=new ce(m,m,l);r.push(at(f,u,0,n.spacingMode==0||n.spacingMode==1?i:1))}else if(c==="mix"){let u=new de(m,m*3,l),w=S(d,"time",0),b=S(d,"mixRotate",1),p=S(d,"mixX",1),g=S(d,"mixY",p);for(let x=0,y=0;;x++){u.setFrame(x,w,b,p,g);let v=f[x+1];if(!v){u.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),T=S(v,"mixY",C),M=d.curve;M&&(y=_(M,u,y,x,0,w,A,b,I,1),y=_(M,u,y,x,1,w,A,p,C,1),y=_(M,u,y,x,2,w,A,g,T,1)),w=A,b=I,p=C,g=T,d=v}r.push(u)}}}if(t.physics)for(let o in t.physics){let a=t.physics[o],n=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);n=s.physicsConstraints.indexOf(l)}for(let l in a){let c=a[l],f=c[0];if(!f)continue;let d=c.length;if(l=="reset"){const u=new pe(d,n);for(let w=0;f!=null;f=c[w+1],w++)u.setFrame(w,S(f,"time",0));r.push(u);continue}let m;if(l=="inertia")m=new fe(d,d,n);else if(l=="strength")m=new ue(d,d,n);else if(l=="damping")m=new me(d,d,n);else if(l=="mass")m=new ge(d,d,n);else if(l=="wind")m=new xe(d,d,n);else if(l=="gravity")m=new we(d,d,n);else if(l=="mix")m=new be(d,d,n);else continue;r.push(at(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let a=t.attachments[o],n=s.findSkin(o);if(!n)throw new Error("Skin not found: "+o);for(let l in a){let c=a[l],f=s.findSlot(l);if(!f)throw new Error("Slot not found: "+l);let d=f.index;for(let m in c){let u=c[m],w=n.getAttachment(d,m);for(let b in u){let p=u[b],g=p[0];if(g){if(b=="deform"){let x=w.bones,y=w.vertices,v=x?y.length/3*2:y.length,A=new ne(p.length,p.length,d,w),I=S(g,"time",0);for(let C=0,T=0;;C++){let M,Y=S(g,"vertices",null);if(!Y)M=x?P.newFloatArray(v):y;else{M=P.newFloatArray(v);let X=S(g,"offset",0);if(P.arrayCopy(Y,0,M,X,Y.length),i!=1)for(let V=X,N=V+Y.length;V<N;V++)M[V]*=i;if(!x)for(let V=0;V<v;V++)M[V]+=y[V]}A.setFrame(C,I,M);let F=p[C+1];if(!F){A.shrink(T);break}let E=S(F,"time",0),k=g.curve;k&&(T=_(k,A,T,C,0,I,E,0,1,1)),I=E,g=F}r.push(A)}else if(b=="sequence"){let x=new ye(p.length,d,w),y=0;for(let v=0;v<p.length;v++){let A=S(g,"delay",y),I=S(g,"time",0),C=es[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,I,C,T,A),y=A,g=p[v+1]}r.push(x)}}}}}}if(t.drawOrder){let o=new wt(t.drawOrder.length),a=s.slots.length,n=0;for(let l=0;l<t.drawOrder.length;l++,n++){let c=t.drawOrder[l],f=null,d=S(c,"offsets",null);if(d){f=P.newArray(a,-1);let m=P.newArray(a-d.length,0),u=0,w=0;for(let b=0;b<d.length;b++){let p=d[b],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[w++]=u++;f[u+p.offset]=u++}for(;u<a;)m[w++]=u++;for(let b=a-1;b>=0;b--)f[b]==-1&&(f[b]=m[--w])}o.setFrame(n,S(c,"time",0),f)}r.push(o)}if(t.events){let o=new Ft(t.events.length),a=0;for(let n=0;n<t.events.length;n++,a++){let l=t.events[n],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let f=new Fe(P.toSinglePrecision(S(l,"time",0)),c);f.intValue=S(l,"int",c.intValue),f.floatValue=S(l,"float",c.floatValue),f.stringValue=S(l,"string",c.stringValue),f.data.audioPath&&(f.volume=S(l,"volume",1),f.balance=S(l,"balance",0)),o.setFrame(a,f)}r.push(o)}let h=0;for(let o=0,a=r.length;o<a;o++)h=Math.max(h,r[o].getDuration());s.animations.push(new Mt(e,r,h))}},Xi=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 at(t,e,s,i){let r=t[0],h=S(r,"time",0),o=S(r,"value",s)*i,a=0;for(let n=0;;n++){e.setFrame(n,h,o);let l=t[n+1];if(!l)return e.shrink(a),e;let c=S(l,"time",0),f=S(l,"value",s)*i;r.curve&&(a=_(r.curve,e,a,n,0,h,c,o,f,i)),h=c,o=f,r=l}}function Ue(t,e,s,i,r,h){let o=t[0],a=S(o,"time",0),n=S(o,s,r)*h,l=S(o,i,r)*h,c=0;for(let f=0;;f++){e.setFrame(f,a,n,l);let d=t[f+1];if(!d)return e.shrink(c),e;let m=S(d,"time",0),u=S(d,s,r)*h,w=S(d,i,r)*h,b=o.curve;b&&(c=_(b,e,c,f,0,a,m,n,u,h),c=_(b,e,c,f,1,a,m,l,w,h)),a=m,n=u,l=w,o=d}}function _(t,e,s,i,r,h,o,a,n,l){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,f=t[c],d=t[c+1]*l,m=t[c+2],u=t[c+3]*l;return e.setBezier(s,i,r,h,a,f,d,m,u,o,n),s+1}function S(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)));export{ie as AlphaTimeline,Mt as Animation,Os as AnimationState,qs as AnimationStateAdapter,Ws as AnimationStateData,gs as AssetCache,Gs as AssetManagerBase,_s as AtlasAttachmentLoader,Ut as Attachment,ut as AttachmentTimeline,Is as BinaryInput,qe as BlendMode,Xe as Bone,Me as BoneData,Ie as BoundingBoxAttachment,hs as CURRENT,Ce as ClippingAttachment,q as Color,It as ConstraintData,rt as CurveTimeline,st as CurveTimeline1,Xt as CurveTimeline2,Ls as DebugUtils,ne as DeformTimeline,xs as Downloader,wt as DrawOrderTimeline,Fe as Event,Ee as EventData,ns as EventQueue,Ft as EventTimeline,ls as EventType,ve as FIRST,zs as FakeTexture,Rt as HOLD_FIRST,os as HOLD_MIX,Ae as HOLD_SUBSEQUENT,ws as IkConstraint,Re as IkConstraintData,le as IkConstraintTimeline,Vt as Inherit,te as InheritTimeline,Bs as IntSet,Qe as Interpolation,R as MathUtils,Bt as MeshAttachment,is as MixBlend,rs as MixDirection,St as PathAttachment,bs as PathConstraint,Pe as PathConstraintData,de as PathConstraintMixTimeline,he as PathConstraintPositionTimeline,ce as PathConstraintSpacingTimeline,As as Physics,me as PhysicsConstraintDampingTimeline,we as PhysicsConstraintGravityTimeline,fe as PhysicsConstraintInertiaTimeline,ge as PhysicsConstraintMassTimeline,be as PhysicsConstraintMixTimeline,pe as PhysicsConstraintResetTimeline,ue as PhysicsConstraintStrengthTimeline,ct as PhysicsConstraintTimeline,xe as PhysicsConstraintWindTimeline,ms as PointAttachment,vt as Pool,Be as PositionMode,Ze as Pow,Vs as PowOut,ae as RGB2Timeline,re as RGBA2Timeline,ee as RGBATimeline,se as RGBTimeline,Ye as RegionAttachment,Le as RotateMode,At as RotateTimeline,Se as SETUP,Et as SUBSEQUENT,Ht as ScaleTimeline,jt as ScaleXTimeline,Jt as ScaleYTimeline,ye as SequenceTimeline,Kt as ShearTimeline,Qt as ShearXTimeline,Zt as ShearYTimeline,vs as Skeleton,Hs as SkeletonBinary,Ti as SkeletonBounds,Yi as SkeletonClipping,Ne as SkeletonData,Mi as SkeletonJson,Lt as Skin,De as SkinEntry,ps as Slot,Oe as SlotData,Ve as SpacingMode,zt as StringSet,cs as Texture,ke as TextureAtlas,us as TextureAtlasPage,Te as TextureAtlasRegion,Pt as TextureFilter,fs as TextureRegion,ds as TextureWrap,Ns as TimeKeeper,H as Timeline,as as TrackEntry,ys as TransformConstraint,We as TransformConstraintData,oe as TransformConstraintTimeline,_t as TranslateTimeline,Gt as TranslateXTimeline,$t as TranslateYTimeline,Cs as Triangulator,P as Utils,Yt as Vector2,lt as VertexAttachment,Ds as WindowedMean};
|
|
1
|
+
"use strict";var Fn=class{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Te=class{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,n=t.length;s<n;s++)this.add(t[s]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},z=class Mt{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Mt(1,1,1,1);static RED=new Mt(1,0,0,1);static GREEN=new Mt(0,1,0,1);static BLUE=new Mt(0,0,1,1);static MAGENTA=new Mt(1,0,1,1);set(e,s,n,i){return this.r=e,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,n,i){return this.r+=e,this.g+=s,this.b+=n,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,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 Mt){return s.setFromString(e)}},U=class dt{static PI=3.1415927;static PI2=dt.PI*2;static invPI2=1/dt.PI2;static radiansToDegrees=180/dt.PI;static radDeg=dt.radiansToDegrees;static degreesToRadians=dt.PI/180;static degRad=dt.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*dt.degRad)}static sinDeg(e){return Math.sin(e*dt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*dt.radDeg}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){const s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return dt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,n){const i=Math.random(),r=s-e;return i<=(n-e)/r?e+Math.sqrt(i*r*(n-e)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Bt=class Vt{static linear=new class extends Vt{applyInternal(e){return e}};static smooth=new class extends Vt{applyInternal(e){return e*e*(3-2*e)}};static slowFast=new class extends Vt{applyInternal(e){return e*e}};static fastSlow=new class extends Vt{applyInternal(e){return(e-1)*(e-1)*-1+1}};static circle=new class extends Vt{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}};apply(e,s,n){return s===void 0||n===void 0?this.applyInternal(e):e+(s-e)*this.applyInternal(n)}},Ls=class extends Bt{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}},Yn=class extends Ls{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},B=class Rt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,n,i,r){for(let c=s,l=i;c<s+r;c++,l++)n[l]=e[c]}static arrayFill(e,s,n,i){for(let r=s;r<n;r++)e[r]=i}static setArraySize(e,s,n=0){const i=e.length;if(i===s)return e;if(e.length=s,i<s)for(let r=i;r<s;r++)e[r]=n;return e}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:Rt.setArraySize(e,s,n)}static newArray(e,s){const n=[];for(let i=0;i<e;i++)n[i]=s;return n}static newFloatArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(e){return Rt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Rt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,s,n=!0){for(let i=0;i<e.length;i++)if(e[i]===s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Pn=class{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Ot=class{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){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}},Ae=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}},kn=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const 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)}},En=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}},Bs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Kt=(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",t))(Kt||{}),Os=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Os||{}),Ns=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Xn=class extends Bs{setFilters(t,e){}setWraps(t,e){}dispose(){}},Ce=class{pages=[];regions=[];constructor(t){const e=new Vn(t),s=new Array(4),n={};n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.format=()=>{},n.filter=a=>{a.minFilter=B.enumValue(Kt,s[1]),a.magFilter=B.enumValue(Kt,s[2])},n.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},n.pma=a=>{a.pma=s[1]==="true"};var i={};i.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},i.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},i.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},i.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},i.rotate=a=>{const h=s[1];h==="true"?a.degrees=90:h!=="false"&&(a.degrees=parseInt(h))},i.index=a=>{a.index=parseInt(s[1])};let r=e.readLine();for(;r&&r.trim().length===0;)r=e.readLine();for(;!(!r||r.trim().length===0||e.readEntry(s,r)===0);)r=e.readLine();let c=null,l=null,o=null;for(;r!==null;)if(r.trim().length===0)c=null,r=e.readLine();else if(c){const a=new Me(c,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{l||(l=[]),o||(o=[]),l.push(s[0]);const f=[];for(let m=0;m<h;m++)f.push(parseInt(s[m+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),l&&l.length>0&&o&&o.length>0&&(a.names=l,a.values=o,l=null,o=null),a.u=a.x/c.width,a.v=a.y/c.height,a.degrees===90?(a.u2=(a.x+a.height)/c.width,a.v2=(a.y+a.width)/c.height):(a.u2=(a.x+a.width)/c.width,a.v2=(a.y+a.height)/c.height),this.regions.push(a)}else{for(c=new $s(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(c)}this.pages.push(c)}}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(const 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()}},Vn=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;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=e.indexOf(",",i);if(r===-1)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},$s=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}},Me=class extends Ns{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)}},Fe=class un{static empty=[];name;timelineAttachment;timelineSlots=un.empty;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,s,n){let i=e[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,c=this.timelineSlots.length;r<c;r++){if(i=e[this.timelineSlots[r]],!i.bone.isActive())continue;const l=(n?i.getAppliedPose():i.getPose()).getAttachment();if(l!=null&&l.timelineAttachment===this)return!0}return!1}},xt=class mn extends Fe{static nextID=0;id=mn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,c,l){i=c+(i>>1)*l;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,b=u.a,x=u.b,w=u.c,v=u.d;for(let y=n,S=c;S<i;y+=2,S+=l){const I=a[y],T=a[y+1];r[S]=I*b+T*x+p,r[S+1]=I*w+T*v+g}return}let d=0,f=0;for(let u=0;u<n;u+=2){const p=h[d];d+=p+1,f+=p}const m=e.bones;if(o.length===0)for(let u=c,p=f*3;u<i;u+=l){let g=0,b=0,x=h[d++];for(x+=d;d<x;d++,p+=3){const w=m[h[d]].appliedPose,v=a[p],y=a[p+1],S=a[p+2];g+=(v*w.a+y*w.b+w.worldX)*S,b+=(v*w.c+y*w.d+w.worldY)*S}r[u]=g,r[u+1]=b}else{const u=o;for(let p=c,g=f*3,b=f<<1;p<i;p+=l){let x=0,w=0,v=h[d++];for(v+=d;d<v;d++,g+=3,b+=2){const y=m[h[d]].appliedPose,S=a[g]+u[b],I=a[g+1]+u[b+1],T=a[g+2];x+=(S*y.a+I*y.b+y.worldX)*T,w+=(S*y.c+I*y.d+y.worldY)*T}r[p]=x,r[p+1]=w}}}copyTo(e){this.bones?(e.bones=[],B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment,e.timelineSlots=this.timelineSlots}},It=class Es extends xt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new z(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new z(0,0,0,0);constructor(e,s){super(e),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const e=new Es(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],B.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],B.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=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,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){const e=new Es(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,s,n){if(!e)throw new Error("Region not set.");const i=n.length;let r=e.u,c=e.v,l=0,o=0;if(e instanceof Me){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,c-=(e.originalWidth-e.offsetX-e.width)/d,l=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*l,n[f+1]=c+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,c-=e.offsetY/d,l=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*l,n[f+1]=c+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,c-=e.offsetX/d,l=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*l,n[f+1]=c+s[f]*o;return;default:r-=e.offsetX/h,c-=(e.originalHeight-e.offsetY-e.height)/d,l=e.originalWidth/h,o=e.originalHeight/d}}else e?(l=e.u2-r,o=e.v2-c):(r=c=0,l=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*l,n[a+1]=c+s[a+1]*o}},Yt=class gn extends Fe{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new z(1,1,1,1);tempColor=new z(1,1,1,1);constructor(e,s){super(e),this.sequence=s}copy(){const e=new gn(this.name,this.sequence.copy());return e.path=this.path,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.color.setFromColor(this.color),e}computeWorldVertices(e,s,n,i,r){const c=e.bone.appliedPose,l=c.worldX,o=c.worldY,a=c.a,h=c.b,d=c.c,f=c.d;let m=s[0],u=s[1];n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o,i+=r,m=s[2],u=s[3],n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o,i+=r,m=s[4],u=s[5],n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o,i+=r,m=s[6],u=s[7],n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,c,l,o,a,h){if(!e)throw new Error("Region not set.");const d=l/e.originalWidth*i,f=o/e.originalHeight*r,m=-l/2*i+e.offsetX*d,u=-o/2*r+e.offsetY*f,p=m+e.width*d,g=u+e.height*f,b=c*U.degRad,x=Math.cos(b),w=Math.sin(b),v=m*x+s,y=m*w,S=u*x+n,I=u*w,T=p*x+s,A=p*w,M=g*x+n,F=g*w;a[0]=v-I,a[1]=S+y,a[2]=v-F,a[3]=M+y,a[4]=T-F,a[5]=M+A,a[6]=T-I,a[7]=S+A,e==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.v2))}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},Nt=class ve{static _nextID=0;id=ve.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(e,s){this.regions=new Array(e),this.pathSuffix=s}copy(){const e=this.regions.length,s=new ve(e,this.pathSuffix);if(B.arrayCopy(this.regions,0,s.regions,0,e),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const n=this.uvs[0].length;s.uvs=[];for(let i=0;i<e;i++)s.uvs[i]=B.newFloatArray(n),B.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<e;n++)s.offsets[n]=[],B.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(e){const s=this.regions.length;if(e instanceof Yt){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Yt.computeUVs(this.regions[n],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[n],this.uvs[n])}else if(e instanceof It){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),It.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(e){let s=e.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,s){if(!this.pathSuffix)return e;let n=e;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return ve._nextID++}},Ye=(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",t))(Ye||{}),Pe=[0,1,2,3,4,5,6],Qt=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new Te,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=t;for(let i=0;i<e;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),qs(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,n,i,r,c,l,o,a){if(!t)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const h=this.timelines;for(let d=0,f=h.length;d<f;d++)h[d].apply(t,e,s,i,r,c,l,o,a)}},Us=(t=>(t[t.rotate=0]="rotate",t[t.x=1]="x",t[t.y=2]="y",t[t.scaleX=3]="scaleX",t[t.scaleY=4]="scaleY",t[t.shearX=5]="shearX",t[t.shearY=6]="shearY",t[t.inherit=7]="inherit",t[t.rgb=8]="rgb",t[t.alpha=9]="alpha",t[t.rgb2=10]="rgb2",t[t.attachment=11]="attachment",t[t.deform=12]="deform",t[t.event=13]="event",t[t.drawOrder=14]="drawOrder",t[t.ikConstraint=15]="ikConstraint",t[t.transformConstraint=16]="transformConstraint",t[t.pathConstraintPosition=17]="pathConstraintPosition",t[t.pathConstraintSpacing=18]="pathConstraintSpacing",t[t.pathConstraintMix=19]="pathConstraintMix",t[t.physicsConstraintInertia=20]="physicsConstraintInertia",t[t.physicsConstraintStrength=21]="physicsConstraintStrength",t[t.physicsConstraintDamping=22]="physicsConstraintDamping",t[t.physicsConstraintMass=23]="physicsConstraintMass",t[t.physicsConstraintWind=24]="physicsConstraintWind",t[t.physicsConstraintGravity=25]="physicsConstraintGravity",t[t.physicsConstraintMix=26]="physicsConstraintMix",t[t.physicsConstraintReset=27]="physicsConstraintReset",t[t.sequence=28]="sequence",t[t.sliderTime=29]="sliderTime",t[t.sliderMix=30]="sliderMix",t))(Us||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=B.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 search(t,e,s=1){const n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}};function Ds(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var wt=class extends Q{curves;constructor(t,e,...s){super(t,...s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,n,i,r,c,l,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const m=(n-r*2+l)*.03,u=(i-c*2+o)*.03,p=((r-l)*3-n+a)*.006,g=((c-o)*3-i+h)*.006;let b=m*2+p,x=u*2+g,w=(r-n)*.3+m+p*.16666667,v=(c-i)*.3+u+g*.16666667,y=n+w,S=i+v;for(let I=f+18;f<I;f+=2)d[f]=y,d[f+1]=S,w+=b,v+=x,b+=p,x+=g,y+=w,S+=v}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const o=this.frames[e],a=this.frames[e+s];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const o=i[n-2],a=i[n-1];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}e+=this.getFrameEntries();const c=i[r-2],l=i[r-1];return l+(t-c)/(this.frames[e]-c)*(this.frames[e+s]-l)}},$t=class extends wt{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){const e=this.frames;let s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=e[s],r=e[s+1];return r+(t-i)/(e[s+2]-i)*(e[s+2+1]-r)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const c=this.getCurveValue(t);return s?r+c*e:i+(n?c:c+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,c){return c===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,c)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const c=this.getCurveValue(t);return s?r+(n?c:c-r)*e:i+(n?c:c-i)*e}getAbsoluteValue2(t,e,s,n,i,r,c){return t<this.frames[0]?s?r:i:s?r+(n?c:c-r)*e:i+(n?c:c-i)*e}getScaleValue(t,e,s,n,i,r,c){if(t<this.frames[0])return s?c:r;const l=this.getCurveValue(t)*c;if(e===1&&!n)return l;let o=s?c:r;return n?o+(l-c)*e:i?o+(Math.abs(l)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(l),o+(l-o)*e)}};function qs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var yt=class extends $t{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,c,l,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,c,l)}},Zt=class extends wt{boneIndex;constructor(t,e,s,n,i){super(t,e,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}apply(t,e,s,n,i,r,c,l,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,c,l)}},Ut=class extends yt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,c){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},ke=class extends Zt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Q.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];o=l[h+1],a=l[h+2];const m=(s-f)/(l[h+3]-f);o+=(l[h+3+1]-o)*m,a+=(l[h+3+2]-a)*m;break}case 1:o=l[h+1],a=l[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.x=e.x+o*n,t.y=e.y+a*n):r?(t.x+=o*n,t.y+=a*n):(t.x+=(e.x+o-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Ee=class extends yt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,c){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Xe=class extends yt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,c){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Ve=class extends Zt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Q.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];o=l[h+1],a=l[h+2];const m=(s-f)/(l[h+3]-f);o+=(l[h+3+1]-o)*m,a+=(l[h+3+2]-a)*m;break}case 1:o=l[h+1],a=l[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(o*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=o,t.scaleY=a;else{let f=0,m=0;i?(f=e.scaleX,m=e.scaleY):(f=t.scaleX,m=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=m+(a-e.scaleY)*n):c?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=m+(Math.abs(a)*Math.sign(m)-m)*n):(f=Math.abs(f)*Math.sign(o),m=Math.abs(m)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=m+(a-m)*n)}}},Re=class extends yt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,c){t.scaleX=this.getScaleValue(s,n,i,r,c,t.scaleX,e.scaleX)}},Le=class extends yt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,c){t.scaleY=this.getScaleValue(s,n,i,r,c,t.scaleY,e.scaleY)}},Be=class extends Zt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Q.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];o=l[h+1],a=l[h+2];const m=(s-f)/(l[h+3]-f);o+=(l[h+3+1]-o)*m,a+=(l[h+3+2]-a)*m;break}case 1:o=l[h+1],a=l[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.shearX=e.shearX+o*n,t.shearY=e.shearY+a*n):r?(t.shearX+=o*n,t.shearY+=a*n):(t.shearX+=(e.shearX+o-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},Oe=class extends yt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,c){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},Ne=class extends yt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,c){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},$e=class extends Q{boneIndex;constructor(t,e){super(t,`7|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,n,i,r,c,l,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(l)r&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Dt=class extends wt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,c,l,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,c)}},Ue=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,n,i,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r}apply1(t,e,s,n,i,r){const c=e.color,l=this.frames;if(s<l[0]){i&&c.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Q.search(l,s,5),m=this.curves[f/5];switch(m){case 0:{const u=l[f];o=l[f+1],a=l[f+2],h=l[f+3],d=l[f+4];const p=(s-u)/(l[f+5]-u);o+=(l[f+5+1]-o)*p,a+=(l[f+5+2]-a)*p,h+=(l[f+5+3]-h)*p,d+=(l[f+5+4]-d)*p;break}case 1:o=l[f+1],a=l[f+2],h=l[f+3],d=l[f+4];break;default:o=this.getBezierValue(s,f,1,m-2),a=this.getBezierValue(s,f,2,m+18-2),h=this.getBezierValue(s,f,3,m+18*2-2),d=this.getBezierValue(s,f,4,m+18*3-2)}if(n===1)c.set(o,a,h,d);else if(i){const u=t.data.setupPose.color;c.set(u.r+(o-u.r)*n,u.g+(a-u.g)*n,u.b+(h-u.b)*n,u.a+(d-u.a)*n)}else c.add((o-c.r)*n,(a-c.g)*n,(h-c.b)*n,(d-c.a)*n)}},De=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(t,e,s,n,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i}apply1(t,e,s,n,i,r){const c=e.color;let l=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const m=t.data.setupPose.color;c.r=m.r,c.g=m.g,c.b=m.b}return}const d=Q.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const m=h[d];l=h[d+1],o=h[d+2],a=h[d+3];const u=(s-m)/(h[d+4]-m);l+=(h[d+4+1]-l)*u,o+=(h[d+4+2]-o)*u,a+=(h[d+4+3]-a)*u;break}case 1:l=h[d+1],o=h[d+2],a=h[d+3];break;default:l=this.getBezierValue(s,d,1,f-2),o=this.getBezierValue(s,d,2,f+18-2),a=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const m=t.data.setupPose.color;l=m.r+(l-m.r)*n,o=m.g+(o-m.g)*n,a=m.b+(a-m.b)*n}else l=c.r+(l-c.r)*n,o=c.g+(o-c.g)*n,a=c.b+(a-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=o<0?0:o>1?1:o,c.b=a<0?0:a>1?1:a}},qe=class extends $t{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,c,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(o?a.appliedPose:a.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const m=a.data.setupPose.color;d=m.a+(d-m.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},_e=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,c,l,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=c,this.frames[t+6]=l,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const c=e.color,l=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const x=t.data.setupPose;c.setFromColor(x.color);const w=x.darkColor;l.r=w.r,l.g=w.g,l.b=w.b}return}let f=0,m=0,u=0,p=0;const g=Q.search(d,s,8),b=this.curves[g>>3];switch(b){case 0:{const x=d[g];f=d[g+1],m=d[g+2],u=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];const w=(s-x)/(d[g+8]-x);f+=(d[g+8+1]-f)*w,m+=(d[g+8+2]-m)*w,u+=(d[g+8+3]-u)*w,p+=(d[g+8+4]-p)*w,o+=(d[g+8+5]-o)*w,a+=(d[g+8+6]-a)*w,h+=(d[g+8+7]-h)*w;break}case 1:f=d[g+1],m=d[g+2],u=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];break;default:f=this.getBezierValue(s,g,1,b-2),m=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),p=this.getBezierValue(s,g,4,b+18*3-2),o=this.getBezierValue(s,g,5,b+18*4-2),a=this.getBezierValue(s,g,6,b+18*5-2),h=this.getBezierValue(s,g,7,b+18*6-2)}if(n===1)c.set(f,m,u,p);else if(i){const x=t.data.setupPose;let w=x.color;c.set(w.r+(f-w.r)*n,w.g+(m-w.g)*n,w.b+(u-w.b)*n,w.a+(p-w.a)*n),w=x.darkColor,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else c.add((f-c.r)*n,(m-c.g)*n,(u-c.b)*n,(p-c.a)*n),o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n;l.r=o<0?0:o>1?1:o,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h}},ze=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,c,l){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=c,this.frames[t+6]=l}apply1(t,e,s,n,i,r){const c=e.color,l=e.darkColor;let o=0,a=0,h=0,d=0,f=0,m=0;const u=this.frames;if(s<u[0]){if(i){const b=t.data.setupPose,x=b.color,w=b.darkColor;c.r=x.r,c.g=x.g,c.b=x.b,l.r=w.r,l.g=w.g,l.b=w.b}return}const p=Q.search(u,s,7),g=this.curves[p/7];switch(g){case 0:{const b=u[p];o=u[p+1],a=u[p+2],h=u[p+3],d=u[p+4],f=u[p+5],m=u[p+6];const x=(s-b)/(u[p+7]-b);o+=(u[p+7+1]-o)*x,a+=(u[p+7+2]-a)*x,h+=(u[p+7+3]-h)*x,d+=(u[p+7+4]-d)*x,f+=(u[p+7+5]-f)*x,m+=(u[p+7+6]-m)*x;break}case 1:o=u[p+1],a=u[p+2],h=u[p+3],d=u[p+4],f=u[p+5],m=u[p+6];break;default:o=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),f=this.getBezierValue(s,p,5,g+18*4-2),m=this.getBezierValue(s,p,6,g+18*5-2)}if(n!==1)if(i){const b=t.data.setupPose;let x=b.color;o=x.r+(o-x.r)*n,a=x.g+(a-x.g)*n,h=x.b+(h-x.b)*n,x=b.darkColor,d=x.r+(d-x.r)*n,f=x.g+(f-x.g)*n,m=x.b+(m-x.b)*n}else o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n,d=l.r+(d-l.r)*n,f=l.g+(f-l.g)*n,m=l.b+(m-l.b)*n;c.r=o<0?0:o>1?1:o,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h,l.r=d<0?0:d>1?1:d,l.g=f<0?0:f>1?1:f,l.b=m<0?0:m>1?1:m}},Pt=class extends Q{slotIndex=0;attachmentNames;constructor(t,e){super(t,`11|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,i,r,c,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;l||s<this.frames[0]?r&&this.setAttachment(t,h,a.data.attachmentName):this.setAttachment(t,h,this.attachmentNames[Q.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},We=class extends wt{slotIndex;attachment;vertices;constructor(t,e,s,n){super(t,e,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,n,i,r,c,l,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const m=(n-r*2+l)*.03,u=o*.03-c*.06,p=((r-l)*3-n+a)*.006,g=(c-o+.33333333)*.018;let b=m*2+p,x=u*2+g,w=(r-n)*.3+m+p*.16666667,v=c*.3+u+g*.16666667,y=n+w,S=v;for(let I=f+18;f<I;f+=2)d[f]=y,d[f+1]=S,w+=b,v+=x,b+=p,x+=g,y+=w,S+=v}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const l=this.frames[e];return(t-l)/(this.frames[e+this.getFrameEntries()]-l)}case 1:return 0}if(n-=2,s[n]>t){const l=this.frames[e];return s[n+1]*(t-l)/(s[n]-l)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const l=s[n-2],o=s[n-1];return o+(t-l)/(s[n]-l)*(s[n+1]-o)}const r=s[i-2],c=s[i-1];return c+(1-c)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,c,l,o){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,o))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],o,r);for(const g of h)this.applyBeforeFirst(a[g],o,r);return}let f,m,u;if(s>=d[d.length-1])u=0,f=this.vertices[d.length-1],m=null;else{const g=Q.search(d,s);u=this.getCurvePercent(s,g),f=this.vertices[g],m=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],o,f,m,u,p,i,r,c);for(const g of h)this.applyToSlot(a[g],o,f,m,u,p,i,r,c)}applyToSlot(t,e,s,n,i,r,c,l,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const h=a.attachment,d=a.deform;if(d.length===0&&(l=!0),d.length=r,n===null)if(c===1)if(o&&!l)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let m=0;m<r;m++)d[m]+=s[m]-f[m]}else B.arrayCopy(s,0,d,0,r);else if(l)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*c;else{const f=h.vertices;for(let m=0;m<r;m++){const u=f[m];d[m]=u+(s[m]-u)*c}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*c;else{const f=h.vertices;for(let m=0;m<r;m++)d[m]+=(s[m]-f[m])*c}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*c;else if(c===1)if(o&&!l)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]+=m+(n[f]-m)*i}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m];d[m]+=u+(n[m]-u)*i-f[m]}}else if(i===0)B.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const m=s[f];d[f]=m+(n[f]-m)*i}else if(l)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]=(m+(n[f]-m)*i)*c}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m],p=f[m];d[m]=p+(u+(n[m]-u)*i-p)*c}}else if(o)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(n[f]-m)*i)*c}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m];d[m]+=(u+(n[m]-u)*i-f[m])*c}}else for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(n[f]-m)*i-d[f])*c}}applyBeforeFirst(t,e,s){if(!t.bone.active)return;const n=e?t.appliedPose:t.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},He=class St extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`28|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return St.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const c=this.frames;e*=St.ENTRIES,c[e]=s,c[e+St.MODE]=n|i<<4,c[e+St.DELAY]=r}apply(e,s,n,i,r,c,l,o,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,f=this.frames;if(o||n<f[0]){if(c){this.setupPose(h[this.slotIndex],a);for(const b of d)this.setupPose(h[b],a)}return}const m=Q.search(f,n,St.ENTRIES),u=f[m],p=f[m+St.MODE],g=f[m+St.DELAY];this.applyToSlot(h[this.slotIndex],a,n,u,p,g);for(const b of d)this.applyToSlot(h[b],a,n,u,p,g)}setupPose(e,s){if(!e.bone.active)return;const n=s?e.appliedPose:e.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(e,s,n,i,r,c){if(!e.bone.active)return;const l=s?e.appliedPose:e.pose;if(l.attachment===null||l.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=l.attachment.sequence.regions.length;const h=Pe[r&15];if(h!==0)switch(o+=(n-i)/c+1e-5|0,h){case 1:o=Math.min(a-1,o);break;case 2:o%=a;break;case 3:{const d=(a<<1)-2;o=d===0?0:o%d,o>=a&&(o=d-o);break}case 4:o=Math.max(a-1-o,0);break;case 5:o=a-1-o%a;break;case 6:{const d=(a<<1)-2;o=d===0?0:(o+a-1)%d,o>=a&&(o=d-o)}}l.sequenceIndex=o}},te=class pn extends Q{static propertyIds=["13"];events;constructor(e){super(e,...pn.propertyIds),this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,n,i,r,c,l,o,a){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,!1,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let f=0;if(s<h[0])f=0;else{f=Q.search(h,s)+1;const m=h[f];for(;f>0&&h[f-1]===m;)f--}for(;f<d&&n>=h[f];f++)i.push(this.events[f])}},Tt=class Xs extends Q{static propertyID="14";static propertyIds=[Xs.propertyID];drawOrders;constructor(e){super(e,...Xs.propertyIds),this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,c,l,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){c&&B.arrayCopy(d,0,h,0,e.slots.length);return}const f=this.drawOrders[Q.search(this.frames,n)];if(!f)B.arrayCopy(d,0,h,0,e.slots.length);else for(let m=0,u=f.length;m<u;m++)h[m]=d[f[m]]}},qt=class bn extends Q{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...bn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(e),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(e){const s=e.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`d${e[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,c,l,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])c&&this.setup(h,d);else{const f=this.drawOrders[Q.search(this.frames,n)];if(!f)this.setup(h,d);else{const m=this.inFolder,u=this.slots;for(let p=0,g=0,b=u.length;!(m[h[p].data.index]&&(h[p]=d[u[f[g]]],++g===b));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,c=0,l=i.length;!(n[e[r].data.index]&&(e[r]=s[i[c]],++c===l));r++);}};function _s(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Ge=class extends wt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,c){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r?1:0,this.frames[t+5]=c?1:0}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;h.mix=b.mix,h.softness=b.softness,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch}return}let f=0,m=0;const u=Q.search(d,s,6),p=this.curves[u/6];switch(p){case 0:{const b=d[u];f=d[u+1],m=d[u+2];const x=(s-b)/(d[u+6]-b);f+=(d[u+6+1]-f)*x,m+=(d[u+6+2]-m)*x;break}case 1:f=d[u+1],m=d[u+2];break;default:f=this.getBezierValue(s,u,1,p-2),m=this.getBezierValue(s,u,2,p+18-2)}const g=r?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(m-g.softness)*i,l?r&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[u+3],h.compress=d[u+4]!==0,h.stretch=d[u+5]!==0)}},je=class extends wt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,c,l){const o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=n,o[t+3]=i,o[t+4]=r,o[t+5]=c,o[t+6]=l}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.data.setupPose;h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY}return}let f,m,u,p,g,b;const x=Q.search(d,s,7),w=this.curves[x/7];switch(w){case 0:{const y=d[x];f=d[x+1],m=d[x+2],u=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];const S=(s-y)/(d[x+7]-y);f+=(d[x+7+1]-f)*S,m+=(d[x+7+2]-m)*S,u+=(d[x+7+3]-u)*S,p+=(d[x+7+4]-p)*S,g+=(d[x+7+5]-g)*S,b+=(d[x+7+6]-b)*S;break}case 1:f=d[x+1],m=d[x+2],u=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];break;default:f=this.getBezierValue(s,x,1,w-2),m=this.getBezierValue(s,x,2,w+18-2),u=this.getBezierValue(s,x,3,w+18*2-2),p=this.getBezierValue(s,x,4,w+18*3-2),g=this.getBezierValue(s,x,5,w+18*4-2),b=this.getBezierValue(s,x,6,w+18*5-2)}const v=r?a.data.setupPose:h;c?(h.mixRotate=v.mixRotate+f*i,h.mixX=v.mixX+m*i,h.mixY=v.mixY+u*i,h.mixScaleX=v.mixScaleX+p*i,h.mixScaleY=v.mixScaleY+g*i,h.mixShearY=v.mixShearY+b*i):(h.mixRotate=v.mixRotate+(f-v.mixRotate)*i,h.mixX=v.mixX+(m-v.mixX)*i,h.mixY=v.mixY+(u-v.mixY)*i,h.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*i,h.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*i,h.mixShearY=v.mixShearY+(b-v.mixShearY)*i)}},kt=class extends $t{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Je=class extends kt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,c,h.position,a.data.setupPose.position)}}},Ke=class extends kt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},Qe=class extends wt{constraintIndex;constructor(t,e,s){super(t,e,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){const r=this.frames;t<<=2,r[t]=e,r[t+1]=s,r[t+2]=n,r[t+3]=i}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.data.setupPose;h.mixRotate=x.mixRotate,h.mixX=x.mixX,h.mixY=x.mixY}return}let f,m,u;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const x=d[p];f=d[p+1],m=d[p+2],u=d[p+3];const w=(s-x)/(d[p+4]-x);f+=(d[p+4+1]-f)*w,m+=(d[p+4+2]-m)*w,u+=(d[p+4+3]-u)*w;break}case 1:f=d[p+1],m=d[p+2],u=d[p+3];break;default:f=this.getBezierValue(s,p,1,g-2),m=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+18*2-2)}const b=r?a.data.setupPose:h;c?(h.mixRotate=b.mixRotate+f*i,h.mixX=b.mixX+m*i,h.mixY=b.mixY+u*i):(h.mixRotate=b.mixRotate+(f-b.mixRotate)*i,h.mixX=b.mixX+(m-b.mixX)*i,h.mixY=b.mixY+(u-b.mixY)*i)}},pt=class extends kt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,c,l,o){if(c&&!this.additive&&(c=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,h=t.physics;for(const d of h)if(d.active&&this.global(d.data)){const f=o?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,c,this.get(f),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,c,this.get(h),this.get(a.data.setupPose)))}}}},Ze=class extends pt{constructor(t,e,s){super(t,e,s,20)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ts=class extends pt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},es=class extends pt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ss=class extends pt{constructor(t,e,s){super(t,e,s,23)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},ns=class extends pt{constructor(t,e,s){super(t,e,s,24),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},is=class extends pt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},rs=class extends pt{constructor(t,e,s){super(t,e,s,26)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},as=class xn extends Q{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...xn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,n,i,r,c,l,o,a){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(e,s,Number.MAX_VALUE,[],r,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[Q.search(d,s)+1]))if(h!=null)h.reset(e);else for(const f of e.physics)f.active&&f.reset(e)}},os=class extends kt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,c,h.time,a.data.setupPose.time)}}},cs=class extends kt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,c,h.mix,a.data.setupPose.mix)}}},Rn=class Vs{static emptyAnimation=new Qt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Ws(this);propertyIds=new Te;animationsChanged=!1;trackEntryPool=new Ot(()=>new zs);constructor(e){this.data=e}update(e){e*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n<i;n++){const r=s[n];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let c=e*r.timeScale;if(r.delay>0){if(r.delay-=c,r.delay>0)continue;c=-r.delay,r.delay=0}let l=r.next;if(l){const o=r.trackLast-l.delay;if(o>=0){for(l.delay=0,l.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*l.timeScale,r.trackTime+=c,this.setTrack(n,l,!0);l.mixingFrom;)l.mixTime+=e,l=l.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=c}this.queue.drain()}updateMixingFrom(e,s){const n=e.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(n.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=e),n.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,e.mixTime+=s,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let l=0,o=n.length;l<o;l++){const a=n[l];if(!a||a.delay>0)continue;i=!0;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,e):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,f=a.getAnimationTime(),m=f,u=s;a.reverse&&(m=a.animation.duration-m,u=null);const p=a.animation.timelines,g=p.length;if(l===0&&h===1)for(let b=0;b<g;b++){B.webkit602BugfixHelper(h);const x=p[b];x instanceof Pt?this.applyAttachmentTimeline(x,e,m,!0,!0):x.apply(e,d,m,u,h,!0,!1,!1,!1)}else{const b=a.timelineMode,x=h>=a.alphaAttachmentThreshold,w=a.additive,v=w||a.shortestRotation,y=!v&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let S=0;S<g;S++){const I=p[S],T=(b[S]&_t)!==0;!v&&I instanceof Ut?this.applyRotateTimeline(I,e,m,h,T,a.timelinesRotation,S<<1,y):I instanceof Pt?this.applyAttachmentTimeline(I,e,m,T,x):(B.webkit602BugfixHelper(h),I.apply(e,d,m,u,h,T,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,f),this.queueEvents(a,f),s.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+ls,c=e.slots;for(let l=0,o=e.slots.length;l<o;l++){const a=c[l];if(a.attachmentState===r){const h=a.data.attachmentName;a.pose.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s){const n=e.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=e.mix(),c=n.alpha*i,l=1-r*e.alpha,o=c*(1-r),a=l>0?o/l:c,h=n.animation.timelines,d=h.length,f=n.timelineMode,m=n.timelineHoldMix,u=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,b=g||n.shortestRotation,x=!b&&n.timelinesRotation.length!==d<<1;x&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let v=n.animationLast,y=n.getAnimationTime(),S=y,I=null;n.reverse?S=n.animation.duration-S:r<n.eventThreshold&&(I=this.events),n.totalAlpha=0;for(let T=0;T<d;T++){const A=h[T],M=f[T];let F=0;if((M&zt)!==0){const E=m[T];F=E==null?a:a*(1-E.mix())}else{if(!p&&A instanceof Tt)continue;F=o}n.totalAlpha+=F;const k=(M&_t)!==0;if(!b&&A instanceof Ut)this.applyRotateTimeline(A,s,S,F,k,w,T<<1,x);else if(A instanceof Pt)this.applyAttachmentTimeline(A,s,S,k,u&&F>=n.alphaAttachmentThreshold);else{const E=!p||!(A instanceof Tt)||!k;A.apply(s,v,S,I,F,k,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,v,y),e.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,s,n,i,r){const c=s.slots[e.slotIndex];if(!c.bone.active||!r&&c.attachmentState===this.unkeyedState+hs)return;let l=n<e.frames[0],o=null;if(l||(o=e.attachmentNames[Q.search(e.frames,n)],l=!r&&o==null),l){if(!i)return;o=c.data.attachmentName}c.pose.setAttachment(o==null?null:s.getAttachment(c.data.index,o)),r?c.attachmentState=this.unkeyedState+hs:l||(c.attachmentState=this.unkeyedState+ls)}applyRotateTimeline(e,s,n,i,r,c,l,o){if(o&&(c[l]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,f=e.frames;if(n<f[0]){r&&(h.rotation=d.rotation);return}const m=r?d.rotation:h.rotation,u=d.rotation+e.getCurveValue(n);let p=0,g=u-m;if(g-=Math.ceil(g/360-.5)*360,g===0)p=c[l];else{let b=0,x=0;o?(b=0,x=g):(b=c[l],x=c[l+1]);const w=b-b%360;p=g+w;let v=g>=0,y=b>=0;Math.abs(x)<=90&&U.signum(x)!==U.signum(g)&&(Math.abs(b-w)>180?(p+=360*U.signum(b),y=v):w!==0?p-=360*U.signum(b):y=v),y!==v&&(p+=360*U.signum(b)),c[l]=p}c[l+1]=g,h.rotation=m+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,c=e.reverse;let l=e.trackLast%r;c&&(l=r-l);const o=this.events;let a=0,h=o.length;for(;a<h;a++){const f=o[a];if(f.time<l!==c)break;f.time>=n&&f.time<=i&&this.queue.event(e,f)}let d=!1;if(e.loop)if(r===0)d=!0;else{const f=Math.floor(e.trackTime/r);d=f>0&&f>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const f=o[a];f.time>=n&&f.time<=i&&this.queue.event(e,f)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,c=i-n,l=e.animation.timelines;for(let o=0,a=e.animation.timelines.length;o<a;o++){const h=l[o];if(!(h instanceof te))continue;const d=h.events,f=h.frames,m=f.length;if(r>=c){for(let u=0;u<m;u++)if(!(f[u]<c)){if(f[u]>=r)break;this.events.push(d[u])}}else{for(let p=0;p<m&&!(f[p]>=r);p++)this.events.push(d[p]);let u=0;for(;u<m&&!(f[u]>=c);u++);for(;u<m;u++)this.events.push(d[u])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const c=this.trackEntry(e,s,n,r);return this.setTrack(e,c,i),this.queue.drain(),c}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const c=this.trackEntry(e,s,n,r);return r?(r.next=c,c.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-c.mixDuration,0))):(this.setTrack(e,c,!0),this.queue.drain(),i<0&&(i=0)),c.delay=i,c}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Vs.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Vs.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do this.computeHold(i),i=i.mixingTo;while(i)}}this.propertyIds.clear()}computeHold(e){const s=e.animation.timelines,n=e.animation.timelines.length,i=e.timelineMode;i.length=n;const r=e.timelineHoldMix;r.length=0;const c=this.propertyIds,l=e.additive,o=e.keepHold,a=e.mixingTo;t:for(let h=0;h<n;h++){const d=s[h],f=d.propertyIds,m=c.addAll(f)&&!(d instanceof qt&&c.contains(Tt.propertyID));if(l&&d.additive){i[h]=m?_t:ee;continue}for(let p=e.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(f)){i[h]=ee;continue t}let u;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(f))u=m?_t:ee;else{u=m?Gs:zt;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(f)){p.mixDuration>0&&(r[h]=p);break}}o&&(u=u&~zt|i[h]&zt),i[h]=u}}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");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){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},zs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!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;totalAlpha=0;mixInterpolation=Bt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Bt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Bt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const 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}},Ws=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const c=i[r];c.start&&c.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const c=i[r];c.interrupt&&c.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const c=i[r];c.end&&c.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const c=i[r];c.dispose&&c.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const c=i[r];c.complete&&c.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let c=0;c<i.length;c++){const l=i[c];l.event&&l.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Hs=(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",t))(Hs||{}),Ln=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},ee=0,_t=1,zt=2,Gs=3,ls=1,hs=2,Bn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},On=class{constructor(t,e="",s=new Js,n=new js){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};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)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}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((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,c)=>{const l=`Couldn't load binary ${t}: status ${r}, ${c}`;this.error(s,t,l),i(l)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,c)=>{const l=`Couldn't load JSON ${t}: status ${r}, ${c}`;this.error(s,t,l),i(l)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(o=>{if(o.ok)return o.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(o=>o?createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(o=>{if(o){const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)}});else{const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)},o.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),o.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((c,l)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(o,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),c(a);return}for(const f of a.pages)this.loadTexture(this.texturePath(r,f.name,n),(m,u)=>{d||(f.setTexture(u),--h===0&&(this.success(e,t,a),c(a)))},(m,u)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),l(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),l(h)}},(o,a)=>{const h=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,h),l(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,c)=>{this.downloader.downloadText(t,l=>{try{const o=this.createTextureAtlas(l,i,t);this.success(e,t,o),r(o)}catch(o){const a=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,a),c(a)}},(l,o)=>{const a=`Couldn't load texture atlas ${t}: status ${l}, ${o}`;this.error(s,t,a),c(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
|
|
2
|
+
${s}`:""}`)}remove(t){t=this.pathPrefix+t;const 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(const t in this.cache.assets){const 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 Ce){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,s,n){const i=new Ce(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const c=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+c]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},js=class Se{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Se.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Se;return Se.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},Js=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){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=e.charCodeAt(i);return n}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 n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(c){this.finish(t,400,JSON.stringify(c))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(c){this.finish(t,400,JSON.stringify(c))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},ds=class wn extends xt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new wn(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Wt=class yn extends xt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new yn(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},se=class vn extends xt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new vn(this.name);return this.copyTo(e),e.lengths=[],B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ks=class Sn extends xt{x=0;y=0;rotation=0;color=new z(.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*U.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,c=n*e.c+i*e.d;return U.atan2Deg(c,r)}copy(){const e=new Sn(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Nn=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Yt(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new It(s,i)}newBoundingBoxAttachment(t,e,s){return new ds(s)}newPathAttachment(t,e,s){return new se(s)}newPointAttachment(t,e,s){return new Ks(s)}newClippingAttachment(t,e,s){return new Wt(s)}},ne=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},fs=class In extends ne{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new re),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new In(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ie=(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",t))(ie||{}),re=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");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}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,f=t.scaleY,m=(e+i)*U.degRad,u=(e+90+r)*U.degRad;this.a=Math.cos(m)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(m)*s*f,this.d=Math.sin(u)*n*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const c=this.bone.parent.appliedPose;let l=c.a,o=c.b,a=c.c,h=c.d;switch(this.worldX=l*this.x+o*this.y+c.worldX,this.worldY=a*this.x+h*this.y+c.worldY,this.inherit){case 0:{const d=(e+i)*U.degRad,f=(e+90+r)*U.degRad,m=Math.cos(d)*s,u=Math.cos(f)*n,p=Math.sin(d)*s,g=Math.sin(f)*n;this.a=l*m+o*p,this.b=l*u+o*g,this.c=a*m+h*p,this.d=a*u+h*g;return}case 1:{const d=(e+i)*U.degRad,f=(e+90+r)*U.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(f)*n,this.c=Math.sin(d)*s,this.d=Math.sin(f)*n;break}case 2:{const d=1/t.scaleX,f=1/t.scaleY;l*=d,a*=f;let m=l*l+a*a,u=0;m>1e-4?(m=Math.abs(l*h*f-o*d*a)/m,o=a*m,h=l*m,u=U.atan2Deg(a,l)):(l=0,a=0,u=90-U.atan2Deg(h,o));const p=(e+i-u)*U.degRad,g=(e+r-u+90)*U.degRad,b=Math.cos(p)*s,x=Math.cos(g)*n,w=Math.sin(p)*s,v=Math.sin(g)*n;this.a=l*b-o*w,this.b=l*x-o*v,this.c=a*b+h*w,this.d=a*x+h*v;break}case 3:case 4:{let d=e*U.degRad,f=Math.cos(d),m=Math.sin(d),u=(l*f+o*m)/t.scaleX,p=(a*f+h*m)/t.scaleY,g=Math.sqrt(u*u+p*p);g>1e-5&&(g=1/g),u*=g,p*=g,g=Math.sqrt(u*u+p*p),this.inherit===3&&l*h-o*a<0!=(t.scaleX<0!=t.scaleY<0)&&(g=-g),d=Math.PI/2+Math.atan2(p,u);const b=Math.cos(d)*g,x=Math.sin(d)*g,w=i*U.degRad,v=(90+r)*U.degRad,y=Math.cos(w)*s,S=Math.cos(v)*n,I=Math.sin(w)*s,T=Math.sin(v)*n;this.a=u*y+b*I,this.b=u*S+b*T,this.c=p*y+x*I,this.d=p*S+x*T;break}}this.a*=t.scaleX,this.b*=t.scaleX,this.c*=t.scaleY,this.d*=t.scaleY}updateLocalTransform(t){if(this.local=0,this.world=t._update,!this.bone.parent){this.x=this.worldX-t.x,this.y=this.worldY-t.y;const b=this.a,x=this.b,w=this.c,v=this.d;this.rotation=U.atan2Deg(w,b),this.scaleX=Math.sqrt(b*b+w*w),this.scaleY=Math.sqrt(x*x+v*v),this.shearX=0,this.shearY=U.atan2Deg(b*x+w*v,b*v-x*w);return}const e=this.bone.parent.appliedPose;let s=e.a,n=e.b,i=e.c,r=e.d,c=1/(s*r-n*i),l=r*c,o=n*c,a=i*c,h=s*c;const d=this.worldX-e.worldX,f=this.worldY-e.worldY;this.x=d*l-f*o,this.y=f*h-d*a;let m,u,p,g;if(this.inherit===1)m=this.a,u=this.b,p=this.c,g=this.d;else{switch(this.inherit){case 2:{const b=Math.abs(s*r-n*i)/(s*s+i*i);n=-i*t.scaleX*b/t.scaleY,r=s*t.scaleY*b/t.scaleX,c=1/(s*r-n*i),l=r*c,o=n*c;break}case 3:case 4:{let b=this.rotation*U.degRad,x=Math.cos(b),w=Math.sin(b);s=(s*x+n*w)/t.scaleX,i=(i*x+r*w)/t.scaleY;let v=Math.sqrt(s*s+i*i);v>1e-5&&(v=1/v),s*=v,i*=v,v=Math.sqrt(s*s+i*i),this.inherit===3&&c<0!=(t.scaleX<0!=t.scaleY<0)&&(v=-v),b=U.PI/2+Math.atan2(i,s),n=Math.cos(b)*v,r=Math.sin(b)*v,c=1/(s*r-n*i),l=r*c,o=n*c,a=i*c,h=s*c}}m=l*this.a-o*this.c,u=l*this.b-o*this.d,p=h*this.c-a*this.a,g=h*this.d-a*this.b}if(this.shearX=0,this.scaleX=Math.sqrt(m*m+p*p),this.scaleX>1e-4){const b=m*g-u*p;this.scaleY=b/this.scaleX,this.shearY=-U.atan2Deg(m*u+p*g,b),this.rotation=U.atan2Deg(p,m)}else this.scaleX=0,this.scaleY=Math.sqrt(u*u+g*g),this.shearY=0,this.rotation=90-U.atan2Deg(g,u)}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t._update)}modifyWorld(t){this.local=t,this.world=t,this.resetWorld(t)}resetWorld(t){const e=this.bone.children;for(let s=0,n=e.length;s<n;s++){const i=e[s].appliedPose;i.world===t&&(i.world=0,i.local=0,i.resetWorld(t))}}getWorldRotationX(){return U.atan2Deg(this.c,this.a)}getWorldRotationY(){return U.atan2Deg(this.d,this.b)}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){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const 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.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=U.degRad;const e=Math.sin(t),s=Math.cos(t);return U.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*U.degRad;const e=Math.sin(t),s=Math.cos(t);return U.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=U.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},us=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},ms=class extends us{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},ae=class Tn extends ms{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new re,new re),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Tn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends ms{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},Qs=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,B.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,B.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends ne{constructor(t,e){super(t,e)}},oe=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},gs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new oe(-1,this);constructor(t){this.name=t}},ce=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},Ht=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new ce)}create(t){return new Zs(this,t)}},ps=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(ps||{}),Zs=class Ft extends Et{bones;target;constructor(e,s){if(super(e,new ce,new ce),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Ft(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Ft.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Ft.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,c,l,o,a,h){typeof n=="number"?Ft.apply1(e,s,n,i,r,c,l,o):Ft.apply2(e,s,n,i,r,c,l,o,a,h)}static apply1(e,s,n,i,r,c,l,o){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,f=a.c,m=a.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*U.signum(e.scaleX),g=(i-s.worldY)*U.signum(e.scaleY);break;case 2:{const b=Math.abs(h*m-d*f)/Math.max(1e-4,h*h+f*f),x=h/e.scaleX,w=f/e.scaleY;d=-w*b*e.scaleX,m=x*b*e.scaleY,u+=U.atan2Deg(w,x)}default:{const b=n-a.worldX,x=i-a.worldY,w=h*m-d*f;Math.abs(w)<=1e-4?(p=0,g=0):(p=(b*m-x*d)/w-s.x,g=(x*h-b*f)/w-s.y)}}if(u+=U.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360),s.rotation+=u*o,r||c){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const b=s.bone.data.length*s.scaleX;if(b>1e-4){const x=p*p+g*g;if(r&&x<b*b||c&&x>b*b){const w=(Math.sqrt(x)/b-1)*o+1;switch(s.scaleX*=w,l){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w}}}}}static apply2(e,s,n,i,r,c,l,o,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,f=s.y,m=s.scaleX,u=s.scaleY,p=n.scaleX,g=0,b=0,x=0;m<0?(m=-m,g=180,x=-1):(g=0,x=1),u<0&&(u=-u,x=-x),p<0?(p=-p,b=180):b=0;let w=0,v=0,y=s.a,S=s.b,I=s.c,T=s.d;const A=Math.abs(m-u)<=1e-4;!A||l?(n.y=0,w=y*n.x+s.worldX,v=I*n.x+s.worldY):(w=y*n.x+S*n.y+s.worldX,v=I*n.x+T*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,S=M.b,I=M.c,T=M.d;let F=y*T-S*I,k=w-M.worldX,E=v-M.worldY;F=Math.abs(F)<=1e-4?0:1/F;const X=(k*T-E*S)*F-d,V=(E*y-k*I)*F-f;let O=Math.sqrt(X*X+V*V),q=n.bone.data.length*p,L,P;if(O<1e-4){Ft.apply(e,s,i,r,!1,l,0,h),n.rotation=0;return}k=i-M.worldX,E=r-M.worldY;let Y=(k*T-E*S)*F-d,$=(E*y-k*I)*F-f,N=Y*Y+$*$;if(a!==0){a*=m*(p+1)*.5;const R=Math.sqrt(N),_=R-O-q*m+a;if(_>0){let D=Math.min(1,_/(a*2))-1;D=(_-a*(1-D*D))/R,Y-=D*Y,$-=D*$,N=Y*Y+$*$}}t:if(A){q*=m;let R=(N-O*O-q*q)/(2*O*q);if(R<-1)R=-1,P=Math.PI*c;else if(R>1){if(R=1,P=0,l)switch(y=(Math.sqrt(N)/(O+q)-1)*h+1,s.scaleX*=y,o){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y}}else P=Math.acos(R)*c;y=O+q*R,S=q*Math.sin(P),L=Math.atan2($*y-Y*S,Y*y+$*S)}else{y=m*q,S=u*q;const R=y*y,_=S*S,D=Math.atan2($,Y);I=_*O*O+R*N-R*_;const J=-2*_*O,tt=_-R;if(T=J*J-4*tt*I,T>=0){let ft=Math.sqrt(T);J<0&&(ft=-ft),ft=-(J+ft)*.5;let gt=ft/tt,Lt=I/ft;const Jt=Math.abs(gt)<Math.abs(Lt)?gt:Lt;if(gt=N-Jt*Jt,gt>=0){E=Math.sqrt(gt)*c,L=D-Math.atan2(E,Jt),P=Math.atan2(E/u,(Jt-O)/m);break t}}let K=U.PI,et=O-y,nt=et*et,st=0,lt=0,it=O+y,rt=it*it,ht=0;I=-y*O/(R-_),I>=-1&&I<=1&&(I=Math.acos(I),k=y*Math.cos(I)+O,E=S*Math.sin(I),T=k*k+E*E,T<nt&&(K=I,nt=T,et=k,st=E),T>rt&&(lt=I,rt=T,it=k,ht=E)),N<=(nt+rt)*.5?(L=D-Math.atan2(st*c,et),P=K*c):(L=D-Math.atan2(ht*c,it),P=lt*c)}const W=Math.atan2(n.y,n.x)*x;L=(L-W)*U.radDeg+g-s.rotation,L>180?L-=360:L<-180&&(L+=360),s.rotation+=L*h,P=((P+W)*U.radDeg-n.shearX)*x+b-n.rotation,P>180?P-=360:P<-180&&(P+=360),n.rotation+=P*h}},le=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Gt=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new le)}create(t){return new tn(this,t)}},bs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(bs||{}),xs=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(xs||{}),ws=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(ws||{}),tn=class bt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new le,new le),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new bt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof se))return;const i=this.appliedPose,r=i.mixRotate,c=i.mixX,l=i.mixY;if(r===0&&c===0&&l===0)return;const o=this.data,a=o.rotateMode===0,h=o.rotateMode===2,d=this.bones,f=d.length,m=a?f:f+1,u=B.setArraySize(this.spaces,m),p=h?this.lengths=B.setArraySize(this.lengths,f):[],g=i.spacing;switch(o.spacingMode){case 2:if(h)for(let S=0,I=m-1;S<I;S++){const T=d[S],A=T.bone.data.length,M=A*T.a,F=A*T.c;p[S]=Math.sqrt(M*M+F*F)}B.arrayFill(u,1,m,g);break;case 3:{let S=0;for(let I=0,T=m-1;I<T;){const A=d[I],M=A.bone.data.length;if(M<bt.epsilon)h&&(p[I]=0),u[++I]=g;else{const F=M*A.a,k=M*A.c,E=Math.sqrt(F*F+k*k);h&&(p[I]=E),u[++I]=E,S+=E}}if(S>0){S=m/S*g;for(let I=1;I<m;I++)u[I]*=S}break}default:{const S=o.spacingMode===0;for(let I=0,T=m-1;I<T;){const A=d[I],M=A.bone.data.length;if(M<bt.epsilon)h&&(p[I]=0),u[++I]=g;else{const F=M*A.a,k=M*A.c,E=Math.sqrt(F*F+k*k);h&&(p[I]=E),u[++I]=(S?Math.max(0,M+g):g)*E/M}}}}const b=this.computeWorldPositions(e,n,m,a);let x=b[0],w=b[1],v=o.offsetRotation,y=!1;if(v===0)y=o.rotateMode===1;else{y=!1;const S=this.slot.bone.appliedPose;v*=S.a*S.d-S.b*S.c>0?U.degRad:-U.degRad}for(let S=0,I=3,T=e._update;S<f;S++,I+=3){const A=d[S];A.worldX+=(x-A.worldX)*c,A.worldY+=(w-A.worldY)*l;const M=b[I],F=b[I+1],k=M-x,E=F-w;if(h){const X=p[S];if(X!==0){const V=(Math.sqrt(k*k+E*E)/X-1)*r+1;A.a*=V,A.c*=V}}if(x=M,w=F,r>0){let X=A.a,V=A.b,O=A.c,q=A.d,L=0,P=0,Y=0;if(a?L=b[I-1]:u[S+1]===0?L=b[I+2]:L=Math.atan2(E,k),L-=Math.atan2(O,X),y){P=Math.cos(L),Y=Math.sin(L);const $=A.bone.data.length;x+=($*(P*X-Y*O)-k)*r,w+=($*(Y*X+P*O)-E)*r}else L+=v;L>U.PI?L-=U.PI2:L<-U.PI&&(L+=U.PI2),L*=r,P=Math.cos(L),Y=Math.sin(L),A.a=P*X-Y*O,A.b=P*V-Y*q,A.c=Y*X+P*O,A.d=Y*V+P*q}A.modifyWorld(T)}}computeWorldPositions(e,s,n,i){const r=this.slot;let c=this.appliedPose.position,l=this.spaces,o=B.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,f=d/6,m=bt.NONE;if(!s.constantSpeed){const P=s.lengths;f-=h?1:2;const Y=P[f];this.data.positionMode===1&&(c*=Y);let $;switch(this.data.spacingMode){case 2:$=Y;break;case 3:$=Y/n;break;default:$=1}a=B.setArraySize(this.world,8);for(let N=0,W=0,R=0;N<n;N++,W+=3){const _=l[N]*$;c+=_;let D=c;if(h)D%=Y,D<0&&(D+=Y),R=0;else if(D<0){m!==bt.BEFORE&&(m=bt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition(D,a,0,o,W);continue}else if(D>Y){m!==bt.AFTER&&(m=bt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition(D-Y,a,0,o,W);continue}for(;;R++){const J=P[R];if(!(D>J)){if(R===0)D/=J;else{const tt=P[R-1];D=(D-tt)/(J-tt)}break}}R!==m&&(m=R,h&&R===f?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,R*6+2,8,a,0,2)),this.addCurvePosition(D,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],o,W,i||N>0&&_===0)}return o}h?(d+=2,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(f--,d-=4,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const u=B.setArraySize(this.curves,f);let p=0,g=a[0],b=a[1],x=0,w=0,v=0,y=0,S=0,I=0,T=0,A=0,M=0,F=0,k=0,E=0,X=0,V=0;for(let P=0,Y=2;P<f;P++,Y+=6)x=a[Y],w=a[Y+1],v=a[Y+2],y=a[Y+3],S=a[Y+4],I=a[Y+5],T=(g-x*2+v)*.1875,A=(b-w*2+y)*.1875,M=((x-v)*3-g+S)*.09375,F=((w-y)*3-b+I)*.09375,k=T*2+M,E=A*2+F,X=(x-g)*.75+T+M*.16666667,V=(w-b)*.75+A+F*.16666667,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,k+=M,E+=F,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,p+=Math.sqrt(X*X+V*V),X+=k+M,V+=E+F,p+=Math.sqrt(X*X+V*V),u[P]=p,g=S,b=I;this.data.positionMode===1&&(c*=p);let O;switch(this.data.spacingMode){case 2:O=p;break;case 3:O=p/n;break;default:O=1}const q=this.segments;let L=0;for(let P=0,Y=0,$=0,N=0;P<n;P++,Y+=3){const W=l[P]*O;c+=W;let R=c;if(h)R%=p,R<0&&(R+=p),$=0,N=0;else if(R<0){this.addBeforePosition(R,a,0,o,Y);continue}else if(R>p){this.addAfterPosition(R-p,a,d-4,o,Y);continue}for(;;$++){const _=u[$];if(!(R>_)){if($===0)R/=_;else{const D=u[$-1];R=(R-D)/(_-D)}break}}if($!==m){m=$;let _=$*6;for(g=a[_],b=a[_+1],x=a[_+2],w=a[_+3],v=a[_+4],y=a[_+5],S=a[_+6],I=a[_+7],T=(g-x*2+v)*.03,A=(b-w*2+y)*.03,M=((x-v)*3-g+S)*.006,F=((w-y)*3-b+I)*.006,k=T*2+M,E=A*2+F,X=(x-g)*.3+T+M*.16666667,V=(w-b)*.3+A+F*.16666667,L=Math.sqrt(X*X+V*V),q[0]=L,_=1;_<8;_++)X+=k,V+=E,k+=M,E+=F,L+=Math.sqrt(X*X+V*V),q[_]=L;X+=k,V+=E,L+=Math.sqrt(X*X+V*V),q[8]=L,X+=k+M,V+=E+F,L+=Math.sqrt(X*X+V*V),q[9]=L,N=0}for(R*=L;;N++){const _=q[N];if(!(R>_)){if(N===0)R/=_;else{const D=q[N-1];R=N+(R-D)/(_-D)}break}}this.addCurvePosition(R*.1,g,b,x,w,v,y,S,I,o,Y,i||P>0&&W===0)}return o}addBeforePosition(e,s,n,i,r){const c=s[n],l=s[n+1],o=s[n+2]-c,a=s[n+3]-l,h=Math.atan2(a,o);i[r]=c+e*Math.cos(h),i[r+1]=l+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const c=s[n+2],l=s[n+3],o=c-s[n],a=l-s[n+1],h=Math.atan2(a,o);i[r]=c+e*Math.cos(h),i[r+1]=l+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,c,l,o,a,h,d,f){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const m=e*e,u=m*e,p=1-e,g=p*p,b=g*p,x=p*e,w=x*3,v=p*w,y=w*e,S=s*b+i*v+c*y+o*u,I=n*b+r*v+l*y+a*u;h[d]=S,h[d+1]=I,f&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(I-(n*g+r*x*2+l*m),S-(s*g+i*x*2+c*m)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let c=0;c<r;c++){const l=i[c].bone;e.sortBone(l),e.constrained(l)}e._updateCache.push(this);for(let c=0;c<r;c++)e.sortReset(i[c].bone.children);for(let c=0;c<r;c++)i[c].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let c=0,l=r.length;c<l;c++){const o=r[c];o.slotIndex===n&&this.sortPath(e,o.attachment,i)}}sortPath(e,s,n){if(!(s instanceof se))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let c=0,l=i.length;c<l;){let o=i[c++];for(o+=c;c<o;)e.sortBone(r[i[c++]])}}}isSourceActive(){return this.slot.bone.active}},en=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(en||{}),he=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){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}},de=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof xt)||!(this.attachment instanceof xt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},sn=class An extends us{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new An(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},nn=class Ie{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ie.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ie.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new ae(n,null);else{const r=this.bones[n.parent.index];i=new ae(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new sn(s,this));this.drawOrder=new Qs(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof ys&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let c=0,l=e.length;c<l;c++)e[c].unconstrained();const s=this.bones,n=s.length;for(let c=0,l=n;c<l;c++){const o=s[c];o.sorted=o.data.skinRequired,o.active=!o.sorted,o.unconstrained()}if(this.skin){const c=this.skin.bones;for(let l=0,o=this.skin.bones.length;l<o;l++){let a=this.bones[c[l].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let c=0;c<r;c++)i[c].unconstrained();for(let c=0;c<r;c++){const l=i[c];l.active=l.isSourceActive()&&(!l.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(l.data)),l.active&&l.sort(this)}for(let c=0;c<n;c++)this.sortBone(s[c]);r=this._updateCache.length;for(let c=0;c<r;c++){const l=this._updateCache[c];l instanceof ae&&(this._updateCache[c]=l.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],c=r.data.attachmentName;if(c){const l=e.getAttachment(n,c);l&&r.pose.setAttachment(l)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const c=n[i];if(c instanceof s&&c.data.name===e)return c}return null}getBoundsRect(e){const s=new Ae,n=new Ae;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(e,s,n=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,c=r;let l=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,f=r.length;d<f;d++){const m=c[d];if(!m.bone.active)continue;let u=0,p=null,g=null;const b=m.appliedPose.attachment;if(b){if(b instanceof Yt)u=8,p=B.setArraySize(n,u,0),b.computeWorldVertices(m,b.getOffsets(m.appliedPose),p,0,2),g=Ie.quadTriangles;else if(b instanceof It)u=b.worldVerticesLength,p=B.setArraySize(n,u,0),b.computeWorldVertices(this,m,0,u,p,0,2),g=b.triangles;else if(b instanceof Wt&&i){i.clipEnd(m),i.clipStart(this,m,b);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,u=i.clippedVertices.length);for(let x=0,w=p.length;x<w;x+=2){const v=p[x],y=p[x+1];l=Math.min(l,v),o=Math.min(o,y),a=Math.max(a,v),h=Math.max(h,y)}}}i&&i.clipEnd(m)}i&&i.clipEnd(),e.set(l,o),s.set(a-l,h-o)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,c=i.length;r<c;r++)i[r].rotate(e,s,n)}},ys=class Cn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new he,new he),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new Cn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*U.degRad,r=Math.cos(i),c=Math.sin(i),l=this.cx-e,o=this.cy-s;this.translate(l*r-o*c-l,l*c+o*r-o)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,c=this.data.y>0,l=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,f=0;switch(s){case 0:return;case 1:this.reset(e);case 2:{const m=Math.max(e.time-this.lastTime,0),u=this.remaining;this.remaining+=m,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let b=this.remaining,x=n.inertia,w=e.data.referenceScale,v=-1,y=0,S=0,I=this.data.limit*m,T=I*Math.abs(e.scaleY);if(I*=Math.abs(e.scaleX),r||c){if(r){const A=(this.ux-p)*x;this.xOffset+=A>I?I:A<-I?-I:A,this.ux=p}if(c){const A=(this.uy-g)*x;this.yOffset+=A>T?T:A<-T?-T:A,this.uy=g}if(b>=d){const A=this.xOffset,M=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,S=n.strength;const F=w*n.wind,k=w*n.gravity,E=(F*e.windX+k*e.gravityX)*e.scaleX,X=(F*e.windY+k*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*S)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),c&&(this.yVelocity-=(X+this.yOffset*S)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),b-=d;while(b>=d);this.xLag=this.xOffset-A,this.yLag=this.yOffset-M}f=Math.max(0,1-b/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),c&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(l||o){let A=Math.atan2(a.c,a.a),M=0,F=0,k=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>I?E=I:E<-I&&(E=-I),X>T?X=T:X<-T&&(X=-T),b=this.remaining,l){k=(this.data.rotate+this.data.shearX)*i,f=this.rotateLag*Math.max(0,1-u/d);let V=Math.atan2(X+this.ty,E+this.tx)-A-(this.rotateOffset-f)*k;this.rotateOffset+=(V-Math.ceil(V*U.invPI2-.5)*U.PI2)*x,V=(this.rotateOffset-f)*k+A,M=Math.cos(V),F=Math.sin(V),o&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*F)*x/V))}else{M=Math.cos(A),F=Math.sin(A);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);V>0&&(this.scaleOffset+=(E*M+X*F)*x/V)}if(b>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,S=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,O=(n.wind*e.windY+n.gravity*e.gravityY)*nn.yDir,q=this.rotateOffset,L=this.scaleOffset,P=h/w;for(;;)if(b-=d,o&&(this.scaleVelocity+=(V*M-O*F-this.scaleOffset*S)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),l){if(this.rotateVelocity-=((V*F+O*M)*P+this.rotateOffset*S)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,b<d)break;const Y=this.rotateOffset*k+A;M=Math.cos(Y),F=Math.sin(Y)}else if(b<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-L}f=Math.max(0,1-b/d)}this.remaining=b}this.cx=a.worldX,this.cy=a.worldY;break}case 3:f=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),c&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(l){let m=(this.rotateOffset-this.rotateLag*f)*i,u=0,p=0,g=0;if(this.data.shearX>0){let b=0;this.data.rotate>0&&(b=m*this.data.rotate,u=Math.sin(b),p=Math.cos(b),g=a.b,a.b=p*g-u*a.d,a.d=u*g+p*a.d),b+=m*this.data.shearX,u=Math.sin(b),p=Math.cos(b),g=a.a,a.a=p*g-u*a.c,a.c=u*g+p*a.c}else m*=this.data.rotate,u=Math.sin(m),p=Math.cos(m),g=a.a,a.a=p*g-u*a.c,a.c=u*g+p*a.c,g=a.b,a.b=p*g-u*a.d,a.d=u*g+p*a.d}if(o){const m=1+(this.scaleOffset-this.scaleLag*f)*i*this.data.scaleX;a.a*=m,a.c*=m}s!==3&&(this.tx=h*a.a,this.ty=h*a.c),a.modifyWorld(e._update)}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},jt=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,new he)}create(t){return new ys(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var fe=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},rn=class Rs extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new fe,new fe),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Rs(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,c=this.bone;if(c!==null){if(!c.active)return;i.local&&c.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,c.appliedPose,i.local,Rs.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const l=e.bones,o=r.bones;for(let a=0,h=r.bones.length;a<h;a++)l[o[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,!1,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const m=i[r[d]];m.sorted=!1,e.sortReset(m.children),e.constrained(m)}const c=n.animation.timelines,l=e.slots,o=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const m=c[d];if(Ds(m))e.constrained(l[m.slotIndex]);else if(m instanceof Tt||m instanceof qt)e.drawOrder.constrained();else if(m instanceof pt)if(m.constraintIndex===-1)for(let u=0;u<h;u++)e.constrained(a[u]);else e.constrained(o[m.constraintIndex]);else if(_s(m)){const u=m.constraintIndex;u!==-1&&e.constrained(o[u])}}}},vt=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(t){super(t,new fe)}create(t){return new rn(this,t)}},vs=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof vt&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},Ss=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},ue=class{name;attachments=[];bones=[];constraints=[];color=new z(.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.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof It?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new Ss(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new Ss(t,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const c=e.attachments[s];for(const l in c){const o=c[l];if(r===o){const a=this.getAttachment(s,l);a&&i.pose.setAttachment(a);break}}}s++}}},Is=class extends ne{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new de),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Ts=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Ts||{}),me=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},an=class Mn extends Et{bones;source;constructor(e,s){if(super(e,new me,new me),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new Mn(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,c=i.localTarget,l=i.additive,o=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,f=i.properties.length,m=e._update,u=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const b=u[p];c?b.modifyLocal(e):b.modifyWorld(m);for(let x=0;x<f;x++){const w=d[x],v=w.value(e,h,r,a)-w.offset,y=w.to;for(let S=0,I=w.to.length;S<I;S++){const T=y[S];if(T.mix(n)!==0){let A=T.offset+v*T.scale;o&&(T.offset<T.max?A=U.clamp(A,T.offset,T.max):A=U.clamp(A,T.max,T.offset)),T.apply(e,n,b,A,c,l)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const c=s[r].bone;e.sortReset(c.children),e.constrained(c)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},j=class ct extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new me)}create(e){return new an(this,e)}getOffsetRotation(){return this.offsets[ct.ROTATION]}setOffsetRotation(e){this.offsets[ct.ROTATION]=e}getOffsetX(){return this.offsets[ct.X]}setOffsetX(e){this.offsets[ct.X]=e}getOffsetY(){return this.offsets[ct.Y]}setOffsetY(e){this.offsets[ct.Y]=e}getOffsetScaleX(){return this.offsets[ct.SCALEX]}setOffsetScaleX(e){this.offsets[ct.SCALEX]=e}getOffsetScaleY(){return this.offsets[ct.SCALEY]}setOffsetScaleY(e){this.offsets[ct.SCALEY]=e}getOffsetShearY(){return this.offsets[ct.SHEARY]}setOffsetShearY(e){this.offsets[ct.SHEARY]=e}},At=class{offset=0;to=[]},Ct=class{offset=0;max=0;scale=0},ge=class extends At{value(t,e,s,n){if(s)return e.rotation+n[j.ROTATION];const i=t.scaleX,r=t.scaleY;let c=Math.atan2(e.c/r,e.a/i)*U.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[j.ROTATION]:-n[j.ROTATION]);return c<0&&(c+=360),c}},As=class extends Ct{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const c=t.scaleX,l=t.scaleY,o=1/c,a=1/l,h=s.a*o,d=s.b*o,f=s.c*a,m=s.d*a;n*=U.degRad,r||(n-=Math.atan2(f,h)),n>U.PI?n-=U.PI2:n<-U.PI&&(n+=U.PI2),n*=e.mixRotate;const u=Math.cos(n),p=Math.sin(n);s.a=(u*h-p*f)*c,s.b=(u*d-p*m)*c,s.c=(p*h+u*f)*l,s.d=(p*d+u*m)*l}}},pe=class extends At{value(t,e,s,n){return s?e.x+n[j.X]:(n[j.X]*e.a+n[j.Y]*e.b+e.worldX)/t.scaleX}},Cs=class extends Ct{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},be=class extends At{value(t,e,s,n){return s?e.y+n[j.Y]:(n[j.X]*e.c+n[j.Y]*e.d+e.worldY)/t.scaleY}},Ms=class extends Ct{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},xe=class extends At{value(t,e,s,n){if(s)return e.scaleX+n[j.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEX]}},Fs=class extends Ct{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const c=1+(n-1)*e.mixScaleX;s.a*=c,s.c*=c}else{let c=s.a/t.scaleX,l=s.c/t.scaleY,o=Math.sqrt(c*c+l*l);o!==0&&(o=1+(n-o)*e.mixScaleX/o,s.a*=o,s.c*=o)}}},we=class extends At{value(t,e,s,n){if(s)return e.scaleY+n[j.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEY]}},Ys=class extends Ct{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const c=1+(n-1)*e.mixScaleY;s.b*=c,s.d*=c}else{let c=s.b/t.scaleX,l=s.d/t.scaleY,o=Math.sqrt(c*c+l*l);o!==0&&(o=1+(n-o)*e.mixScaleY/o,s.b*=o,s.d*=o)}}},ye=class extends At{value(t,e,s,n){if(s)return e.shearY+n[j.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*U.radDeg-90+n[j.SHEARY]}},Ps=class extends Ct{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const c=t.scaleX,l=t.scaleY,o=s.b/c,a=s.d/l,h=Math.atan2(a,o);n=(n+90)*U.degRad,r?n-=U.PI/2:(n-=h-Math.atan2(s.c/c,s.a/l),n>U.PI?n-=U.PI2:n<-U.PI&&(n+=U.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(o*o+a*a);s.b=Math.cos(n)*d*l,s.d=Math.sin(n)*d*c}}},$n=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new vs;s.name="";const n=new on(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const c=n.readBoolean();c&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}const o=s.bones;l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Bone name must not be null.");const p=m===0?null:o[n.readInt(!0)],g=new fs(m,u,p),b=g.setupPose;b.rotation=n.readFloat(),b.x=n.readFloat()*e,b.y=n.readFloat()*e,b.scaleX=n.readFloat(),b.scaleY=n.readFloat(),b.shearX=n.readFloat(),b.shearY=n.readFloat(),b.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),c&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),o.push(g)}l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Slot name must not be null.");const p=o[n.readInt(!0)],g=new Is(m,u,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const b=n.readInt32();b!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,b),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),c&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let m=0;m<h;m++){const u=n.readString();if(!u)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case oi:{const g=new Ht(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.target=o[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const x=g.setupPose;x.bendDirection=(b&4)!==0?-1:1,x.compress=(b&8)!==0,x.stretch=(b&16)!==0,(b&32)!==0&&(x.mix=(b&64)!==0?n.readFloat():1),(b&128)!==0&&(x.softness=n.readFloat()*e),a.push(g);break}case li:{const g=new j(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.source=o[n.readInt(!0)];let b=n.readUnsignedByte();g.skinRequired=(b&1)!==0,g.localSource=(b&2)!==0,g.localTarget=(b&4)!==0,g.additive=(b&8)!==0,g.clamp=(b&16)!==0,p=b>>5;for(let w=0,v;w<p;w++){let y=1,S;switch(n.readByte()){case 0:S=new ge;break;case 1:{y=e,S=new pe;break}case 2:{y=e,S=new be;break}case 3:S=new xe;break;case 4:S=new we;break;case 5:S=new ye;break;default:S=null}if(S){S.offset=n.readFloat()*y,v=n.readByte();for(let I=0;I<v;I++){let T=1,A;switch(n.readByte()){case 0:A=new As;break;case 1:{T=e,A=new Cs;break}case 2:{T=e,A=new Ms;break}case 3:A=new Fs;break;case 4:A=new Ys;break;case 5:A=new Ps;break;default:A=null}A&&(A.offset=n.readFloat()*T,A.max=n.readFloat()*T,A.scale=n.readFloat()*T/y,S.to[I]=A)}g.properties[w]=S}}b=n.readByte(),(b&1)!==0&&(g.offsets[j.ROTATION]=n.readFloat()),(b&2)!==0&&(g.offsets[j.X]=n.readFloat()*e),(b&4)!==0&&(g.offsets[j.Y]=n.readFloat()*e),(b&8)!==0&&(g.offsets[j.SCALEX]=n.readFloat()),(b&16)!==0&&(g.offsets[j.SCALEY]=n.readFloat()),(b&32)!==0&&(g.offsets[j.SHEARY]=n.readFloat()),b=n.readByte();const x=g.setupPose;(b&1)!==0&&(x.mixRotate=n.readFloat()),(b&2)!==0&&(x.mixX=n.readFloat()),(b&4)!==0&&(x.mixY=n.readFloat()),(b&8)!==0&&(x.mixScaleX=n.readFloat()),(b&16)!==0&&(x.mixScaleY=n.readFloat()),(b&32)!==0&&(x.mixShearY=n.readFloat()),a.push(g);break}case ci:{const g=new Gt(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,g.positionMode=b>>1&1,g.spacingMode=b>>2&3,g.rotateMode=b>>4&3,(b&128)!==0&&(g.offsetRotation=n.readFloat());const x=g.setupPose;x.position=n.readFloat(),g.positionMode===0&&(x.position*=e),x.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(x.spacing*=e),x.mixRotate=n.readFloat(),x.mixX=n.readFloat(),x.mixY=n.readFloat(),a.push(g);break}case hi:{const g=new jt(u);g.bone=o[n.readInt(!0)];let b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.x=n.readFloat()),(b&4)!==0&&(g.y=n.readFloat()),(b&8)!==0&&(g.rotate=n.readFloat()),(b&16)!==0&&(g.scaleX=n.readFloat()),(b&32)!==0&&(g.shearX=n.readFloat()),g.limit=((b&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const x=g.setupPose;x.inertia=n.readFloat(),x.strength=n.readFloat(),x.damping=n.readFloat(),x.massInverse=(b&128)!==0?n.readFloat():1,x.wind=n.readFloat(),x.gravity=n.readFloat(),b=n.readByte(),(b&1)!==0&&(g.inertiaGlobal=!0),(b&2)!==0&&(g.strengthGlobal=!0),(b&4)!==0&&(g.dampingGlobal=!0),(b&8)!==0&&(g.massGlobal=!0),(b&16)!==0&&(g.windGlobal=!0),(b&32)!==0&&(g.gravityGlobal=!0),(b&64)!==0&&(g.mixGlobal=!0),x.mix=(b&128)!==0?n.readFloat():1,a.push(g);break}case di:{const g=new vt(u),b=n.readByte();if(g.skinRequired=(b&1)!==0,g.loop=(b&2)!==0,g.additive=(b&4)!==0,(b&8)!==0&&(g.setupPose.time=n.readFloat()),(b&16)!==0&&(g.setupPose.mix=(b&32)!==0?n.readFloat():1),(b&64)!==0){g.local=(b&128)!==0,g.bone=o[n.readInt(!0)];const x=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new ge;break;case 1:{w=e,g.property=new pe;break}case 2:{w=e,g.property=new be;break}case 3:g.property=new xe;break;case 4:g.property=new we;break;case 5:g.property=new ye;break;default:continue}g.property.offset=x*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,c);d&&(s.defaultSkin=d,s.skins.push(d));{let m=s.skins.length;for(B.setArraySize(s.skins,l=m+n.readInt(!0));m<l;m++){const u=this.readSkin(n,s,!1,c);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[m]=u}}l=this.linkedMeshes.length;for(let m=0;m<l;m++){const u=this.linkedMeshes[m],p=s.skins[u.skinIndex];if(!u.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(u.sourceIndex,u.source);if(!g)throw new Error(`Source mesh not found: ${u.source}`);u.mesh.timelineAttachment=u.inheritTimelines?g:u.mesh,u.mesh.setSourceMesh(g),u.mesh.updateSequence()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Event data name must not be null");const p=new gs(u),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const f=s.animations;l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,u,s,c))}for(let m=0;m<h;m++){const u=a[m];u instanceof vt&&(u.animation=f[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new ue("default")}else{const c=t.readString();if(!c)throw new Error("Skin name must not be null.");i=new ue(c),n&&z.rgba8888ToColor(i.color,t.readInt32());let l=t.readInt(!0),o=e.bones,a=i.bones;for(let h=0;h<l;h++)a[h]=o[t.readInt(!0)];l=t.readInt(!0),o=e.constraints,a=i.constraints;for(let h=0;h<l;h++)a[h]=o[t.readInt(!0)];r=t.readInt(!0)}for(let c=0;c<r;c++){const l=t.readInt(!0);for(let o=0,a=t.readInt(!0);o<a;o++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,l,h,n);d&&i.setAttachment(l,h,d)}}return i}readAttachment(t,e,s,n,i,r){const c=this.scale,l=t.readByte(),o=(l&8)!==0?t.readStringRef():i;if(!o)throw new Error("Attachment name must not be null");switch(l&7){case 0:{let a=(l&16)!==0?t.readStringRef():null;const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),f=(l&128)!==0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat();a||(a=o);const w=this.attachmentLoader.newRegionAttachment(s,i,o,a,d);return w?(w.path=a,w.x=m*c,w.y=u*c,w.scaleX=p,w.scaleY=g,w.rotation=f,w.width=b*c,w.height=x*c,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(l&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,o);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(l&16)!==0?t.readStringRef():o;const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),f=t.readInt(!0),m=this.readVertices(t,(l&128)!==0),u=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-f-2)*3),g=t.readInt(!0);let b=null;if(g>0){b=[];for(let S=0;S<g;S++)b[S]=t.readInt(!0)}let x=[],w=0,v=0;r&&(x=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),v=t.readFloat()),a||(a=o);const y=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=f<<1,y.bones=m.bones,y.vertices=m.vertices,y.worldVerticesLength=m.length,y.regionUVs=u,y.triangles=p,b&&(y.timelineSlots=b),r&&(y.edges=x,y.width=w*c,y.height=v*c),y.updateSequence(),y):null}case 3:{const a=(l&16)!==0?t.readStringRef():o;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),f=(l&128)!==0,m=t.readInt(!0),u=t.readInt(!0),p=t.readStringRef();let g=0,b=0;r&&(g=t.readFloat(),b=t.readFloat());const x=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return x?(x.path=a,z.rgba8888ToColor(x.color,h),r&&(x.width=g*c,x.height=b*c),this.linkedMeshes.push(new Un(x,u,n,m,p,f)),x):null}case 4:{const a=(l&16)!==0,h=(l&32)!==0,d=this.readVertices(t,(l&64)!==0),f=this.readFloatArray(t,d.length/6,c),m=r?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,i,o);return u?(u.closed=a,u.constantSpeed=h,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,r&&z.rgba8888ToColor(u.color,m),u):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=r?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,i,o);return m?(m.x=h*c,m.y=d*c,m.rotation=a,r&&z.rgba8888ToColor(m.color,f),m):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(l&16)!==0),d=r?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,i,o);return f?(f.endSlot=e.slots[a],f.convex=(l&32)!==0,f.inverse=(l&64)!==0,f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,r&&z.rgba8888ToColor(f.color,d),f):null}}}readSequence(t,e){if(!e)return new Nt(1,!1);const s=new Nt(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new cn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),c=[],l=[];for(let o=0,a=0;o<r;){const h=t.readInt(!0);c[o++]=h;for(let d=0;d<h;d++,a+=3)c[o++]=t.readInt(!0),l[a]=t.readFloat()*s,l[a+1]=t.readFloat()*s,l[a+2]=t.readFloat()}return new cn(c,B.toFloatArray(l),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=x-1;switch(b){case ei:{const v=new Pt(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readStringRef());i.push(v);break}case si:{const v=t.readInt(!0),y=new Ue(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let F=0,k=0;y.setFrame(F,S,I,T,A,M),F!==w;F++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(F);break;case mt:H(t,y,k++,F,0,S,E,I,X,1),H(t,y,k++,F,1,S,E,T,V,1),H(t,y,k++,F,2,S,E,A,O,1),H(t,y,k++,F,3,S,E,M,q,1)}S=E,I=X,T=V,A=O,M=q}i.push(y);break}case ni:{const v=t.readInt(!0),y=new De(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let M=0,F=0;y.setFrame(M,S,I,T,A),M!==w;M++){const k=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(M);break;case mt:H(t,y,F++,M,0,S,k,I,E,1),H(t,y,F++,M,1,S,k,T,X,1),H(t,y,F++,M,2,S,k,A,V,1)}S=k,I=E,T=X,A=V}i.push(y);break}case ii:{const v=t.readInt(!0),y=new _e(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,S,I,T,A,M,F,k,E),X!==w;X++){const O=t.readFloat(),q=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(X);break;case mt:H(t,y,V++,X,0,S,O,I,q,1),H(t,y,V++,X,1,S,O,T,L,1),H(t,y,V++,X,2,S,O,A,P,1),H(t,y,V++,X,3,S,O,M,Y,1),H(t,y,V++,X,4,S,O,F,$,1),H(t,y,V++,X,5,S,O,k,N,1),H(t,y,V++,X,6,S,O,E,W,1)}S=O,I=q,T=L,A=P,M=Y,F=$,k=N,E=W}i.push(y);break}case ri:{const v=t.readInt(!0),y=new ze(x,v,u);let S=t.readFloat(),I=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,S,I,T,A,M,F,k),E!==w;E++){const V=t.readFloat(),O=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(E);break;case mt:H(t,y,X++,E,0,S,V,I,O,1),H(t,y,X++,E,1,S,V,T,q,1),H(t,y,X++,E,2,S,V,A,L,1),H(t,y,X++,E,3,S,V,M,P,1),H(t,y,X++,E,4,S,V,F,Y,1),H(t,y,X++,E,5,S,V,k,$,1)}S=V,I=O,T=q,A=L,M=P,F=Y,k=$}i.push(y);break}case ai:{const v=new qe(x,t.readInt(!0),u);let y=t.readFloat(),S=t.readUnsignedByte()/255;for(let I=0,T=0;v.setFrame(I,y,S),I!==w;I++){const A=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ut:v.setStepped(I);break;case mt:H(t,v,T++,I,0,y,A,S,M,1)}y=A,S=M}i.push(v)}}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===ti){const v=new $e(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readByte());i.push(v);continue}const w=t.readInt(!0);switch(b){case _n:Z(t,i,new Ut(x,w,u),1);break;case zn:Z(t,i,new ke(x,w,u),r);break;case Wn:Z(t,i,new Ee(x,w,u),r);break;case Hn:Z(t,i,new Xe(x,w,u),r);break;case Gn:Z(t,i,new Ve(x,w,u),1);break;case jn:Z(t,i,new Re(x,w,u),1);break;case Jn:Z(t,i,new Le(x,w,u),1);break;case Kn:Z(t,i,new Be(x,w,u),1);break;case Qn:Z(t,i,new Oe(x,w,u),1);break;case Zn:Z(t,i,new Ne(x,w,u),1);break}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Ge(p,t.readInt(!0),u);let x=t.readByte(),w=t.readFloat(),v=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,y=(x&4)!==0?t.readFloat()*r:0;for(let S=0,I=0;b.setFrame(S,w,v,y,(x&8)!==0?1:-1,(x&16)!==0,(x&32)!==0),S!==g;S++){x=t.readByte();const T=t.readFloat(),A=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,M=(x&4)!==0?t.readFloat()*r:0;(x&64)!==0?b.setStepped(S):(x&128)!==0&&(H(t,b,I++,S,0,w,T,v,A,1),H(t,b,I++,S,1,w,T,y,M,r)),w=T,v=A,y=M}i.push(b)}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new je(p,t.readInt(!0),u);let x=t.readFloat(),w=t.readFloat(),v=t.readFloat(),y=t.readFloat(),S=t.readFloat(),I=t.readFloat(),T=t.readFloat();for(let A=0,M=0;b.setFrame(A,x,w,v,y,S,I,T),A!==g;A++){const F=t.readFloat(),k=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),O=t.readFloat(),q=t.readFloat();switch(t.readByte()){case ut:b.setStepped(A);break;case mt:H(t,b,M++,A,0,x,F,w,k,1),H(t,b,M++,A,1,x,F,v,E,1),H(t,b,M++,A,2,x,F,y,X,1),H(t,b,M++,A,3,x,F,S,V,1),H(t,b,M++,A,4,x,F,I,O,1),H(t,b,M++,A,5,x,F,T,q,1)}x=F,w=k,v=E,y=X,S=V,I=O,T=q}i.push(b)}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=s.constraints[u];for(let g=0,b=t.readInt(!0);g<b;g++){const x=t.readByte(),w=t.readInt(!0),v=t.readInt(!0);switch(x){case mi:Z(t,i,new Je(w,v,u),p.positionMode===0?r:1);break;case gi:Z(t,i,new Ke(w,v,u),p.spacingMode===0||p.spacingMode===1?r:1);break;case pi:{const y=new Qe(w,v,u);let S=t.readFloat(),I=t.readFloat(),T=t.readFloat(),A=t.readFloat();for(let M=0,F=0,k=y.getFrameCount()-1;y.setFrame(M,S,I,T,A),M!==k;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),O=t.readFloat();switch(t.readByte()){case ut:y.setStepped(M);break;case mt:H(t,y,F++,M,0,S,E,I,X,1),H(t,y,F++,M,1,S,E,T,V,1),H(t,y,F++,M,2,S,E,A,O,1)}S=E,I=X,T=V,A=O}i.push(y)}}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===Ti){const v=new as(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat());i.push(v);continue}const w=t.readInt(!0);switch(b){case bi:Z(t,i,new Ze(x,w,u),1);break;case xi:Z(t,i,new ts(x,w,u),1);break;case wi:Z(t,i,new es(x,w,u),1);break;case yi:Z(t,i,new ss(x,w,u),1);break;case vi:Z(t,i,new ns(x,w,u),1);break;case Si:Z(t,i,new is(x,w,u),1);break;case Ii:Z(t,i,new rs(x,w,u),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=t.readInt(!0);switch(b){case Ai:Z(t,i,new os(x,w,u),1);break;case Ci:Z(t,i,new cs(x,w,u),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readInt(!0);for(let x=0,w=t.readInt(!0);x<w;x++){const v=t.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=u.getAttachment(b,v),S=t.readByte(),I=t.readInt(!0),T=I-1;switch(S){case fi:{const A=y,M=A.bones,F=A.vertices,k=M?F.length/3*2:F.length,E=t.readInt(!0),X=new We(I,E,b,A);let V=t.readFloat();for(let O=0,q=0;;O++){let L,P=t.readInt(!0);if(P===0)L=M?B.newFloatArray(k):F;else{L=B.newFloatArray(k);const $=t.readInt(!0);if(P+=$,r===1)for(let N=$;N<P;N++)L[N]=t.readFloat();else for(let N=$;N<P;N++)L[N]=t.readFloat()*r;if(!M)for(let N=0,W=L.length;N<W;N++)L[N]+=F[N]}if(X.setFrame(O,V,L),O===T)break;const Y=t.readFloat();switch(t.readByte()){case ut:X.setStepped(O);break;case mt:H(t,X,q++,O,0,V,Y,0,1,1)}V=Y}i.push(X);break}case ui:{const A=new He(I,b,y);for(let M=0;M<I;M++){const F=t.readFloat(),k=t.readInt32();A.setFrame(M,F,Pe[k&15],k>>4,t.readFloat())}i.push(A);break}}}}}const c=s.slots.length,l=t.readInt(!0);if(l>0){const f=new Tt(l);for(let m=0;m<l;m++)f.setFrame(m,t.readFloat(),ln(t,c));i.push(f)}const o=t.readInt(!0);for(let f=0;f<o;f++){const m=t.readInt(!0),u=new Array(m);for(let b=0;b<m;b++)u[b]=t.readInt(!0);const p=t.readInt(!0),g=new qt(p,u,c);for(let b=0;b<p;b++)g.setFrame(b,t.readFloat(),ln(t,m));i.push(g)}const a=t.readInt(!0);if(a>0){const f=new te(a);for(let m=0;m<a;m++){const u=t.readFloat(),p=s.events[t.readInt(!0)],g=new oe(u,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),f.setFrame(m,g)}i.push(f)}let h=0;for(let f=0,m=i.length;f<m;f++)h=Math.max(h,i[f].getDuration());const d=new Qt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},on=class{constructor(t,e=[],s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const 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(){const 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="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},Un=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},cn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s,n){s instanceof $t?Dn(t,e,s,n):qn(t,e,s,n)}function Dn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let c=0,l=0,o=s.getFrameCount()-1;s.setFrame(c,i,r),c!==o;c++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ut:s.setStepped(c);break;case mt:H(t,s,l++,c,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function qn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,c=t.readFloat()*n;for(let l=0,o=0,a=s.getFrameCount()-1;s.setFrame(l,i,r,c),l!==a;l++){const h=t.readFloat(),d=t.readFloat()*n,f=t.readFloat()*n;switch(t.readByte()){case ut:s.setStepped(l);break;case mt:H(t,s,o++,l,0,i,h,r,d,n),H(t,s,o++,l,1,i,h,c,f,n)}i=h,r=d,c=f}e.push(s)}function ln(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,c=0;for(let l=0;l<s;l++){const o=t.readInt(!0);for(;r!==o;)i[c++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[c++]=r++;for(let l=e-1;l>=0;l--)n[l]===-1&&(n[l]=i[--c]);return n}function H(t,e,s,n,i,r,c,l,o,a){e.setBezier(s,n,i,r,l,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,c,o)}var _n=0,zn=1,Wn=2,Hn=3,Gn=4,jn=5,Jn=6,Kn=7,Qn=8,Zn=9,ti=10,ei=0,si=1,ni=2,ii=3,ri=4,ai=5,oi=0,ci=1,li=2,hi=3,di=4,fi=0,ui=1,mi=0,gi=1,pi=2,bi=0,xi=1,wi=2,yi=4,vi=5,Si=6,Ii=7,Ti=8,Ai=0,Ci=1,ut=1,mt=2,Mi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Ot(()=>B.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,c=r.length;s.length=0,i.freeAll(n),n.length=0;for(let l=0;l<c;l++){const o=r[l];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof ds){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=B.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,o,0,a.worldVerticesLength,h,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,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,c=i.length;r<c;r++){const l=i[r],o=l;for(let a=0,h=l.length;a<h;a+=2){const d=o[a],f=o[a+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),n=Math.max(n,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){const i=this.minX,r=this.minY,c=this.maxX,l=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=c&&s>=c||e>=l&&n>=l)return!1;const o=(n-e)/(s-t);let a=o*(i-t)+e;if(a>r&&a<l||(a=o*(c-t)+e,a>r&&a<l))return!0;let h=(r-e)/o+t;return h>i&&h<c||(h=(l-e)/o+t,h>i&&h<c)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){const n=t,i=t.length;let r=i-2,c=!1;for(let l=0;l<i;l+=2){const o=n[l+1],a=n[r+1];if(o<s&&a>=s||a<s&&o>=s){const h=n[l];h+(s-o)/(a-o)*(n[r]-h)<e&&(c=!c)}r=l}return c}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,c=i.length;r<c;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,c=t.length,l=e-n,o=s-i,a=e*i-s*n;let h=r[c-2],d=r[c-1];for(let f=0;f<c;f+=2){const m=r[f],u=r[f+1],p=h*u-d*m,g=h-m,b=d-u,x=l*b-o*g,w=(a*g-l*p)/x;if((w>=h&&w<=m||w>=m&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const v=(a*b-o*p)/x;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=m,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},hn=class at{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Ot(()=>[]);polygonIndicesPool=new Ot(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let l=0;l<n;l++)i[l]=l;const r=this.isConcaveArray;r.length=0;for(let l=0;l<n;l++)r[l]=at.isConcave(l,n,s,i);const c=this.triangles;for(c.length=0;n>3;){let l=n-1,o=0,a=1;for(;;){t:if(!r[o]){const f=i[l]<<1,m=i[o]<<1,u=i[a]<<1,p=s[f],g=s[f+1],b=s[m],x=s[m+1],w=s[u],v=s[u+1];for(let y=a+1<n?a+1:0;y!==l;){if(r[y]){const S=i[y]<<1,I=s[S],T=s[S+1];if(at.positiveArea(w,v,p,g,I,T)&&at.positiveArea(p,g,b,x,I,T)&&at.positiveArea(b,x,w,v,I,T))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[o])break;o--}while(o>0);l=o>0?o-1:n-1,a=o+1<n?o+1:0;break}l=o,o=a,++a===n&&(a=0)}c.push(i[l],i[o],i[a]),i.splice(o,1),r.splice(o,1),n--;const h=o>0?o-1:n-1,d=o<n?o:0;r[h]=at.isConcave(h,n,s,i),r[d]=at.isConcave(d,n,s,i)}return n===3&&c.push(i[2],i[0],i[1]),c}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let l=this.polygonPool.obtain();l.length=0;let o=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const f=s[h]<<1,m=s[h+1]<<1,u=s[h+2]<<1,p=n[f],g=n[f+1],b=n[m],x=n[m+1],w=n[u],v=n[u+1];if(o===f){const y=l.length-4;if(at.winding(l[y],l[y+1],l[y+2],l[y+3],w,v)===a&&at.winding(w,v,l[0],l[1],l[2],l[3])===a){l.push(w,v),c.push(u);continue}}l.length>0&&(i.push(l),r.push(c),l=this.polygonPool.obtain(),c=this.polygonIndicesPool.obtain()),l.length=0,l.push(p,g,b,x),l.push(w,v),c.length=0,c.push(f,m,u),a=at.winding(p,g,b,x,w,v),o=f}l.length>0&&(i.push(l),r.push(c));for(let h=0,d=i.length;h<d;h++){if(c=r[h],c.length===0)continue;const f=c[0];let m=c[c.length-1];l=i[h];const u=l.length-4;let p=l[u],g=l[u+1],b=l[u+2],x=l[u+3];const w=l[0],v=l[1],y=l[2],S=l[3],I=at.winding(p,g,b,x,w,v);for(let T=0;T<d;T++){if(T===h)continue;const A=r[T];if(A.length!==3)continue;const M=A[0],F=A[1],k=A[2],E=i[T],X=E[E.length-2],V=E[E.length-1];M!==f||F!==m||at.winding(p,g,b,x,X,V)===I&&at.winding(X,V,w,v,y,S)===I&&(E.length=0,A.length=0,l.push(X,V),c.push(k),m=k,p=b,g=x,b=X,x=V,T=-1)}}for(let h=i.length-1;h>=0;h--)l=i[h],l.length===0?(i.splice(h,1),this.polygonPool.free(l),c=r[h],r.splice(h,1),this.polygonIndicesPool.free(c)):l.push(l[0],l[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,c=i[e]<<1,l=i[e+1<s?e+1:0]<<1;return!at.positiveArea(n[r],n[r+1],n[c],n[c+1],n[l],n[l+1])}static positiveArea(e,s,n,i,r,c){return e*(c-i)+n*(s-c)+r*(i-s)>=0}static winding(e,s,n,i,r,c){return e*(c-i)+n*(s-c)+r*(i-s)>=0?1:-1}},dn=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=B.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,c=this.makeClockwise(r);c||this.inverse||s.convex?(c||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new hn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,c,l){return n&&i&&r&&typeof c=="boolean"&&typeof l=="number"?this.clipTrianglesRender(t,e,s,n,i,r,c,l):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let f=e[d]<<1;const m=t[f],u=t[f+1];f=e[d+1]<<1;const p=t[f],g=t[f+1];f=e[d+2]<<1;const b=t[f],x=t[f+1];this.clipInverse(m,u,p,g,b,x,h);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const S=w[v++];let I=S>>1,T=n.length;const A=B.setArraySize(n,T+S);B.arrayCopy(w,v,A,T,S),T=i.length;const M=B.setArraySize(i,T+3*(I-2));for(let F=1;F<I-1;F++,T+=3)M[T]=r,M[T+1]=r+F,M[T+2]=r+F+1;r+=I,v+=S}}return!0}const c=this.clipOutput,l=this.clippingPolygons,o=l.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const f=t[d],m=t[d+1];d=e[h+1]<<1;const u=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],b=t[d+1];for(let x=0;x<o;x++){let w=n.length;if(this.clip(f,m,u,p,g,b,l[x])){a=this.clipOutput;const v=c.length;if(v===0)continue;let y=v>>1;const S=B.setArraySize(n,w+v);B.arrayCopy(a,0,S,w,v),w=i.length;const I=B.setArraySize(i,w+3*(y-2));y--;for(let T=1;T<y;T++,w+=3)I[w]=r,I[w+1]=r+T,I[w+2]=r+T+1;r+=y}else{const v=B.setArraySize(n,w+6);v[w]=f,v[w+1]=m,v[w+2]=u,v[w+3]=p,v[w+4]=g,v[w+5]=b,w=i.length;const y=B.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,c,l){const o=this.clippedVertices;o.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let b=e[g],x=e[g+1],w=e[g+2];const v=t[b*l],y=t[b*l+1],S=t[x*l],I=t[x*l+1],T=t[w*l],A=t[w*l+1];this.clipInverse(v,y,S,I,T,A,p);const M=this.inverseVertices.length;if(M===0)continue;const F=n[b<<=1],k=n[b+1],E=n[x<<=1],X=n[x+1],V=n[w<<=1],O=n[w+1],q=I-A,L=T-S,P=v-T,Y=A-y,$=1/(q*P+L*(y-A)),N=this.inverseVertices;for(let W=0;W<M;){const R=N[W++],_=R>>1;let D=o.length;const J=B.setArraySize(o,D+_*l);for(let K=0;K<R;K+=2,D+=l){const et=N[W+K],nt=N[W+K+1];J[D]=et,J[D+1]=nt,J[D+2]=i.r,J[D+3]=i.g,J[D+4]=i.b,J[D+5]=i.a;const st=et-T,lt=nt-A,it=(q*st+L*lt)*$,rt=(Y*st+P*lt)*$,ht=1-it-rt;J[D+6]=F*it+E*rt+V*ht,J[D+7]=k*it+X*rt+O*ht,c&&(J[D+8]=r.r,J[D+9]=r.g,J[D+10]=r.b,J[D+11]=r.a)}D=a.length;const tt=B.setArraySize(a,D+3*(_-2));for(let K=1;K<_-1;K++,D+=3)tt[D]=h,tt[D+1]=h+K,tt[D+2]=h+K+1;h+=_,W+=R}}return!0}const d=this.clipOutput,f=this.clippingPolygons,m=this.clippingPolygons.length;let u=null;for(let p=0;p<s;p+=3){let g=e[p];const b=t[g*l],x=t[g*l+1],w=n[g<<1],v=n[(g<<1)+1];g=e[p+1];const y=t[g*l],S=t[g*l+1],I=n[g<<1],T=n[(g<<1)+1];g=e[p+2];const A=t[g*l],M=t[g*l+1],F=n[g<<1],k=n[(g<<1)+1],E=S-M,X=A-y,V=b-A,O=M-x,q=1/(E*V+X*(x-M));for(let L=0;L<m;L++){let P=o.length;if(this.clip(b,x,y,S,A,M,f[L])){u=this.clipOutput;const Y=d.length;if(Y===0)continue;let $=Y>>1;const N=B.setArraySize(o,P+$*l);for(let R=0;R<Y;R+=2,P+=l){const _=u[R],D=u[R+1];N[P]=_,N[P+1]=D,N[P+2]=i.r,N[P+3]=i.g,N[P+4]=i.b,N[P+5]=i.a;const J=_-A,tt=D-M,K=(E*J+X*tt)*q,et=(O*J+V*tt)*q,nt=1-K-et;N[P+6]=w*K+I*et+F*nt,N[P+7]=v*K+T*et+k*nt,c&&(N[P+8]=r.r,N[P+9]=r.g,N[P+10]=r.b,N[P+11]=r.a)}P=a.length;const W=B.setArraySize(a,P+3*($-2));$--;for(let R=1;R<$;R++,P+=3)W[P]=h,W[P+1]=h+R,W[P+2]=h+R+1;h+=$+1}else{const Y=B.setArraySize(o,P+3*l);Y[P]=b,Y[P+1]=x,Y[P+2]=i.r,Y[P+3]=i.g,Y[P+4]=i.b,Y[P+5]=i.a,c?(Y[P+6]=w,Y[P+7]=v,Y[P+8]=r.r,Y[P+9]=r.g,Y[P+10]=r.b,Y[P+11]=r.a,Y[P+12]=y,Y[P+13]=S,Y[P+14]=i.r,Y[P+15]=i.g,Y[P+16]=i.b,Y[P+17]=i.a,Y[P+18]=I,Y[P+19]=T,Y[P+20]=r.r,Y[P+21]=r.g,Y[P+22]=r.b,Y[P+23]=r.a,Y[P+24]=A,Y[P+25]=M,Y[P+26]=i.r,Y[P+27]=i.g,Y[P+28]=i.b,Y[P+29]=i.a,Y[P+30]=F,Y[P+31]=k,Y[P+32]=r.r,Y[P+33]=r.g,Y[P+34]=r.b,Y[P+35]=r.a):(Y[P+6]=w,Y[P+7]=v,Y[P+8]=y,Y[P+9]=S,Y[P+10]=i.r,Y[P+11]=i.g,Y[P+12]=i.b,Y[P+13]=i.a,Y[P+14]=I,Y[P+15]=T,Y[P+16]=A,Y[P+17]=M,Y[P+18]=i.r,Y[P+19]=i.g,Y[P+20]=i.b,Y[P+21]=i.a,Y[P+22]=F,Y[P+23]=k),P=a.length;const $=B.setArraySize(a,P+3);$[P]=h,$[P+1]=h+1,$[P+2]=h+2,h+=3;break}}}return u!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let c=this._clippedVerticesTyped,l=this._clippedUVsTyped,o=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const u=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const b=t[e+g],x=t[e+g+1];let w=s[p]<<1;const v=i[w],y=i[w+1];g=s[p+1]*r;const S=t[e+g],I=t[e+g+1];w=s[p+1]<<1;const T=i[w],A=i[w+1];g=s[p+2]*r;const M=t[e+g],F=t[e+g+1];w=s[p+2]<<1;const k=i[w],E=i[w+1];this.clipInverse(b,x,S,I,M,F,u);const X=this.inverseVertices.length;if(X===0)continue;const V=I-F,O=M-S,q=b-M,L=F-x,P=1/(V*q+O*(x-F)),Y=this.inverseVertices;for(let $=0;$<X;){const N=Y[$++],W=N>>1;let R=this.clippedVerticesLength;const _=R+W*r,D=this.clippedUVsLength+W*2;c.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(c.subarray(0,R)),c=this._clippedVerticesTyped),l.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),l=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=D;const J=this._clippedVerticesTyped,tt=this._clippedUVsTyped;let K=D-W*2;for(let st=0;st<N;st+=2,R+=r,K+=2){const lt=Y[$+st],it=Y[$+st+1];J[R]=lt,J[R+1]=it;const rt=lt-M,ht=it-F,ft=(V*rt+O*ht)*P,gt=(L*rt+q*ht)*P,Lt=1-ft-gt;tt[K]=v*ft+T*gt+k*Lt,tt[K+1]=y*ft+A*gt+E*Lt}R=this.clippedTrianglesLength;const et=R+3*(W-2);o.length<et&&(this._clippedTrianglesTyped=new Uint16Array(et*2),this._clippedTrianglesTyped.set(o.subarray(0,R)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=et;const nt=o;for(let st=1;st<W-1;st++,R+=3)nt[R]=a,nt[R+1]=a+st,nt[R+2]=a+st+1;a+=W,$+=N}}return!0}const h=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let m=null;for(let u=0;u<n;u+=3){let p=s[u],g=p*r;const b=t[e+g],x=t[e+g+1];let w=p<<1;const v=i[w],y=i[w+1];p=s[u+1],g=p*r;const S=t[e+g],I=t[e+g+1];w=p<<1;const T=i[w],A=i[w+1];p=s[u+2],g=p*r;const M=t[e+g],F=t[e+g+1];w=p<<1;const k=i[w],E=i[w+1],X=I-F,V=M-S,O=b-M,q=F-x,L=1/(X*O+V*(x-F));for(let P=0;P<f;P++){let Y=this.clippedVerticesLength;if(this.clip(b,x,S,I,M,F,d[P])){m=h;const $=h.length;if($===0)continue;let N=$>>1;const W=Y+N*r;c.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(c.subarray(0,Y)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+N*2)*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),c=this._clippedVerticesTyped,l=this._clippedUVsTyped);const R=c,_=l;this.clippedVerticesLength=W;let D=this.clippedUVsLength;this.clippedUVsLength=D+N*2;for(let K=0;K<$;K+=2,Y+=r,D+=2){const et=m[K],nt=m[K+1];R[Y]=et,R[Y+1]=nt;const st=et-M,lt=nt-F,it=(X*st+V*lt)*L,rt=(q*st+O*lt)*L,ht=1-it-rt;_[D]=v*it+T*rt+k*ht,_[D+1]=y*it+A*rt+E*ht}Y=this.clippedTrianglesLength;const J=Y+3*(N-2);o.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(o.subarray(0,Y)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const tt=o;N--;for(let K=1;K<N;K++,Y+=3)tt[Y]=a,tt[Y+1]=a+K,tt[Y+2]=a+K+1;a+=N+1}else{let $=Y+3*r;c.length<$&&(this._clippedVerticesTyped=new Float32Array($*2),this._clippedVerticesTyped.set(c.subarray(0,Y)),c=this._clippedVerticesTyped),c[Y]=b,c[Y+1]=x,c[Y+r]=S,c[Y+r+1]=I,c[Y+r*2]=M,c[Y+r*2+1]=F;const N=this.clippedUVsLength+3*2;l.length<N&&(this._clippedUVsTyped=new Float32Array(N*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),l=this._clippedUVsTyped);const W=this.clippedUVsLength;l[W]=v,l[W+1]=y,l[W+2]=T,l[W+3]=A,l[W+4]=k,l[W+5]=E,this.clippedVerticesLength=$,this.clippedUVsLength=N,Y=this.clippedTrianglesLength,$=Y+3,o.length<$&&(this._clippedTrianglesTyped=new Uint16Array($*2),this._clippedTrianglesTyped.set(o.subarray(0,Y)),o=this._clippedTrianglesTyped);const R=o;R[Y]=a,R[Y+1]=a+1,R[Y+2]=a+2,a+=3,this.clippedTrianglesLength=$;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),m!==null}clip(t,e,s,n,i,r,c){const l=this.clipOutput;let o=!1,a,h;c.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=c;a.length=8;const f=a;f[0]=t,f[1]=e,f[2]=s,f[3]=n,f[4]=i,f[5]=r,f[6]=t,f[7]=e,h.length=0;const m=c.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],b=p-d[u+2],x=g-d[u+3],w=h.length,v=a;for(let S=0,I=a.length-2;S<I;){t=v[S],e=v[S+1],S+=2,s=v[S],n=v[S+1];const T=x*(p-s)>b*(g-n),A=x*(p-t)-b*(g-e);if(A>0)if(T)h.push(s,n);else{const M=s-t,F=n-e,k=A/(M*x-F*b);k>=0&&k<=1?(h.push(t+M*k,e+F*k),o=!0):h.push(s,n)}else if(T){const M=s-t,F=n-e,k=A/(M*x-F*b);k>=0&&k<=1?(h.push(t+M*k,e+F*k,s,n),o=!0):h.push(s,n)}else o=!0}if(w===h.length)return l.length=0,!0;if(h.push(h[0],h[1]),u===m)break;const y=h;h=a,h.length=0,a=y}if(l!==h){l.length=0;for(let u=0,p=h.length-2;u<p;u++)l[u]=h[u]}else l.length=l.length-2;return o}clipInverse(t,e,s,n,i,r,c){this.inverseVertices.length=0;const l=c.length-4;let o,a;c.length%4>=2?(o=this.clipOutput,a=this.scratch):(o=this.scratch,a=this.clipOutput),o.length=8;let h=c,d=o;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let f=0;;f+=2){const m=h[f],u=h[f+1],p=m-h[f+2],g=u-h[f+3],b=a.length,x=this.inverseVertices.length;this.inverseVertices.push(0),d=o;for(let y=0,S=o.length-2;y<S;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const I=g*(m-s)>p*(u-n),T=g*(m-t)-p*(u-e);if(T>0)if(I)a.push(s,n);else{const A=s-t,M=n-e,F=T/(A*g-M*p);if(F>=0&&F<=1){const k=t+A*F,E=e+M*F;a.push(k,E),this.inverseVertices.push(k,E,s,n)}else a.push(s,n)}else if(I){const A=s-t,M=n-e,F=T/(A*g-M*p);if(F>=0&&F<=1){const k=t+A*F,E=e+M*F;this.inverseVertices.push(k,E),a.push(k,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-x-1;if(w>=6?this.inverseVertices[x]=w:this.inverseVertices.length=x,b===a.length||(a.push(a[0],a[1]),f===l))break;const v=a;a=o,a.length=0,o=v}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,c=e[s-2],l=e[s-1],o=e[0],a=e[1];for(let d=2;d<s;d+=2){const f=e[d],m=e[d+1];r+=o*m-f*a;const u=(o-c)*(m-a)-(a-l)*(f-o);i=i&&u<=0,n=n&&u>=0,c=o,l=a,o=f,a=m}r+=o*e[1]-e[0]*a;const h=(o-c)*(e[1]-a)-(a-l)*(e[0]-o);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,f=s-2,m=s>>1;d<m;d+=2){const u=e[d],p=e[d+1],g=f-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=u,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let c=2;c<e;c+=2){const l=s[c],o=s[c+1];let a=c-2;for(;a>=0&&(n[a]>l||n[a]===l&&n[a+1]>o);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=l,n[a+3]=o}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let c=4;c<e;c+=2,i+=2){const l=n[c],o=n[c+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(l-s[i-4])>=0&&(i-=2,i!==2););s[i]=l,s[i+1]=o}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let c=e-6;c>=0;c-=2,i+=2){const l=n[c],o=n[c+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(l-s[i-4])>=0&&(i-=2,i!==r););s[i]=l,s[i+1]=o}t.length=i-2}},Fi=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new vs,n=typeof t=="string"?JSON.parse(t):t,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=C(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const c=n.bones[r];let l=null;const o=C(c,"parent",null);o&&(l=s.findBone(o));const a=new fs(s.bones.length,c.name,l);a.length=C(c,"length",0)*e;const h=a.setupPose;h.x=C(c,"x",0)*e,h.y=C(c,"y",0)*e,h.rotation=C(c,"rotation",0),h.scaleX=C(c,"scaleX",1),h.scaleY=C(c,"scaleY",1),h.shearX=C(c,"shearX",0),h.shearY=C(c,"shearY",0),h.inherit=B.enumValue(ie,C(c,"inherit","Normal")),a.skinRequired=C(c,"skin",!1);const d=C(c,"color",null);d&&a.color.setFromString(d),a.icon=C(c,"icon",void 0),a.iconSize=C(c,"iconSize",1),a.iconRotation=C(c,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const c=n.slots[r],l=c.name,o=s.findBone(c.bone);if(!o)throw new Error(`Couldn't find bone ${c.bone} for slot ${l}`);const a=new Is(s.slots.length,l,o),h=C(c,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(c,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(c,"attachment",null),a.blendMode=B.enumValue(Ts,C(c,"blend","normal")),a.visible=C(c,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const c=r.name,l=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const o=new Ht(c);o.skinRequired=l;for(let m=0;m<r.bones.length;m++){const u=s.findBone(r.bones[m]);if(!u)throw new Error(`Couldn't find bone ${r.bones[m]} for IK constraint ${c}.`);o.bones.push(u)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${c}.`);o.target=h;const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(ps,d));const f=o.setupPose;f.mix=C(r,"mix",1),f.softness=C(r,"softness",0)*e,f.bendDirection=C(r,"bendPositive",!0)?1:-1,f.compress=C(r,"compress",!1),f.stretch=C(r,"stretch",!1),s.constraints.push(o);break}case"transform":{const o=new j(c);o.skinRequired=l;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);o.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);o.source=h,o.localSource=C(r,"localSource",!1),o.localTarget=C(r,"localTarget",!1),o.additive=C(r,"additive",!1),o.clamp=C(r,"clamp",!1);let d=!1,f=!1,m=!1,u=!1,p=!1,g=!1;const b=Object.entries(C(r,"properties",{}));for(const[w,v]of b){const y=this.fromProperty(w),S=this.propertyScale(w,e);y.offset=C(v,"offset",0)*S;const I=Object.entries(C(v,"to",{}));for(const[T,A]of I){let M=1,F;switch(T){case"rotate":{d=!0,F=new As;break}case"x":{f=!0,F=new Cs,M=e;break}case"y":{m=!0,F=new Ms,M=e;break}case"scaleX":{u=!0,F=new Fs;break}case"scaleY":{p=!0,F=new Ys;break}case"shearY":{g=!0,F=new Ps;break}default:throw new Error(`Invalid transform constraint to property: ${T}`)}F.offset=C(A,"offset",0)*M,F.max=C(A,"max",1)*M,F.scale=C(A,"scale",1)*M/S,y.to.push(F)}y.to.length>0&&o.properties.push(y)}o.offsets[j.ROTATION]=C(r,"rotation",0),o.offsets[j.X]=C(r,"x",0)*e,o.offsets[j.Y]=C(r,"y",0)*e,o.offsets[j.SCALEX]=C(r,"scaleX",0),o.offsets[j.SCALEY]=C(r,"scaleY",0),o.offsets[j.SHEARY]=C(r,"shearY",0);const x=o.setupPose;d&&(x.mixRotate=C(r,"mixRotate",1)),f&&(x.mixX=C(r,"mixX",1)),m&&(x.mixY=C(r,"mixY",x.mixX)),u&&(x.mixScaleX=C(r,"mixScaleX",1)),p&&(x.mixScaleY=C(r,"mixScaleY",x.mixScaleX)),g&&(x.mixShearY=C(r,"mixShearY",1)),s.constraints.push(o);break}case"path":{const o=new Gt(c);o.skinRequired=l;for(let f=0;f<r.bones.length;f++){const m=r.bones[f],u=s.findBone(m);if(!u)throw new Error(`Couldn't find bone ${m} for path constraint ${r.name}.`);o.bones.push(u)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);o.slot=h,o.positionMode=B.enumValue(bs,C(r,"positionMode","Percent")),o.spacingMode=B.enumValue(xs,C(r,"spacingMode","Length")),o.rotateMode=B.enumValue(ws,C(r,"rotateMode","Tangent")),o.offsetRotation=C(r,"rotation",0);const d=o.setupPose;d.position=C(r,"position",0),o.positionMode===0&&(d.position*=e),d.spacing=C(r,"spacing",0),(o.spacingMode===0||o.spacingMode===1)&&(d.spacing*=e),d.mixRotate=C(r,"mixRotate",1),d.mixX=C(r,"mixX",1),d.mixY=C(r,"mixY",d.mixX),s.constraints.push(o);break}case"physics":{const o=new jt(c);o.skinRequired=l;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);o.bone=h,o.x=C(r,"x",0),o.y=C(r,"y",0),o.rotate=C(r,"rotate",0),o.scaleX=C(r,"scaleX",0),o.shearX=C(r,"shearX",0),o.limit=C(r,"limit",5e3)*e,o.step=1/C(r,"fps",60);const d=o.setupPose;d.inertia=C(r,"inertia",.5),d.strength=C(r,"strength",100),d.damping=C(r,"damping",.85),d.massInverse=1/C(r,"mass",1),d.wind=C(r,"wind",0),d.gravity=C(r,"gravity",0),d.mix=C(r,"mix",1),o.inertiaGlobal=C(r,"inertiaGlobal",!1),o.strengthGlobal=C(r,"strengthGlobal",!1),o.dampingGlobal=C(r,"dampingGlobal",!1),o.massGlobal=C(r,"massGlobal",!1),o.windGlobal=C(r,"windGlobal",!1),o.gravityGlobal=C(r,"gravityGlobal",!1),o.mixGlobal=C(r,"mixGlobal",!1),s.constraints.push(o);break}case"slider":{const o=new vt(c);o.skinRequired=l,o.additive=C(r,"additive",!1),o.loop=C(r,"loop",!1),o.setupPose.time=C(r,"time",0),o.setupPose.mix=C(r,"mix",1);const a=r.bone;if(a){if(o.bone=s.findBone(a),!o.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;o.property=this.fromProperty(h);const d=this.propertyScale(h,e);o.property.offset=C(r,"from",0)*d,o.offset=C(r,"to",0),o.scale=C(r,"scale",1)/d,o.local=C(r,"local",!1)}s.constraints.push(o);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const c=n.skins[r],l=new ue(c.name);if(c.bones)for(let o=0;o<c.bones.length;o++){const a=c.bones[o],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${c.name}.`);l.bones.push(h)}if(c.ik)for(let o=0;o<c.ik.length;o++){const a=c.ik[o],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.transform)for(let o=0;o<c.transform.length;o++){const a=c.transform[o],h=s.findConstraint(a,j);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.path)for(let o=0;o<c.path.length;o++){const a=c.path[o],h=s.findConstraint(a,Gt);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.physics)for(let o=0;o<c.physics.length;o++){const a=c.physics[o],h=s.findConstraint(a,jt);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.slider)for(let o=0;o<c.slider.length;o++){const a=c.slider[o],h=s.findConstraint(a,vt);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}for(const o in c.attachments){const a=s.findSlot(o);if(!a)throw new Error(`Couldn't find skin slot ${o} for skin ${c.name}.`);const h=c.attachments[o];for(const d in h){const f=this.readAttachment(h[d],l,a.index,d,s);f&&l.setAttachment(a.index,d,f)}}s.skins.push(l),l.name==="default"&&(s.defaultSkin=l)}for(let r=0,c=this.linkedMeshes.length;r<c;r++){const l=this.linkedMeshes[r],o=l.skin?s.findSkin(l.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${l.skin}`);const a=o.getAttachment(l.sourceIndex,l.source);if(!a)throw new Error(`Source mesh not found: ${l.source}`);l.mesh.timelineAttachment=l.inheritTimelines?a:l.mesh,l.mesh.setSourceMesh(a),l.mesh.updateSequence();t:if(l.inheritTimelines&&l.slotIndex!==l.sourceIndex){const h=a.timelineSlots;for(const f of h)if(f===l.slotIndex)break t;const d=[...h];d[h.length]=l.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const c=n.events[r],l=new gs(r),o=l.setupPose;o.intValue=C(c,"int",0),o.floatValue=C(c,"float",0),o.stringValue=C(c,"string",""),l._audioPath=C(c,"audio",null),l.audioPath&&(o.volume=C(c,"volume",o.volume),o.balance=C(c,"balance",o.balance)),s.events.push(l)}if(n.animations)for(const r in n.animations){const c=n.animations[r];this.readAnimation(c,r,s)}if(n.constraints)for(const r in n.constraints){const c=n.constraints[r];if(c.type==="slider"){const l=s.findConstraint(c.name,vt),o=c.animation,a=s.findAnimation(o);if(!a)throw new Error(`Slider animation not found: ${o}`);l.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new ge;break;case"x":e=new pe;break;case"y":e=new be;break;case"scaleX":e=new xe;break;case"scaleY":e=new we;break;case"shearY":e=new ye;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,c=C(t,"name",n);switch(C(t,"type","region")){case"region":{const l=C(t,"path",c),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,c,l,o);if(!a)return null;a.path=l,a.x=C(t,"x",0)*r,a.y=C(t,"y",0)*r,a.scaleX=C(t,"scaleX",1),a.scaleY=C(t,"scaleY",1),a.rotation=C(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=C(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const l=this.attachmentLoader.newBoundingBoxAttachment(e,n,c);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);const o=C(t,"color",null);return o&&l.color.setFromString(o),l}case"mesh":case"linkedmesh":{const l=C(t,"path",c),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,c,l,o);if(!a)return null;a.path=l;const h=C(t,"color",null);h&&a.color.setFromString(h),a.width=C(t,"width",0)*r,a.height=C(t,"height",0)*r;const d=C(t,"source",null);if(d){let m=s;const u=C(t,"slot",null);if(u){const p=i.findSlot(u);if(!p)throw new Error(`Source mesh slot not found: ${u}`);m=p.index}return this.linkedMeshes.push(new Yi(a,C(t,"skin",null),s,m,d,C(t,"timelines",!0))),a}const f=t.uvs;return this.readVertices(t,a,f.length),a.triangles=t.triangles,a.regionUVs=f,a.edges=C(t,"edges",null),a.hullLength=C(t,"hull",0)*2,a.updateSequence(),a}case"path":{const l=this.attachmentLoader.newPathAttachment(e,n,c);if(!l)return null;l.closed=C(t,"closed",!1),l.constantSpeed=C(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,l,o<<1);const a=B.newArray(o/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;l.lengths=a;const h=C(t,"color",null);return h&&l.color.setFromString(h),l}case"point":{const l=this.attachmentLoader.newPointAttachment(e,n,c);if(!l)return null;l.x=C(t,"x",0)*r,l.y=C(t,"y",0)*r,l.rotation=C(t,"rotation",0);const o=C(t,"color",null);return o&&l.color.setFromString(o),l}case"clipping":{const l=this.attachmentLoader.newClippingAttachment(e,n,c);if(!l)return null;const o=C(t,"end",null);o&&(l.endSlot=i.findSlot(o)),l.convex=C(t,"convex",!1),l.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,l,a<<1);const h=C(t,"color",null);return h&&l.color.setFromString(h),l}}return null}readSequence(t){if(t==null)return new Nt(1,!1);const e=new Nt(C(t,"count",0),!0);return e.start=C(t,"start",1),e.digits=C(t,"digits",0),e.setupIndex=C(t,"setup",0),e}readVertices(t,e,s){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const l=B.toFloatArray(i);if(n!==1)for(let o=0,a=i.length;o<a;o++)l[o]*=n;e.vertices=l;return}const r=[],c=[];for(let l=0,o=i.length;l<o;){const a=i[l++];c.push(a);for(let h=l+a*4;l<h;l+=4)c.push(i[l]),r.push(i[l+1]*n),r.push(i[l+2]*n),r.push(i[l+3])}e.bones=c,e.vertices=B.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const o in t.slots){const a=t.slots[o],h=s.findSlot(o);if(!h)throw new Error(`Slot not found: ${o}`);const d=h.index;for(const f in a){const m=a[f];if(!m)continue;const u=m.length;switch(f){case"attachment":{const p=new Pt(u,d);for(let g=0;g<u;g++){const b=m[g];p.setFrame(g,C(b,"time",0),C(b,"name",null))}i.push(p);break}case"rgba":{const p=new Ue(u,u<<2,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b,x.a);const y=m[w+1];if(!y){p.shrink(v);break}const S=C(y,"time",0),I=z.fromString(y.color),T=g.curve;T&&(v=G(T,p,v,w,0,b,S,x.r,I.r,1),v=G(T,p,v,w,1,b,S,x.g,I.g,1),v=G(T,p,v,w,2,b,S,x.b,I.b,1),v=G(T,p,v,w,3,b,S,x.a,I.a,1)),b=S,x=I,g=y}i.push(p);break}case"rgb":{const p=new De(u,u*3,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b);const y=m[w+1];if(!y){p.shrink(v);break}const S=C(y,"time",0),I=z.fromString(y.color),T=g.curve;T&&(v=G(T,p,v,w,0,b,S,x.r,I.r,1),v=G(T,p,v,w,1,b,S,x.g,I.g,1),v=G(T,p,v,w,2,b,S,x.b,I.b,1)),b=S,x=I,g=y}i.push(p);break}case"alpha":{ot(i,m,new qe(u,u,d),0,1);break}case"rgba2":{const p=new _e(u,u*7,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,x.a,w.r,w.g,w.b);const S=m[v+1];if(!S){p.shrink(y);break}const I=C(S,"time",0),T=z.fromString(S.light),A=z.fromString(S.dark),M=g.curve;M&&(y=G(M,p,y,v,0,b,I,x.r,T.r,1),y=G(M,p,y,v,1,b,I,x.g,T.g,1),y=G(M,p,y,v,2,b,I,x.b,T.b,1),y=G(M,p,y,v,3,b,I,x.a,T.a,1),y=G(M,p,y,v,4,b,I,w.r,A.r,1),y=G(M,p,y,v,5,b,I,w.g,A.g,1),y=G(M,p,y,v,6,b,I,w.b,A.b,1)),b=I,x=T,w=A,g=S}i.push(p);break}case"rgb2":{const p=new ze(u,u*6,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,w.r,w.g,w.b);const S=m[v+1];if(!S){p.shrink(y);break}const I=C(S,"time",0),T=z.fromString(S.light),A=z.fromString(S.dark),M=g.curve;M&&(y=G(M,p,y,v,0,b,I,x.r,T.r,1),y=G(M,p,y,v,1,b,I,x.g,T.g,1),y=G(M,p,y,v,2,b,I,x.b,T.b,1),y=G(M,p,y,v,3,b,I,w.r,A.r,1),y=G(M,p,y,v,4,b,I,w.g,A.g,1),y=G(M,p,y,v,5,b,I,w.b,A.b,1)),b=I,x=T,w=A,g=S}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${m.name} (${a.name})`)}}}if(t.bones)for(const o in t.bones){const a=t.bones[o],h=s.findBone(o);if(!h)throw new Error(`Bone not found: ${o}`);const d=h.index;for(const f in a){const m=a[f],u=m.length;if(u!==0)switch(f){case"rotate":ot(i,m,new Ut(u,u,d),0,1);break;case"translate":ks(i,m,new ke(u,u<<1,d),"x","y",0,n);break;case"translatex":ot(i,m,new Ee(u,u,d),0,n);break;case"translatey":ot(i,m,new Xe(u,u,d),0,n);break;case"scale":ks(i,m,new Ve(u,u<<1,d),"x","y",1,1);break;case"scalex":ot(i,m,new Re(u,u,d),1,1);break;case"scaley":ot(i,m,new Le(u,u,d),1,1);break;case"shear":ks(i,m,new Be(u,u<<1,d),"x","y",0,1);break;case"shearx":ot(i,m,new Oe(u,u,d),0,1);break;case"sheary":ot(i,m,new Ne(u,u,d),0,1);break;case"inherit":{const p=new $e(u,h.index);for(let g=0;g<m.length;g++){const b=m[g];p.setFrame(g,C(b,"time",0),B.enumValue(ie,C(b,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${m.name} (${a.name})`)}}}if(t.ik)for(const o in t.ik){const a=t.ik[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,Ht);if(!d)throw new Error(`IK Constraint not found: ${o}`);const f=new Ge(a.length,a.length<<1,s.constraints.indexOf(d));let m=C(h,"time",0),u=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,b=0;;g++){f.setFrame(g,m,u,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const x=a[g+1];if(!x){f.shrink(b);break}const w=C(x,"time",0),v=C(x,"mix",1),y=C(x,"softness",0)*n,S=h.curve;S&&(b=G(S,f,b,g,0,m,w,u,v,1),b=G(S,f,b,g,1,m,w,p,y,n)),m=w,u=v,p=y,h=x}i.push(f)}if(t.transform)for(const o in t.transform){const a=t.transform[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,j);if(!d)throw new Error(`Transform constraint not found: ${o}`);const f=new je(a.length,a.length*6,s.constraints.indexOf(d));let m=C(h,"time",0),u=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),b=C(h,"mixScaleX",1),x=C(h,"mixScaleY",1);const w=C(h,"mixShearY",1);for(let v=0,y=0;;v++){f.setFrame(v,m,u,p,g,b,x,w);const S=a[v+1];if(!S){f.shrink(y);break}const I=C(S,"time",0),T=C(S,"mixRotate",1),A=C(S,"mixX",1),M=C(S,"mixY",A),F=C(S,"mixScaleX",1),k=C(S,"mixScaleY",1),E=C(S,"mixShearY",1),X=h.curve;X&&(y=G(X,f,y,v,0,m,I,u,T,1),y=G(X,f,y,v,1,m,I,p,A,1),y=G(X,f,y,v,2,m,I,g,M,1),y=G(X,f,y,v,3,m,I,b,F,1),y=G(X,f,y,v,4,m,I,x,k,1),y=G(X,f,y,v,5,m,I,w,E,1)),m=I,u=T,p=A,g=M,b=F,x=k,b=F,h=S}i.push(f)}if(t.path)for(const o in t.path){const a=t.path[o],h=s.findConstraint(o,Gt);if(!h)throw new Error(`Path constraint not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const m=a[f];let u=m[0];if(!u)continue;const p=m.length;switch(f){case"position":{const g=new Je(p,p,d);ot(i,m,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Ke(p,p,d);ot(i,m,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new Qe(p,p*3,d);let b=C(u,"time",0),x=C(u,"mixRotate",1),w=C(u,"mixX",1),v=C(u,"mixY",w);for(let y=0,S=0;;y++){g.setFrame(y,b,x,w,v);const I=m[y+1];if(!I){g.shrink(S);break}const T=C(I,"time",0),A=C(I,"mixRotate",1),M=C(I,"mixX",1),F=C(I,"mixY",M),k=u.curve;k&&(S=G(k,g,S,y,0,b,T,x,A,1),S=G(k,g,S,y,1,b,T,w,M,1),S=G(k,g,S,y,2,b,T,v,F,1)),b=T,x=A,w=M,v=F,u=I}i.push(g);break}}}}if(t.physics)for(const o in t.physics){const a=t.physics[o];let h=-1;if(o.length>0){const d=s.findConstraint(o,jt);if(!d)throw new Error(`Physics constraint not found: ${o}`);h=s.constraints.indexOf(d)}for(const d in a){const f=a[d];let m=f[0];if(!m)continue;const u=f.length;let p,g=0;if(d==="reset"){const b=new as(u,h);for(let x=0;m!=null;m=f[x+1],x++)b.setFrame(x,C(m,"time",0));i.push(b);continue}switch(d){case"inertia":p=new Ze(u,u,h);break;case"strength":p=new ts(u,u,h);break;case"damping":p=new es(u,u,h);break;case"mass":p=new ss(u,u,h);break;case"wind":p=new ns(u,u,h);break;case"gravity":p=new is(u,u,h);break;case"mix":{g=1,p=new rs(u,u,h);break}default:continue}ot(i,f,p,g,1)}}if(t.slider)for(const o in t.slider){const a=t.slider[o],h=s.findConstraint(o,vt);if(!h)throw new Error(`Slider not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const m=a[f];if(!m[0])continue;const p=m.length;switch(f){case"time":ot(i,m,new os(p,p,d),1,1);break;case"mix":ot(i,m,new cs(p,p,d),1,1);break}}}if(t.attachments)for(const o in t.attachments){const a=t.attachments[o],h=s.findSkin(o);if(!h)throw new Error(`Skin not found: ${o}`);for(const d in a){const f=a[d],m=s.findSlot(d);if(!m)throw new Error(`Attachment slot not found: ${d}`);const u=m.index;for(const p in f){const g=f[p],b=h.getAttachment(u,p);if(!b)throw new Error(`Timeline attachment not found: ${p}`);for(const x in g){const w=g[x];let v=w[0];if(v){if(x==="deform"){const y=b.bones,S=b.vertices,I=y?S.length/3*2:S.length,T=new We(w.length,w.length,u,b);let A=C(v,"time",0);for(let M=0,F=0;;M++){let k;const E=C(v,"vertices",null);if(!E)k=y?B.newFloatArray(I):S;else{k=B.newFloatArray(I);const q=C(v,"offset",0);if(B.arrayCopy(E,0,k,q,E.length),n!==1)for(let L=q,P=L+E.length;L<P;L++)k[L]*=n;if(!y)for(let L=0;L<I;L++)k[L]+=S[L]}T.setFrame(M,A,k);const X=w[M+1];if(!X){T.shrink(F);break}const V=C(X,"time",0),O=v.curve;O&&(F=G(O,T,F,M,0,A,V,0,1,1)),A=V,v=X}i.push(T)}else if(x==="sequence"){const y=new He(w.length,u,b);let S=0;for(let I=0;I<w.length;I++){const T=C(v,"delay",S),A=C(v,"time",0),M=Ye[C(v,"mode","hold")],F=C(v,"index",0);y.setFrame(I,A,M,F,T),S=T,v=w[I+1]}i.push(y)}}}}}}if(t.drawOrder){const o=new Tt(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)o.setFrame(h++,C(d,"time",0),fn(s,d,a,null));i.push(o)}if(t.drawOrderFolder)for(const o of t.drawOrderFolder){const a=C(o,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const f=C(o,"keys",[]),m=new qt(f.length,h,s.slots.length);let u=0;for(const p of f)m.setFrame(u++,C(p,"time",0),fn(s,p,h.length,h));i.push(m)}if(t.events){const o=new te(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],f=s.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const m=f.setupPose,u=new oe(B.toSinglePrecision(C(d,"time",0)),f);u.intValue=C(d,"int",m.intValue),u.floatValue=C(d,"float",m.floatValue),u.stringValue=C(d,"string",m.stringValue),u.data.audioPath&&(u.volume=C(d,"volume",m.volume),u.balance=C(d,"balance",m.volume)),o.setFrame(a,u)}i.push(o)}let r=0;for(let o=0,a=i.length;o<a;o++)r=Math.max(r,i[o].getDuration());const c=new Qt(e,i,r),l=C(t,"color",null);l!==null&&c.color.setFromString(l),s.animations.push(c)}},Yi=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ot(t,e,s,n,i){let r=e[0],c=r.time??0,l=(r.value??n)*i,o=0;for(let a=0;;a++){s.setFrame(a,c,l);const h=e[a+1];if(!h){s.shrink(o),t.push(s);return}const d=h.time??0,f=(h.value??n)*i;r.curve&&(o=G(r.curve,s,o,a,0,c,d,l,f,i)),c=d,l=f,r=h}}function ks(t,e,s,n,i,r,c){let l=e[0],o=l.time??0,a=(l[n]??r)*c,h=(l[i]??r)*c,d=0;for(let f=0;;f++){s.setFrame(f,o,a,h);const m=e[f+1];if(!m){s.shrink(d),t.push(s);return}const u=m.time??0,p=(m[n]??r)*c,g=(m[i]??r)*c,b=l.curve;b&&(d=G(b,s,d,f,0,o,u,a,p,c),d=G(b,s,d,f,1,o,u,h,g,c)),o=u,a=p,h=g,l=m}}function fn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),c=new Array(s-i.length);let l=0,o=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let f=0;f<s;f++)if(n[f]===h.index){d=f;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;l!==d;)c[o++]=l++;r[l+a.offset]=l++}for(;l<s;)c[o++]=l++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=c[--o]);return r}function G(t,e,s,n,i,r,c,l,o,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],f=t[h+1]*a,m=t[h+2],u=t[h+3]*a;return e.setBezier(s,n,i,r,l,d,f,m,u,c,o),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var Pi=class{commandPool=new ki;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new dn;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let c=0;c<t.slots.length;c++){const l=r[c],o=l.appliedPose.attachment;if(!o){i.clipEnd(l);continue}const a=l.appliedPose,h=a.color;if((h.a===0||!l.bone.active)&&!(o instanceof Wt)){i.clipEnd(l);continue}let f,m,u,p,g,b,x;if(o instanceof Yt){if(b=o.color,b.a===0){i.clipEnd(l);continue}const I=o.sequence,T=I.resolveIndex(a);o.computeWorldVertices(l,o.getOffsets(a),this.worldVertices,0,n),f=this.worldVertices,m=4,u=I.getUVs(T),p=this.quadIndices,g=6,x=I.regions[T]?.texture}else if(o instanceof It){if(b=o.color,b.a===0){i.clipEnd(l);continue}this.worldVertices.length<o.worldVerticesLength&&(this.worldVertices=new Float32Array(o.worldVerticesLength)),o.computeWorldVertices(t,l,0,o.worldVerticesLength,this.worldVertices,0,n),f=this.worldVertices,m=o.worldVerticesLength>>1;const I=o.sequence,T=I.resolveIndex(a);u=I.getUVs(T),p=o.triangles,g=p.length,x=I.regions[T]?.texture}else if(o instanceof Wt){i.clipStart(t,l,o);continue}else continue;const w=t.color;let v,y;if(e){let I;if(s){I=Math.floor(s[3]*w.a*h.a*b.a*255);const T=Math.floor(I*s[0]*w.r*h.r*b.r),A=Math.floor(I*s[1]*w.g*h.g*b.g),M=Math.floor(I*s[2]*w.b*h.b*b.b);v=I<<24|T<<16|A<<8|M}else{I=Math.floor(w.a*h.a*b.a*255);const T=Math.floor(I*w.r*h.r*b.r),A=Math.floor(I*w.g*h.g*b.g),M=Math.floor(I*w.b*h.b*b.b);v=I<<24|T<<16|A<<8|M}if(y=4278190080,a.darkColor){const{r:T,g:A,b:M}=a.darkColor;y=4278190080|Math.floor(T*I)<<16|Math.floor(A*I)<<8|Math.floor(M*I)}}else{if(s){const I=Math.floor(s[3]*w.a*h.a*b.a*255),T=Math.floor(s[0]*w.r*h.r*b.r*255),A=Math.floor(s[1]*w.g*h.g*b.g*255),M=Math.floor(s[2]*w.b*h.b*b.b*255);v=I<<24|T<<16|A<<8|M}else{const I=Math.floor(w.a*h.a*b.a*255),T=Math.floor(w.r*h.r*b.r*255),A=Math.floor(w.g*h.g*b.g*255),M=Math.floor(w.b*h.b*b.b*255);v=I<<24|T<<16|A<<8|M}if(y=0,a.darkColor){const{r:I,g:T,b:A}=a.darkColor;y=Math.floor(I*255)<<16|Math.floor(T*255)<<8|Math.floor(A*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(f,0,p,g,u,n),f=i.clippedVerticesTyped,m=i.clippedVerticesLength/n,u=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const S=this.commandPool.getCommand(m,g,n);S.blendMode=l.data.blendMode,S.texture=x,S.positions.set(f.subarray(0,m*n)),S.uvs.set(u.subarray(0,m<<1));for(let I=0;I<m;I++)S.colors[I]=v,S.darkColors[I]=y;p instanceof Uint16Array?S.indices.set(p.subarray(0,g)):S.indices.set(p.slice(0,g)),this.renderCommands.push(S),i.clipEnd(l)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const c=t[e],l=this.commandPool.getCommand(n,i,r);l.blendMode=c.blendMode,l.texture=c.texture;let o=0,a=0,h=0,d=0,f=0;for(let m=e;m<=s;m++){const u=t[m];l.positions.set(u.positions,o),o+=u.numVertices*r,l.uvs.set(u.uvs,a),a+=u.numVertices<<1,l.colors.set(u.colors,h),l.darkColors.set(u.darkColors,h),h+=u.numVertices;for(let p=0;p<u.numIndices;p++)l.indices[d+p]=u.indices[p]+f;d+=u.numIndices,f+=u.numVertices}return l}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,c=n.numVertices,l=n.numIndices;for(;r<=this.renderCommands.length;){const o=r<this.renderCommands.length?this.renderCommands[r]:null;if(o&&o.numVertices===0&&o.numIndices===0){r++;continue}if(o!==null&&o.texture===n.texture&&o.blendMode===n.blendMode&&o.colors[0]===n.colors[0]&&o.darkColors[0]===n.darkColors[0]&&l+o.numIndices<65535)c+=o.numVertices,l+=o.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,c,l,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,c=n.numVertices,l=n.numIndices}r++}return e}},ki=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),c=new Uint32Array(t),l=new Uint32Array(t),o=new Uint16Array(e);n={positions:i,uvs:r,colors:c,darkColors:l,indices:o,_positions:i,_uvs:r,_colors:c,_darkColors:l,_indices:o,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};export{qe as AlphaTimeline,Qt as Animation,Rn as AnimationState,Ln as AnimationStateAdapter,Bn as AnimationStateData,js as AssetCache,On as AssetManagerBase,Nn as AtlasAttachmentLoader,Fe as Attachment,Pt as AttachmentTimeline,on as BinaryInput,Ts as BlendMode,ae as Bone,fs as BoneData,re as BonePose,yt as BoneTimeline1,Zt as BoneTimeline2,ds as BoundingBoxAttachment,Wt as ClippingAttachment,z as Color,Et as Constraint,Xt as ConstraintData,kt as ConstraintTimeline1,wt as CurveTimeline,$t as CurveTimeline1,Pn as DebugUtils,We as DeformTimeline,Js as Downloader,Qs as DrawOrder,qt as DrawOrderFolderTimeline,Tt as DrawOrderTimeline,oe as Event,gs as EventData,Ws as EventQueue,te as EventTimeline,Hs as EventType,_t as FIRST,Xn as FakeTexture,At as FromProperty,ge as FromRotate,xe as FromScaleX,we as FromScaleY,ye as FromShearY,pe as FromX,be as FromY,zt as HOLD,Gs as HOLD_FIRST,Zs as IkConstraint,Ht as IkConstraintData,ce as IkConstraintPose,Ge as IkConstraintTimeline,ie as Inherit,$e as InheritTimeline,Fn as IntSet,Bt as Interpolation,U as MathUtils,It as MeshAttachment,se as PathAttachment,tn as PathConstraint,Gt as PathConstraintData,Qe as PathConstraintMixTimeline,le as PathConstraintPose,Je as PathConstraintPositionTimeline,Ke as PathConstraintSpacingTimeline,en as Physics,ys as PhysicsConstraint,es as PhysicsConstraintDampingTimeline,jt as PhysicsConstraintData,is as PhysicsConstraintGravityTimeline,Ze as PhysicsConstraintInertiaTimeline,ss as PhysicsConstraintMassTimeline,rs as PhysicsConstraintMixTimeline,he as PhysicsConstraintPose,as as PhysicsConstraintResetTimeline,ts as PhysicsConstraintStrengthTimeline,pt as PhysicsConstraintTimeline,ns as PhysicsConstraintWindTimeline,Ks as PointAttachment,Ot as Pool,us as Posed,ms as PosedActive,ne as PosedData,bs as PositionMode,Ls as Pow,Yn as PowOut,Us as Property,hs as RETAIN,ze as RGB2Timeline,_e as RGBA2Timeline,Ue as RGBATimeline,De as RGBTimeline,Yt as RegionAttachment,ws as RotateMode,Ut as RotateTimeline,ls as SETUP,ee as SUBSEQUENT,Ve as ScaleTimeline,Re as ScaleXTimeline,ps as ScaleYMode,Le as ScaleYTimeline,Nt as Sequence,Ye as SequenceMode,Pe as SequenceModeValues,He as SequenceTimeline,Be as ShearTimeline,Oe as ShearXTimeline,Ne as ShearYTimeline,nn as Skeleton,$n as SkeletonBinary,Mi as SkeletonBounds,dn as SkeletonClipping,vs as SkeletonData,Fi as SkeletonJson,Pi as SkeletonRendererCore,ue as Skin,Ss as SkinEntry,rn as Slider,vt as SliderData,cs as SliderMixTimeline,fe as SliderPose,os as SliderTimeline,sn as Slot,Dt as SlotCurveTimeline,Is as SlotData,de as SlotPose,xs as SpacingMode,Te as StringSet,Bs as Texture,Ce as TextureAtlas,$s as TextureAtlasPage,Me as TextureAtlasRegion,Kt as TextureFilter,Ns as TextureRegion,Os as TextureWrap,kn as TimeKeeper,Q as Timeline,Ct as ToProperty,As as ToRotate,Fs as ToScaleX,Ys as ToScaleY,Ps as ToShearY,Cs as ToX,Ms as ToY,zs as TrackEntry,an as TransformConstraint,j as TransformConstraintData,me as TransformConstraintPose,je as TransformConstraintTimeline,ke as TranslateTimeline,Ee as TranslateXTimeline,Xe as TranslateYTimeline,hn as Triangulator,B as Utils,Ae as Vector2,xt as VertexAttachment,En as WindowedMean,qs as isBoneTimeline,_s as isConstraintTimeline,Ds as isSlotTimeline};
|