@esotericsoftware/spine-core 4.2.117 → 4.3.1

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.
Files changed (129) hide show
  1. package/dist/Animation.d.ts +426 -274
  2. package/dist/Animation.js +1174 -1210
  3. package/dist/AnimationState.d.ts +246 -201
  4. package/dist/AnimationState.js +508 -471
  5. package/dist/AnimationStateData.d.ts +12 -10
  6. package/dist/AnimationStateData.js +19 -20
  7. package/dist/AssetManagerBase.d.ts +27 -21
  8. package/dist/AssetManagerBase.js +67 -43
  9. package/dist/AtlasAttachmentLoader.d.ts +18 -12
  10. package/dist/AtlasAttachmentLoader.js +28 -39
  11. package/dist/Bone.d.ts +15 -109
  12. package/dist/Bone.js +22 -362
  13. package/dist/BoneData.d.ts +13 -28
  14. package/dist/BoneData.js +20 -29
  15. package/dist/BonePose.d.ts +132 -0
  16. package/dist/BonePose.js +456 -0
  17. package/dist/Constraint.d.ts +41 -0
  18. package/dist/Constraint.js +38 -0
  19. package/dist/ConstraintData.d.ts +16 -5
  20. package/dist/ConstraintData.js +15 -9
  21. package/dist/DrawOrder.d.ts +48 -0
  22. package/dist/DrawOrder.js +64 -0
  23. package/dist/Event.d.ts +11 -6
  24. package/dist/Event.js +10 -5
  25. package/dist/EventData.d.ts +10 -6
  26. package/dist/EventData.js +18 -7
  27. package/dist/IkConstraint.d.ts +23 -28
  28. package/dist/IkConstraint.js +122 -124
  29. package/dist/IkConstraintData.d.ts +14 -19
  30. package/dist/IkConstraintData.js +22 -23
  31. package/dist/IkConstraintPose.d.ts +49 -0
  32. package/dist/IkConstraintPose.js +55 -0
  33. package/dist/PathConstraint.d.ts +18 -23
  34. package/dist/PathConstraint.js +162 -139
  35. package/dist/PathConstraintData.d.ts +11 -14
  36. package/dist/PathConstraintData.js +14 -16
  37. package/dist/PathConstraintPose.d.ts +43 -0
  38. package/dist/PathConstraintPose.js +49 -0
  39. package/dist/Physics.d.ts +39 -0
  40. package/dist/Physics.js +41 -0
  41. package/dist/PhysicsConstraint.d.ts +26 -30
  42. package/dist/PhysicsConstraint.js +114 -94
  43. package/dist/PhysicsConstraintData.d.ts +28 -13
  44. package/dist/PhysicsConstraintData.js +35 -13
  45. package/dist/PhysicsConstraintPose.d.ts +47 -0
  46. package/dist/PhysicsConstraintPose.js +55 -0
  47. package/dist/Pose.d.ts +33 -0
  48. package/dist/Pose.js +30 -0
  49. package/dist/Posed.d.ts +58 -0
  50. package/dist/Posed.js +78 -0
  51. package/dist/PosedActive.d.ts +41 -0
  52. package/dist/{attachments/HasTextureRegion.js → PosedActive.js} +17 -2
  53. package/dist/PosedData.d.ts +40 -0
  54. package/dist/PosedData.js +45 -0
  55. package/dist/Skeleton.d.ts +110 -99
  56. package/dist/Skeleton.js +271 -449
  57. package/dist/SkeletonBinary.d.ts +1 -1
  58. package/dist/SkeletonBinary.js +655 -466
  59. package/dist/SkeletonBounds.d.ts +4 -4
  60. package/dist/SkeletonBounds.js +45 -46
  61. package/dist/SkeletonClipping.d.ts +26 -22
  62. package/dist/SkeletonClipping.js +654 -340
  63. package/dist/SkeletonData.d.ts +18 -35
  64. package/dist/SkeletonData.js +57 -97
  65. package/dist/SkeletonJson.d.ts +8 -6
  66. package/dist/SkeletonJson.js +895 -640
  67. package/dist/SkeletonRendererCore.d.ts +58 -0
  68. package/dist/SkeletonRendererCore.js +310 -0
  69. package/dist/Skin.d.ts +20 -16
  70. package/dist/Skin.js +58 -53
  71. package/dist/Slider.d.ts +46 -0
  72. package/dist/Slider.js +115 -0
  73. package/dist/SliderData.d.ts +58 -0
  74. package/dist/SliderData.js +59 -0
  75. package/dist/SliderPose.d.ts +37 -0
  76. package/dist/SliderPose.js +40 -0
  77. package/dist/Slot.d.ts +16 -38
  78. package/dist/Slot.js +37 -60
  79. package/dist/SlotData.d.ts +5 -12
  80. package/dist/SlotData.js +7 -15
  81. package/dist/SlotPose.d.ts +59 -0
  82. package/dist/SlotPose.js +81 -0
  83. package/dist/Texture.d.ts +1 -0
  84. package/dist/Texture.js +2 -1
  85. package/dist/TextureAtlas.d.ts +3 -3
  86. package/dist/TextureAtlas.js +49 -49
  87. package/dist/TransformConstraint.d.ts +16 -28
  88. package/dist/TransformConstraint.js +72 -209
  89. package/dist/TransformConstraintData.d.ts +108 -20
  90. package/dist/TransformConstraintData.js +274 -24
  91. package/dist/TransformConstraintPose.d.ts +45 -0
  92. package/dist/TransformConstraintPose.js +52 -0
  93. package/dist/Triangulator.d.ts +1 -1
  94. package/dist/Triangulator.js +91 -107
  95. package/dist/{Updatable.d.ts → Update.d.ts} +5 -12
  96. package/dist/Update.js +30 -0
  97. package/dist/Utils.d.ts +14 -3
  98. package/dist/Utils.js +80 -37
  99. package/dist/attachments/Attachment.d.ts +27 -19
  100. package/dist/attachments/Attachment.js +59 -35
  101. package/dist/attachments/AttachmentLoader.d.ts +14 -14
  102. package/dist/attachments/AttachmentLoader.js +1 -1
  103. package/dist/attachments/BoundingBoxAttachment.d.ts +1 -1
  104. package/dist/attachments/BoundingBoxAttachment.js +2 -2
  105. package/dist/attachments/ClippingAttachment.d.ts +10 -3
  106. package/dist/attachments/ClippingAttachment.js +12 -3
  107. package/dist/attachments/{HasTextureRegion.d.ts → HasSequence.d.ts} +11 -14
  108. package/dist/attachments/HasSequence.js +30 -0
  109. package/dist/attachments/MeshAttachment.d.ts +28 -35
  110. package/dist/attachments/MeshAttachment.js +85 -97
  111. package/dist/attachments/PathAttachment.d.ts +3 -3
  112. package/dist/attachments/PathAttachment.js +6 -6
  113. package/dist/attachments/PointAttachment.d.ts +11 -6
  114. package/dist/attachments/PointAttachment.js +8 -3
  115. package/dist/attachments/RegionAttachment.d.ts +25 -27
  116. package/dist/attachments/RegionAttachment.js +101 -113
  117. package/dist/attachments/Sequence.d.ts +31 -6
  118. package/dist/attachments/Sequence.js +79 -13
  119. package/dist/esm/spine-core.min.mjs +2 -2
  120. package/dist/esm/spine-core.mjs +7747 -6116
  121. package/dist/esm/spine-core.mjs.map +4 -4
  122. package/dist/iife/spine-core.js +7747 -6116
  123. package/dist/iife/spine-core.js.map +4 -4
  124. package/dist/iife/spine-core.min.js +2 -2
  125. package/dist/index.d.ts +32 -11
  126. package/dist/index.js +33 -12
  127. package/dist/polyfills.js +4 -5
  128. package/package.json +1 -1
  129. 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 Yn=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}},Ie=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 Ct{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Ct(1,1,1,1);static RED=new Ct(1,0,0,1);static GREEN=new Ct(0,1,0,1);static BLUE=new Ct(0,0,1,1);static MAGENTA=new Ct(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 Ct){return s.setFromString(e)}},R=class lt{static epsilon=1e-5;static epsilon2=lt.epsilon*lt.epsilon;static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*lt.degRad)}static sinDeg(e){return Math.sin(e*lt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*lt.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 lt.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}},Fn=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 l=s,c=i;l<s+r;l++,c++)n[c]=e[l]}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)]}},kn=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}},Ce=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}},Pn=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(){}},Me=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 l=null,c=null,o=null;for(;r!==null;)if(r.trim().length===0)l=null,r=e.readLine();else if(l){const a=new Ye(l,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{c||(c=[]),o||(o=[]),c.push(s[0]);const f=[];for(let u=0;u<h;u++)f.push(parseInt(s[u+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),c&&c.length>0&&o&&o.length>0&&(a.names=c,a.values=o,c=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees===90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new $s(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(l)}this.pages.push(l)}}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}},Ye=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,l=this.timelineSlots.length;r<l;r++){if(i=e[this.timelineSlots[r]],!i.bone.isActive())continue;const c=(n?i.getAppliedPose():i.getPose()).getAttachment();if(c!=null&&c.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,l,c){i=l+(i>>1)*c;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);const m=s.bone.appliedPose,p=m.worldX,g=m.worldY,x=m.a,b=m.b,w=m.c,S=m.d;for(let y=n,v=l;v<i;y+=2,v+=c){const T=a[y],A=a[y+1];r[v]=T*x+A*b+p,r[v+1]=T*w+A*S+g}return}let d=0,f=0;for(let m=0;m<n;m+=2){const p=h[d];d+=p+1,f+=p}const u=e.bones;if(o.length===0)for(let m=l,p=f*3;m<i;m+=c){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=u[h[d]].appliedPose,S=a[p],y=a[p+1],v=a[p+2];g+=(S*w.a+y*w.b+w.worldX)*v,x+=(S*w.c+y*w.d+w.worldY)*v}r[m]=g,r[m+1]=x}else{const m=o;for(let p=l,g=f*3,x=f<<1;p<i;p+=c){let b=0,w=0,S=h[d++];for(S+=d;d<S;d++,g+=3,x+=2){const y=u[h[d]].appliedPose,v=a[g]+m[x],T=a[g+1]+m[x+1],A=a[g+2];b+=(v*y.a+T*y.b+y.worldX)*A,w+=(v*y.c+T*y.d+y.worldY)*A}r[p]=b,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}},St=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,l=e.v,c=0,o=0;if(e instanceof Ye){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,l-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*c,n[f+1]=l+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,l-=e.offsetY/d,c=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*c,n[f+1]=l+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,l-=e.offsetX/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*c,n[f+1]=l+s[f]*o;return;default:r-=e.offsetX/h,l-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,o=e.originalHeight/d}}else e?(c=e.u2-r,o=e.v2-l):(r=l=0,c=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*c,n[a+1]=l+s[a+1]*o}},Ft=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 l=e.bone.appliedPose,c=l.worldX,o=l.worldY,a=l.a,h=l.b,d=l.c,f=l.d;let u=s[0],m=s[1];n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[2],m=s[3],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[4],m=s[5],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[6],m=s[7],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,l,c,o,a,h){if(!e)throw new Error("Region not set.");const d=c/e.originalWidth*i,f=o/e.originalHeight*r,u=-c/2*i+e.offsetX*d,m=-o/2*r+e.offsetY*f,p=u+e.width*d,g=m+e.height*f,x=l*R.degRad,b=Math.cos(x),w=Math.sin(x),S=u*b+s,y=u*w,v=m*b+n,T=m*w,A=p*b+s,I=p*w,M=g*b+n,Y=g*w;a[0]=S-T,a[1]=v+y,a[2]=S-Y,a[3]=M+y,a[4]=A-Y,a[5]=M+I,a[6]=A-T,a[7]=v+I,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 Se{static _nextID=0;id=Se.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 Se(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 Ft){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Ft.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 St){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),St.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 Se._nextID++}},ke=(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))(ke||{}),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 Ie,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,l,c,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,l,c,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 bt=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,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=(i-l*2+o)*.03,p=((r-c)*3-n+a)*.006,g=((l-o)*3-i+h)*.006;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,S=(l-i)*.3+m+g*.16666667,y=n+w,v=i+S;for(let T=f+18;f<T;f+=2)d[f]=y,d[f+1]=v,w+=x,S+=b,x+=p,b+=g,y+=w,v+=S}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 l=i[r-2],c=i[r-1];return c+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-c)}},$t=class extends bt{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 l=this.getCurveValue(t);return s?r+l*e:i+(n?l:l+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,l){return l===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,l)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getAbsoluteValue2(t,e,s,n,i,r,l){return t<this.frames[0]?s?r:i:s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getScaleValue(t,e,s,n,i,r,l){if(t<this.frames[0])return s?l:r;const c=this.getCurveValue(t)*l;if(e===1&&!n)return c;let o=s?l:r;return n?o+(c-l)*e:i?o+(Math.abs(c)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(c),o+(c-o)*e)}};function qs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var wt=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,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Zt=class extends bt{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,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Ut=class extends wt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,l){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Ee=class extends Zt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[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)}},Xe=class extends wt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,l){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Ve=class extends wt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,l){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Re=class extends Zt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[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,u=0;i?(f=e.scaleX,u=e.scaleY):(f=t.scaleX,u=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=u+(a-e.scaleY)*n):l?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=u+(Math.abs(a)*Math.sign(u)-u)*n):(f=Math.abs(f)*Math.sign(o),u=Math.abs(u)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=u+(a-u)*n)}}},Le=class extends wt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,l){t.scaleX=this.getScaleValue(s,n,i,r,l,t.scaleX,e.scaleX)}},Be=class extends wt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,l){t.scaleY=this.getScaleValue(s,n,i,r,l,t.scaleY,e.scaleY)}},Oe=class extends Zt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[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)}},Ne=class extends wt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,l){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},$e=class extends wt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,l){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},Ue=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,l,c,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(c)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 bt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,l)}},De=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 l=e.color,c=this.frames;if(s<c[0]){i&&l.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Q.search(c,s,5),u=this.curves[f/5];switch(u){case 0:{const m=c[f];o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];const p=(s-m)/(c[f+5]-m);o+=(c[f+5+1]-o)*p,a+=(c[f+5+2]-a)*p,h+=(c[f+5+3]-h)*p,d+=(c[f+5+4]-d)*p;break}case 1:o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];break;default:o=this.getBezierValue(s,f,1,u-2),a=this.getBezierValue(s,f,2,u+18-2),h=this.getBezierValue(s,f,3,u+18*2-2),d=this.getBezierValue(s,f,4,u+18*3-2)}if(n===1)l.set(o,a,h,d);else if(i){const m=t.data.setupPose.color;l.set(m.r+(o-m.r)*n,m.g+(a-m.g)*n,m.b+(h-m.b)*n,m.a+(d-m.a)*n)}else l.add((o-l.r)*n,(a-l.g)*n,(h-l.b)*n,(d-l.a)*n)}},qe=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 l=e.color;let c=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const u=t.data.setupPose.color;l.r=u.r,l.g=u.g,l.b=u.b}return}const d=Q.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const u=h[d];c=h[d+1],o=h[d+2],a=h[d+3];const m=(s-u)/(h[d+4]-u);c+=(h[d+4+1]-c)*m,o+=(h[d+4+2]-o)*m,a+=(h[d+4+3]-a)*m;break}case 1:c=h[d+1],o=h[d+2],a=h[d+3];break;default:c=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 u=t.data.setupPose.color;c=u.r+(c-u.r)*n,o=u.g+(o-u.g)*n,a=u.b+(a-u.b)*n}else c=l.r+(c-l.r)*n,o=l.g+(o-l.g)*n,a=l.b+(a-l.b)*n;l.r=c<0?0:c>1?1:c,l.g=o<0?0:o>1?1:o,l.b=a<0?0:a>1?1:a}},_e=class extends $t{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,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 u=a.data.setupPose.color;d=u.a+(d-u.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},ze=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,l,c,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]=l,this.frames[t+6]=c,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const b=t.data.setupPose;l.setFromColor(b.color);const w=b.darkColor;c.r=w.r,c.g=w.g,c.b=w.b}return}let f=0,u=0,m=0,p=0;const g=Q.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];f=d[g+1],u=d[g+2],m=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];const w=(s-b)/(d[g+8]-b);f+=(d[g+8+1]-f)*w,u+=(d[g+8+2]-u)*w,m+=(d[g+8+3]-m)*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],u=d[g+2],m=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,x-2),u=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),o=this.getBezierValue(s,g,5,x+18*4-2),a=this.getBezierValue(s,g,6,x+18*5-2),h=this.getBezierValue(s,g,7,x+18*6-2)}if(n===1)l.set(f,u,m,p);else if(i){const b=t.data.setupPose;let w=b.color;l.set(w.r+(f-w.r)*n,w.g+(u-w.g)*n,w.b+(m-w.b)*n,w.a+(p-w.a)*n),w=b.darkColor,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else l.add((f-l.r)*n,(u-l.g)*n,(m-l.b)*n,(p-l.a)*n),o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.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}},We=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,l,c){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]=l,this.frames[t+6]=c}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0,d=0,f=0,u=0;const m=this.frames;if(s<m[0]){if(i){const x=t.data.setupPose,b=x.color,w=x.darkColor;l.r=b.r,l.g=b.g,l.b=b.b,c.r=w.r,c.g=w.g,c.b=w.b}return}const p=Q.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];o=m[p+1],a=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];const b=(s-x)/(m[p+7]-x);o+=(m[p+7+1]-o)*b,a+=(m[p+7+2]-a)*b,h+=(m[p+7+3]-h)*b,d+=(m[p+7+4]-d)*b,f+=(m[p+7+5]-f)*b,u+=(m[p+7+6]-u)*b;break}case 1:o=m[p+1],a=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[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),u=this.getBezierValue(s,p,6,g+18*5-2)}if(n!==1)if(i){const x=t.data.setupPose;let b=x.color;o=b.r+(o-b.r)*n,a=b.g+(a-b.g)*n,h=b.b+(h-b.b)*n,b=x.darkColor,d=b.r+(d-b.r)*n,f=b.g+(f-b.g)*n,u=b.b+(u-b.b)*n}else o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n,d=c.r+(d-c.r)*n,f=c.g+(f-c.g)*n,u=c.b+(u-c.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,c.r=d<0?0:d>1?1:d,c.g=f<0?0:f>1?1:f,c.b=u<0?0:u>1?1:u}},kt=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,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;c||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)}},He=class extends bt{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,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=o*.03-l*.06,p=((r-c)*3-n+a)*.006,g=(l-o+.33333333)*.018;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,S=l*.3+m+g*.16666667,y=n+w,v=S;for(let T=f+18;f<T;f+=2)d[f]=y,d[f+1]=v,w+=x,S+=b,x+=p,b+=g,y+=w,v+=S}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const c=this.frames[e];return(t-c)/(this.frames[e+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>t){const c=this.frames[e];return s[n+1]*(t-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const c=s[n-2],o=s[n-1];return o+(t-c)/(s[n]-c)*(s[n+1]-o)}const r=s[i-2],l=s[i-1];return l+(1-l)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,l,c,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,u,m;if(s>=d[d.length-1])m=0,f=this.vertices[d.length-1],u=null;else{const g=Q.search(d,s);m=this.getCurvePercent(s,g),f=this.vertices[g],u=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],o,f,u,m,p,i,r,l);for(const g of h)this.applyToSlot(a[g],o,f,u,m,p,i,r,l)}applyToSlot(t,e,s,n,i,r,l,c,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&&(c=!0),d.length=r,n===null)if(l===1)if(o&&!c)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=s[u]-f[u]}else B.arrayCopy(s,0,d,0,r);else if(c)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++){const m=f[u];d[u]=m+(s[u]-m)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*l}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*l;else if(l===1)if(o&&!c)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=u+(n[f]-u)*i}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u];d[u]+=m+(n[u]-m)*i-f[u]}}else if(i===0)B.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const u=s[f];d[f]=u+(n[f]-u)*i}else if(c)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*l}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u],p=f[u];d[u]=p+(m+(n[u]-m)*i-p)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*l}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u];d[u]+=(m+(n[u]-m)*i-f[u])*l}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*l}}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))}},Ge=class vt 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 vt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const l=this.frames;e*=vt.ENTRIES,l[e]=s,l[e+vt.MODE]=n|i<<4,l[e+vt.DELAY]=r}apply(e,s,n,i,r,l,c,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(l){this.setupPose(h[this.slotIndex],a);for(const x of d)this.setupPose(h[x],a)}return}const u=Q.search(f,n,vt.ENTRIES),m=f[u],p=f[u+vt.MODE],g=f[u+vt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,m,p,g);for(const x of d)this.applyToSlot(h[x],a,n,m,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,l){if(!e.bone.active)return;const c=s?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=c.attachment.sequence.regions.length;const h=Pe[r&15];if(h!==0)switch(o+=(n-i)/l+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)}}c.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,l,c,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 u=h[f];for(;f>0&&h[f-1]===u;)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,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){l&&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 u=0,m=f.length;u<m;u++)h[u]=d[f[u]]}},qt=class xn extends Q{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...xn.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,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])l&&this.setup(h,d);else{const f=this.drawOrders[Q.search(this.frames,n)];if(!f)this.setup(h,d);else{const u=this.inFolder,m=this.slots;for(let p=0,g=0,x=m.length;!(u[h[p].data.index]&&(h[p]=d[m[f[g]]],++g===x));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,l=0,c=i.length;!(n[e[r].data.index]&&(e[r]=s[i[l]],++l===c));r++);}};function _s(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var je=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,l){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]=l?1:0}apply(t,e,s,n,i,r,l,c,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.mix=x.mix,h.softness=x.softness,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch}return}let f=0,u=0;const m=Q.search(d,s,6),p=this.curves[m/6];switch(p){case 0:{const x=d[m];f=d[m+1],u=d[m+2];const b=(s-x)/(d[m+6]-x);f+=(d[m+6+1]-f)*b,u+=(d[m+6+2]-u)*b;break}case 1:f=d[m+1],u=d[m+2];break;default:f=this.getBezierValue(s,m,1,p-2),u=this.getBezierValue(s,m,2,p+18-2)}const g=r?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,c?r&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[m+3],h.compress=d[m+4]!==0,h.stretch=d[m+5]!==0)}},Je=class extends bt{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,l,c){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]=l,o[t+6]=c}apply(t,e,s,n,i,r,l,c,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,u,m,p,g,x;const b=Q.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];f=d[b+1],u=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const v=(s-y)/(d[b+7]-y);f+=(d[b+7+1]-f)*v,u+=(d[b+7+2]-u)*v,m+=(d[b+7+3]-m)*v,p+=(d[b+7+4]-p)*v,g+=(d[b+7+5]-g)*v,x+=(d[b+7+6]-x)*v;break}case 1:f=d[b+1],u=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:f=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+18*2-2),p=this.getBezierValue(s,b,4,w+18*3-2),g=this.getBezierValue(s,b,5,w+18*4-2),x=this.getBezierValue(s,b,6,w+18*5-2)}const S=r?a.data.setupPose:h;l?(h.mixRotate=S.mixRotate+f*i,h.mixX=S.mixX+u*i,h.mixY=S.mixY+m*i,h.mixScaleX=S.mixScaleX+p*i,h.mixScaleY=S.mixScaleY+g*i,h.mixShearY=S.mixShearY+x*i):(h.mixRotate=S.mixRotate+(f-S.mixRotate)*i,h.mixX=S.mixX+(u-S.mixX)*i,h.mixY=S.mixY+(m-S.mixY)*i,h.mixScaleX=S.mixScaleX+(p-S.mixScaleX)*i,h.mixScaleY=S.mixScaleY+(g-S.mixScaleY)*i,h.mixShearY=S.mixShearY+(x-S.mixShearY)*i)}},Pt=class extends $t{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Ke=class extends Pt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,l,h.position,a.data.setupPose.position)}}},Qe=class extends Pt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,l,c,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)}}},Ze=class extends bt{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,l,c,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.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY}return}let f,u,m;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];f=d[p+1],u=d[p+2],m=d[p+3];const w=(s-b)/(d[p+4]-b);f+=(d[p+4+1]-f)*w,u+=(d[p+4+2]-u)*w,m+=(d[p+4+3]-m)*w;break}case 1:f=d[p+1],u=d[p+2],m=d[p+3];break;default:f=this.getBezierValue(s,p,1,g-2),u=this.getBezierValue(s,p,2,g+18-2),m=this.getBezierValue(s,p,3,g+18*2-2)}const x=r?a.data.setupPose:h;l?(h.mixRotate=x.mixRotate+f*i,h.mixX=x.mixX+u*i,h.mixY=x.mixY+m*i):(h.mixRotate=x.mixRotate+(f-x.mixRotate)*i,h.mixX=x.mixX+(u-x.mixX)*i,h.mixY=x.mixY+(m-x.mixY)*i)}},pt=class extends Pt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,l,c,o){if(l&&!this.additive&&(l=!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,l,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,l,this.get(h),this.get(a.data.setupPose)))}}}},ts=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}},es=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}},ss=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}},ns=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}},is=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}},rs=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}},as=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}},os=class bn extends Q{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...bn.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,l,c,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)}},ls=class extends Pt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,l,h.time,a.data.setupPose.time)}}},cs=class extends Pt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,l,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 Ie;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 l=e*r.timeScale;if(r.delay>0){if(r.delay-=l,r.delay>0)continue;l=-r.delay,r.delay=0}let c=r.next;if(c){const o=r.trackLast-c.delay;if(o>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*c.timeScale,r.trackTime+=l,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=e,c=c.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+=l}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 c=0,o=n.length;c<o;c++){const a=n[c];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(),u=f,m=s;a.reverse&&(u=a.animation.duration-u,m=null);const p=a.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x<g;x++){B.webkit602BugfixHelper(h);const b=p[x];b instanceof kt?this.applyAttachmentTimeline(b,e,u,!0,!0):b.apply(e,d,u,m,h,!0,!1,!1,!1)}else{const x=a.timelineMode,b=h>=a.alphaAttachmentThreshold,w=a.additive,S=w||a.shortestRotation,y=!S&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let v=0;v<g;v++){const T=p[v],A=(x[v]&_t)!==0;!S&&T instanceof Ut?this.applyRotateTimeline(T,e,u,h,A,a.timelinesRotation,v<<1,y):T instanceof kt?this.applyAttachmentTimeline(T,e,u,A,b):(B.webkit602BugfixHelper(h),T.apply(e,d,u,m,h,A,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+hs,l=e.slots;for(let c=0,o=e.slots.length;c<o;c++){const a=l[c];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(),l=n.alpha*i,c=1-r*e.alpha,o=l*(1-r),a=c>0?o/c:l,h=n.animation.timelines,d=h.length,f=n.timelineMode,u=n.timelineHoldMix,m=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,x=g||n.shortestRotation,b=!x&&n.timelinesRotation.length!==d<<1;b&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let S=n.animationLast,y=n.getAnimationTime(),v=y,T=null;n.reverse?v=n.animation.duration-v:r<n.eventThreshold&&(T=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const I=h[A],M=f[A];let Y=0;if((M&zt)!==0){const E=u[A];Y=E==null?a:a*(1-E.mix())}else{if(!p&&I instanceof Tt)continue;Y=o}n.totalAlpha+=Y;const P=(M&_t)!==0;if(!x&&I instanceof Ut)this.applyRotateTimeline(I,s,v,Y,P,w,A<<1,b);else if(I instanceof kt)this.applyAttachmentTimeline(I,s,v,P,m&&Y>=n.alphaAttachmentThreshold);else{const E=!p||!(I instanceof Tt)||!P;I.apply(s,S,v,T,Y,P,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,S,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 l=s.slots[e.slotIndex];if(!l.bone.active||!r&&l.attachmentState===this.unkeyedState+ds)return;let c=n<e.frames[0],o=null;if(c||(o=e.attachmentNames[Q.search(e.frames,n)],c=!r&&o==null),c){if(!i)return;o=l.data.attachmentName}l.pose.setAttachment(o==null?null:s.getAttachment(l.data.index,o)),r?l.attachmentState=this.unkeyedState+ds:c||(l.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,s,n,i,r,l,c,o){if(o&&(l[c]=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 u=r?d.rotation:h.rotation,m=d.rotation+e.getCurveValue(n);let p=0,g=m-u;if(g-=Math.ceil(g/360-.5)*360,g===0)p=l[c];else{let x=0,b=0;o?(x=0,b=g):(x=l[c],b=l[c+1]);const w=x-x%360;p=g+w;let S=g>=0,y=x>=0;Math.abs(b)<=90&&R.signum(b)!==R.signum(g)&&(Math.abs(x-w)>180?(p+=360*R.signum(x),y=S):w!==0?p-=360*R.signum(x):y=S),y!==S&&(p+=360*R.signum(x)),l[c]=p}l[c+1]=g,h.rotation=u+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,l=e.reverse;let c=e.trackLast%r;l&&(c=r-c);const o=this.events;let a=0,h=o.length;for(;a<h;a++){const f=o[a];if(f.time<c!==l)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,l=i-n,c=e.animation.timelines;for(let o=0,a=e.animation.timelines.length;o<a;o++){const h=c[o];if(!(h instanceof te))continue;const d=h.events,f=h.frames,u=f.length;if(r>=l){for(let m=0;m<u;m++)if(!(f[m]<l)){if(f[m]>=r)break;this.events.push(d[m])}}else{for(let p=0;p<u&&!(f[p]>=r);p++)this.events.push(d[p]);let m=0;for(;m<u&&!(f[m]>=l);m++);for(;m<u;m++)this.events.push(d[m])}}}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 l=this.trackEntry(e,s,n,r);return this.setTrack(e,l,i),this.queue.drain(),l}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 l=this.trackEntry(e,s,n,r);return r?(r.next=l,l.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-l.mixDuration,0))):(this.setTrack(e,l,!0),this.queue.drain(),i<0&&(i=0)),l.delay=i,l}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 l=this.propertyIds,c=e.additive,o=e.keepHold,a=e.mixingTo;t:for(let h=0;h<n;h++){const d=s[h],f=d.propertyIds,u=l.addAll(f)&&!(d instanceof qt&&l.contains(Tt.propertyID));if(c&&d.additive){i[h]=u?_t:ee;continue}for(let p=e.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(f)){i[h]=ee;continue t}let m;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(f))m=u?_t:ee;else{m=u?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&&(m=m&~zt|i[h]&zt),i[h]=m}}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 l=i[r];l.start&&l.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const l=i[r];l.interrupt&&l.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const l=i[r];l.end&&l.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const l=i[r];l.dispose&&l.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 l=i[r];l.complete&&l.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let l=0;l<i.length;l++){const c=i[l];c.event&&c.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,hs=1,ds=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,l)=>{const c=`Couldn't load binary ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}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,l)=>{const c=`Couldn't load JSON ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}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((l,c)=>{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),l(a);return}for(const f of a.pages)this.loadTexture(this.texturePath(r,f.name,n),(u,m)=>{d||(f.setTexture(m),--h===0&&(this.success(e,t,a),l(a)))},(u,m)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${u}`;this.error(s,t,p),c(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),c(h)}},(o,a)=>{const h=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,h),c(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,l)=>{this.downloader.downloadText(t,c=>{try{const o=this.createTextureAtlas(c,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),l(a)}},(c,o)=>{const a=`Couldn't load texture atlas ${t}: status ${c}, ${o}`;this.error(s,t,a),l(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 Me){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 Me(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 l=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+l]=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 Te{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Te.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Te;return Te.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(l){this.finish(t,400,JSON.stringify(l))}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(l){this.finish(t,400,JSON.stringify(l))}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)}},fs=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*R.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,l=n*e.c+i*e.d;return R.atan2Deg(l,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 Ft(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new St(s,i)}newBoundingBoxAttachment(t,e,s){return new fs(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}},us=class Tn 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 Tn(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,u=(e+i)*R.degRad,m=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(u)*s*f,this.d=Math.sin(m)*n*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const l=this.bone.parent.appliedPose;let c=l.a,o=l.b,a=l.c,h=l.d;switch(this.worldX=c*this.x+o*this.y+l.worldX,this.worldY=a*this.x+h*this.y+l.worldY,this.inherit){case 0:{const d=(e+i)*R.degRad,f=(e+90+r)*R.degRad,u=Math.cos(d)*s,m=Math.cos(f)*n,p=Math.sin(d)*s,g=Math.sin(f)*n;this.a=c*u+o*p,this.b=c*m+o*g,this.c=a*u+h*p,this.d=a*m+h*g;return}case 1:{const d=t.scaleX,f=t.scaleY,u=(e+i)*R.degRad,m=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(u)*s*f,this.d=Math.sin(m)*n*f;break}case 2:{const d=t.scaleX,f=t.scaleY,u=1/d,m=1/f;c*=u,a*=m;let p=c*c+a*a,g=0;p>R.epsilon2?(p=Math.abs(c*h*m-o*u*a)/p,o=a*p,h=c*p,g=e-R.atan2Deg(a,c)):(c=0,a=0,g=e-90+R.atan2Deg(h,o));const x=(g+i)*R.degRad,b=(g+r+90)*R.degRad,w=Math.cos(x)*s,S=Math.cos(b)*n,y=Math.sin(x)*s,v=Math.sin(b)*n;this.a=(c*w-o*y)*d,this.b=(c*S-o*v)*d,this.c=(a*w+h*y)*f,this.d=(a*S+h*v)*f;break}case 3:case 4:{const d=t.scaleX,f=t.scaleY,u=1/d,m=1/f,p=e*R.degRad,g=Math.cos(p),x=Math.sin(p);let b=(c*g+o*x)*u,w=(a*g+h*x)*m;const S=1/Math.sqrt(b*b+w*w);b*=S,w*=S;let y=-w,v=b;this.inherit===3&&c*h-o*a<0!=(d<0!=f<0)&&(y=-y,v=-v);const T=i*R.degRad,A=(90+r)*R.degRad,I=Math.cos(T)*s,M=Math.cos(A)*n,Y=Math.sin(T)*s,P=Math.sin(A)*n;this.a=(b*I+y*Y)*d,this.b=(b*M+y*P)*d,this.c=(w*I+v*Y)*f,this.d=(w*M+v*P)*f;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;const e=t.scaleX,s=t.scaleY;if(!this.bone.parent){const g=1/e,x=1/s;this.x=(this.worldX-t.x)*g,this.y=(this.worldY-t.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,l=n.c,c=n.d;const o=i*c-r*l,a=1/(i*c-r*l),h=c*a,d=r*a,f=l*a,u=i*a,m=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=m*h-p*d,this.y=p*u-m*f,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,u*this.c-f*this.a,u*this.d-f*this.b,0);break;case 1:{const g=1/e,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/e,x=1/s;i*=g,l*=x;const b=this.a*g,w=this.b*g,S=this.c*x,y=this.d*x,v=1/(i*i+l*l),T=1/Math.abs(o*g*x);this.set5((i*b+l*S)*v,(i*w+l*y)*v,(i*S-l*b)*T,(i*y-l*w)*T,R.atan2Deg(l,i));break}case 3:case 4:{const g=1/e,x=1/s,b=this.a*g,w=this.b*g,S=this.c*x,y=this.d*x;let v=c*this.a-r*this.c,T=i*this.c-l*this.a;o<0&&(v=-v,T=-T);let A=R.atan2Deg(T,v);this.rotation=A,A*=R.degRad;const I=Math.cos(A),M=Math.sin(A);let Y=(i*I+r*M)*g,P=(l*I+c*M)*x;const E=1/Math.sqrt(Y*Y+P*P);Y*=E,P*=E;const X=this.inherit===3&&o<0!=(e<0!=s<0)?-1:1;this.set4(Y*b+P*S,Y*w+P*y,(Y*S-P*b)*X,(Y*y-P*w)*X)}}}set4(t,e,s,n){const i=t*t+s*s,r=e*e+n*n;i>R.epsilon2?(this.shearX=R.atan2Deg(s,t),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,s,n,i){this.shearX=0;const r=t*t+s*s,l=e*e+n*n;if(r>R.epsilon2){const c=R.atan2Deg(s,t);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(l),l>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(l),this.shearY=0,this.rotation=l>R.epsilon2?R.atan2Deg(n,e)-90+i:i}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 R.atan2Deg(this.c,this.a)}getWorldRotationY(){return R.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*=R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.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)*R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=R.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}},ms=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)}},gs=class extends ms{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},ae=class An extends gs{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 An(this.data,e);return s.pose.set(this.pose),s}},Et=class extends gs{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=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(oe||{}),le=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}},ps=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 le(-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}},Zs=class Mt 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 Mt(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:Mt.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Mt.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,l,c,o,a,h){typeof n=="number"?Mt.apply1(e,s,n,i,r,l,c,o):Mt.apply2(e,s,n,i,r,l,c,o,a,h)}static apply1(e,s,n,i,r,l,c,o){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,f=a.c,u=a.d,m=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*R.signum(e.scaleX),g=(i-s.worldY)*R.signum(e.scaleY);break;case 2:{const x=Math.abs(h*u-d*f)/Math.max(R.epsilon,h*h+f*f),b=h/e.scaleX,w=f/e.scaleY;d=-w*x*e.scaleX,u=b*x*e.scaleY,m+=R.atan2Deg(w,b)}default:{const x=n-a.worldX,b=i-a.worldY,w=h*u-d*f;Math.abs(w)<=R.epsilon?(p=0,g=0):(p=(x*u-b*d)/w-s.x,g=(b*h-x*f)/w-s.y)}}if(m+=R.atan2Deg(g,p),s.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),s.rotation+=m*o,r||l){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>R.epsilon){const b=p*p+g*g;if(r&&b<x*x||l&&b>x*x){const w=(Math.sqrt(b)/x-1)*o+1;switch(s.scaleX*=w,c){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(e,s,n,i,r,l,c,o,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,f=s.y,u=s.scaleX,m=s.scaleY,p=n.scaleX,g=0,x=0,b=0;u<0?(u=-u,g=180,b=-1):(g=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,x=180):x=0;let w=0,S=0,y=s.a,v=s.b,T=s.c,A=s.d;const I=Math.abs(u-m)<=R.epsilon;!I||c?(n.y=0,w=y*n.x+s.worldX,S=T*n.x+s.worldY):(w=y*n.x+v*n.y+s.worldX,S=T*n.x+A*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,v=M.b,T=M.c,A=M.d;let Y=y*A-v*T,P=w-M.worldX,E=S-M.worldY;Y=Math.abs(Y)<=R.epsilon?0:1/Y;const X=(P*A-E*v)*Y-d,V=(E*y-P*T)*Y-f;let N=Math.sqrt(X*X+V*V),q=n.bone.data.length*p,O,k;if(N<R.epsilon){Mt.apply(e,s,i,r,!1,c,0,h),n.rotation=0;return}P=i-M.worldX,E=r-M.worldY;let F=(P*A-E*v)*Y-d,U=(E*y-P*T)*Y-f,$=F*F+U*U;if(a!==0){a*=u*(p+1)*.5;const L=Math.sqrt($),_=L-N-q*u+a;if(_>0){let D=Math.min(1,_/(a*2))-1;D=(_-a*(1-D*D))/L,F-=D*F,U-=D*U,$=F*F+U*U}}t:if(I){q*=u;let L=($-N*N-q*q)/(2*N*q);if(L<-1)L=-1,k=Math.PI*l;else if(L>1){if(L=1,k=0,c)switch(y=(Math.sqrt($)/(N+q)-1)*h+1,s.scaleX*=y,o){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else k=Math.acos(L)*l;y=N+q*L,v=q*Math.sin(k),O=Math.atan2(U*y-F*v,F*y+U*v)}else{y=u*q,v=m*q;const L=y*y,_=v*v,D=Math.atan2(U,F);T=_*N*N+L*$-L*_;const J=-2*_*N,tt=_-L;if(A=J*J-4*tt*T,A>=0){let ft=Math.sqrt(A);J<0&&(ft=-ft),ft=-(J+ft)*.5;let gt=ft/tt,Lt=T/ft;const Jt=Math.abs(gt)<Math.abs(Lt)?gt:Lt;if(gt=$-Jt*Jt,gt>=0){E=Math.sqrt(gt)*l,O=D-Math.atan2(E,Jt),k=Math.atan2(E/m,(Jt-N)/u);break t}}let K=R.PI,et=N-y,nt=et*et,st=0,ht=0,it=N+y,rt=it*it,dt=0;T=-y*N/(L-_),T>=-1&&T<=1&&(T=Math.acos(T),P=y*Math.cos(T)+N,E=v*Math.sin(T),A=P*P+E*E,A<nt&&(K=T,nt=A,et=P,st=E),A>rt&&(ht=T,rt=A,it=P,dt=E)),$<=(nt+rt)*.5?(O=D-Math.atan2(st*l,et),k=K*l):(O=D-Math.atan2(dt*l,it),k=ht*l)}const W=Math.atan2(n.y,n.x)*b;O=(O-W)*R.radDeg+g-s.rotation,O>180?O-=360:O<=-180&&(O+=360),s.rotation+=O*h,k=((k+W)*R.radDeg-n.shearX)*b+x-n.rotation,k>180?k-=360:k<=-180&&(k+=360),n.rotation+=k*h}},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)}},he=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 he)}create(t){return new tn(this,t)}},xs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(xs||{}),bs=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(bs||{}),ws=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(ws||{}),tn=class Yt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new he,new he),!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 Yt(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,l=i.mixX,c=i.mixY;if(r===0&&l===0&&c===0)return;const o=this.data,a=o.rotateMode===0,h=o.rotateMode===2,d=this.bones,f=d.length,u=a?f:f+1,m=B.setArraySize(this.spaces,u),p=h?this.lengths=B.setArraySize(this.lengths,f):[],g=i.spacing;switch(o.spacingMode){case 2:if(h)for(let v=0,T=u-1;v<T;v++){const A=d[v],I=A.bone.data.length,M=I*A.a,Y=I*A.c;p[v]=Math.sqrt(M*M+Y*Y)}B.arrayFill(m,1,u,g);break;case 3:{let v=0;for(let T=0,A=u-1;T<A;){const I=d[T],M=I.bone.data.length;if(M<R.epsilon)h&&(p[T]=0),m[++T]=g;else{const Y=M*I.a,P=M*I.c,E=Math.sqrt(Y*Y+P*P);h&&(p[T]=E),m[++T]=E,v+=E}}if(v>0){v=u/v*g;for(let T=1;T<u;T++)m[T]*=v}break}default:{const v=o.spacingMode===0;for(let T=0,A=u-1;T<A;){const I=d[T],M=I.bone.data.length;if(M<R.epsilon)h&&(p[T]=0),m[++T]=g;else{const Y=M*I.a,P=M*I.c,E=Math.sqrt(Y*Y+P*P);h&&(p[T]=E),m[++T]=(v?Math.max(0,M+g):g)*E/M}}}}const x=this.computeWorldPositions(e,n,u,a);let b=x[0],w=x[1],S=o.offsetRotation,y=!1;if(S===0)y=o.rotateMode===1;else{y=!1;const v=this.slot.bone.appliedPose;S*=v.a*v.d-v.b*v.c>0?R.degRad:-R.degRad}for(let v=0,T=3,A=e._update;v<f;v++,T+=3){const I=d[v];I.worldX+=(b-I.worldX)*l,I.worldY+=(w-I.worldY)*c;const M=x[T],Y=x[T+1],P=M-b,E=Y-w;if(h){const X=p[v];if(X!==0){const V=(Math.sqrt(P*P+E*E)/X-1)*r+1;I.a*=V,I.c*=V}}if(b=M,w=Y,r>0){let X=I.a,V=I.b,N=I.c,q=I.d,O=0,k=0,F=0;if(a?O=x[T-1]:m[v+1]===0?O=x[T+2]:O=Math.atan2(E,P),O-=Math.atan2(N,X),y){k=Math.cos(O),F=Math.sin(O);const U=I.bone.data.length;b+=(U*(k*X-F*N)-P)*r,w+=(U*(F*X+k*N)-E)*r}else O+=S;O>R.PI?O-=R.PI2:O<-R.PI&&(O+=R.PI2),O*=r,k=Math.cos(O),F=Math.sin(O),I.a=k*X-F*N,I.b=k*V-F*q,I.c=F*X+k*N,I.d=F*V+k*q}I.modifyWorld(A)}}computeWorldPositions(e,s,n,i){const r=this.slot;let l=this.appliedPose.position,c=this.spaces,o=B.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,f=d/6,u=Yt.NONE;if(!s.constantSpeed){const k=s.lengths;f-=h?1:2;const F=k[f];this.data.positionMode===1&&(l*=F);let U;switch(this.data.spacingMode){case 2:U=F;break;case 3:U=F/n;break;default:U=1}a=B.setArraySize(this.world,8);for(let $=0,W=0,L=0;$<n;$++,W+=3){const _=c[$]*U;l+=_;let D=l;if(h)D%=F,D<0&&(D+=F),L=0;else if(D<0){u!==Yt.BEFORE&&(u=Yt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition(D,a,0,o,W);continue}else if(D>F){u!==Yt.AFTER&&(u=Yt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition(D-F,a,0,o,W);continue}for(;;L++){const J=k[L];if(!(D>J)){if(L===0)D/=J;else{const tt=k[L-1];D=(D-tt)/(J-tt)}break}}L!==u&&(u=L,h&&L===f?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*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||$>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 m=B.setArraySize(this.curves,f);let p=0,g=a[0],x=a[1],b=0,w=0,S=0,y=0,v=0,T=0,A=0,I=0,M=0,Y=0,P=0,E=0,X=0,V=0;for(let k=0,F=2;k<f;k++,F+=6)b=a[F],w=a[F+1],S=a[F+2],y=a[F+3],v=a[F+4],T=a[F+5],A=(g-b*2+S)*.1875,I=(x-w*2+y)*.1875,M=((b-S)*3-g+v)*.09375,Y=((w-y)*3-x+T)*.09375,P=A*2+M,E=I*2+Y,X=(b-g)*.75+A+M*.16666667,V=(w-x)*.75+I+Y*.16666667,p+=Math.sqrt(X*X+V*V),X+=P,V+=E,P+=M,E+=Y,p+=Math.sqrt(X*X+V*V),X+=P,V+=E,p+=Math.sqrt(X*X+V*V),X+=P+M,V+=E+Y,p+=Math.sqrt(X*X+V*V),m[k]=p,g=v,x=T;this.data.positionMode===1&&(l*=p);let N;switch(this.data.spacingMode){case 2:N=p;break;case 3:N=p/n;break;default:N=1}const q=this.segments;let O=0;for(let k=0,F=0,U=0,$=0;k<n;k++,F+=3){const W=c[k]*N;l+=W;let L=l;if(h)L%=p,L<0&&(L+=p),U=0,$=0;else if(L<0){this.addBeforePosition(L,a,0,o,F);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,o,F);continue}for(;;U++){const _=m[U];if(!(L>_)){if(U===0)L/=_;else{const D=m[U-1];L=(L-D)/(_-D)}break}}if(U!==u){u=U;let _=U*6;for(g=a[_],x=a[_+1],b=a[_+2],w=a[_+3],S=a[_+4],y=a[_+5],v=a[_+6],T=a[_+7],A=(g-b*2+S)*.03,I=(x-w*2+y)*.03,M=((b-S)*3-g+v)*.006,Y=((w-y)*3-x+T)*.006,P=A*2+M,E=I*2+Y,X=(b-g)*.3+A+M*.16666667,V=(w-x)*.3+I+Y*.16666667,O=Math.sqrt(X*X+V*V),q[0]=O,_=1;_<8;_++)X+=P,V+=E,P+=M,E+=Y,O+=Math.sqrt(X*X+V*V),q[_]=O;X+=P,V+=E,O+=Math.sqrt(X*X+V*V),q[8]=O,X+=P+M,V+=E+Y,O+=Math.sqrt(X*X+V*V),q[9]=O,$=0}for(L*=O;;$++){const _=q[$];if(!(L>_)){if($===0)L/=_;else{const D=q[$-1];L=$+(L-D)/(_-D)}break}}this.addCurvePosition(L*.1,g,x,b,w,S,y,v,T,o,F,i||k>0&&W===0)}return o}addBeforePosition(e,s,n,i,r){const l=s[n],c=s[n+1],o=s[n+2]-l,a=s[n+3]-c,h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const l=s[n+2],c=s[n+3],o=l-s[n],a=c-s[n+1],h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,l,c,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 u=e*e,m=u*e,p=1-e,g=p*p,x=g*p,b=p*e,w=b*3,S=p*w,y=w*e,v=s*x+i*S+l*y+o*m,T=n*x+r*S+c*y+a*m;h[d]=v,h[d+1]=T,f&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(T-(n*g+r*b*2+c*u),v-(s*g+i*b*2+l*u)))}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 l=0;l<r;l++){const c=i[l].bone;e.sortBone(c),e.constrained(c)}e._updateCache.push(this);for(let l=0;l<r;l++)e.sortReset(i[l].bone.children);for(let l=0;l<r;l++)i[l].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let l=0,c=r.length;l<c;l++){const o=r[l];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 l=0,c=i.length;l<c;){let o=i[l++];for(o+=l;l<o;)e.sortBone(r[i[l++]])}}}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||{}),de=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}},fe=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 In extends ms{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new fe,new fe),!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 In(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 Ae{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ae.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ae.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 l=0,c=e.length;l<c;l++)e[l].unconstrained();const s=this.bones,n=s.length;for(let l=0,c=n;l<c;l++){const o=s[l];o.sorted=o.data.skinRequired,o.active=!o.sorted,o.unconstrained()}if(this.skin){const l=this.skin.bones;for(let c=0,o=this.skin.bones.length;c<o;c++){let a=this.bones[l[c].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let l=0;l<r;l++)i[l].unconstrained();for(let l=0;l<r;l++){const c=i[l];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let l=0;l<n;l++)this.sortBone(s[l]);r=this._updateCache.length;for(let l=0;l<r;l++){const c=this._updateCache[l];c instanceof ae&&(this._updateCache[l]=c.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],l=r.data.attachmentName;if(l){const c=e.getAttachment(n,l);c&&r.pose.setAttachment(c)}}}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 l=n[i];if(l instanceof s&&l.data.name===e)return l}return null}getBoundsRect(e){const s=new Ce,n=new Ce;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,l=r;let c=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 u=l[d];if(!u.bone.active)continue;let m=0,p=null,g=null;const x=u.appliedPose.attachment;if(x){if(x instanceof Ft)m=8,p=B.setArraySize(n,m,0),x.computeWorldVertices(u,x.getOffsets(u.appliedPose),p,0,2),g=Ae.quadTriangles;else if(x instanceof St)m=x.worldVerticesLength,p=B.setArraySize(n,m,0),x.computeWorldVertices(this,u,0,m,p,0,2),g=x.triangles;else if(x instanceof Wt&&i){i.clipEnd(u),i.clipStart(this,u,x);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,m=i.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const S=p[b],y=p[b+1];c=Math.min(c,S),o=Math.min(o,y),a=Math.max(a,S),h=Math.max(h,y)}}}i&&i.clipEnd(u)}i&&i.clipEnd(),e.set(c,o),s.set(a-c,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,l=i.length;r<l;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 de,new de),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*R.degRad,r=Math.cos(i),l=Math.sin(i),c=this.cx-e,o=this.cy-s;this.translate(c*r-o*l-c,c*l+o*r-o)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,l=this.data.y>0,c=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 u=Math.max(e.time-this.lastTime,0),m=this.remaining;this.remaining+=u,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 x=this.remaining,b=n.inertia,w=e.data.referenceScale,S=-1,y=0,v=0,T=this.data.limit*u,A=T*Math.abs(e.scaleY);if(T*=Math.abs(e.scaleX),r||l){if(r){const I=(this.ux-p)*b;this.xOffset+=I>T?T:I<-T?-T:I,this.ux=p}if(l){const I=(this.uy-g)*b;this.yOffset+=I>A?A:I<-A?-A:I,this.uy=g}if(x>=d){const I=this.xOffset,M=this.yOffset;S=n.damping**(60*d),y=d*n.massInverse,v=n.strength;const Y=w*n.wind,P=w*n.gravity,E=(Y*e.windX+P*e.gravityX)*e.scaleX,X=(Y*e.windY+P*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*v)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=S),l&&(this.yVelocity-=(X+this.yOffset*v)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=S),x-=d;while(x>=d);this.xLag=this.xOffset-I,this.yLag=this.yOffset-M}f=Math.max(0,1-x/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c||o){let I=Math.atan2(a.c,a.a),M=0,Y=0,P=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>T?E=T:E<-T&&(E=-T),X>A?X=A:X<-A&&(X=-A),x=this.remaining,c){P=(this.data.rotate+this.data.shearX)*i,f=this.rotateLag*Math.max(0,1-m/d);let V=Math.atan2(X+this.ty,E+this.tx)-I-(this.rotateOffset-f)*P;this.rotateOffset+=(V-Math.ceil(V*R.invPI2-.5)*R.PI2)*b,V=(this.rotateOffset-f)*P+I,M=Math.cos(V),Y=Math.sin(V),o&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*Y)*b/V))}else{M=Math.cos(I),Y=Math.sin(I);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);V>0&&(this.scaleOffset+=(E*M+X*Y)*b/V)}if(x>=d){S===-1&&(S=n.damping**(60*d),y=d*n.massInverse,v=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,N=(n.wind*e.windY+n.gravity*e.gravityY)*nn.yDir,q=this.rotateOffset,O=this.scaleOffset,k=h/w;for(;;)if(x-=d,o&&(this.scaleVelocity+=(V*M-N*Y-this.scaleOffset*v)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=S),c){if(this.rotateVelocity-=((V*Y+N*M)*k+this.rotateOffset*v)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=S,x<d)break;const F=this.rotateOffset*P+I;M=Math.cos(F),Y=Math.sin(F)}else if(x<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-O}f=Math.max(0,1-x/d)}this.remaining=x}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),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c){let u=(this.rotateOffset-this.rotateLag*f)*i,m=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=u*this.data.rotate,m=Math.sin(x),p=Math.cos(x),g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d),x+=u*this.data.shearX,m=Math.sin(x),p=Math.cos(x),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c}else u*=this.data.rotate,m=Math.sin(u),p=Math.cos(u),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c,g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d}if(o){let u=1+(this.scaleOffset-this.scaleLag*f)*i*this.data.scaleX;switch(a.a*=u,a.c*=u,this.data.scaleYMode){case 1:a.b*=u,a.d*=u;break;case 2:u=Math.abs(u),u=u>=.7?1/u:4-3.67347*u,a.b*=u,a.d*=u}}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;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}constructor(t){super(t,new de)}create(t){return new ys(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var ue=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 ue,new ue),!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,l=this.bone;if(l!==null){if(!l.active)return;i.local&&l.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,l.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 c=e.bones,o=r.bones;for(let a=0,h=r.bones.length;a<h;a++)c[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 u=i[r[d]];u.sorted=!1,e.sortReset(u.children),e.constrained(u)}const l=n.animation.timelines,c=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 u=l[d];if(Ds(u))e.constrained(c[u.slotIndex]);else if(u instanceof Tt||u instanceof qt)e.drawOrder.constrained();else if(u instanceof pt)if(u.constraintIndex===-1)for(let m=0;m<h;m++)e.constrained(a[m]);else e.constrained(o[u.constraintIndex]);else if(_s(u)){const m=u.constraintIndex;m!==-1&&e.constrained(o[m])}}}},yt=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(t){super(t,new ue)}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 yt&&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}},me=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 St?(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 l=e.attachments[s];for(const c in l){const o=l[c];if(r===o){const a=this.getAttachment(s,c);a&&i.pose.setAttachment(a);break}}}s++}}},Ts=class extends ne{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new fe),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},As=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(As||{}),ge=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 ge,new ge),!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,l=i.localTarget,c=i.additive,o=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,f=i.properties.length,u=e._update,m=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=m[p];l?x.modifyLocal(e):x.modifyWorld(u);for(let b=0;b<f;b++){const w=d[b],S=w.value(e,h,r,a)-w.offset,y=w.to;for(let v=0,T=w.to.length;v<T;v++){const A=y[v];if(A.mix(n)!==0){let I=A.offset+S*A.scale;o&&(A.offset<A.max?I=R.clamp(I,A.offset,A.max):I=R.clamp(I,A.max,A.offset)),A.apply(e,n,x,I,l,c)}}}}}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 l=s[r].bone;e.sortReset(l.children),e.constrained(l)}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 ge)}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=[]},It=class{offset=0;max=0;scale=0},pe=class extends At{value(t,e,s,n){if(s)return e.rotation+n[j.ROTATION];const i=t.scaleX,r=t.scaleY;let l=Math.atan2(e.c/r,e.a/i)*R.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[j.ROTATION]:-n[j.ROTATION]);return l<0&&(l+=360),l}},Is=class extends It{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 l=t.scaleX,c=t.scaleY,o=1/l,a=1/c,h=s.a*o,d=s.b*o,f=s.c*a,u=s.d*a;n*=R.degRad,r||(n-=Math.atan2(f,h)),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2),n*=e.mixRotate;const m=Math.cos(n),p=Math.sin(n);s.a=(m*h-p*f)*l,s.b=(m*d-p*u)*l,s.c=(p*h+m*f)*c,s.d=(p*d+m*u)*c}}},xe=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 It{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 It{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)}},we=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]}},Ys=class extends It{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 l=1+(n-1)*e.mixScaleX;s.a*=l,s.c*=l}else{let l=s.a/t.scaleX,c=s.c/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleX/o,s.a*=o,s.c*=o)}}},ye=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]}},Fs=class extends It{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 l=1+(n-1)*e.mixScaleY;s.b*=l,s.d*=l}else{let l=s.b/t.scaleX,c=s.d/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleY/o,s.b*=o,s.d*=o)}}},ve=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))*R.radDeg-90+n[j.SHEARY]}},ks=class extends It{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 l=t.scaleX,c=t.scaleY,o=s.b/l,a=s.d/c,h=Math.atan2(a,o);n=(n+90)*R.degRad,r?n-=R.PI/2:(n-=h-Math.atan2(s.c/l,s.a/c),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(o*o+a*a);s.b=Math.cos(n)*d*c,s.d=Math.sin(n)*d*l}}},$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 l=n.readBoolean();l&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("String in string table must not be null.");n.strings.push(m)}const o=s.bones;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Bone name must not be null.");const p=u===0?null:o[n.readInt(!0)],g=new us(u,m,p),x=g.setupPose;x.rotation=n.readFloat(),x.x=n.readFloat()*e,x.y=n.readFloat()*e,x.scaleX=n.readFloat(),x.scaleY=n.readFloat(),x.shearX=n.readFloat(),x.shearY=n.readFloat(),x.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),l&&(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)}c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Slot name must not be null.");const p=o[n.readInt(!0)],g=new Ts(u,m,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const x=n.readInt32();x!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,x),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),l&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let u=0;u<h;u++){const m=n.readString();if(!m)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case oi:{const g=new Ht(m);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 x=n.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?n.readFloat():1),(x&128)!==0&&(b.softness=n.readFloat()*e),a.push(g);break}case ci:{const g=new j(m);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 x=n.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,S;w<p;w++){let y=1,v;switch(n.readByte()){case 0:v=new pe;break;case 1:{y=e,v=new xe;break}case 2:{y=e,v=new be;break}case 3:v=new we;break;case 4:v=new ye;break;case 5:v=new ve;break;default:v=null}if(v){v.offset=n.readFloat()*y,S=n.readByte();for(let T=0;T<S;T++){let A=1,I;switch(n.readByte()){case 0:I=new Is;break;case 1:{A=e,I=new Cs;break}case 2:{A=e,I=new Ms;break}case 3:I=new Ys;break;case 4:I=new Fs;break;case 5:I=new ks;break;default:I=null}I&&(I.offset=n.readFloat()*A,I.max=n.readFloat()*A,I.scale=n.readFloat()*A/y,v.to[T]=I)}g.properties[w]=v}}x=n.readByte(),(x&1)!==0&&(g.offsets[j.ROTATION]=n.readFloat()),(x&2)!==0&&(g.offsets[j.X]=n.readFloat()*e),(x&4)!==0&&(g.offsets[j.Y]=n.readFloat()*e),(x&8)!==0&&(g.offsets[j.SCALEX]=n.readFloat()),(x&16)!==0&&(g.offsets[j.SCALEY]=n.readFloat()),(x&32)!==0&&(g.offsets[j.SHEARY]=n.readFloat()),x=n.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=n.readFloat()),(x&2)!==0&&(b.mixX=n.readFloat()),(x&4)!==0&&(b.mixY=n.readFloat()),(x&8)!==0&&(b.mixScaleX=n.readFloat()),(x&16)!==0&&(b.mixScaleY=n.readFloat()),(x&32)!==0&&(b.mixShearY=n.readFloat()),a.push(g);break}case li:{const g=new Gt(m);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 x=n.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=n.readFloat());const b=g.setupPose;b.position=n.readFloat(),g.positionMode===0&&(b.position*=e),b.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=e),b.mixRotate=n.readFloat(),b.mixX=n.readFloat(),b.mixY=n.readFloat(),a.push(g);break}case hi:{const g=new jt(m);g.bone=o[n.readInt(!0)];let x=n.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=n.readFloat()),(x&4)!==0&&(g.y=n.readFloat()),(x&8)!==0&&(g.rotate=n.readFloat()),(x&16)!==0){let w=n.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(x&32)!==0&&(g.shearX=n.readFloat()),g.limit=((x&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const b=g.setupPose;b.inertia=n.readFloat(),b.strength=n.readFloat(),b.damping=n.readFloat(),b.massInverse=(x&128)!==0?n.readFloat():1,b.wind=n.readFloat(),b.gravity=n.readFloat(),x=n.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?n.readFloat():1,a.push(g);break}case di:{const g=new yt(m),x=n.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0&&(g.setupPose.time=n.readFloat()),(x&16)!==0&&(g.setupPose.mix=(x&32)!==0?n.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=o[n.readInt(!0)];const b=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new pe;break;case 1:{w=e,g.property=new xe;break}case 2:{w=e,g.property=new be;break}case 3:g.property=new we;break;case 4:g.property=new ye;break;case 5:g.property=new ve;break;default:continue}g.property.offset=b*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,l);d&&(s.defaultSkin=d,s.skins.push(d));{let u=s.skins.length;for(B.setArraySize(s.skins,c=u+n.readInt(!0));u<c;u++){const m=this.readSkin(n,s,!1,l);if(!m)throw new Error("readSkin() should not have returned null.");s.skins[u]=m}}c=this.linkedMeshes.length;for(let u=0;u<c;u++){const m=this.linkedMeshes[u],p=s.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(m.sourceIndex,m.source);if(!g)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?g:m.mesh,m.mesh.setSourceMesh(g),m.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Event data name must not be null");const p=new ps(m),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;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,m,s,l))}for(let u=0;u<h;u++){const m=a[u];m instanceof yt&&(m.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 me("default")}else{const l=t.readString();if(!l)throw new Error("Skin name must not be null.");i=new me(l),n&&z.rgba8888ToColor(i.color,t.readInt32());let c=t.readInt(!0),o=e.bones,a=i.bones;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];c=t.readInt(!0),o=e.constraints,a=i.constraints;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];r=t.readInt(!0)}for(let l=0;l<r;l++){const c=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,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(t,e,s,n,i,r){const l=this.scale,c=t.readByte(),o=(c&8)!==0?t.readStringRef():i;if(!o)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let a=(c&16)!==0?t.readStringRef():null;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0?t.readFloat():0,u=t.readFloat(),m=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat();a||(a=o);const w=this.attachmentLoader.newRegionAttachment(s,i,o,a,d);return w?(w.path=a,w.x=u*l,w.y=m*l,w.scaleX=p,w.scaleY=g,w.rotation=f,w.width=x*l,w.height=b*l,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(c&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=(c&16)!==0?t.readStringRef():o;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=t.readInt(!0),u=this.readVertices(t,(c&128)!==0),m=this.readFloatArray(t,u.length,1),p=this.readShortArray(t,(u.length-f-2)*3),g=t.readInt(!0);let x=null;if(g>0){x=[];for(let v=0;v<g;v++)x[v]=t.readInt(!0)}let b=[],w=0,S=0;r&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),S=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=u.bones,y.vertices=u.vertices,y.worldVerticesLength=u.length,y.regionUVs=m,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*l,y.height=S*l),y.updateSequence(),y):null}case 3:{const a=(c&16)!==0?t.readStringRef():o;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0,u=t.readInt(!0),m=t.readInt(!0),p=t.readStringRef();let g=0,x=0;r&&(g=t.readFloat(),x=t.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return b?(b.path=a,z.rgba8888ToColor(b.color,h),r&&(b.width=g*l,b.height=x*l),this.linkedMeshes.push(new Un(b,m,n,u,p,f)),b):null}case 4:{const a=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(t,(c&64)!==0),f=this.readFloatArray(t,d.length/6,l),u=r?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,i,o);return m?(m.closed=a,m.constantSpeed=h,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,r&&z.rgba8888ToColor(m.color,u),m):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=r?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,i,o);return u?(u.x=h*l,u.y=d*l,u.rotation=a,r&&z.rgba8888ToColor(u.color,f),u):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(c&16)!==0),d=r?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,i,o);return f?(f.endSlot=e.slots[a],f.convex=(c&32)!==0,f.inverse=(c&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 ln(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),l=[],c=[];for(let o=0,a=0;o<r;){const h=t.readInt(!0);l[o++]=h;for(let d=0;d<h;d++,a+=3)l[o++]=t.readInt(!0),c[a]=t.readFloat()*s,c[a+1]=t.readFloat()*s,c[a+2]=t.readFloat()}return new ln(l,B.toFloatArray(c),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,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0),w=b-1;switch(x){case ei:{const S=new kt(b,m);for(let y=0;y<b;y++)S.setFrame(y,t.readFloat(),t.readStringRef());i.push(S);break}case si:{const S=t.readInt(!0),y=new De(b,S,m);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let Y=0,P=0;y.setFrame(Y,v,T,A,I,M),Y!==w;Y++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(Y);break;case mt:H(t,y,P++,Y,0,v,E,T,X,1),H(t,y,P++,Y,1,v,E,A,V,1),H(t,y,P++,Y,2,v,E,I,N,1),H(t,y,P++,Y,3,v,E,M,q,1)}v=E,T=X,A=V,I=N,M=q}i.push(y);break}case ni:{const S=t.readInt(!0),y=new qe(b,S,m);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,Y=0;y.setFrame(M,v,T,A,I),M!==w;M++){const P=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,Y++,M,0,v,P,T,E,1),H(t,y,Y++,M,1,v,P,A,X,1),H(t,y,Y++,M,2,v,P,I,V,1)}v=P,T=E,A=X,I=V}i.push(y);break}case ii:{const S=t.readInt(!0),y=new ze(b,S,m);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,v,T,A,I,M,Y,P,E),X!==w;X++){const N=t.readFloat(),q=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(X);break;case mt:H(t,y,V++,X,0,v,N,T,q,1),H(t,y,V++,X,1,v,N,A,O,1),H(t,y,V++,X,2,v,N,I,k,1),H(t,y,V++,X,3,v,N,M,F,1),H(t,y,V++,X,4,v,N,Y,U,1),H(t,y,V++,X,5,v,N,P,$,1),H(t,y,V++,X,6,v,N,E,W,1)}v=N,T=q,A=O,I=k,M=F,Y=U,P=$,E=W}i.push(y);break}case ri:{const S=t.readInt(!0),y=new We(b,S,m);let v=t.readFloat(),T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,v,T,A,I,M,Y,P),E!==w;E++){const V=t.readFloat(),N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(E);break;case mt:H(t,y,X++,E,0,v,V,T,N,1),H(t,y,X++,E,1,v,V,A,q,1),H(t,y,X++,E,2,v,V,I,O,1),H(t,y,X++,E,3,v,V,M,k,1),H(t,y,X++,E,4,v,V,Y,F,1),H(t,y,X++,E,5,v,V,P,U,1)}v=V,T=N,A=q,I=O,M=k,Y=F,P=U}i.push(y);break}case ai:{const S=new _e(b,t.readInt(!0),m);let y=t.readFloat(),v=t.readUnsignedByte()/255;for(let T=0,A=0;S.setFrame(T,y,v),T!==w;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ut:S.setStepped(T);break;case mt:H(t,S,A++,T,0,y,I,v,M,1)}y=I,v=M}i.push(S)}}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0);if(x===ti){const S=new Ue(b,m);for(let y=0;y<b;y++)S.setFrame(y,t.readFloat(),t.readByte());i.push(S);continue}const w=t.readInt(!0);switch(x){case _n:Z(t,i,new Ut(b,w,m),1);break;case zn:Z(t,i,new Ee(b,w,m),r);break;case Wn:Z(t,i,new Xe(b,w,m),r);break;case Hn:Z(t,i,new Ve(b,w,m),r);break;case Gn:Z(t,i,new Re(b,w,m),1);break;case jn:Z(t,i,new Le(b,w,m),1);break;case Jn:Z(t,i,new Be(b,w,m),1);break;case Kn:Z(t,i,new Oe(b,w,m),1);break;case Qn:Z(t,i,new Ne(b,w,m),1);break;case Zn:Z(t,i,new $e(b,w,m),1);break}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=t.readInt(!0),g=p-1,x=new je(p,t.readInt(!0),m);let b=t.readByte(),w=t.readFloat(),S=(b&1)!==0?(b&2)!==0?t.readFloat():1:0,y=(b&4)!==0?t.readFloat()*r:0;for(let v=0,T=0;x.setFrame(v,w,S,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),v!==g;v++){b=t.readByte();const A=t.readFloat(),I=(b&1)!==0?(b&2)!==0?t.readFloat():1:0,M=(b&4)!==0?t.readFloat()*r:0;(b&64)!==0?x.setStepped(v):(b&128)!==0&&(H(t,x,T++,v,0,w,A,S,I,1),H(t,x,T++,v,1,w,A,y,M,r)),w=A,S=I,y=M}i.push(x)}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=t.readInt(!0),g=p-1,x=new Je(p,t.readInt(!0),m);let b=t.readFloat(),w=t.readFloat(),S=t.readFloat(),y=t.readFloat(),v=t.readFloat(),T=t.readFloat(),A=t.readFloat();for(let I=0,M=0;x.setFrame(I,b,w,S,y,v,T,A),I!==g;I++){const Y=t.readFloat(),P=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat(),q=t.readFloat();switch(t.readByte()){case ut:x.setStepped(I);break;case mt:H(t,x,M++,I,0,b,Y,w,P,1),H(t,x,M++,I,1,b,Y,S,E,1),H(t,x,M++,I,2,b,Y,y,X,1),H(t,x,M++,I,3,b,Y,v,V,1),H(t,x,M++,I,4,b,Y,T,N,1),H(t,x,M++,I,5,b,Y,A,q,1)}b=Y,w=P,S=E,y=X,v=V,T=N,A=q}i.push(x)}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=s.constraints[m];for(let g=0,x=t.readInt(!0);g<x;g++){const b=t.readByte(),w=t.readInt(!0),S=t.readInt(!0);switch(b){case mi:Z(t,i,new Ke(w,S,m),p.positionMode===0?r:1);break;case gi:Z(t,i,new Qe(w,S,m),p.spacingMode===0||p.spacingMode===1?r:1);break;case pi:{const y=new Ze(w,S,m);let v=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();for(let M=0,Y=0,P=y.getFrameCount()-1;y.setFrame(M,v,T,A,I),M!==P;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat();switch(t.readByte()){case ut:y.setStepped(M);break;case mt:H(t,y,Y++,M,0,v,E,T,X,1),H(t,y,Y++,M,1,v,E,A,V,1),H(t,y,Y++,M,2,v,E,I,N,1)}v=E,T=X,A=V,I=N}i.push(y)}}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0);if(x===Ai){const S=new os(b,m);for(let y=0;y<b;y++)S.setFrame(y,t.readFloat());i.push(S);continue}const w=t.readInt(!0);switch(x){case xi:Z(t,i,new ts(b,w,m),1);break;case bi:Z(t,i,new es(b,w,m),1);break;case wi:Z(t,i,new ss(b,w,m),1);break;case yi:Z(t,i,new ns(b,w,m),1);break;case vi:Z(t,i,new is(b,w,m),1);break;case Si:Z(t,i,new rs(b,w,m),1);break;case Ti:Z(t,i,new as(b,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0),w=t.readInt(!0);switch(x){case Ii:Z(t,i,new ls(b,w,m),1);break;case Ci:Z(t,i,new cs(b,w,m),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readInt(!0);for(let b=0,w=t.readInt(!0);b<w;b++){const S=t.readStringRef();if(!S)throw new Error("attachmentName must not be null.");const y=m.getAttachment(x,S),v=t.readByte(),T=t.readInt(!0),A=T-1;switch(v){case fi:{const I=y,M=I.bones,Y=I.vertices,P=M?Y.length/3*2:Y.length,E=t.readInt(!0),X=new He(T,E,x,I);let V=t.readFloat();for(let N=0,q=0;;N++){let O,k=t.readInt(!0);if(k===0)O=M?B.newFloatArray(P):Y;else{O=B.newFloatArray(P);const U=t.readInt(!0);if(k+=U,r===1)for(let $=U;$<k;$++)O[$]=t.readFloat();else for(let $=U;$<k;$++)O[$]=t.readFloat()*r;if(!M)for(let $=0,W=O.length;$<W;$++)O[$]+=Y[$]}if(X.setFrame(N,V,O),N===A)break;const F=t.readFloat();switch(t.readByte()){case ut:X.setStepped(N);break;case mt:H(t,X,q++,N,0,V,F,0,1,1)}V=F}i.push(X);break}case ui:{const I=new Ge(T,x,y);for(let M=0;M<T;M++){const Y=t.readFloat(),P=t.readInt32();I.setFrame(M,Y,Pe[P&15],P>>4,t.readFloat())}i.push(I);break}}}}}const l=s.slots.length,c=t.readInt(!0);if(c>0){const f=new Tt(c);for(let u=0;u<c;u++)f.setFrame(u,t.readFloat(),cn(t,l));i.push(f)}const o=t.readInt(!0);for(let f=0;f<o;f++){const u=t.readInt(!0),m=new Array(u);for(let x=0;x<u;x++)m[x]=t.readInt(!0);const p=t.readInt(!0),g=new qt(p,m,l);for(let x=0;x<p;x++)g.setFrame(x,t.readFloat(),cn(t,u));i.push(g)}const a=t.readInt(!0);if(a>0){const f=new te(a);for(let u=0;u<a;u++){const m=t.readFloat(),p=s.events[t.readInt(!0)],g=new le(m,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(u,g)}i.push(f)}let h=0;for(let f=0,u=i.length;f<u;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}},ln=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 l=0,c=0,o=s.getFrameCount()-1;s.setFrame(l,i,r),l!==o;l++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ut:s.setStepped(l);break;case mt:H(t,s,c++,l,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,l=t.readFloat()*n;for(let c=0,o=0,a=s.getFrameCount()-1;s.setFrame(c,i,r,l),c!==a;c++){const h=t.readFloat(),d=t.readFloat()*n,f=t.readFloat()*n;switch(t.readByte()){case ut:s.setStepped(c);break;case mt:H(t,s,o++,c,0,i,h,r,d,n),H(t,s,o++,c,1,i,h,l,f,n)}i=h,r=d,l=f}e.push(s)}function cn(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,l=0;for(let c=0;c<s;c++){const o=t.readInt(!0);for(;r!==o;)i[l++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[l++]=r++;for(let c=e-1;c>=0;c--)n[c]===-1&&(n[c]=i[--l]);return n}function H(t,e,s,n,i,r,l,c,o,a){e.setBezier(s,n,i,r,c,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,l,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,li=1,ci=2,hi=3,di=4,fi=0,ui=1,mi=0,gi=1,pi=2,xi=0,bi=1,wi=2,yi=4,vi=5,Si=6,Ti=7,Ai=8,Ii=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,l=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<l;c++){const o=r[c];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof fs){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,l=i.length;r<l;r++){const c=i[r],o=c;for(let a=0,h=c.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,l=this.maxX,c=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=l&&s>=l||e>=c&&n>=c)return!1;const o=(n-e)/(s-t);let a=o*(i-t)+e;if(a>r&&a<c||(a=o*(l-t)+e,a>r&&a<c))return!0;let h=(r-e)/o+t;return h>i&&h<l||(h=(c-e)/o+t,h>i&&h<l)}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,l=!1;for(let c=0;c<i;c+=2){const o=n[c+1],a=n[r+1];if(o<s&&a>=s||a<s&&o>=s){const h=n[c];h+(s-o)/(a-o)*(n[r]-h)<e&&(l=!l)}r=c}return l}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,l=i.length;r<l;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,l=t.length,c=e-n,o=s-i,a=e*i-s*n;let h=r[l-2],d=r[l-1];for(let f=0;f<l;f+=2){const u=r[f],m=r[f+1],p=h*m-d*u,g=h-u,x=d-m,b=c*x-o*g,w=(a*g-c*p)/b;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const S=(a*x-o*p)/b;if((S>=d&&S<=m||S>=m&&S<=d)&&(S>=s&&S<=i||S>=i&&S<=s))return!0}h=u,d=m}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 c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=at.isConcave(c,n,s,i);const l=this.triangles;for(l.length=0;n>3;){let c=n-1,o=0,a=1;for(;;){t:if(!r[o]){const f=i[c]<<1,u=i[o]<<1,m=i[a]<<1,p=s[f],g=s[f+1],x=s[u],b=s[u+1],w=s[m],S=s[m+1];for(let y=a+1<n?a+1:0;y!==c;){if(r[y]){const v=i[y]<<1,T=s[v],A=s[v+1];if(at.positiveArea(w,S,p,g,T,A)&&at.positiveArea(p,g,x,b,T,A)&&at.positiveArea(x,b,w,S,T,A))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[o])break;o--}while(o>0);c=o>0?o-1:n-1,a=o+1<n?o+1:0;break}c=o,o=a,++a===n&&(a=0)}l.push(i[c],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&&l.push(i[2],i[0],i[1]),l}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 l=this.polygonIndicesPool.obtain();l.length=0;let c=this.polygonPool.obtain();c.length=0;let o=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const f=s[h]<<1,u=s[h+1]<<1,m=s[h+2]<<1,p=n[f],g=n[f+1],x=n[u],b=n[u+1],w=n[m],S=n[m+1];if(o===f){const y=c.length-4;if(at.winding(c[y],c[y+1],c[y+2],c[y+3],w,S)===a&&at.winding(w,S,c[0],c[1],c[2],c[3])===a){c.push(w,S),l.push(m);continue}}c.length>0&&(i.push(c),r.push(l),c=this.polygonPool.obtain(),l=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,x,b),c.push(w,S),l.length=0,l.push(f,u,m),a=at.winding(p,g,x,b,w,S),o=f}c.length>0&&(i.push(c),r.push(l));for(let h=0,d=i.length;h<d;h++){if(l=r[h],l.length===0)continue;const f=l[0];let u=l[l.length-1];c=i[h];const m=c.length-4;let p=c[m],g=c[m+1],x=c[m+2],b=c[m+3];const w=c[0],S=c[1],y=c[2],v=c[3],T=at.winding(p,g,x,b,w,S);for(let A=0;A<d;A++){if(A===h)continue;const I=r[A];if(I.length!==3)continue;const M=I[0],Y=I[1],P=I[2],E=i[A],X=E[E.length-2],V=E[E.length-1];M!==f||Y!==u||at.winding(p,g,x,b,X,V)===T&&at.winding(X,V,w,S,y,v)===T&&(E.length=0,I.length=0,c.push(X,V),l.push(P),u=P,p=x,g=b,x=X,b=V,A=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),l=r[h],r.splice(h,1),this.polygonIndicesPool.free(l)):c.push(c[0],c[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,l=i[e]<<1,c=i[e+1<s?e+1:0]<<1;return!at.positiveArea(n[r],n[r+1],n[l],n[l+1],n[c],n[c+1])}static positiveArea(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0}static winding(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+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,l=this.makeClockwise(r);l||this.inverse||s.convex?(l||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,l,c){return n&&i&&r&&typeof l=="boolean"&&typeof c=="number"?this.clipTrianglesRender(t,e,s,n,i,r,l,c):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 u=t[f],m=t[f+1];f=e[d+1]<<1;const p=t[f],g=t[f+1];f=e[d+2]<<1;const x=t[f],b=t[f+1];this.clipInverse(u,m,p,g,x,b,h);const w=this.inverseVertices;for(let S=0,y=this.inverseVertices.length;S<y;){const v=w[S++];let T=v>>1,A=n.length;const I=B.setArraySize(n,A+v);B.arrayCopy(w,S,I,A,v),A=i.length;const M=B.setArraySize(i,A+3*(T-2));for(let Y=1;Y<T-1;Y++,A+=3)M[A]=r,M[A+1]=r+Y,M[A+2]=r+Y+1;r+=T,S+=v}}return!0}const l=this.clipOutput,c=this.clippingPolygons,o=c.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const f=t[d],u=t[d+1];d=e[h+1]<<1;const m=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],x=t[d+1];for(let b=0;b<o;b++){let w=n.length;if(this.clip(f,u,m,p,g,x,c[b])){a=this.clipOutput;const S=l.length;if(S===0)continue;let y=S>>1;const v=B.setArraySize(n,w+S);B.arrayCopy(a,0,v,w,S),w=i.length;const T=B.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)T[w]=r,T[w+1]=r+A,T[w+2]=r+A+1;r+=y}else{const S=B.setArraySize(n,w+6);S[w]=f,S[w+1]=u,S[w+2]=m,S[w+3]=p,S[w+4]=g,S[w+5]=x,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,l,c){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 x=e[g],b=e[g+1],w=e[g+2];const S=t[x*c],y=t[x*c+1],v=t[b*c],T=t[b*c+1],A=t[w*c],I=t[w*c+1];this.clipInverse(S,y,v,T,A,I,p);const M=this.inverseVertices.length;if(M===0)continue;const Y=n[x<<=1],P=n[x+1],E=n[b<<=1],X=n[b+1],V=n[w<<=1],N=n[w+1],q=T-I,O=A-v,k=S-A,F=I-y,U=1/(q*k+O*(y-I)),$=this.inverseVertices;for(let W=0;W<M;){const L=$[W++],_=L>>1;let D=o.length;const J=B.setArraySize(o,D+_*c);for(let K=0;K<L;K+=2,D+=c){const et=$[W+K],nt=$[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-A,ht=nt-I,it=(q*st+O*ht)*U,rt=(F*st+k*ht)*U,dt=1-it-rt;J[D+6]=Y*it+E*rt+V*dt,J[D+7]=P*it+X*rt+N*dt,l&&(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+=L}}return!0}const d=this.clipOutput,f=this.clippingPolygons,u=this.clippingPolygons.length;let m=null;for(let p=0;p<s;p+=3){let g=e[p];const x=t[g*c],b=t[g*c+1],w=n[g<<1],S=n[(g<<1)+1];g=e[p+1];const y=t[g*c],v=t[g*c+1],T=n[g<<1],A=n[(g<<1)+1];g=e[p+2];const I=t[g*c],M=t[g*c+1],Y=n[g<<1],P=n[(g<<1)+1],E=v-M,X=I-y,V=x-I,N=M-b,q=1/(E*V+X*(b-M));for(let O=0;O<u;O++){let k=o.length;if(this.clip(x,b,y,v,I,M,f[O])){m=this.clipOutput;const F=d.length;if(F===0)continue;let U=F>>1;const $=B.setArraySize(o,k+U*c);for(let L=0;L<F;L+=2,k+=c){const _=m[L],D=m[L+1];$[k]=_,$[k+1]=D,$[k+2]=i.r,$[k+3]=i.g,$[k+4]=i.b,$[k+5]=i.a;const J=_-I,tt=D-M,K=(E*J+X*tt)*q,et=(N*J+V*tt)*q,nt=1-K-et;$[k+6]=w*K+T*et+Y*nt,$[k+7]=S*K+A*et+P*nt,l&&($[k+8]=r.r,$[k+9]=r.g,$[k+10]=r.b,$[k+11]=r.a)}k=a.length;const W=B.setArraySize(a,k+3*(U-2));U--;for(let L=1;L<U;L++,k+=3)W[k]=h,W[k+1]=h+L,W[k+2]=h+L+1;h+=U+1}else{const F=B.setArraySize(o,k+3*c);F[k]=x,F[k+1]=b,F[k+2]=i.r,F[k+3]=i.g,F[k+4]=i.b,F[k+5]=i.a,l?(F[k+6]=w,F[k+7]=S,F[k+8]=r.r,F[k+9]=r.g,F[k+10]=r.b,F[k+11]=r.a,F[k+12]=y,F[k+13]=v,F[k+14]=i.r,F[k+15]=i.g,F[k+16]=i.b,F[k+17]=i.a,F[k+18]=T,F[k+19]=A,F[k+20]=r.r,F[k+21]=r.g,F[k+22]=r.b,F[k+23]=r.a,F[k+24]=I,F[k+25]=M,F[k+26]=i.r,F[k+27]=i.g,F[k+28]=i.b,F[k+29]=i.a,F[k+30]=Y,F[k+31]=P,F[k+32]=r.r,F[k+33]=r.g,F[k+34]=r.b,F[k+35]=r.a):(F[k+6]=w,F[k+7]=S,F[k+8]=y,F[k+9]=v,F[k+10]=i.r,F[k+11]=i.g,F[k+12]=i.b,F[k+13]=i.a,F[k+14]=T,F[k+15]=A,F[k+16]=I,F[k+17]=M,F[k+18]=i.r,F[k+19]=i.g,F[k+20]=i.b,F[k+21]=i.a,F[k+22]=Y,F[k+23]=P),k=a.length;const U=B.setArraySize(a,k+3);U[k]=h,U[k+1]=h+1,U[k+2]=h+2,h+=3;break}}}return m!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let l=this._clippedVerticesTyped,c=this._clippedUVsTyped,o=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const m=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const x=t[e+g],b=t[e+g+1];let w=s[p]<<1;const S=i[w],y=i[w+1];g=s[p+1]*r;const v=t[e+g],T=t[e+g+1];w=s[p+1]<<1;const A=i[w],I=i[w+1];g=s[p+2]*r;const M=t[e+g],Y=t[e+g+1];w=s[p+2]<<1;const P=i[w],E=i[w+1];this.clipInverse(x,b,v,T,M,Y,m);const X=this.inverseVertices.length;if(X===0)continue;const V=T-Y,N=M-v,q=x-M,O=Y-b,k=1/(V*q+N*(b-Y)),F=this.inverseVertices;for(let U=0;U<X;){const $=F[U++],W=$>>1;let L=this.clippedVerticesLength;const _=L+W*r,D=this.clippedUVsLength+W*2;l.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(l.subarray(0,L)),l=this._clippedVerticesTyped),c.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=D;const J=this._clippedVerticesTyped,tt=this._clippedUVsTyped;let K=D-W*2;for(let st=0;st<$;st+=2,L+=r,K+=2){const ht=F[U+st],it=F[U+st+1];J[L]=ht,J[L+1]=it;const rt=ht-M,dt=it-Y,ft=(V*rt+N*dt)*k,gt=(O*rt+q*dt)*k,Lt=1-ft-gt;tt[K]=S*ft+A*gt+P*Lt,tt[K+1]=y*ft+I*gt+E*Lt}L=this.clippedTrianglesLength;const et=L+3*(W-2);o.length<et&&(this._clippedTrianglesTyped=new Uint16Array(et*2),this._clippedTrianglesTyped.set(o.subarray(0,L)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=et;const nt=o;for(let st=1;st<W-1;st++,L+=3)nt[L]=a,nt[L+1]=a+st,nt[L+2]=a+st+1;a+=W,U+=$}}return!0}const h=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let u=null;for(let m=0;m<n;m+=3){let p=s[m],g=p*r;const x=t[e+g],b=t[e+g+1];let w=p<<1;const S=i[w],y=i[w+1];p=s[m+1],g=p*r;const v=t[e+g],T=t[e+g+1];w=p<<1;const A=i[w],I=i[w+1];p=s[m+2],g=p*r;const M=t[e+g],Y=t[e+g+1];w=p<<1;const P=i[w],E=i[w+1],X=T-Y,V=M-v,N=x-M,q=Y-b,O=1/(X*N+V*(b-Y));for(let k=0;k<f;k++){let F=this.clippedVerticesLength;if(this.clip(x,b,v,T,M,Y,d[k])){u=h;const U=h.length;if(U===0)continue;let $=U>>1;const W=F+$*r;l.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(l.subarray(0,F)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+$*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),l=this._clippedVerticesTyped,c=this._clippedUVsTyped);const L=l,_=c;this.clippedVerticesLength=W;let D=this.clippedUVsLength;this.clippedUVsLength=D+$*2;for(let K=0;K<U;K+=2,F+=r,D+=2){const et=u[K],nt=u[K+1];L[F]=et,L[F+1]=nt;const st=et-M,ht=nt-Y,it=(X*st+V*ht)*O,rt=(q*st+N*ht)*O,dt=1-it-rt;_[D]=S*it+A*rt+P*dt,_[D+1]=y*it+I*rt+E*dt}F=this.clippedTrianglesLength;const J=F+3*($-2);o.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(o.subarray(0,F)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const tt=o;$--;for(let K=1;K<$;K++,F+=3)tt[F]=a,tt[F+1]=a+K,tt[F+2]=a+K+1;a+=$+1}else{let U=F+3*r;l.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(l.subarray(0,F)),l=this._clippedVerticesTyped),l[F]=x,l[F+1]=b,l[F+r]=v,l[F+r+1]=T,l[F+r*2]=M,l[F+r*2+1]=Y;const $=this.clippedUVsLength+3*2;c.length<$&&(this._clippedUVsTyped=new Float32Array($*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const W=this.clippedUVsLength;c[W]=S,c[W+1]=y,c[W+2]=A,c[W+3]=I,c[W+4]=P,c[W+5]=E,this.clippedVerticesLength=U,this.clippedUVsLength=$,F=this.clippedTrianglesLength,U=F+3,o.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(o.subarray(0,F)),o=this._clippedTrianglesTyped);const L=o;L[F]=a,L[F+1]=a+1,L[F+2]=a+2,a+=3,this.clippedTrianglesLength=U;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),u!==null}clip(t,e,s,n,i,r,l){const c=this.clipOutput;let o=!1,a,h;l.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=l;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 u=l.length-4;for(let m=0;;m+=2){const p=d[m],g=d[m+1],x=p-d[m+2],b=g-d[m+3],w=h.length,S=a;for(let v=0,T=a.length-2;v<T;){t=S[v],e=S[v+1],v+=2,s=S[v],n=S[v+1];const A=b*(p-s)>x*(g-n),I=b*(p-t)-x*(g-e);if(I>0)if(A)h.push(s,n);else{const M=s-t,Y=n-e,P=I/(M*b-Y*x);P>=0&&P<=1?(h.push(t+M*P,e+Y*P),o=!0):h.push(s,n)}else if(A){const M=s-t,Y=n-e,P=I/(M*b-Y*x);P>=0&&P<=1?(h.push(t+M*P,e+Y*P,s,n),o=!0):h.push(s,n)}else o=!0}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),m===u)break;const y=h;h=a,h.length=0,a=y}if(c!==h){c.length=0;for(let m=0,p=h.length-2;m<p;m++)c[m]=h[m]}else c.length=c.length-2;return o}clipInverse(t,e,s,n,i,r,l){this.inverseVertices.length=0;const c=l.length-4;let o,a;l.length%4>=2?(o=this.clipOutput,a=this.scratch):(o=this.scratch,a=this.clipOutput),o.length=8;let h=l,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 u=h[f],m=h[f+1],p=u-h[f+2],g=m-h[f+3],x=a.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=o;for(let y=0,v=o.length-2;y<v;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const T=g*(u-s)>p*(m-n),A=g*(u-t)-p*(m-e);if(A>0)if(T)a.push(s,n);else{const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const P=t+I*Y,E=e+M*Y;a.push(P,E),this.inverseVertices.push(P,E,s,n)}else a.push(s,n)}else if(T){const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const P=t+I*Y,E=e+M*Y;this.inverseVertices.push(P,E),a.push(P,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-b-1;if(w>=6?this.inverseVertices[b]=w:this.inverseVertices.length=b,x===a.length||(a.push(a[0],a[1]),f===c))break;const S=a;a=o,a.length=0,o=S}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,l=e[s-2],c=e[s-1],o=e[0],a=e[1];for(let d=2;d<s;d+=2){const f=e[d],u=e[d+1];r+=o*u-f*a;const m=(o-l)*(u-a)-(a-c)*(f-o);i=i&&m<=0,n=n&&m>=0,l=o,c=a,o=f,a=u}r+=o*e[1]-e[0]*a;const h=(o-l)*(e[1]-a)-(a-c)*(e[0]-o);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,f=s-2,u=s>>1;d<u;d+=2){const m=e[d],p=e[d+1],g=f-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=m,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 l=2;l<e;l+=2){const c=s[l],o=s[l+1];let a=l-2;for(;a>=0&&(n[a]>c||n[a]===c&&n[a+1]>o);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=c,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 l=4;l<e;l+=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=o}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let l=e-6;l>=0;l-=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=o}t.length=i-2}},Yi=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 l=n.bones[r];let c=null;const o=C(l,"parent",null);o&&(c=s.findBone(o));const a=new us(s.bones.length,l.name,c);a.length=C(l,"length",0)*e;const h=a.setupPose;h.x=C(l,"x",0)*e,h.y=C(l,"y",0)*e,h.rotation=C(l,"rotation",0),h.scaleX=C(l,"scaleX",1),h.scaleY=C(l,"scaleY",1),h.shearX=C(l,"shearX",0),h.shearY=C(l,"shearY",0),h.inherit=B.enumValue(ie,C(l,"inherit","Normal")),a.skinRequired=C(l,"skin",!1);const d=C(l,"color",null);d&&a.color.setFromString(d),a.icon=C(l,"icon",void 0),a.iconSize=C(l,"iconSize",1),a.iconRotation=C(l,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const l=n.slots[r],c=l.name,o=s.findBone(l.bone);if(!o)throw new Error(`Couldn't find bone ${l.bone} for slot ${c}`);const a=new Ts(s.slots.length,c,o),h=C(l,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(l,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(l,"attachment",null),a.blendMode=B.enumValue(As,C(l,"blend","normal")),a.visible=C(l,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const l=r.name,c=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const o=new Ht(l);o.skinRequired=c;for(let u=0;u<r.bones.length;u++){const m=s.findBone(r.bones[u]);if(!m)throw new Error(`Couldn't find bone ${r.bones[u]} for IK constraint ${l}.`);o.bones.push(m)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${l}.`);o.target=h;const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(oe,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(l);o.skinRequired=c;for(let w=0;w<r.bones.length;w++){const S=r.bones[w],y=s.findBone(S);if(!y)throw new Error(`Couldn't find bone ${S} 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,u=!1,m=!1,p=!1,g=!1;const x=Object.entries(C(r,"properties",{}));for(const[w,S]of x){const y=this.fromProperty(w),v=this.propertyScale(w,e);y.offset=C(S,"offset",0)*v;const T=Object.entries(C(S,"to",{}));for(const[A,I]of T){let M=1,Y;switch(A){case"rotate":{d=!0,Y=new Is;break}case"x":{f=!0,Y=new Cs,M=e;break}case"y":{u=!0,Y=new Ms,M=e;break}case"scaleX":{m=!0,Y=new Ys;break}case"scaleY":{p=!0,Y=new Fs;break}case"shearY":{g=!0,Y=new ks;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}Y.offset=C(I,"offset",0)*M,Y.max=C(I,"max",1)*M,Y.scale=C(I,"scale",1)*M/v,y.to.push(Y)}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 b=o.setupPose;d&&(b.mixRotate=C(r,"mixRotate",1)),f&&(b.mixX=C(r,"mixX",1)),u&&(b.mixY=C(r,"mixY",b.mixX)),m&&(b.mixScaleX=C(r,"mixScaleX",1)),p&&(b.mixScaleY=C(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=C(r,"mixShearY",1)),s.constraints.push(o);break}case"path":{const o=new Gt(l);o.skinRequired=c;for(let f=0;f<r.bones.length;f++){const u=r.bones[f],m=s.findBone(u);if(!m)throw new Error(`Couldn't find bone ${u} for path constraint ${r.name}.`);o.bones.push(m)}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(xs,C(r,"positionMode","Percent")),o.spacingMode=B.enumValue(bs,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(l);o.skinRequired=c;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);const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(oe,d)),o.shearX=C(r,"shearX",0),o.limit=C(r,"limit",5e3)*e,o.step=1/C(r,"fps",60);const f=o.setupPose;f.inertia=C(r,"inertia",.5),f.strength=C(r,"strength",100),f.damping=C(r,"damping",.85),f.massInverse=1/C(r,"mass",1),f.wind=C(r,"wind",0),f.gravity=C(r,"gravity",0),f.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 yt(l);o.skinRequired=c,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 l=n.skins[r],c=new me(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){const a=l.bones[o],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);c.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){const a=l.ik[o],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){const a=l.transform[o],h=s.findConstraint(a,j);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){const a=l.path[o],h=s.findConstraint(a,Gt);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.physics)for(let o=0;o<l.physics.length;o++){const a=l.physics[o],h=s.findConstraint(a,jt);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.slider)for(let o=0;o<l.slider.length;o++){const a=l.slider[o],h=s.findConstraint(a,yt);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}for(const o in l.attachments){const a=s.findSlot(o);if(!a)throw new Error(`Couldn't find skin slot ${o} for skin ${l.name}.`);const h=l.attachments[o];for(const d in h){const f=this.readAttachment(h[d],c,a.index,d,s);f&&c.setAttachment(a.index,d,f)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,l=this.linkedMeshes.length;r<l;r++){const c=this.linkedMeshes[r],o=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${c.skin}`);const a=o.getAttachment(c.sourceIndex,c.source);if(!a)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?a:c.mesh,c.mesh.setSourceMesh(a),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=a.timelineSlots;for(const f of h)if(f===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const l=n.events[r],c=new ps(r),o=c.setupPose;o.intValue=C(l,"int",0),o.floatValue=C(l,"float",0),o.stringValue=C(l,"string",""),c._audioPath=C(l,"audio",null),c.audioPath&&(o.volume=C(l,"volume",o.volume),o.balance=C(l,"balance",o.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const l=n.animations[r];this.readAnimation(l,r,s)}if(n.constraints)for(const r in n.constraints){const l=n.constraints[r];if(l.type==="slider"){const c=s.findConstraint(l.name,yt),o=l.animation,a=s.findAnimation(o);if(!a)throw new Error(`Slider animation not found: ${o}`);c.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new pe;break;case"x":e=new xe;break;case"y":e=new be;break;case"scaleX":e=new we;break;case"scaleY":e=new ye;break;case"shearY":e=new ve;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,l=C(t,"name",n);switch(C(t,"type","region")){case"region":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,l,c,o);if(!a)return null;a.path=c,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 c=this.attachmentLoader.newBoundingBoxAttachment(e,n,l);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"mesh":case"linkedmesh":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,l,c,o);if(!a)return null;a.path=c;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 u=s;const m=C(t,"slot",null);if(m){const p=i.findSlot(m);if(!p)throw new Error(`Source mesh slot not found: ${m}`);u=p.index}return this.linkedMeshes.push(new Fi(a,C(t,"skin",null),s,u,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 c=this.attachmentLoader.newPathAttachment(e,n,l);if(!c)return null;c.closed=C(t,"closed",!1),c.constantSpeed=C(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,c,o<<1);const a=B.newArray(o/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;c.lengths=a;const h=C(t,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(e,n,l);if(!c)return null;c.x=C(t,"x",0)*r,c.y=C(t,"y",0)*r,c.rotation=C(t,"rotation",0);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(e,n,l);if(!c)return null;const o=C(t,"end",null);o&&(c.endSlot=i.findSlot(o)),c.convex=C(t,"convex",!1),c.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,c,a<<1);const h=C(t,"color",null);return h&&c.color.setFromString(h),c}}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 c=B.toFloatArray(i);if(n!==1)for(let o=0,a=i.length;o<a;o++)c[o]*=n;e.vertices=c;return}const r=[],l=[];for(let c=0,o=i.length;c<o;){const a=i[c++];l.push(a);for(let h=c+a*4;c<h;c+=4)l.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}e.bones=l,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 u=a[f];if(!u)continue;const m=u.length;switch(f){case"attachment":{const p=new kt(m,d);for(let g=0;g<m;g++){const x=u[g];p.setFrame(g,C(x,"time",0),C(x,"name",null))}i.push(p);break}case"rgba":{const p=new De(m,m<<2,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.color);for(let w=0,S=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=u[w+1];if(!y){p.shrink(S);break}const v=C(y,"time",0),T=z.fromString(y.color),A=g.curve;A&&(S=G(A,p,S,w,0,x,v,b.r,T.r,1),S=G(A,p,S,w,1,x,v,b.g,T.g,1),S=G(A,p,S,w,2,x,v,b.b,T.b,1),S=G(A,p,S,w,3,x,v,b.a,T.a,1)),x=v,b=T,g=y}i.push(p);break}case"rgb":{const p=new qe(m,m*3,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.color);for(let w=0,S=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=u[w+1];if(!y){p.shrink(S);break}const v=C(y,"time",0),T=z.fromString(y.color),A=g.curve;A&&(S=G(A,p,S,w,0,x,v,b.r,T.r,1),S=G(A,p,S,w,1,x,v,b.g,T.g,1),S=G(A,p,S,w,2,x,v,b.b,T.b,1)),x=v,b=T,g=y}i.push(p);break}case"alpha":{ot(i,u,new _e(m,m,d),0,1);break}case"rgba2":{const p=new ze(m,m*7,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let S=0,y=0;;S++){p.setFrame(S,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const v=u[S+1];if(!v){p.shrink(y);break}const T=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,S,0,x,T,b.r,A.r,1),y=G(M,p,y,S,1,x,T,b.g,A.g,1),y=G(M,p,y,S,2,x,T,b.b,A.b,1),y=G(M,p,y,S,3,x,T,b.a,A.a,1),y=G(M,p,y,S,4,x,T,w.r,I.r,1),y=G(M,p,y,S,5,x,T,w.g,I.g,1),y=G(M,p,y,S,6,x,T,w.b,I.b,1)),x=T,b=A,w=I,g=v}i.push(p);break}case"rgb2":{const p=new We(m,m*6,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let S=0,y=0;;S++){p.setFrame(S,x,b.r,b.g,b.b,w.r,w.g,w.b);const v=u[S+1];if(!v){p.shrink(y);break}const T=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,S,0,x,T,b.r,A.r,1),y=G(M,p,y,S,1,x,T,b.g,A.g,1),y=G(M,p,y,S,2,x,T,b.b,A.b,1),y=G(M,p,y,S,3,x,T,w.r,I.r,1),y=G(M,p,y,S,4,x,T,w.g,I.g,1),y=G(M,p,y,S,5,x,T,w.b,I.b,1)),x=T,b=A,w=I,g=v}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${u.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 u=a[f],m=u.length;if(m!==0)switch(f){case"rotate":ot(i,u,new Ut(m,m,d),0,1);break;case"translate":Ps(i,u,new Ee(m,m<<1,d),"x","y",0,n);break;case"translatex":ot(i,u,new Xe(m,m,d),0,n);break;case"translatey":ot(i,u,new Ve(m,m,d),0,n);break;case"scale":Ps(i,u,new Re(m,m<<1,d),"x","y",1,1);break;case"scalex":ot(i,u,new Le(m,m,d),1,1);break;case"scaley":ot(i,u,new Be(m,m,d),1,1);break;case"shear":Ps(i,u,new Oe(m,m<<1,d),"x","y",0,1);break;case"shearx":ot(i,u,new Ne(m,m,d),0,1);break;case"sheary":ot(i,u,new $e(m,m,d),0,1);break;case"inherit":{const p=new Ue(m,h.index);for(let g=0;g<u.length;g++){const x=u[g];p.setFrame(g,C(x,"time",0),B.enumValue(ie,C(x,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${u.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 je(a.length,a.length<<1,s.constraints.indexOf(d));let u=C(h,"time",0),m=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,x=0;;g++){f.setFrame(g,u,m,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const b=a[g+1];if(!b){f.shrink(x);break}const w=C(b,"time",0),S=C(b,"mix",1),y=C(b,"softness",0)*n,v=h.curve;v&&(x=G(v,f,x,g,0,u,w,m,S,1),x=G(v,f,x,g,1,u,w,p,y,n)),u=w,m=S,p=y,h=b}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 u=C(h,"time",0),m=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),x=C(h,"mixScaleX",1),b=C(h,"mixScaleY",1);const w=C(h,"mixShearY",1);for(let S=0,y=0;;S++){f.setFrame(S,u,m,p,g,x,b,w);const v=a[S+1];if(!v){f.shrink(y);break}const T=C(v,"time",0),A=C(v,"mixRotate",1),I=C(v,"mixX",1),M=C(v,"mixY",I),Y=C(v,"mixScaleX",1),P=C(v,"mixScaleY",1),E=C(v,"mixShearY",1),X=h.curve;X&&(y=G(X,f,y,S,0,u,T,m,A,1),y=G(X,f,y,S,1,u,T,p,I,1),y=G(X,f,y,S,2,u,T,g,M,1),y=G(X,f,y,S,3,u,T,x,Y,1),y=G(X,f,y,S,4,u,T,b,P,1),y=G(X,f,y,S,5,u,T,w,E,1)),u=T,m=A,p=I,g=M,x=Y,b=P,x=Y,h=v}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 u=a[f];let m=u[0];if(!m)continue;const p=u.length;switch(f){case"position":{const g=new Ke(p,p,d);ot(i,u,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Qe(p,p,d);ot(i,u,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new Ze(p,p*3,d);let x=C(m,"time",0),b=C(m,"mixRotate",1),w=C(m,"mixX",1),S=C(m,"mixY",w);for(let y=0,v=0;;y++){g.setFrame(y,x,b,w,S);const T=u[y+1];if(!T){g.shrink(v);break}const A=C(T,"time",0),I=C(T,"mixRotate",1),M=C(T,"mixX",1),Y=C(T,"mixY",M),P=m.curve;P&&(v=G(P,g,v,y,0,x,A,b,I,1),v=G(P,g,v,y,1,x,A,w,M,1),v=G(P,g,v,y,2,x,A,S,Y,1)),x=A,b=I,w=M,S=Y,m=T}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 u=f[0];if(!u)continue;const m=f.length;let p,g=0;if(d==="reset"){const x=new os(m,h);for(let b=0;u!=null;u=f[b+1],b++)x.setFrame(b,C(u,"time",0));i.push(x);continue}switch(d){case"inertia":p=new ts(m,m,h);break;case"strength":p=new es(m,m,h);break;case"damping":p=new ss(m,m,h);break;case"mass":p=new ns(m,m,h);break;case"wind":p=new is(m,m,h);break;case"gravity":p=new rs(m,m,h);break;case"mix":{g=1,p=new as(m,m,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,yt);if(!h)throw new Error(`Slider not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const u=a[f];if(!u[0])continue;const p=u.length;switch(f){case"time":ot(i,u,new ls(p,p,d),1,1);break;case"mix":ot(i,u,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],u=s.findSlot(d);if(!u)throw new Error(`Attachment slot not found: ${d}`);const m=u.index;for(const p in f){const g=f[p],x=h.getAttachment(m,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let S=w[0];if(S){if(b==="deform"){const y=x.bones,v=x.vertices,T=y?v.length/3*2:v.length,A=new He(w.length,w.length,m,x);let I=C(S,"time",0);for(let M=0,Y=0;;M++){let P;const E=C(S,"vertices",null);if(!E)P=y?B.newFloatArray(T):v;else{P=B.newFloatArray(T);const q=C(S,"offset",0);if(B.arrayCopy(E,0,P,q,E.length),n!==1)for(let O=q,k=O+E.length;O<k;O++)P[O]*=n;if(!y)for(let O=0;O<T;O++)P[O]+=v[O]}A.setFrame(M,I,P);const X=w[M+1];if(!X){A.shrink(Y);break}const V=C(X,"time",0),N=S.curve;N&&(Y=G(N,A,Y,M,0,I,V,0,1,1)),I=V,S=X}i.push(A)}else if(b==="sequence"){const y=new Ge(w.length,m,x);let v=0;for(let T=0;T<w.length;T++){const A=C(S,"delay",v),I=C(S,"time",0),M=ke[C(S,"mode","hold")],Y=C(S,"index",0);y.setFrame(T,I,M,Y,A),v=A,S=w[T+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",[]),u=new qt(f.length,h,s.slots.length);let m=0;for(const p of f)u.setFrame(m++,C(p,"time",0),fn(s,p,h.length,h));i.push(u)}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 u=f.setupPose,m=new le(B.toSinglePrecision(C(d,"time",0)),f);m.intValue=C(d,"int",u.intValue),m.floatValue=C(d,"float",u.floatValue),m.stringValue=C(d,"string",u.stringValue),m.data.audioPath&&(m.volume=C(d,"volume",u.volume),m.balance=C(d,"balance",u.volume)),o.setFrame(a,m)}i.push(o)}let r=0;for(let o=0,a=i.length;o<a;o++)r=Math.max(r,i[o].getDuration());const l=new Qt(e,i,r),c=C(t,"color",null);c!==null&&l.color.setFromString(c),s.animations.push(l)}},Fi=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],l=r.time??0,c=(r.value??n)*i,o=0;for(let a=0;;a++){s.setFrame(a,l,c);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,l,d,c,f,i)),l=d,c=f,r=h}}function Ps(t,e,s,n,i,r,l){let c=e[0],o=c.time??0,a=(c[n]??r)*l,h=(c[i]??r)*l,d=0;for(let f=0;;f++){s.setFrame(f,o,a,h);const u=e[f+1];if(!u){s.shrink(d),t.push(s);return}const m=u.time??0,p=(u[n]??r)*l,g=(u[i]??r)*l,x=c.curve;x&&(d=G(x,s,d,f,0,o,m,a,p,l),d=G(x,s,d,f,1,o,m,h,g,l)),o=m,a=p,h=g,c=u}}function fn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),l=new Array(s-i.length);let c=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(;c!==d;)l[o++]=c++;r[c+a.offset]=c++}for(;c<s;)l[o++]=c++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=l[--o]);return r}function G(t,e,s,n,i,r,l,c,o,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],f=t[h+1]*a,u=t[h+2],m=t[h+3]*a;return e.setBezier(s,n,i,r,c,d,f,u,m,l,o),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var ki=class{commandPool=new Pi;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 l=0;l<t.slots.length;l++){const c=r[l],o=c.appliedPose.attachment;if(!o){i.clipEnd(c);continue}const a=c.appliedPose,h=a.color;if((h.a===0||!c.bone.active)&&!(o instanceof Wt)){i.clipEnd(c);continue}let f,u,m,p,g,x,b;if(o instanceof Ft){if(x=o.color,x.a===0){i.clipEnd(c);continue}const T=o.sequence,A=T.resolveIndex(a);o.computeWorldVertices(c,o.getOffsets(a),this.worldVertices,0,n),f=this.worldVertices,u=4,m=T.getUVs(A),p=this.quadIndices,g=6,b=T.regions[A]?.texture}else if(o instanceof St){if(x=o.color,x.a===0){i.clipEnd(c);continue}this.worldVertices.length<o.worldVerticesLength&&(this.worldVertices=new Float32Array(o.worldVerticesLength)),o.computeWorldVertices(t,c,0,o.worldVerticesLength,this.worldVertices,0,n),f=this.worldVertices,u=o.worldVerticesLength>>1;const T=o.sequence,A=T.resolveIndex(a);m=T.getUVs(A),p=o.triangles,g=p.length,b=T.regions[A]?.texture}else if(o instanceof Wt){i.clipStart(t,c,o);continue}else continue;const w=t.color;let S,y;if(e){let T;if(s){T=Math.floor(s[3]*w.a*h.a*x.a*255);const A=Math.floor(T*s[0]*w.r*h.r*x.r),I=Math.floor(T*s[1]*w.g*h.g*x.g),M=Math.floor(T*s[2]*w.b*h.b*x.b);S=T<<24|A<<16|I<<8|M}else{T=Math.floor(w.a*h.a*x.a*255);const A=Math.floor(T*w.r*h.r*x.r),I=Math.floor(T*w.g*h.g*x.g),M=Math.floor(T*w.b*h.b*x.b);S=T<<24|A<<16|I<<8|M}if(y=4278190080,a.darkColor){const{r:A,g:I,b:M}=a.darkColor;y=4278190080|Math.floor(A*T)<<16|Math.floor(I*T)<<8|Math.floor(M*T)}}else{if(s){const T=Math.floor(s[3]*w.a*h.a*x.a*255),A=Math.floor(s[0]*w.r*h.r*x.r*255),I=Math.floor(s[1]*w.g*h.g*x.g*255),M=Math.floor(s[2]*w.b*h.b*x.b*255);S=T<<24|A<<16|I<<8|M}else{const T=Math.floor(w.a*h.a*x.a*255),A=Math.floor(w.r*h.r*x.r*255),I=Math.floor(w.g*h.g*x.g*255),M=Math.floor(w.b*h.b*x.b*255);S=T<<24|A<<16|I<<8|M}if(y=0,a.darkColor){const{r:T,g:A,b:I}=a.darkColor;y=Math.floor(T*255)<<16|Math.floor(A*255)<<8|Math.floor(I*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(f,0,p,g,m,n),f=i.clippedVerticesTyped,u=i.clippedVerticesLength/n,m=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const v=this.commandPool.getCommand(u,g,n);v.blendMode=c.data.blendMode,v.texture=b,v.positions.set(f.subarray(0,u*n)),v.uvs.set(m.subarray(0,u<<1));for(let T=0;T<u;T++)v.colors[T]=S,v.darkColors[T]=y;p instanceof Uint16Array?v.indices.set(p.subarray(0,g)):v.indices.set(p.slice(0,g)),this.renderCommands.push(v),i.clipEnd(c)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const l=t[e],c=this.commandPool.getCommand(n,i,r);c.blendMode=l.blendMode,c.texture=l.texture;let o=0,a=0,h=0,d=0,f=0;for(let u=e;u<=s;u++){const m=t[u];c.positions.set(m.positions,o),o+=m.numVertices*r,c.uvs.set(m.uvs,a),a+=m.numVertices<<1,c.colors.set(m.colors,h),c.darkColors.set(m.darkColors,h),h+=m.numVertices;for(let p=0;p<m.numIndices;p++)c.indices[d+p]=m.indices[p]+f;d+=m.numIndices,f+=m.numVertices}return c}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,l=n.numVertices,c=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]&&c+o.numIndices<65535)l+=o.numVertices,c+=o.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,l,c,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,l=n.numVertices,c=n.numIndices}r++}return e}},Pi=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),l=new Uint32Array(t),c=new Uint32Array(t),o=new Uint16Array(e);n={positions:i,uvs:r,colors:l,darkColors:c,indices:o,_positions:i,_uvs:r,_colors:l,_darkColors:c,_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{_e 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,kt as AttachmentTimeline,on as BinaryInput,As as BlendMode,ae as Bone,us as BoneData,re as BonePose,wt as BoneTimeline1,Zt as BoneTimeline2,fs as BoundingBoxAttachment,Wt as ClippingAttachment,z as Color,Et as Constraint,Xt as ConstraintData,Pt as ConstraintTimeline1,bt as CurveTimeline,$t as CurveTimeline1,kn as DebugUtils,He as DeformTimeline,Js as Downloader,Qs as DrawOrder,qt as DrawOrderFolderTimeline,Tt as DrawOrderTimeline,le as Event,ps as EventData,Ws as EventQueue,te as EventTimeline,Hs as EventType,_t as FIRST,Xn as FakeTexture,At as FromProperty,pe as FromRotate,we as FromScaleX,ye as FromScaleY,ve as FromShearY,xe as FromX,be as FromY,zt as HOLD,Gs as HOLD_FIRST,Zs as IkConstraint,Ht as IkConstraintData,ce as IkConstraintPose,je as IkConstraintTimeline,ie as Inherit,Ue as InheritTimeline,Yn as IntSet,Bt as Interpolation,R as MathUtils,St as MeshAttachment,se as PathAttachment,tn as PathConstraint,Gt as PathConstraintData,Ze as PathConstraintMixTimeline,he as PathConstraintPose,Ke as PathConstraintPositionTimeline,Qe as PathConstraintSpacingTimeline,en as Physics,ys as PhysicsConstraint,ss as PhysicsConstraintDampingTimeline,jt as PhysicsConstraintData,rs as PhysicsConstraintGravityTimeline,ts as PhysicsConstraintInertiaTimeline,ns as PhysicsConstraintMassTimeline,as as PhysicsConstraintMixTimeline,de as PhysicsConstraintPose,os as PhysicsConstraintResetTimeline,es as PhysicsConstraintStrengthTimeline,pt as PhysicsConstraintTimeline,is as PhysicsConstraintWindTimeline,Ks as PointAttachment,Ot as Pool,ms as Posed,gs as PosedActive,ne as PosedData,xs as PositionMode,Ls as Pow,Fn as PowOut,Us as Property,ds as RETAIN,We as RGB2Timeline,ze as RGBA2Timeline,De as RGBATimeline,qe as RGBTimeline,Ft as RegionAttachment,ws as RotateMode,Ut as RotateTimeline,hs as SETUP,ee as SUBSEQUENT,Re as ScaleTimeline,Le as ScaleXTimeline,oe as ScaleYMode,Be as ScaleYTimeline,Nt as Sequence,ke as SequenceMode,Pe as SequenceModeValues,Ge as SequenceTimeline,Oe as ShearTimeline,Ne as ShearXTimeline,$e as ShearYTimeline,nn as Skeleton,$n as SkeletonBinary,Mi as SkeletonBounds,dn as SkeletonClipping,vs as SkeletonData,Yi as SkeletonJson,ki as SkeletonRendererCore,me as Skin,Ss as SkinEntry,rn as Slider,yt as SliderData,cs as SliderMixTimeline,ue as SliderPose,ls as SliderTimeline,sn as Slot,Dt as SlotCurveTimeline,Ts as SlotData,fe as SlotPose,bs as SpacingMode,Ie as StringSet,Bs as Texture,Me as TextureAtlas,$s as TextureAtlasPage,Ye as TextureAtlasRegion,Kt as TextureFilter,Ns as TextureRegion,Os as TextureWrap,Pn as TimeKeeper,Q as Timeline,It as ToProperty,Is as ToRotate,Ys as ToScaleX,Fs as ToScaleY,ks as ToShearY,Cs as ToX,Ms as ToY,zs as TrackEntry,an as TransformConstraint,j as TransformConstraintData,ge as TransformConstraintPose,Je as TransformConstraintTimeline,Ee as TranslateTimeline,Xe as TranslateXTimeline,Ve as TranslateYTimeline,hn as Triangulator,B as Utils,Ce as Vector2,xt as VertexAttachment,En as WindowedMean,qs as isBoneTimeline,_s as isConstraintTimeline,Ds as isSlotTimeline};